MaasUnionMaasUnion
API Reference
AI Model APIImagesDoubao Image

Create Doubao Image

API Reference

  • Gateway path: POST /doubao/v1/images/generations
  • Upstream capability: Volcano Engine Ark Seedream image generation (/api/v3/images/generations)
  • Channel type: Doubao Image (ChannelTypeDoubaoImage = 61)
  • Official reference: Volcano Engine Ark — Image Generation API

Overview

Doubao Image is a dedicated image channel type newly added by the gateway, used to fully interface with 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" }])

Dedicated Route

ItemDescription
Gateway pathPOST https://www.maasunion.com/doubao/v1/images/generations
Routing policyOnly dispatched to channels of type "Doubao Image"; never hits VolcEngine or other channels
Request/Response formatConsistent with the Volcano Engine Ark official API; the gateway transparently forwards and parses billing fields
Upstream address{channel base_url}/api/v3/images/generations (default https://ark.cn-beijing.volces.com)

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

Supported Models (Built-in Reference)

Administrators can configure the model name or Endpoint ID on the channel. The list below is the built-in reference:

modelDescription
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-260128Endpoint ID example
doubao-seedream-4-0-250828Endpoint ID example

Model Capability Matrix

ModelText-to-ImageImage-to-ImageMulti-image FusionSeriesStreamWeb SearchCustom Output Format
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
  • Single image to image: 1 reference image + text → single image
  • Text to image: pure text → single image

Authentication

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

On the upstream channel side, the Volcano Engine Ark API Key is used; the gateway automatically injects Authorization: Bearer {ARK_API_KEY} on forwarding. Clients do not need to (and should not) pass the upstream key.

Request Parameters

Request Body

ParameterTypeRequiredDefaultDescription
modelstringYesModel ID or Endpoint ID (must be configured on a Doubao Image channel)
promptstringYesPrompt, ≤ 300 Chinese characters / 600 English words is recommended
imagestring / arrayNoInput image (URL or Base64), at most 14
sizestringNo2048x20482K / 3K / 4K or custom WxH (e.g. 2048x2048)
sequential_image_generationstringNodisabledauto (series) / disabled (single)
sequential_image_generation_options.max_imagesintegerNo15Maximum images in the series, range [1, 15]
toolsarrayNoTool config, e.g. [{ "type": "web_search" }] to enable web search
streambooleanNofalseWhether to stream the output (SSE)
guidance_scalefloatNoText 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)

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 gateway 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
  }'

Billing

The gateway parses the billing info from the usage field in the upstream response:

FieldGateway Usage
usage.generated_imagesWritten into n multiplier for per-image billing (the actual number returned upstream is used for series)
usage.output_tokens / usage.total_tokensUsed by Token-based billing models
usage.tool_usage.web_searchWeb search additional usage (if supported by model/multiplier config)

The actual deduction rules depend on the administrator's configuration in Model Multiplier / Price, consistent with channel-group strategy.

Differences vs. VolcEngine Channel

ComparisonDoubao Image (61)VolcEngine (45)
Gateway path/doubao/v1/images/generations/v1/images/generations (shared with other OpenAI image interfaces)
Channel scopeImage only, dedicated Seedream adapterGeneral: chat, embedding, TTS, image, video, etc.
Route isolationDedicated route only hits type=61 channelsDistributed by model name, may be mixed with LLM channels
Doubao-specific parametersFully transparent (series, stream, tools, etc.)Relies on transparent mode in some scenarios
Suitable forSeedream image API onlyReusing the same Ark Key for multiple capabilities

Both can coexist: it is recommended to use the Doubao Image dedicated route for new integrations; existing VolcEngine configurations can be migrated gradually.

Notes

  1. Image URL validity: Valid for 24 hours after generation; please download or persist in time.
  2. model is required: The dedicated route does not auto-fill placeholder model names like dall-e.
  3. Channel type match: When calling /doubao/v1/images/generations, the model must be configured on a "Doubao Image" channel.
  4. Streaming vs non-streaming: For series, streaming is recommended to get each image as it is generated; non-streaming waits for all to complete.
  5. Prompt length: Too long can scatter the information; keep within 300 Chinese characters / 600 English words.
  6. 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?