Skip to content

Seedream Image Generation ​

Use this endpoint to generate images from text descriptions or reference images. It supports text-to-image, single-image-to-image, multi-image-to-image, and sequential (group) image generation; the Seedream 5.0 pro model additionally supports layer decomposition and interactive editing.

Endpoint ​

http
POST /v1/images/generations

Authentication ​

MethodDescription
Bearer TokenInclude Authorization: Bearer <API_key> in the request header to authenticate your account.

Request Headers ​

ParameterTypeRequiredDescription
Content-TypestringYesThe media type of the request body. Set it to application/json
AuthorizationstringYesBearer API_key, used to authenticate your account

Model Capabilities ​

  • Seedream 5.0 pro (doubao-seedream-5-0-pro-260628): Supports layer decomposition (splitting a single image into 1 base image + up to 16 independently editable layers) and interactive editing (specifying the edit area via coordinates, box selection, arrows, etc.); single-image output only (does not support sequential_image_generation), and does not yet support group generation, web search, or streaming output
  • Seedream 5.0 lite (doubao-seedream-5-0-260128): Supports group generation (when sequential_image_generation is auto: up to 15 images for text-to-group, up to 14 for single-image-to-group), multi-image-to-image, single-image-to-image, and text-to-image; use disabled for single-image output only

Request Body ​

ParameterTypeRequiredDefaultDescription
modelstringYes-Model ID. See "Supported Model IDs" below
promptstringYes-Prompt for generating the image or specifying layer-decomposition intent. Chinese prompt recommended not to exceed 300 characters, English not to exceed 600 words
imagestring / string[]No-Reference image(s), as a URL or Base64 (data:image/<format>;base64,<encoded>, format must be lowercase); per-image requirements below
sizestringNo-Image size. Available tiers and pixel ranges differ per model. See "Size" below
layer_decompositionbooleanNofalseLayer decomposition switch: true enables layer decomposition mode (Seedream 5.0 pro only; then image is required and only a single image is allowed)
optimize_prompt_optionsobjectNo-Prompt optimization configuration. See subtable below
output_formatstringNojpegOutput image format: png / jpeg. In layer decomposition mode, this only controls the base image format; layers are always png
backgroundstringNoopaqueImage alpha channel: transparent (transparent background) / opaque (opaque). Seedream 5.0 pro only; image-to-image only, with a single input image that has an alpha channel
response_formatstringNourlReturn format: url (download link, valid for 24 hours) / b64_json (Base64-encoded)
sequential_image_generationstringNodisabledGroup mode: auto (model decides whether to return a group) / disabled (group off, single image only). Seedream 5.0 lite only
sequential_image_generation_optionsobjectNo-Group configuration, effective only when sequential_image_generation is auto. See subtable below
streambooleanNofalseStreaming switch: true returns each generated image as it is produced. Only supported by Seedream 5.0 lite
toolsobject[]No-Tool configuration (Seedream 5.0 lite only), e.g., enabling web search. See subtable below
watermarkbooleanNotrueWatermark switch: false no watermark, true adds an "AI generated" watermark to the bottom-right corner

optimize_prompt_options Parameters ​

ParameterTypeRequiredDefaultDescription
optimize_prompt_options.modestringNostandardPrompt optimization mode: standard (higher quality, slower); fast (faster, slightly lower quality, not supported by Seedream 5.0 lite)

sequential_image_generation_options Parameters ​

ParameterTypeRequiredDefaultDescription
sequential_image_generation_options.max_imagesintegerNo15Maximum number of images generated in this request, range [1, 15]. The actual number is also limited by the reference image count (input reference images + generated images ≤ 15)

tools Parameters ​

ParameterTypeRequiredDescription
tools[].typestringYesTool type: web_search (web search). When enabled, the model decides whether to search the web based on the prompt; the search count can be queried via usage.tool_usage.web_search

image Notes ​

  • Image generation scenario: Seedream 5.0 pro supports up to 10 reference images; Seedream 5.0 lite supports up to 14
  • Single image requirements: formats jpeg / png / webp / bmp / tiff / gif / heic / heif; aspect ratio [1/16, 16]; side length > 14px; size ≤ 30MB; total pixels [196, 6000×6000]
  • Layer decomposition scenario: image is required, single image only, formats png / jpeg, total pixels [512×512, 6000×6000]

Size (size) ​

Each model supports two configuration methods (do not mix): Method 1 specifies a resolution tier (the model judges the aspect ratio from the prompt); Method 2 specifies the exact width×height pixel value (widthxheight).

ModelMethod 1 values (default)Method 2 constraints
Seedream 5.0 pro (image generation)1K / 1.5K / 2K (default 2K; 1.5K costs the same as 1K with better quality)Total pixels [1280x720, 2048x2048x1.1025], aspect ratio [1/16, 16]
Seedream 5.0 pro (layer decomposition)1K / 1.5K / 2K / auto (default auto, output follows the input dimensions; base image and layers preserve their source aspect ratio)Method 2 not supported
Seedream 5.0 lite2K / 3K / 4K (no default)Default 2048x2048, total pixels [2560x1440, 4096x4096], aspect ratio [1/16, 16]

Resolution tier to pixel size reference for Seedream 5.0 pro (image generation scenario):

ResolutionAspect ratioPixel size
1K1:11024x1024
1K4:3 / 3:4 / 16:9 / 9:16 / 3:2 / 2:3 / 21:91152x864 / 864x1152 / 1424x800 / 800x1424 / 1248x832 / 832x1248 / 1568x672
1.5K1:11536x1536
1.5K4:3 / 3:4 / 16:9 / 9:16 / 3:2 / 2:3 / 21:91792x1344 / 1344x1792 / 2048x1152 / 1152x2048 / 1872x1248 / 1248x1872 / 2352x1008
2K1:12048x2048
2K4:3 / 3:4 / 16:9 / 9:16 / 3:2 / 2:3 / 21:92368x1776 / 1776x2368 / 2816x1584 / 1584x2816 / 2496x1664 / 1664x2496 / 3136x1344

Request Example ​

Text-to-Image ​

bash
curl --location --request POST 'https://neolink.com/api/v1/images/generations' \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <API Key>' \
     --data-raw '{
         "model": "<Model ID>",
         "prompt": "A cute orange cat wearing round-framed glasses, sitting by the windowsill reading a newspaper in warm afternoon sunlight",
         "size": "2K",
         "response_format": "b64_json",
         "watermark": true
     }'
python
import base64
import requests

url = "https://neolink.com/api/v1/images/generations"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <API Key>",
}

payload = {
    "model": "<Model ID>",
    "prompt": "A cute orange cat wearing round-framed glasses, sitting by the windowsill reading a newspaper in warm afternoon sunlight",
    "size": "2K",
    "response_format": "b64_json",
    "watermark": True,
}

resp = requests.post(url, headers=headers, json=payload, timeout=60)
resp.raise_for_status()
data = resp.json()

# Extract the returned image and save it
for item in data["data"]:
    image = item["b64_json"]
    with open("output.png", "wb") as f:
        f.write(base64.b64decode(image))

Image-to-Image (Multi-Image-to-Image) ​

Pass reference image(s) in image (multiple allowed) together with a text prompt to generate an image.

Base64 Encoding Note: image accepts Base64 in the format data:image/png;base64,<Base64 encoded>. See the encoding script below:

bash
#!/usr/bin/env bash
set -euo pipefail
IMAGE_PATH="./input.png"

if [[ "$(base64 --version 2>&1)" = *"FreeBSD"* ]]; then
    B64FLAGS="--input"
else
    B64FLAGS="-w0"
fi
echo -n "data:image/png;base64," > base64.txt
base64 $B64FLAGS "$IMAGE_PATH" >> base64.txt
bash
curl --location --request POST 'https://neolink.com/api/v1/images/generations' \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <API Key>' \
     --data-raw '{
         "model": "<Model ID>",
         "prompt": "Place the cat from the reference image in a seaside sunset scene, keeping a photorealistic style",
         "image": [
             "https://example.com/reference-cat.png",
             "data:image/png;base64,<Base64 Code>"
         ],
         "size": "2K"
     }'
python
import requests

url = "https://neolink.com/api/v1/images/generations"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <API Key>",
}

payload = {
    "model": "<Model ID>",
    "prompt": "Place the cat from the reference image in a seaside sunset scene, keeping a photorealistic style",
    "image": [
        "https://example.com/reference-cat.png",
        "data:image/png;base64,<Base64 Code>",
    ],
    "size": "2K",
}

resp = requests.post(url, headers=headers, json=payload, timeout=60)
resp.raise_for_status()
result = resp.json()
print(result)

Multi-Image Fusion ​

Pass multiple reference images; the model fuses elements from the images into a single image based on the prompt (e.g., swapping the figure's outfit in image 1 with the outfit in image 2).

bash
curl --location --request POST 'https://neolink.com/api/v1/images/generations' \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <API Key>' \
     --data-raw '{
         "model": "doubao-seedream-5-0-pro-260628",
         "prompt": "Replace the outfit in image 1 with the one in image 2",
         "image": [
             "https://example.com/figure-1.png",
             "https://example.com/outfit-2.png"
         ],
         "size": "2K",
         "output_format": "png",
         "watermark": false
     }'
python
import requests

url = "https://neolink.com/api/v1/images/generations"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <API Key>",
}

payload = {
    "model": "doubao-seedream-5-0-pro-260628",
    "prompt": "Replace the outfit in image 1 with the one in image 2",
    "image": [
        "https://example.com/figure-1.png",
        "https://example.com/outfit-2.png",
    ],
    "size": "2K",
    "output_format": "png",
    "watermark": False,
}

resp = requests.post(url, headers=headers, json=payload, timeout=60)
resp.raise_for_status()
result = resp.json()
print(result["data"][0]["url"])

Layer Decomposition ​

With layer_decomposition enabled, the model splits the input image into 1 base image + up to 16 independently editable layers (all with an alpha channel). In prompt, you can use <bbox>left top right bottom</bbox> to specify the coordinates of the elements to split.

bash
curl --location --request POST 'https://neolink.com/api/v1/images/generations' \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <API Key>' \
     --data-raw '{
         "model": "doubao-seedream-5-0-pro-260628",
         "prompt": "Perform precise layer decomposition on the image. The coordinates of the text to decompose are <bbox>180 64 812 198</bbox> and <bbox>178 714 826 810</bbox>; the parrot coordinates are <bbox>347 305 642 997</bbox>.",
         "image": "https://example.com/input.png",
         "layer_decomposition": true,
         "size": "2K",
         "output_format": "jpeg",
         "response_format": "url",
         "watermark": true
     }'
python
import requests

url = "https://neolink.com/api/v1/images/generations"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <API Key>",
}

payload = {
    "model": "doubao-seedream-5-0-pro-260628",
    "prompt": "Perform precise layer decomposition on the image. The coordinates of the text to decompose are <bbox>180 64 812 198</bbox> and <bbox>178 714 826 810</bbox>; the parrot coordinates are <bbox>347 305 642 997</bbox>.",
    "image": "https://example.com/input.png",
    "layer_decomposition": True,
    "size": "2K",
    "output_format": "jpeg",
    "response_format": "url",
    "watermark": True,
}

resp = requests.post(url, headers=headers, json=payload, timeout=60)
resp.raise_for_status()
result = resp.json()

# The base image has z_index 0; layers increment from 1
for item in result["data"]:
    print(item["z_index"], item.get("name"), item["size"])

Interactive Editing ​

Provide a reference image with hand-drawn sketch/marked regions together with an editing instruction; the model performs precise edits based on the marked regions (e.g., adding, replacing, or removing local elements).

bash
curl --location --request POST 'https://neolink.com/api/v1/images/generations' \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <API Key>' \
     --data-raw '{
         "model": "doubao-seedream-5-0-pro-260628",
         "prompt": "Edit the image based on the hand-drawn sketch. Add a stack of realistic magazines or art books in the marked area at the bottom left, and add a ceramic cup of coffee with saucer in the marked area on the right. Remove all sketch lines. Keep the composition unchanged. Let the newly added objects blend naturally into the existing scene.",
         "image": "https://example.com/sketch.png",
         "size": "2K",
         "output_format": "png",
         "response_format": "url",
         "watermark": false
     }'
python
import requests

url = "https://neolink.com/api/v1/images/generations"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <API Key>",
}

payload = {
    "model": "doubao-seedream-5-0-pro-260628",
    "prompt": "Edit the image based on the hand-drawn sketch. Add a stack of realistic magazines or art books in the marked area at the bottom left, and add a ceramic cup of coffee with saucer in the marked area on the right. Remove all sketch lines. Keep the composition unchanged. Let the newly added objects blend naturally into the existing scene.",
    "image": "https://example.com/sketch.png",
    "size": "2K",
    "output_format": "png",
    "response_format": "url",
    "watermark": False,
}

resp = requests.post(url, headers=headers, json=payload, timeout=60)
resp.raise_for_status()
result = resp.json()
print(result["data"][0]["url"])

Group Generation (Multi-Reference-Image-to-Group) ​

When sequential_image_generation is auto, group mode is enabled; the model decides based on the prompt and reference images whether to generate a set of related images (input reference images + generated images ≤ 15).

bash
curl --location --request POST 'https://neolink.com/api/v1/images/generations' \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <API Key>' \
     --data-raw '{
         "model": "doubao-seedream-5-0-260128",
         "prompt": "Generate 3 images of a girl and a cow plush toy happily riding a roller coaster at the amusement park, covering morning, noon, and night",
         "image": [
             "https://example.com/reference-girl.png",
             "https://example.com/reference-cow.png"
         ],
         "sequential_image_generation": "auto",
         "sequential_image_generation_options": {
             "max_images": 3
         },
         "size": "2K",
         "output_format": "png",
         "watermark": false
     }'
python
import requests

url = "https://neolink.com/api/v1/images/generations"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <API Key>",
}

payload = {
    "model": "doubao-seedream-5-0-260128",
    "prompt": "Generate 3 images of a girl and a cow plush toy happily riding a roller coaster at the amusement park, covering morning, noon, and night",
    "image": [
        "https://example.com/reference-girl.png",
        "https://example.com/reference-cow.png",
    ],
    "sequential_image_generation": "auto",
    "sequential_image_generation_options": {"max_images": 3},
    "size": "2K",
    "output_format": "png",
    "watermark": False,
}

resp = requests.post(url, headers=headers, json=payload, timeout=60)
resp.raise_for_status()
result = resp.json()

# Iterate and print the URL and size of each image
for item in result["data"]:
    print(item["url"], item["size"])

Supported Model IDs ​

  • doubao-seedream-5-0-pro-260628 — Supports layer decomposition (up to 16 layers), interactive editing, and multi-image-to-image (up to 10 reference images)
  • doubao-seedream-5-0-260128 — Supports group generation, multi/single-image-to-image (up to 14 reference images), web search, and streaming output

<Model ID> should be replaced with the actual model ID. The actual available models, resolutions, and reference image counts depend on the platform.

Response Body ​

ParameterTypeDescription
createdintegerUnix timestamp (seconds) of the request creation time
modelstringThe model ID used for this request
dataobject[]List of output image information; url, b64_json, size are common fields; other fields vary by scenario
data.urlstringImage download URL, returned when response_format is url; valid for 24 hours
data.b64_jsonstringBase64 image data, returned when response_format is b64_json
data.sizestringImage pixel size, format widthxheight, e.g., 2048x2048
data.output_formatstringOutput image format, png or jpeg
data.z_indexintegerLayer stacking index; the base image is always 0, layers increment from 1 (layer decomposition scenario)
data.namestringName/label of the decomposed layer element (layer decomposition scenario)
data.descriptionstringDetailed description of the decomposed layer element (layer decomposition scenario)
data.bounding_boxobjectBounding box of the layer in the base-image coordinate system (layer decomposition scenario)
data.bounding_box.absolutearrayAbsolute pixel coordinates [left, top, right, bottom]; the base-image top-left corner is (0, 0)
data.bounding_box.normalizedarrayNormalized coordinates [left, top, right, bottom] in the [0, 1000] range
data.errorobjectError info (code, message) when a single image fails in group generation; other images are unaffected
errorobjectTop-level error info (code, message), returned when no image could be generated
usageobjectUsage information
usage.generated_imagesintegerNumber of successfully generated images; only successful images are billed
usage.input_imagesintegerNumber of input images
usage.output_tokensintegerTokens spent on generated images, computed as sum(image_width * image_height) / 256, rounded down
usage.total_tokensintegerTotal tokens consumed by this request; input tokens are not counted, so it equals output_tokens
usage.tool_usageobjectTool usage information
usage.tool_usage.web_searchintegerNumber of web searches; 0 means no search was performed

Response Example ​

The following response examples assume response_format is url, showing typical output structures for text-to-image / image-to-image, multi-image fusion, layer decomposition, interactive editing, and group generation (with b64_json, data.url is replaced by data.b64_json).

Note on layer decomposition: the base image has z_index fixed at 0 and does not return bounding_box; each layer returns z_index, name, description, and bounding_box. You can restore layers to the base image or a custom canvas using bounding_box.absolute / normalized.

Note on group generation: in group mode data returns multiple images; if a single image fails, that entry additionally returns an error field (code, message) without affecting other images.

json
{
  "created": 1722769557,
  "model": "<Model ID>",
  "data": [
    {
      "url": "https://.../image_1.png",
      "size": "2048x2048",
      "output_format": "png"
    }
  ],
  "usage": {
    "generated_images": 1,
    "output_tokens": 16384,
    "total_tokens": 16384
  }
}
json
{
  "model": "doubao-seedream-5-0-pro-260628",
  "created": 1757323224,
  "data": [
    {
      "url": "https://.../fused.png",
      "size": "1760x2368"
    }
  ],
  "usage": {
    "generated_images": 1,
    "output_tokens": 16280,
    "total_tokens": 16280
  }
}
json
{
  "model": "doubao-seedream-5-0-pro-260628",
  "created": 1784696685,
  "data": [
    {
      "url": "https://.../base.png",
      "size": "2048x2048",
      "output_format": "jpeg",
      "z_index": 0
    },
    {
      "url": "https://.../layer_title.png",
      "size": "1273x265",
      "output_format": "png",
      "z_index": 1,
      "bounding_box": {
        "absolute": [383, 120, 1655, 384],
        "normalized": [187, 59, 808, 188]
      },
      "name": "Seedream heading text",
      "description": "Yellow large serif-font Seedream heading text"
    }
  ],
  "usage": {
    "input_images": 1,
    "generated_images": 8,
    "output_tokens": 23107,
    "total_tokens": 23107
  }
}
json
{
  "model": "doubao-seedream-5-0-pro-260628",
  "created": 1757323224,
  "data": [
    {
      "url": "https://.../edited.png",
      "size": "2048x2048"
    }
  ],
  "usage": {
    "generated_images": 1,
    "output_tokens": 18000,
    "total_tokens": 18000
  }
}
json
{
  "model": "doubao-seedream-5-0-260128",
  "created": 1757388756,
  "data": [
    {
      "url": "https://.../image_1.png",
      "size": "2720x1536"
    },
    {
      "url": "https://.../image_2.png",
      "size": "2720x1536"
    },
    {
      "url": "https://.../image_3.png",
      "size": "2720x1536"
    }
  ],
  "usage": {
    "generated_images": 3,
    "output_tokens": 48960,
    "total_tokens": 48960
  }
}

Notes:

  • Image URLs returned by url are valid for 24 hours after generation; download them in time.
  • If response_format is b64_json, the generated image is Base64-encoded and must be decoded before saving.