ToAPIs ToAPIs
Seedream-5.0-Pro

Seedream-5.0-Pro Image Generation

Generate high-quality images and decompose layers using Seedream 5.0 Pro model with 1K/2K resolution

POST
/v1/images/generations

Note for users in mainland China: Please use https://toapis.cn as the API endpoint (Base URL). Replace https://toapis.com with https://toapis.cn in the examples in this document.

  • Seedream 5.0 Pro high-quality image generation and layer decomposition model from ByteDance Seed team
  • Use the model parameter to select doubao-seedream-5-0-pro or doubao-seedream-5-0-pro-global
  • Supports 1K and 2K resolutions (single image output for ordinary generation; up to 16 transparent PNG layers plus base image when layer_decomposition=true)
  • Supports text-to-image, image-to-image, multi-reference editing, and single-image layer decomposition
  • Billing rule: for doubao-seedream-5-0-pro, the first reference image (or text-to-image base tier) carries no extra reference surcharge and billing applies from the second reference image onward; doubao-seedream-5-0-pro-global bills by resolution tier
  • Async task management, query results by task ID

Important Change: For better performance and cost control, we no longer support passing base64 image data directly in image_urls. Please use the Upload Image API first to upload images and get URLs, then call this endpoint.

Authentication

Authorizationstringheaderrequired

All endpoints require Bearer Token authentication

Get your API Key from the API Key Management Page

Add to request header:

Authorization: Bearer YOUR_API_KEY

Request Parameters

modelstringbodyrequireddefault: doubao-seedream-5-0-pro

Image generation model name. Accepts doubao-seedream-5-0-pro or doubao-seedream-5-0-pro-global

Example: "doubao-seedream-5-0-pro"

disable_nsfwbooleanbodydefault: true

Controls whether NSFW content generation is disabled (platform parameter).

  • true (default) or omitted: Disable NSFW content generation
  • false: Allow NSFW content generation (subject to account and regional eligibility)

Takes effect only when the JSON boolean false is explicitly provided; null is treated as omitted, and non-boolean values return 400. NSFW generation remains disabled in restricted regions and account types.

promptstringbodyrequired

Text description for image generation (currently required even when layer_decomposition=true)

Recommended length: up to 300 Chinese characters or 600 English words for best results

sizestringbodydefault: 1:1

Image aspect ratio, resolution tier, or explicit pixel dimensions

When layer_decomposition is enabled, pass the 1K or 2K resolution preset directly in this field (do not pass WIDTHxHEIGHT pixels).

Supported aspect ratios for ordinary generation/editing:

  • 1:1: Square (default)
  • 4:3: Landscape 4:3
  • 3:4: Portrait 3:4
  • 16:9: Landscape widescreen
  • 9:16: Portrait vertical
  • 3:2: Landscape 3:2
  • 2:3: Portrait 2:3
  • 21:9: Ultra-wide
  • 9:21: Ultra-tall

Ordinary generation/editing also accepts 1K, 2K, or explicit WIDTHxHEIGHT pixels (total pixels 921600-4624220, aspect ratio [1/16, 16]). 3K, 4K, and size="auto" are not supported.

nintegerbodydefault: 1

Number of images to generate. Seedream 5.0 Pro supports 1 or omitted only (sequential multi-image generation is not supported).

When layer_decomposition=true, also omit n or set it to 1 (it does not specify the layer count).

Must enter a plain number (e.g., 1), do not use quotes or it will cause an error

layer_decompositionbooleanbodydefault: false

Enables Seedream 5.0 Pro layer decomposition.

  • false: returns a regular flattened image (default)
  • true: decomposes exactly one reference image into a base image (z_index: 0) plus up to 16 independent transparent PNG layers (up to 17 total items)

Requires exactly one JPEG or PNG reference image and size set to 1K or 2K. When enabled, each result.data[] item includes z_index; independent layers also include bounding_box, name, and description.

image_urlsstring[]body

Reference image URL list for image-to-image, editing, or layer decomposition (also accepts reference_images, images arrays, or single-image image)

⚠️ URL format only (base64 no longer supported)

  • Publicly accessible image URL (http:// or https://)
  • You can use the Upload Image API to upload local images and get URLs

Limitations:

  • Image count: 0-10 for ordinary generation/editing (omit for text-to-image); exactly 1 when layer_decomposition=true
  • Image formats: jpeg, png, webp for ordinary generation/editing; jpeg, png only for layer decomposition
  • Aspect ratio (width/height) range: [1/16, 16]
  • Width and height (px) > 14
  • Size: not exceeding 30 MB
  • Total pixels: not exceeding 6000×6000 px

Billing notes:

  • doubao-seedream-5-0-pro: the first reference image has no extra surcharge; billing applies from the second reference image onward
  • doubao-seedream-5-0-pro-global: billed per resolution tier
metadataobjectbody

Model-specific extension parameters for configuring advanced Seedream 5.0 Pro options

metadata properties
metadata.resolutionstringbody

Image resolution (1K or 2K). Explicitly pass "1K" or "2K" in every request so billing tier and output resolution stay aligned.

Supported resolutions:

  • 1K: Basic resolution
  • 2K: Standard resolution

Note: Seedream 5.0 Pro does not support 3K or 4K resolution; use doubao-seedream-5-0 for 3K or doubao-seedream-5-5 for 1K/1.5K/2K/3K

metadata.output_formatstringbodydefault: png

Output image file format. Accepts png (default) or jpeg.

In layer decomposition mode, this applies only to the base image; independent layers are always transparent PNG.

metadata.optimize_prompt_optionsobjectbody

Prompt optimization options

Properties:

  • mode (string): Optimization mode, supports standard

Example:

"optimize_prompt_options": { "mode": "standard" }
metadata.watermarkbooleanbodydefault: false

Whether to add a visible watermark to the generated image

  • true: Add watermark
  • false: No watermark (default)

Parameter Limitations

Sequential multi-image generation (sequential_image_generation, sequential_image_generation_options), streaming (stream=true), and web search (tools) are not supported.

Query Results

A successful submission does not mean generation is complete. Query the task with the same API Key (result.data is returned when status is completed):

curl "https://toapis.com/v1/images/generations/TASK_ID" \
  -H "Authorization: Bearer $TOAPIS_API_KEY"

Response Fields

idstring

Unique task identifier for status queries

objectstring

Object type, always generation.task

modelstring

Model name used

statusstring

Task status

  • pending, queued: Queued for processing
  • in_progress: Processing
  • completed: Successfully completed
  • failed: Failed
progressinteger

Task progress percentage (0-100)

created_atinteger

Task creation timestamp (Unix timestamp)

metadataobject

Task metadata

completed_atinteger

Task completion timestamp (Unix timestamp). Returned only after the task completes.

expires_atinteger

Result file expiration timestamp (Unix timestamp, 30 days after completion). Download or persist the files before they expire.

resultobject

Generated result returned when status is completed.

result.typestring

Result type. Always image for image tasks.

result.dataarray

Image result list. With layer decomposition enabled, the first item is normally the base image and the remaining items are independent transparent PNG layers.

result.data[].urlstring

Public URL of the base image or independent layer.

result.data[].z_indexinteger

Layer stacking order. With layer decomposition enabled, the base image is normally 0 and independent layers increase from there.

result.data[].sizestring

Pixel dimensions of the base image or independent layer, for example 2048x2048.

result.data[].output_formatstring

File format of this result item. The base image can use the requested format; transparent independent layers use png.

result.data[].bounding_boxobject

Layer position on the base image, with absolute and normalized coordinates.

result.data[].bounding_box.absolutearray

Absolute pixel coordinates on the base image in [x1, y1, x2, y2] order, representing the top-left and bottom-right corners.

result.data[].bounding_box.normalizedarray

Normalized coordinates in [x1, y1, x2, y2] order, with values ranging from 0 to 1000.

result.data[].namestring

Layer name.

result.data[].descriptionstring

Description of the layer contents.

Request Example

curl --request POST \
  --url https://toapis.com/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "doubao-seedream-5-0-pro",
    "prompt": "A cute panda playing in a bamboo forest",
    "size": "1:1",
    "n": 1,
    "metadata": {
      "resolution": "2K",
      "output_format": "png"
    }
  }'
curl --request POST \
  --url https://toapis.com/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "doubao-seedream-5-0-pro",
    "prompt": "A cute panda playing in a bamboo forest",
    "size": "1:1",
    "n": 1,
    "image_urls": [
      "https://example.com/panda.jpg"
    ],
    "metadata": {
      "resolution": "1K"
    }
  }'
curl --request POST \
  --url https://toapis.com/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "doubao-seedream-5-0-pro",
    "prompt": "Precisely separate the image into a base image and independent transparent PNG layers.",
    "image_urls": [
      "https://example.com/office-desk.png"
    ],
    "size": "2K",
    "n": 1,
    "layer_decomposition": true,
    "metadata": {
      "resolution": "2K"
    }
  }'
import requests

response = requests.post(
    "https://toapis.com/v1/images/generations",
    headers={
        "Authorization": "Bearer your-ToAPIs-key",
        "Content-Type": "application/json"
    },
    json={
        "model": "doubao-seedream-5-0-pro",
        "prompt": "A cute panda playing in a bamboo forest",
        "size": "1:1",
        "n": 1,
        "metadata": {
            "resolution": "2K",
            "output_format": "png"
        }
    }
)

task = response.json()
print(f"Task ID: {task['id']}")
print(f"Status: {task['status']}")
import requests

response = requests.post(
    "https://toapis.com/v1/images/generations",
    headers={
        "Authorization": "Bearer your-ToAPIs-key",
        "Content-Type": "application/json"
    },
    json={
        "model": "doubao-seedream-5-0-pro",
        "prompt": "A cute panda playing in a bamboo forest",
        "size": "1:1",
        "n": 1,
        "image_urls": ["https://example.com/panda.jpg"],
        "metadata": {
            "resolution": "1K"
        }
    }
)

task = response.json()
print(f"Task ID: {task['id']}")
print(f"Status: {task['status']}")
const response = await fetch('https://toapis.com/v1/images/generations', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer your-ToAPIs-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'doubao-seedream-5-0-pro',
    prompt: 'A cute panda playing in a bamboo forest',
    size: '1:1',
    n: 1,
    metadata: {
      resolution: '2K',
      output_format: 'png'
    }
  })
});

const task = await response.json();
console.log(`Task ID: ${task.id}`);
console.log(`Status: ${task.status}`);
const response = await fetch('https://toapis.com/v1/images/generations', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer your-ToAPIs-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'doubao-seedream-5-0-pro',
    prompt: 'A cute panda playing in a bamboo forest',
    size: '1:1',
    n: 1,
    image_urls: ['https://example.com/panda.jpg'],
    metadata: {
      resolution: '1K'
    }
  })
});

const task = await response.json();
console.log(`Task ID: ${task.id}`);
console.log(`Status: ${task.status}`);

Response Example

{
  "id": "tsk_img_abc123def456",
  "object": "generation.task",
  "model": "doubao-seedream-5-0-pro",
  "status": "pending",
  "progress": 0,
  "created_at": 1703884800,
  "metadata": {}
}
{
  "completed_at": 1787128810,
  "created_at": 1787128650,
  "expires_at": 1789720810,
  "id": "tsk_img_example_layer_decomposition",
  "model": "doubao-seedream-5-0-pro",
  "object": "generation.task",
  "progress": 100,
  "result": {
    "type": "image",
    "data": [
      {
        "url": "https://files.toapis.com/images/example/base.jpg",
        "size": "1600x2848",
        "output_format": "jpeg",
        "z_index": 0
      },
      {
        "url": "https://files.toapis.com/images/example/layer-1.png",
        "size": "3040x955",
        "output_format": "png",
        "z_index": 1,
        "bounding_box": {
          "absolute": [0, 0, 1600, 503],
          "normalized": [0, 0, 999, 176]
        },
        "name": "Background office equipment",
        "description": "The monitor edge and file organizer extracted from the background"
      },
      {
        "url": "https://files.toapis.com/images/example/layer-2.png",
        "size": "1982x1162",
        "output_format": "png",
        "z_index": 2,
        "bounding_box": {
          "absolute": [800, 589, 1599, 1058],
          "normalized": [500, 207, 999, 371]
        },
        "name": "Stacked white papers",
        "description": "Several stacked white office papers extracted from the desk"
      }
    ]
  },
  "status": "completed"
}