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

ModelEntry pointsDefault sizeCommon size values (examples)
doubao-seedream-4.0Ark native POST /api/v3/images/generations; OpenAI-compatible POST /v1/images/generations2K1K / 2K / 4K
doubao-seedream-5.0-proOpenAI-compatible POST /v1/images/generations2K1K / 1.5K / 2K
doubao-seedream-5.0-liteOpenAI-compatible POST /v1/images/generations2K2K / 3K / 4K
doubao-seedream-5.0-flashOpenAI-compatible POST /v1/images/generations2K1K / 1.5K / 2K
  • All models support text to image and image to image (single / multiple references) and require model and prompt. 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.0 is served on both. No Seedream model enables /v1/images/edits; for image to image use the image field of image generation. The protocols listed in the Model Catalog are authoritative.
  • The gateway forwards size as-is; a tier outside the table is validated by the upstream and usually returns 400.
  • 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), point base_url at https://api.modelgo.ai/api/v3 and use your ModelGo API key as api_key. The SDK's images.generate uses the native entry point, so it can only call doubao-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)

bash
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 image for text to image; image to image / multiple references use the JSON image field (URL or base64).
  • n must be omitted or 1: Ark's Images API has no n; with n ≥ 2 the upstream decides whether to return 400 or 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 one image) and other fields as-is; an unsupported value may be rejected by the upstream with 400 or silently ignored while the request still succeeds, so use the values listed on this page.

Ark native entry point (4.0 only)

bash
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_succeeded event per successful image (image_index, url or b64_json, size); a failed item in a sequential set is an image_generation.partial_failed event (with error).
  • Then an image_generation.completed event carrying usage, then data: [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: true on 5.0 pro / 5.0 flash returns 400.

Response

json
{
  "model": "doubao-seedream-5.0-pro",
  "created": 1757318400,
  "data": [{"url": "https://...", "size": "2816x1584"}],
  "usage": {"generated_images": 1}
}
  • response_format defaults to url, and the link is valid for 24 hours — download it promptly. With b64_json, data[].b64_json carries the base64 image.
  • data[].size is the actual output size. In a sequential set, an image that failed appears as {"error": {...}} while the others are returned as usual.

2. Parameters

FieldModelsDescription
modelAllRequired
promptAllRequired. With a tier size, describe the aspect ratio here
imageAllReference 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
sizeAllResolution tier (default 2K) or explicit pixels WxH (such as 1280x720)
sequential_image_generation5.0 lite / 4.0Sequential set switch: disabled (default) / auto
sequential_image_generation_options.max_images5.0 lite / 4.0Maximum images in a set; only with auto
response_formatAllurl (default) / b64_json
output_format5.0 familyjpeg (default) / png
background5.0 pro / 5.0 flashopaque (default) / transparent
layer_decomposition5.0 pro / 5.0 flashtrue 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.modeAllstandard (default) / fast
tools[].type5.0 liteweb_search (web search)
watermarkAllWhether to watermark, default true

3. Full example (Python, OpenAI SDK)

Ark-specific fields go in extra_body:

python
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.