MaasUnionMaasUnion
API Reference
AI Model APIImagesDoubao Image

Create Doubao Image

API Reference

Overview

The Doubao image API calls the Seedream model family on Volcano Engine Ark, including:

  • Text-to-image, image-to-image, multi-image fusion
  • Sequential image generation (sequential_image_generation: auto)
  • Streaming SSE output (stream: true)
  • Web search (tools: [{ "type": "web_search" }])
  • Interactive editing and layer decomposition (Seedream 5.0 Pro only)

Dedicated Route

ItemDescription
Gateway pathPOST https://www.maasunion.com/doubao/v1/images/generations
Request/Response formatConsistent with the Volcano Engine Ark official API

API gateway base URL: https://www.maasunion.com

Supported Models

The Seedream models currently available (subject to what the platform has enabled):

modelDescription
doubao-seedream-5-0-pro-260628Seedream 5.0 Pro: interactive editing and layer decomposition
doubao-seedream-5.0-lite5.0 lite series
doubao-seedream-4.54.5 series
doubao-seedream-4.04.0 series
doubao-seedream-3.0-t2i3.0 text-to-image
doubao-seedream-5-0-2601285.0 lite
doubao-seedream-4-0-2508284.0

Model Capability Matrix

ModelText-to-ImageImage-to-ImageMulti-image FusionInteractive EditLayer SplitSeriesStreamWeb SearchCustom Output Format
doubao-seedream-5-0-pro-260628✅✅✅✅✅❌❌❌❌ (default jpeg)
doubao-seedream-5.0-lite✅✅✅❌❌✅✅✅✅ (png/jpeg)
doubao-seedream-4.5✅✅✅❌❌✅✅❌❌ (default jpeg)
doubao-seedream-4.0✅✅✅❌❌✅✅❌❌ (default jpeg)
doubao-seedream-3.0-t2i✅❌❌❌❌❌❌❌❌

Series (sequential_image_generation: "auto"):

  • Multi-image to series: 2–14 reference images + text → correlated series (reference images + generated images ≤ 15)
  • Single image to series: 1 reference image + text → at most 14 images
  • Text to series: pure text → at most 15 images

Single image (sequential_image_generation: "disabled" or omitted):

  • Multi-image to image: 2–14 reference images + text → single image (Seedream 5.0 Pro: at most 10 reference images)
  • Single image to image: 1 reference image + text → single image
  • Text to image: pure text → single image

Seedream 5.0 Pro does not support sequential image generation. Use single-image mode.

Authentication

HeaderRequiredDescription
AuthorizationYesBearer {your_api_token}, API token issued by the platform
Content-TypeRequired for POSTapplication/json

Use the platform API token. Clients do not need to (and should not) pass an upstream vendor key.

Request Parameters

Request Body

ParameterTypeRequiredDefaultDescription
modelstringYes—Model ID, e.g. doubao-seedream-5-0-pro-260628
promptstringYes—Prompt, ≤ 300 Chinese characters / 600 English words is recommended. For interactive editing, describe the region and desired change here
imagestring / arrayNo—Input image (URL or Base64). At most 14 for 5.0-lite / 4.5 / 4.0; at most 10 for Seedream 5.0 Pro
layer_decompositionbooleanNofalseWhether to split layers; Seedream 5.0 Pro only
sizestringNo2048x20482K / 3K / 4K or custom WxH (e.g. 2048x2048)
sequential_image_generationstringNodisabledauto (series) / disabled (single); Seedream 5.0 Pro does not support auto
sequential_image_generation_options.max_imagesintegerNo15Maximum images in the series, range [1, 15]
toolsarrayNo—Tool config, e.g. [{ "type": "web_search" }] to enable web search; Seedream 5.0 Pro does not support this
streambooleanNofalseWhether to stream the output (SSE); Seedream 5.0 Pro does not support this
guidance_scalefloatNo—Text weight [1, 10] (5.0-lite / 4.5 / 4.0 do not support)
output_formatstringNojpegpng / jpeg (custom only supported by 5.0-lite)
response_formatstringNourlurl (24h valid) / b64_json
watermarkbooleanNotrueWhether to add watermark
optimize_prompt_options.modestringNostandardstandard (high quality) / fast (fast; 5.0-lite / 4.5 do not support)

Image Input Limits

ItemRequirement
Image formatjpeg, png; 5.0-lite / 4.5 / 4.0 additionally support webp / bmp / tiff / gif / heic / heif
Aspect ratio[1/16, 16] (5.0-lite / 4.5 / 4.0)
Width/height> 14px
Single file size≤ 30 MB
Total pixels≤ 6000×6000 = 36,000,000 px
Number of reference imagesAt most 14 (5.0-lite / 4.5 / 4.0); Seedream 5.0 Pro: at most 10

Response Parameters

Non-streaming Response

FieldTypeDescription
modelstringModel ID used
createdintegerCreated time (Unix seconds)
data[].urlstringImage URL (valid for 24h)
data[].b64_jsonstringImage Base64 (when response_format=b64_json)
data[].sizestringPixel dimensions, e.g. 2048x2048
data[].error.codestringError code of a single image failure
data[].error.messagestringError description of a single image failure
usage.generated_imagesintegerNumber of successfully generated images (billing basis)
usage.output_tokensintegerTokens ≈ sum(width×height)/256
usage.total_tokensintegerTotal tokens
usage.tool_usage.web_searchintegerNumber of web search invocations
error.codestringRequest-level error code
error.messagestringRequest-level error description

Series failure handling:

  • Moderation failed: continue generating the next image
  • Internal service error (500): stop generating

Streaming Response (SSE)

After setting stream: true, the response is text/event-stream, with event types:

EventDescription
image_generation.partial_succeededA single image is generated successfully
image_generation.completedAll complete, with usage
[DONE]Stream end

partial_succeeded event fields example:

{
  "type": "image_generation.partial_succeeded",
  "model": "doubao-seedream-5-0-260128",
  "created": 1757396757,
  "image_index": 0,
  "url": "https://...",
  "size": "2496x1664"
}

The completed event contains the full usage; the platform uses it to complete billing.

2K Resolution

Aspect RatioPixels
1:12048×2048
4:32304×1728
3:41728×2304
16:92848×1600
9:161600×2848
3:22496×1664
2:31664×2496
21:93136×1344

3K Resolution

Aspect RatioPixels
1:13072×3072
4:33456×2592
3:42592×3456
16:94096×2304
9:162304×4096
2:32496×3744
3:23744×2496
21:94704×2016

4K Resolution

Aspect RatioPixels
1:14096×4096
3:43520×4704
4:34704×3520
16:95504×3040
9:163040×5504
2:33328×4992
3:24992×3328
21:96240×2656

Custom pixel values must satisfy:

  • Total pixels: [3,686,400, 16,777,216] (approx. 2560×1440 to 4096×4096)
  • Aspect ratio: [1/16, 16]

Call Examples

1. Text-to-Image

curl "https://www.maasunion.com/doubao/v1/images/generations" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-0-260128",
    "prompt": "Vibrant close-up editorial portrait, the model has a piercing gaze, wearing a sculptural hat, with rich color blocking",
    "size": "2K",
    "output_format": "png",
    "watermark": false
  }'

Response example:

{
  "model": "doubao-seedream-5-0-260128",
  "created": 1757321139,
  "data": [
    {
      "url": "https://...",
      "size": "3104x1312"
    }
  ],
  "usage": {
    "generated_images": 1,
    "output_tokens": 15840,
    "total_tokens": 15840
  }
}

2. Image-to-Image

curl "https://www.maasunion.com/doubao/v1/images/generations" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-0-260128",
    "prompt": "Keep the model's pose, but change the clothing material from silver metal to fully transparent water",
    "image": "https://example.com/reference.png",
    "size": "2K",
    "output_format": "png",
    "watermark": false
  }'

3. Multi-image Fusion

curl "https://www.maasunion.com/doubao/v1/images/generations" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-0-260128",
    "prompt": "Replace the clothing in image 1 with the clothing in image 2",
    "image": [
      "https://example.com/outfit-source.png",
      "https://example.com/outfit-target.png"
    ],
    "sequential_image_generation": "disabled",
    "size": "2K",
    "watermark": false
  }'

4. Multi-reference Image to Series

curl "https://www.maasunion.com/doubao/v1/images/generations" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-0-260128",
    "prompt": "Generate 3 images of a girl and a cow plush toy riding a roller coaster happily in an amusement park, covering morning, noon, and evening",
    "image": [
      "https://example.com/ref-1.png",
      "https://example.com/ref-2.png"
    ],
    "sequential_image_generation": "auto",
    "sequential_image_generation_options": {
      "max_images": 3
    },
    "size": "2K",
    "watermark": false
  }'

5. Streaming Output

curl "https://www.maasunion.com/doubao/v1/images/generations" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-0-260128",
    "prompt": "Based on reference image 1, generate four images: the character wearing sunglasses, riding a motorcycle, wearing a hat, and holding a lollipop respectively",
    "image": "https://example.com/ref.png",
    "sequential_image_generation": "auto",
    "sequential_image_generation_options": { "max_images": 4 },
    "size": "2K",
    "stream": true,
    "watermark": false
  }'

SSE response snippet:

event: image_generation.partial_succeeded
data: {"type":"image_generation.partial_succeeded","image_index":0,"url":"https://...","size":"2496x1664"}

event: image_generation.completed
data: {"type":"image_generation.completed","usage":{"generated_images":4,"output_tokens":48672,"total_tokens":48672}}

data: [DONE]
curl "https://www.maasunion.com/doubao/v1/images/generations" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-0-260128",
    "prompt": "Create a 5-day weather forecast chart for Shanghai in a modern flat illustration style",
    "size": "2048x2048",
    "tools": [{ "type": "web_search" }],
    "output_format": "png",
    "response_format": "url",
    "watermark": false
  }'

7. Interactive Editing (Seedream 5.0 Pro)

Pass a reference image and describe the region and desired change in prompt.

curl "https://www.maasunion.com/doubao/v1/images/generations" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-0-pro-260628",
    "prompt": "Replace the person in the reference image with a cyberpunk style, keep the composition unchanged",
    "image": "https://example.com/input.png",
    "size": "2K",
    "watermark": false
  }'

8. Layer Decomposition (Seedream 5.0 Pro)

Set layer_decomposition: true to split the image into independent layers. Split results and metadata are returned as-is.

curl "https://www.maasunion.com/doubao/v1/images/generations" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-0-pro-260628",
    "prompt": "Split the image into three layers: subject, shadow, and background",
    "image": ["https://example.com/input.png"],
    "size": "2K",
    "layer_decomposition": true,
    "watermark": false
  }'

Seedream 5.0 Pro

doubao-seedream-5-0-pro-260628 uses the same endpoint POST /doubao/v1/images/generations. In addition to text-to-image, image-to-image, and multi-image fusion, it supports:

  • Interactive editing: Pass a reference image in image and describe the edit region and target in prompt (for example, box selection, point selection, arrows, or sketch marks).
  • Layer decomposition: Set layer_decomposition: true. Split results and metadata are returned as-is.

Limits:

  • At most 10 reference images
  • stream: true is not supported
  • sequential_image_generation: "auto" (series) is not supported
  • tools (web search) is not supported

Layer decomposition may return multiple images and is billed by the actual usage.generated_images count.

Billing

The platform parses billing info from the usage field in the response:

FieldUsage
usage.generated_imagesPer-image billing (the actual number returned is used for series and layer decomposition)
usage.output_tokens / usage.total_tokensUsed by Token-based billing models
usage.tool_usage.web_searchWeb search additional usage

See the platform for the actual price.

Notes

  1. Image URL validity: Valid for 24 hours after generation; please download or persist in time.
  2. model is required: Use a model ID provided by the platform, e.g. doubao-seedream-5-0-pro-260628.
  3. Streaming vs non-streaming: For series, streaming is recommended to get each image as it is generated; non-streaming waits for all to complete. Seedream 5.0 Pro does not support streaming and must use non-streaming.
  4. Prompt length: Too long can scatter the information; keep within 300 Chinese characters / 600 English words.
  5. OpenAI SDK compatibility: The request/response format is similar to OpenAI's image interface; you may try pointing the OpenAI client to https://www.maasunion.com/doubao/v1 (verify SDK compatibility with the SSE event format yourself).

How is this guide?