curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/images/generations";
const payload = {
model: "doubao-seedream-5-0-pro",
prompt: "A cyberpunk city night scene, neon lights reflecting on wet streets",
size: "16:9",
resolution: "2K"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.apimart.ai/v1/images/generations"
payload := map[string]interface{}{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://api.apimart.ai/v1/images/generations";
String payload = """
{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
<?php
$url = "https://api.apimart.ai/v1/images/generations";
$payload = [
"model" => "doubao-seedream-5-0-pro",
"prompt" => "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size" => "16:9",
"resolution" => "2K"
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer <token>",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
require 'net/http'
require 'json'
require 'uri'
url = URI("https://api.apimart.ai/v1/images/generations")
payload = {
model: "doubao-seedream-5-0-pro",
prompt: "A cyberpunk city night scene, neon lights reflecting on wet streets",
size: "16:9",
resolution: "2K"
}
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = payload.to_json
response = http.request(request)
puts response.body
import Foundation
let url = URL(string: "https://api.apimart.ai/v1/images/generations")!
let payload: [String: Any] = [
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
]
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print("Error: \(error)")
return
}
if let data = data, let responseString = String(data: data, encoding: .utf8) {
print(responseString)
}
}
task.resume()
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var url = "https://api.apimart.ai/v1/images/generations";
var payload = @"{
""model"": ""doubao-seedream-5-0-pro"",
""prompt"": ""A cyberpunk city night scene, neon lights reflecting on wet streets"",
""size"": ""16:9"",
""resolution"": ""2K""
}";
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");
var content = new StringContent(payload, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if(curl) {
const char *url = "https://api.apimart.ai/v1/images/generations";
const char *payload = "{"
"\"model\":\"doubao-seedream-5-0-pro\","
"\"prompt\":\"A cyberpunk city night scene, neon lights reflecting on wet streets\","
"\"size\":\"16:9\","
"\"resolution\":\"2K\""
"}";
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return 0;
}
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSURL *url = [NSURL URLWithString:@"https://api.apimart.ai/v1/images/generations"];
NSDictionary *payload = @{
@"model": @"doubao-seedream-5-0-pro",
@"prompt": @"A cyberpunk city night scene, neon lights reflecting on wet streets",
@"size": @"16:9",
@"resolution": @"2K"
};
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:payload
options:0
error:&error];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:@"Bearer <token>" forHTTPHeaderField:@"Authorization"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:jsonData];
NSURLSessionDataTask *task = [[NSURLSession sharedSession]
dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"Error: %@", error);
return;
}
NSString *result = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSLog(@"%@", result);
}];
[task resume];
[[NSRunLoop mainRunLoop] run];
}
return 0;
}
(* Requires cohttp and yojson libraries *)
open Lwt
open Cohttp
open Cohttp_lwt_unix
let url = "https://api.apimart.ai/v1/images/generations"
let payload = {|{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}|}
let () =
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "Bearer <token>"
|> fun h -> Header.add h "Content-Type" "application/json"
in
let body = Cohttp_lwt.Body.of_string payload in
let response = Client.post ~headers ~body (Uri.of_string url) >>= fun (resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body_str ->
print_endline body_str
in
Lwt_main.run response
import 'dart:convert';
import 'package:http/http.dart' as http;
void main() async {
final url = Uri.parse('https://api.apimart.ai/v1/images/generations');
final payload = {
'model': 'doubao-seedream-5-0-pro',
'prompt': 'A cyberpunk city night scene, neon lights reflecting on wet streets',
'size': '16:9',
'resolution': '2K'
};
final response = await http.post(
url,
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
},
body: jsonEncode(payload),
);
print(response.body);
}
library(httr)
library(jsonlite)
url <- "https://api.apimart.ai/v1/images/generations"
payload <- list(
model = "doubao-seedream-5-0-pro",
prompt = "A cyberpunk city night scene, neon lights reflecting on wet streets",
size = "16:9",
resolution = "2K"
)
response <- POST(
url,
add_headers(
Authorization = "Bearer <token>",
`Content-Type` = "application/json"
),
body = toJSON(payload, auto_unbox = TRUE),
encode = "raw"
)
cat(content(response, "text"))
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Invalid authentication credentials",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient balance. Please top up your account",
"type": "payment_required"
}
}
{
"error": {
"code": 403,
"message": "Access forbidden. You don't have permission to access this resource",
"type": "permission_error"
}
}
{
"error": {
"code": 429,
"message": "Rate limit exceeded. Please try again later",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "Internal server error. Please try again later",
"type": "server_error"
}
}
{
"error": {
"code": 502,
"message": "Bad gateway. The server is temporarily unavailable",
"type": "bad_gateway"
}
}
Seedream-5.0-Pro
Seedream-5.0-Pro Image Generation
- Asynchronous processing mode, returns a task ID for subsequent queries
- Supports text-to-image, single-image-to-image, and multi-reference image-to-image (up to 10 reference images)
- Supports 1K / 1.5K / 2K resolution tiers, or exact pixels via
size - Single-image model: one image per request; PNG / JPEG output
- Generated image links are valid for 72 hours; please save them promptly
POST
/
v1
/
images
/
generations
curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/images/generations";
const payload = {
model: "doubao-seedream-5-0-pro",
prompt: "A cyberpunk city night scene, neon lights reflecting on wet streets",
size: "16:9",
resolution: "2K"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.apimart.ai/v1/images/generations"
payload := map[string]interface{}{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://api.apimart.ai/v1/images/generations";
String payload = """
{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
<?php
$url = "https://api.apimart.ai/v1/images/generations";
$payload = [
"model" => "doubao-seedream-5-0-pro",
"prompt" => "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size" => "16:9",
"resolution" => "2K"
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer <token>",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
require 'net/http'
require 'json'
require 'uri'
url = URI("https://api.apimart.ai/v1/images/generations")
payload = {
model: "doubao-seedream-5-0-pro",
prompt: "A cyberpunk city night scene, neon lights reflecting on wet streets",
size: "16:9",
resolution: "2K"
}
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = payload.to_json
response = http.request(request)
puts response.body
import Foundation
let url = URL(string: "https://api.apimart.ai/v1/images/generations")!
let payload: [String: Any] = [
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
]
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print("Error: \(error)")
return
}
if let data = data, let responseString = String(data: data, encoding: .utf8) {
print(responseString)
}
}
task.resume()
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var url = "https://api.apimart.ai/v1/images/generations";
var payload = @"{
""model"": ""doubao-seedream-5-0-pro"",
""prompt"": ""A cyberpunk city night scene, neon lights reflecting on wet streets"",
""size"": ""16:9"",
""resolution"": ""2K""
}";
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");
var content = new StringContent(payload, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if(curl) {
const char *url = "https://api.apimart.ai/v1/images/generations";
const char *payload = "{"
"\"model\":\"doubao-seedream-5-0-pro\","
"\"prompt\":\"A cyberpunk city night scene, neon lights reflecting on wet streets\","
"\"size\":\"16:9\","
"\"resolution\":\"2K\""
"}";
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return 0;
}
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSURL *url = [NSURL URLWithString:@"https://api.apimart.ai/v1/images/generations"];
NSDictionary *payload = @{
@"model": @"doubao-seedream-5-0-pro",
@"prompt": @"A cyberpunk city night scene, neon lights reflecting on wet streets",
@"size": @"16:9",
@"resolution": @"2K"
};
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:payload
options:0
error:&error];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:@"Bearer <token>" forHTTPHeaderField:@"Authorization"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:jsonData];
NSURLSessionDataTask *task = [[NSURLSession sharedSession]
dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"Error: %@", error);
return;
}
NSString *result = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSLog(@"%@", result);
}];
[task resume];
[[NSRunLoop mainRunLoop] run];
}
return 0;
}
(* Requires cohttp and yojson libraries *)
open Lwt
open Cohttp
open Cohttp_lwt_unix
let url = "https://api.apimart.ai/v1/images/generations"
let payload = {|{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}|}
let () =
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "Bearer <token>"
|> fun h -> Header.add h "Content-Type" "application/json"
in
let body = Cohttp_lwt.Body.of_string payload in
let response = Client.post ~headers ~body (Uri.of_string url) >>= fun (resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body_str ->
print_endline body_str
in
Lwt_main.run response
import 'dart:convert';
import 'package:http/http.dart' as http;
void main() async {
final url = Uri.parse('https://api.apimart.ai/v1/images/generations');
final payload = {
'model': 'doubao-seedream-5-0-pro',
'prompt': 'A cyberpunk city night scene, neon lights reflecting on wet streets',
'size': '16:9',
'resolution': '2K'
};
final response = await http.post(
url,
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
},
body: jsonEncode(payload),
);
print(response.body);
}
library(httr)
library(jsonlite)
url <- "https://api.apimart.ai/v1/images/generations"
payload <- list(
model = "doubao-seedream-5-0-pro",
prompt = "A cyberpunk city night scene, neon lights reflecting on wet streets",
size = "16:9",
resolution = "2K"
)
response <- POST(
url,
add_headers(
Authorization = "Bearer <token>",
`Content-Type` = "application/json"
),
body = toJSON(payload, auto_unbox = TRUE),
encode = "raw"
)
cat(content(response, "text"))
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Invalid authentication credentials",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient balance. Please top up your account",
"type": "payment_required"
}
}
{
"error": {
"code": 403,
"message": "Access forbidden. You don't have permission to access this resource",
"type": "permission_error"
}
}
{
"error": {
"code": 429,
"message": "Rate limit exceeded. Please try again later",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "Internal server error. Please try again later",
"type": "server_error"
}
}
{
"error": {
"code": 502,
"message": "Bad gateway. The server is temporarily unavailable",
"type": "bad_gateway"
}
}
curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/images/generations";
const payload = {
model: "doubao-seedream-5-0-pro",
prompt: "A cyberpunk city night scene, neon lights reflecting on wet streets",
size: "16:9",
resolution: "2K"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.apimart.ai/v1/images/generations"
payload := map[string]interface{}{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://api.apimart.ai/v1/images/generations";
String payload = """
{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
<?php
$url = "https://api.apimart.ai/v1/images/generations";
$payload = [
"model" => "doubao-seedream-5-0-pro",
"prompt" => "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size" => "16:9",
"resolution" => "2K"
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer <token>",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
require 'net/http'
require 'json'
require 'uri'
url = URI("https://api.apimart.ai/v1/images/generations")
payload = {
model: "doubao-seedream-5-0-pro",
prompt: "A cyberpunk city night scene, neon lights reflecting on wet streets",
size: "16:9",
resolution: "2K"
}
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = payload.to_json
response = http.request(request)
puts response.body
import Foundation
let url = URL(string: "https://api.apimart.ai/v1/images/generations")!
let payload: [String: Any] = [
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
]
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print("Error: \(error)")
return
}
if let data = data, let responseString = String(data: data, encoding: .utf8) {
print(responseString)
}
}
task.resume()
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var url = "https://api.apimart.ai/v1/images/generations";
var payload = @"{
""model"": ""doubao-seedream-5-0-pro"",
""prompt"": ""A cyberpunk city night scene, neon lights reflecting on wet streets"",
""size"": ""16:9"",
""resolution"": ""2K""
}";
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");
var content = new StringContent(payload, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if(curl) {
const char *url = "https://api.apimart.ai/v1/images/generations";
const char *payload = "{"
"\"model\":\"doubao-seedream-5-0-pro\","
"\"prompt\":\"A cyberpunk city night scene, neon lights reflecting on wet streets\","
"\"size\":\"16:9\","
"\"resolution\":\"2K\""
"}";
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return 0;
}
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSURL *url = [NSURL URLWithString:@"https://api.apimart.ai/v1/images/generations"];
NSDictionary *payload = @{
@"model": @"doubao-seedream-5-0-pro",
@"prompt": @"A cyberpunk city night scene, neon lights reflecting on wet streets",
@"size": @"16:9",
@"resolution": @"2K"
};
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:payload
options:0
error:&error];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:@"Bearer <token>" forHTTPHeaderField:@"Authorization"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:jsonData];
NSURLSessionDataTask *task = [[NSURLSession sharedSession]
dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"Error: %@", error);
return;
}
NSString *result = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSLog(@"%@", result);
}];
[task resume];
[[NSRunLoop mainRunLoop] run];
}
return 0;
}
(* Requires cohttp and yojson libraries *)
open Lwt
open Cohttp
open Cohttp_lwt_unix
let url = "https://api.apimart.ai/v1/images/generations"
let payload = {|{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cyberpunk city night scene, neon lights reflecting on wet streets",
"size": "16:9",
"resolution": "2K"
}|}
let () =
let headers = Header.init ()
|> fun h -> Header.add h "Authorization" "Bearer <token>"
|> fun h -> Header.add h "Content-Type" "application/json"
in
let body = Cohttp_lwt.Body.of_string payload in
let response = Client.post ~headers ~body (Uri.of_string url) >>= fun (resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body_str ->
print_endline body_str
in
Lwt_main.run response
import 'dart:convert';
import 'package:http/http.dart' as http;
void main() async {
final url = Uri.parse('https://api.apimart.ai/v1/images/generations');
final payload = {
'model': 'doubao-seedream-5-0-pro',
'prompt': 'A cyberpunk city night scene, neon lights reflecting on wet streets',
'size': '16:9',
'resolution': '2K'
};
final response = await http.post(
url,
headers: {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/json',
},
body: jsonEncode(payload),
);
print(response.body);
}
library(httr)
library(jsonlite)
url <- "https://api.apimart.ai/v1/images/generations"
payload <- list(
model = "doubao-seedream-5-0-pro",
prompt = "A cyberpunk city night scene, neon lights reflecting on wet streets",
size = "16:9",
resolution = "2K"
)
response <- POST(
url,
add_headers(
Authorization = "Bearer <token>",
`Content-Type` = "application/json"
),
body = toJSON(payload, auto_unbox = TRUE),
encode = "raw"
)
cat(content(response, "text"))
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Invalid authentication credentials",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient balance. Please top up your account",
"type": "payment_required"
}
}
{
"error": {
"code": 403,
"message": "Access forbidden. You don't have permission to access this resource",
"type": "permission_error"
}
}
{
"error": {
"code": 429,
"message": "Rate limit exceeded. Please try again later",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "Internal server error. Please try again later",
"type": "server_error"
}
}
{
"error": {
"code": 502,
"message": "Bad gateway. The server is temporarily unavailable",
"type": "bad_gateway"
}
}
Authorizations
string
required
All API endpoints require Bearer Token authenticationGet your API Key:Visit the API Key Management Page to get your API KeyAdd it to the request header:
Authorization: Bearer YOUR_API_KEY
Single-image model:
doubao-seedream-5-0-pro generates only 1 image per request. The following are rejected (HTTP 400, no task, no charge):n > 1sequential_image_generation: "auto"(group generation not supported)- more than 10 items in
image_urls
tools (web search), stream, optimize_prompt_options.Body
string
default:"doubao-seedream-5-0-pro"
required
Image generation model name
doubao-seedream-5-0-pro(recommended)- Also accepted:
doubao-seedream-5.0-pro
string
required
Text description for image generation
Tip: Keep it within 600 English words; overly long descriptions may lose detail.
string
default:"1K"
Resolution tier (lowercase accepted)
1K(default)1.5K(same price as 1K, better quality — prefer 1.5K unless you have a reason not to)2K
When
size is an exact pixel value (e.g. 2048x1024), this field is ignored and dimensions come only from size.string
default:"auto"
Aspect ratio,
auto, or exact pixels. Do not mix the two styles:Style ①: tier + aspect ratio
Used withresolution. Supported ratios:1:1,4:3,3:4,16:9,9:16,3:2,2:3,21:9- Also accepts
16x9-stylexseparators auto(default): only the resolution tier is applied; final aspect ratio is chosen from the prompt / references
9:21) return 400 — no silent fallback to 1:1.Tier × ratio → output pixels:| Resolution | 1:1 | 4:3 | 3:4 | 16:9 | 9:16 | 3:2 | 2:3 | 21:9 |
|---|---|---|---|---|---|---|---|---|
| 1K | 1024×1024 | 1152×864 | 864×1152 | 1312×736 | 736×1312 | 1248×832 | 832×1248 | 1568×672 |
| 1.5K | 1536×1536 | 1792×1344 | 1344×1792 | 2048×1152 | 1152×2048 | 1872×1248 | 1248×1872 | 2352×1008 |
| 2K | 2048×2048 | 2304×1728 | 1728×2304 | 2560×1440 | 1440×2560 | 2496×1664 | 1664×2496 | 3024×1296 |
Style ②: exact pixels
Whensize is widthxheight, pixels are used as-is and resolution does not apply. Accepts 2048X1024 / 2048×1024.| Constraint | Range |
|---|---|
| Total pixels (width × height) | [921600, 4624220] (about 1280×720 ~ 2048×2048×1.1025) |
| Aspect ratio (width / height) | [1/16, 16] |
Limits apply to the product of width and height, not each edge alone. Example:
512×512 is too small (400); 2048×1024 is valid.array
Reference image URL list for single / multi-reference image-to-image, up to 10Two formats:1. Public URL
http://orhttps://- Example:
https://example.com/image.jpg
- Format:
data:image/<format>;base64,<data>—<format>must be lowercase - Example:
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABg...
- Formats: jpeg / png / webp / bmp / tiff / gif / heic / heif
- Aspect ratio (w/h):
[1/16, 16] - Each edge > 14 px
- Size ≤ 30 MB
- Total pixels ≤
6000×6000(36,000,000)
Billing: First reference image free; each additional image has a fixed surcharge.
string
default:"jpeg"
Output image format
jpeg(default)png
Compatibility:response_formatis equivalent tooutput_format; other values are treated asjpeg.
boolean
default:"false"
Whether to add an “AI generated” watermark at the bottom-right
true: add watermarkfalse: no watermark (default)
Request Examples
Text-to-image (tier + ratio)
{
"model": "doubao-seedream-5-0-pro",
"prompt": "Cyberpunk city night scene, neon reflections on wet streets",
"resolution": "2K",
"size": "21:9",
"output_format": "png"
}
Text-to-image (exact pixels)
{
"model": "doubao-seedream-5-0-pro",
"prompt": "Minimal e-commerce hero image, white background, product centered",
"size": "1600x1600"
}
Multi-reference
{
"model": "doubao-seedream-5-0-pro",
"prompt": "Replace the outfit in image 1 with the outfit in image 2",
"image_urls": [
"https://example.com/person.jpg",
"https://example.com/dress.jpg"
],
"resolution": "2K",
"size": "auto"
}
Recommended: 1.5K same price, better quality
{
"model": "doubao-seedream-5-0-pro",
"prompt": "A cute orange cat on a windowsill in afternoon sun, cinematic",
"resolution": "1.5K",
"size": "16:9"
}
Billing Notes
Total = output unit price + reference surcharge × max(0, ref_count − 1)
| Condition | Unit price |
|---|---|
≤ 2.61 million pixels (1.5K or lower: resolution 1K / 1.5K / omit, or exact pixels ≤ 2,601,124) | $0.045 / image |
> 2.61 million pixels (higher than 1.5K: resolution: "2K", or exact pixels > 2,601,124) | $0.09 / image |
- 1.5K costs the same as 1K ($0.045).
- With exact-pixel
size, billing uses actual output area;resolutionis ignored (e.g.size: "2048x2048"→ $0.09). - First reference image is free; each additional reference has a surcharge.
- Failed tasks are fully refunded.
Common Errors
| Case | Notes |
|---|---|
Unsupported resolution tier | e.g. 3K / 4K → 400 |
| Ratio outside the list | e.g. 9:21 → 400 |
| Exact-pixel total out of range | Must be in [921600, 4624220] |
| Exact-pixel aspect out of range | Must be in [1/16, 16] |
n > 1 / sequential group mode | Single-image model |
| More than 10 references | Rejected |
⏱️ Slower generation: ~90s for 1K, ~160s for 2K (quality first). Poll Get Task Status every 5–10 seconds; client timeout 5 minutes. Generated image links are valid for 72 hours; please save them promptly.
Response
integer
Response status code
⌘I