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
POST /v1/images/generationsAuthentication
| Method | Description |
|---|---|
| Bearer Token | Include Authorization: Bearer <API_key> in the request header to authenticate your account. |
Request Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
Content-Type | string | Yes | The media type of the request body. Set it to application/json |
Authorization | string | Yes | Bearer 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_generationisauto: 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; usedisabledfor single-image output only
Request Body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | - | Model ID. See "Supported Model IDs" below |
prompt | string | Yes | - | Prompt for generating the image or specifying layer-decomposition intent. Chinese prompt recommended not to exceed 300 characters, English not to exceed 600 words |
image | string / string[] | No | - | Reference image(s), as a URL or Base64 (data:image/<format>;base64,<encoded>, format must be lowercase); per-image requirements below |
size | string | No | - | Image size. Available tiers and pixel ranges differ per model. See "Size" below |
layer_decomposition | boolean | No | false | Layer 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_options | object | No | - | Prompt optimization configuration. See subtable below |
output_format | string | No | jpeg | Output image format: png / jpeg. In layer decomposition mode, this only controls the base image format; layers are always png |
background | string | No | opaque | Image 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_format | string | No | url | Return format: url (download link, valid for 24 hours) / b64_json (Base64-encoded) |
sequential_image_generation | string | No | disabled | Group mode: auto (model decides whether to return a group) / disabled (group off, single image only). Seedream 5.0 lite only |
sequential_image_generation_options | object | No | - | Group configuration, effective only when sequential_image_generation is auto. See subtable below |
stream | boolean | No | false | Streaming switch: true returns each generated image as it is produced. Only supported by Seedream 5.0 lite |
tools | object[] | No | - | Tool configuration (Seedream 5.0 lite only), e.g., enabling web search. See subtable below |
watermark | boolean | No | true | Watermark switch: false no watermark, true adds an "AI generated" watermark to the bottom-right corner |
optimize_prompt_options Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
optimize_prompt_options.mode | string | No | standard | Prompt optimization mode: standard (higher quality, slower); fast (faster, slightly lower quality, not supported by Seedream 5.0 lite) |
sequential_image_generation_options Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
sequential_image_generation_options.max_images | integer | No | 15 | Maximum 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
| Parameter | Type | Required | Description |
|---|---|---|---|
tools[].type | string | Yes | Tool 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:
imageis required, single image only, formatspng/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).
| Model | Method 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 lite | 2K / 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):
| Resolution | Aspect ratio | Pixel size |
|---|---|---|
| 1K | 1:1 | 1024x1024 |
| 1K | 4:3 / 3:4 / 16:9 / 9:16 / 3:2 / 2:3 / 21:9 | 1152x864 / 864x1152 / 1424x800 / 800x1424 / 1248x832 / 832x1248 / 1568x672 |
| 1.5K | 1:1 | 1536x1536 |
| 1.5K | 4:3 / 3:4 / 16:9 / 9:16 / 3:2 / 2:3 / 21:9 | 1792x1344 / 1344x1792 / 2048x1152 / 1152x2048 / 1872x1248 / 1248x1872 / 2352x1008 |
| 2K | 1:1 | 2048x2048 |
| 2K | 4:3 / 3:4 / 16:9 / 9:16 / 3:2 / 2:3 / 21:9 | 2368x1776 / 1776x2368 / 2816x1584 / 1584x2816 / 2496x1664 / 1664x2496 / 3136x1344 |
Request Example
Text-to-Image
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
}'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:
imageaccepts Base64 in the formatdata:image/png;base64,<Base64 encoded>. See the encoding script below:
#!/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.txtcurl --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"
}'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).
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
}'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.
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
}'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).
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
}'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).
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
}'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
| Parameter | Type | Description |
|---|---|---|
created | integer | Unix timestamp (seconds) of the request creation time |
model | string | The model ID used for this request |
data | object[] | List of output image information; url, b64_json, size are common fields; other fields vary by scenario |
data.url | string | Image download URL, returned when response_format is url; valid for 24 hours |
data.b64_json | string | Base64 image data, returned when response_format is b64_json |
data.size | string | Image pixel size, format widthxheight, e.g., 2048x2048 |
data.output_format | string | Output image format, png or jpeg |
data.z_index | integer | Layer stacking index; the base image is always 0, layers increment from 1 (layer decomposition scenario) |
data.name | string | Name/label of the decomposed layer element (layer decomposition scenario) |
data.description | string | Detailed description of the decomposed layer element (layer decomposition scenario) |
data.bounding_box | object | Bounding box of the layer in the base-image coordinate system (layer decomposition scenario) |
data.bounding_box.absolute | array | Absolute pixel coordinates [left, top, right, bottom]; the base-image top-left corner is (0, 0) |
data.bounding_box.normalized | array | Normalized coordinates [left, top, right, bottom] in the [0, 1000] range |
data.error | object | Error info (code, message) when a single image fails in group generation; other images are unaffected |
error | object | Top-level error info (code, message), returned when no image could be generated |
usage | object | Usage information |
usage.generated_images | integer | Number of successfully generated images; only successful images are billed |
usage.input_images | integer | Number of input images |
usage.output_tokens | integer | Tokens spent on generated images, computed as sum(image_width * image_height) / 256, rounded down |
usage.total_tokens | integer | Total tokens consumed by this request; input tokens are not counted, so it equals output_tokens |
usage.tool_usage | object | Tool usage information |
usage.tool_usage.web_search | integer | Number of web searches; 0 means no search was performed |
Response Example
The following response examples assume
response_formatisurl, showing typical output structures for text-to-image / image-to-image, multi-image fusion, layer decomposition, interactive editing, and group generation (withb64_json,data.urlis replaced bydata.b64_json).Note on layer decomposition: the base image has
z_indexfixed at0and does not returnbounding_box; each layer returnsz_index,name,description, andbounding_box. You can restore layers to the base image or a custom canvas usingbounding_box.absolute/normalized.Note on group generation: in group mode
datareturns multiple images; if a single image fails, that entry additionally returns anerrorfield (code,message) without affecting other images.
{
"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
}
}{
"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
}
}{
"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
}
}{
"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
}
}{
"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
urlare valid for 24 hours after generation; download them in time.- If
response_formatisb64_json, the generated image is Base64-encoded and must be decoded before saving.
