Seedream API Integration Guide & Examples
Official API reference: Image generation API (BytePlus ModelArk). The body carries the official Ark fields and the response keeps the official shape; fields, defaults and per-model support follow the official reference.
Models and entry points
| Model | Entry points | Default size | Common size values (examples) |
|---|---|---|---|
doubao-seedream-4.0 | Ark native POST /api/v3/images/generations; OpenAI-compatible POST /v1/images/generations | 2K | 1K / 2K / 4K |
doubao-seedream-5.0-pro | OpenAI-compatible POST /v1/images/generations | 2K | 1K / 1.5K / 2K |
doubao-seedream-5.0-lite | OpenAI-compatible POST /v1/images/generations | 2K | 2K / 3K / 4K |
doubao-seedream-5.0-flash | OpenAI-compatible POST /v1/images/generations | 2K | 1K / 1.5K / 2K |
- All models support text to image and image to image (single / multiple references) and require
modelandprompt. Sequential sets (sequential_image_generation: "auto") are supported on 5.0 lite / 4.0 only; 5.0 pro / 5.0 flash are single-image models. - The 5.0 family is served on the OpenAI-compatible entry point only; calling the Ark native entry point with it returns
400 model_protocol_not_offered.doubao-seedream-4.0is served on both. No Seedream model enables/v1/images/edits; for image to image use theimagefield of image generation. The protocols listed in the Model Catalog are authoritative. - The gateway forwards
sizeas-is; a tier outside the table is validated by the upstream and usually returns400. - Images are returned synchronously — there is no polling; the Ark native entry point can also stream events with
stream: true, see Streaming.
With the official Ark SDK (
volcenginesdkarkruntime), pointbase_urlathttps://api.modelgo.ai/api/v3and use your ModelGo API key asapi_key. The SDK'simages.generateuses the native entry point, so it can only calldoubao-seedream-4.0. The same client can also create Seedance video tasks (client.content_generation.tasks) — see Seedance. For the 5.0 family use an OpenAI SDK or plain HTTP on the OpenAI-compatible entry point.
1. Create an image
OpenAI-compatible entry point (4.0 / 5.0 family)
curl https://api.modelgo.ai/v1/images/generations \
-H "Authorization: Bearer $MODELGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-5.0-pro",
"prompt": "Put the cat from the first image into the neon street from the second",
"image": ["https://example-cdn.com/cat.jpg", "https://example-cdn.com/street.jpg"],
"size": "2K",
"watermark": false
}'- Omit
imagefor text to image; image to image / multiple references use the JSONimagefield (URL or base64). nmust be omitted or1: Ark's Images API has non; withn ≥ 2the upstream decides whether to return400or ignore it. Use a sequential set for several images.- This entry point forwards
size,watermark,response_format,stream,background,tools,layer_decomposition(sent together with oneimage) and other fields as-is; an unsupported value may be rejected by the upstream with400or silently ignored while the request still succeeds, so use the values listed on this page.
Ark native entry point (4.0 only)
curl https://api.modelgo.ai/api/v3/images/generations \
-H "Authorization: Bearer $MODELGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-4.0",
"prompt": "Four shiba inu posters in different styles: cyberpunk, watercolor, minimal, retro film",
"size": "2K",
"sequential_image_generation": "auto",
"sequential_image_generation_options": {"max_images": 4}
}'The native entry point is stricter than the official API: unknown fields, and fields the target model does not support (such as background or layer_decomposition on 4.0), return 400 naming the field.
Streaming
The native entry point supports stream: true, returning text/event-stream:
- One
image_generation.partial_succeededevent per successful image (image_index,urlorb64_json,size); a failed item in a sequential set is animage_generation.partial_failedevent (witherror). - Then an
image_generation.completedevent carryingusage, thendata: [DONE]. - Images are delivered together once generation finishes, not progressively one by one; billing is identical to the non-stream call.
- Per Ark's rules, only 5.0 lite / 4.5 / 4.0 stream;
stream: trueon 5.0 pro / 5.0 flash returns400.
Response
{
"model": "doubao-seedream-5.0-pro",
"created": 1757318400,
"data": [{"url": "https://...", "size": "2816x1584"}],
"usage": {"generated_images": 1}
}response_formatdefaults tourl, and the link is valid for 24 hours — download it promptly. Withb64_json,data[].b64_jsoncarries the base64 image.data[].sizeis the actual output size. In a sequential set, an image that failed appears as{"error": {...}}while the others are returned as usual.
2. Parameters
| Field | Models | Description |
|---|---|---|
model | All | Required |
prompt | All | Required. With a tier size, describe the aspect ratio here |
image | All | Reference image URL or data:image/<format>;base64,<...>. 2–14 images for multi-reference; reference images + generated images ≤ 15. URLs must be public direct links the upstream can GET |
size | All | Resolution tier (default 2K) or explicit pixels WxH (such as 1280x720) |
sequential_image_generation | 5.0 lite / 4.0 | Sequential set switch: disabled (default) / auto |
sequential_image_generation_options.max_images | 5.0 lite / 4.0 | Maximum images in a set; only with auto |
response_format | All | url (default) / b64_json |
output_format | 5.0 family | jpeg (default) / png |
background | 5.0 pro / 5.0 flash | opaque (default) / transparent |
layer_decomposition | 5.0 pro / 5.0 flash | true splits the input image into 1 base image + up to 16 editable layers; exactly one image is required. In data[], the item with z_index 0 is the base image and the rest are transparent PNG layers with bounding_box / name / description. Billed per generated image (usage.generated_images = base image + layers); 17 images are pre-authorized at creation and the unused part is released at settlement |
optimize_prompt_options.mode | All | standard (default) / fast |
tools[].type | 5.0 lite | web_search (web search) |
watermark | All | Whether to watermark, default true |
3. Full example (Python, OpenAI SDK)
Ark-specific fields go in extra_body:
import os, requests
from openai import OpenAI
client = OpenAI(api_key=os.environ["MODELGO_API_KEY"], base_url="https://api.modelgo.ai/v1")
r = client.images.generate(model="doubao-seedream-5.0-pro",
prompt="A ginger cat on a windowsill, 16:9 landscape, film grain",
size="2K", extra_body={"watermark": False})
open("cat.jpg", "wb").write(requests.get(r.data[0].url, timeout=60).content)4. Billing
Billed per image: by usage.generated_images, regardless of the size tier, and the same on both entry points; web search on 5.0 lite is charged additionally per search. Unit prices are in the console's model list. Error handling: Errors & Rate Limits.