Skip to content

Seedream 5.0 Pro ​

ByteDance | 1K / 1.5K / 2K | reference editing | transparent PNG | layer decomposition

Seedream 5.0 Pro uses the same request contract as Flash and is aimed at scenes that need finer detail; the catalog states what is enabled for your Workspace. It generates and edits images from text plus reference images. Every request creates one asynchronous task: create it, poll it, then download the private roles it returns.

Base URL https://api.tokenlio.ai — the paths below are relative to it:

  • Create: POST /v1/images/generations → 202 Accepted
  • Query: GET /v1/tasks/{id}
  • Download: GET /v1/tasks/{id}/content?role=image_0

Before you start

  1. Create a Workspace model-routing API key in the Tokenlio console.
  2. Copy the API model ID published for your Workspace from the model catalog. The examples use seedream-5-0-pro.
  3. Image tasks are asynchronous: the create call only accepts the task. Poll until succeeded, then download.

Integration guide, not an availability announcement

Available models, parameter support and prices are listed in the catalog, and your Workspace and API key must both be permitted for this model. This page describes the contract; it does not grant access.

1. Choose a model ​

ModelSize tiersImages per taskExtra output controls
Seedream 5.0 Pro1k / 1.5k / 2kexactly 1transparent PNG, layer decomposition
Seedream 5.0 Flash1k / 1.5k / 2kexactly 1transparent PNG, layer decomposition
Seedream 5.0 Lite2k / 3k / 4k1–15 in one tasknone (batch generation instead)

Flash and Pro default to size: auto with resolution: 1k and return a single image. Lite defaults to 1:1 with 2k and can return several images from one task; it does not accept background, layer_decomposition or prompt optimization.

n is not portable between models

Flash and Pro accept exactly n: 1. A request copied from a Lite batch (n: 2 or more) is rejected locally with 400 and n must be 1 for this model; create separate tasks to generate multiple images.

Model names describe capabilities, not access. All values below are placeholders only for the parts you must replace.

2. Quick start: create, poll, download ​

bash
BASE_URL='https://api.tokenlio.ai'
curl "$BASE_URL/v1/images/generations" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: seedream-pro-001' \
  --data '{"model":"seedream-5-0-pro","prompt":"A serene mountain lake at sunrise, soft mist over the water","size":"auto","resolution":"1k"}'
json
{
  "model": "seedream-5-0-pro",
  "prompt": "A serene mountain lake at sunrise, soft mist over the water",
  "size": "auto",
  "resolution": "1k"
}
python
import json, os, urllib.request

body = {
    "model": "seedream-5-0-pro",
    "prompt": "A serene mountain lake at sunrise, soft mist over the water",
    "size": "auto",
    "resolution": "1k",
}
request = urllib.request.Request(
    "https://api.tokenlio.ai/v1/images/generations",
    data=json.dumps(body).encode(),
    headers={
        "Authorization": f"Bearer {os.environ['TOKENLIO_API_KEY']}",
        "Content-Type": "application/json",
        "Idempotency-Key": "seedream-pro-001",
    },
)
print(json.load(urllib.request.urlopen(request)))

A 202 means the task was accepted, not that an image exists:

json
{
  "id": "dfc68868-d388-4d83-a173-d44e47a8bec7",
  "model": "seedream-5-0-pro",
  "status": "queued",
  "assets": []
}

Then poll and download:

bash
curl "https://api.tokenlio.ai/v1/tasks/dfc68868-d388-4d83-a173-d44e47a8bec7" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY"
bash
curl --location "https://api.tokenlio.ai/v1/tasks/dfc68868-d388-4d83-a173-d44e47a8bec7/content?role=image_0" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" -o result.jpeg

status moves queued → processing → succeeded or failed. Poll every 5–15 seconds; the default image timeout is 10 minutes. Keep message and error.code, and never create a new task while a previous response is still uncertain — query the stored task ID instead.

3. Request parameters ​

ParameterTypeDefaultContract
modelstringrequiredExact published API model ID
promptstringrequiredNon-empty UTF-8 text; may be omitted only with layer_decomposition: true
sizestringautoauto, a ratio, a size tier, or exact WxH pixels
resolutionstring1k1k / 1.5k / 2k; used when size is auto or a ratio
ninteger1This model accepts exactly 1
output_formatstringjpegjpeg or png
backgroundstringopaqueopaque or transparent (needs one PNG with alpha)
layer_decompositionbooleanfalseSplit one reference image into 1–17 ordered files
image_urlsstring[]emptyPublic HTTPS URLs or complete Base64 Data URIs; at most 10; input order is significant
watermarkbooleanomittedSend explicitly to control watermarking
nsfw_checkbooleanomittedSend explicitly to control content checking
optimize_prompt_optionsobject{"mode":"standard"}Only mode: "standard" is accepted

Use real JSON booleans and integers — not strings, and not null. Unknown fields, duplicate keys, null values and trailing data are rejected, so remove anything you do not need.

Not part of this integration

quality, mask_url, output_compression, moderation, aspect_ratio, response_format, watermark_text and internal asset, creator or price fields are rejected. The response is never a synchronous OpenAI-style payload: there is no data[].b64_json and no multipart /v1/images/edits. Reference images are supplied through image_urls.

4. Size, resolution and output count ​

size and resolution interact in a fixed order:

sizeActual output
autoTier from resolution (1k by default)
1k / 1.5k / 2kSize tier wins; resolution is ignored
Ratio such as 16:9That ratio at the resolution tier
Exact WxHThose exact pixels; resolution is ignored
  • Tiers are case-insensitive and normalised to lowercase; 1K is stored as 1k.
  • Supported ratios: 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3, 2:1, 1:2, 21:9.
  • Exact pixels must total 921,600–4,624,220 pixels with a long-to-short ratio of at most 16:1, for example 2048x2048 or 2048x1152.
  • n is exactly 1: one image per task. Generate several images with several tasks, or use Seedream 5.0 Lite.
json
{
  "model": "seedream-5-0-pro",
  "prompt": "A wide cinematic desert road at golden hour",
  "size": "16:9",
  "resolution": "2k"
}
json
{
  "model": "seedream-5-0-pro",
  "prompt": "A square product photo of a ceramic cup on linen",
  "size": "2048x2048"
}

5. Reference images and Base64 ​

Send references in image_urls as public HTTPS URLs or as complete Data URIs. Order is preserved, so describe positions in the prompt when it matters.

LimitFlash / Pro
Reference images per requestat most 10
Bytes per reference file≤ 30 MiB
Decoded inline images, total≤ 45 MiB
Whole JSON request body≤ 64 MiB
Pixels per sidemore than 14 px, at most 24,000 px
Total pixels per image≤ 36 megapixels
Aspect ratiobetween 1:16 and 16:1
Accepted formatsPNG, JPEG, WebP, GIF, BMP, TIFF

Every reference must be a single, fully decodable static image. Animated PNG and WebP, multi-frame GIF, multi-page TIFF, MPO and concatenated JPEG are rejected, and HEIC/HEIF are not supported — convert them first. For Base64, send the complete data:image/png;base64,... form: bare Base64, URL-safe alphabets, spaces, missing padding and a declared MIME that disagrees with the real bytes are all rejected.

Inline identity is the decoded image content, not the Base64 text, so re-wrapping line breaks does not create a different request. Large batches should use URLs instead of inline data. URLs are measured after the task is accepted, so a broken or slow link can still fail the task later.

python
import base64, json
from pathlib import Path

data = Path("reference.png").read_bytes()
request = {
    "model": "seedream-5-0-pro",
    "prompt": "Keep the subject and change the lighting to a soft window light",
    "image_urls": ["data:image/png;base64," + base64.b64encode(data).decode("ascii")],
}
Path("request.json").write_text(json.dumps(request), encoding="utf-8")
bash
curl "https://api.tokenlio.ai/v1/images/generations" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: seedream-pro-reference-001' \
  --data-binary @request.json
json
{
  "model": "seedream-5-0-pro",
  "prompt": "Place the same chair beside a large window, keep its material",
  "size": "4:3",
  "resolution": "1.5k",
  "image_urls": ["https://YOUR_PUBLIC_CDN/chair.png"]
}

Build the JSON with a JSON library and hold it in a file or memory. Never paste image bytes into a query string, a header or your logs.

6. Advanced output controls ​

Transparent PNG editing ​

Transparency requires exactly one reference PNG with a real alpha channel, background: transparent and output_format: png. A flat JPEG that merely looks transparent does not qualify, and transparency cannot be combined with layer decomposition.

json
{
  "model": "seedream-5-0-pro",
  "prompt": "Keep the subject, remove the background, preserve the soft edge",
  "background": "transparent",
  "output_format": "png",
  "image_urls": ["https://YOUR_PUBLIC_CDN/with-alpha.png"]
}

Layer decomposition ​

Layer decomposition splits one reference image into ordered, separately downloadable layers: the base plus up to 16 stacked layers, 1–17 files in total. Request with layer_decomposition: true and n: 1.

json
{
  "model": "seedream-5-0-pro",
  "layer_decomposition": true,
  "n": 1,
  "image_urls": ["https://YOUR_PUBLIC_CDN/poster.png"]
}
  • Exactly one reference image, at least 262,144 and at most 36,000,000 pixels.
  • size must be auto or a size tier; exact pixels and ratios are not accepted here.
  • prompt is optional; add it to steer which elements become layers.
  • n: 1 is the number of requested results. The actual file count is assets.length and can be anywhere from 1 to 17.

Prompt optimisation, watermark and content check ​

optimize_prompt_options defaults to {"mode":"standard"}; this is the only accepted mode. Send watermark or nsfw_check explicitly when you need a specific value — leaving them out means the platform does not set them.

7. Results, roles and reconstruction ​

json
{
  "id": "dfc68868-d388-4d83-a173-d44e47a8bec7",
  "model": "seedream-5-0-pro",
  "status": "succeeded",
  "canvas": {
    "width": 2048,
    "height": 2048
  },
  "assets": [
    {
      "role": "image_0",
      "url": "https://private.example.com/signed-result",
      "mime": "image/jpeg",
      "width": 2048,
      "height": 2048,
      "layer": {
        "kind": "base",
        "z_index": 0
      }
    },
    {
      "role": "image_1",
      "url": "https://private.example.com/signed-layer",
      "mime": "image/png",
      "width": 1024,
      "height": 1024,
      "layer": {
        "kind": "layer",
        "z_index": 1,
        "name": "Subject",
        "bounding_box": {
          "absolute": [512, 512, 1536, 1536],
          "normalized": [0.25, 0.25, 0.75, 0.75]
        }
      }
    }
  ]
}
FieldMeaning
assets[].roleimage_0 is the base or first image; image_1–image_16 are ordered layers
assets[].urlPrivate signed link; query the task again for a fresh one
assets[].mimeMeasured type of the delivered file
assets[].width / heightMeasured pixel size
canvas.width / heightMeasured size of the base image, present for decomposed results

To rebuild a decomposed result:

  1. Sort assets by the numeric index in role — image_2 comes before image_10, which a plain string sort gets wrong.
  2. Start with canvas.width × canvas.height as the output size.
  3. Stack layers in ascending layer.z_index.
  4. Place each layer at layer.bounding_box.absolute = [x1, y1, x2, y2] in canvas pixels. normalized uses 0–1 coordinates of the same box, not a second image size.
  5. Never assume a layer raster fills the canvas — use the returned box, and treat layer.name and layer.description as plain text.

Download only the roles the task actually returned, and use the real mime, width and height instead of guessing from a file extension. Assets become readable only after the whole result is delivered: a partial list is never a partial success. Every GET /v1/tasks/{id} returns a working private link, so refresh it instead of storing signed URLs.

8. Pricing, idempotency and errors ​

Billing is per delivered image at the published price for the model, size tier and options. Reference-image and layer-decomposition figures are indicative prices for planning, not a fixed task charge, and they are not multiplied by the number of output files. Failed, timed-out or rejected generations are not charged to the customer.

Send Idempotency-Key on create. Retrying the same request with the same key returns the original task; the same key with different parameters or different input identity returns 409 and must not be treated as a new task.

HTTPerror.codeTypical cause
400IMAGE_REQUEST_INVALIDInvalid or unsupported field; the message names the field and the limit
400IMAGE_ASSET_INVALIDReference image format, dimensions, size or transparency rejected
401 / 404IMAGE_TASK_NOT_FOUNDKey disabled, wrong Workspace, or task not visible to it
409IMAGE_IDEMPOTENCY_CONFLICTSame Idempotency-Key used for a different request
409IMAGE_PRICE_CHANGEDOptions or price changed; retry the original request with the same key
413IMAGE_REQUEST_TOO_LARGEBody above 64 MiB, or inline images above 45 MiB decoded
429IMAGE_RATE_LIMITEDRequest rate or concurrency limit reached
429IMAGE_AMOUNT_BUDGET_EXCEEDEDWorkspace, member or key usage limit reached
503IMAGE_SERVICE_UNAVAILABLEConfiguration unavailable for this model

Messages are written for the field you got wrong, for example size must be auto, a supported aspect ratio, a supported resolution tier, or valid WxH pixels or background=transparent requires output_format=png. When the task itself fails, read error.code — including TASK_TIMEOUT — instead of retrying blindly.

Next steps ​

Access leading AI models through one unified API