Seedream 5.0 Lite
ByteDance | 2K / 3K / 4K | 1–15 images per task | reference editing | batch generation
Seedream 5.0 Lite generates images from text plus optional references, and can return several images from a single task. 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
- Create a Workspace model-routing API key in the Tokenlio console.
- Copy the API model ID published for your Workspace from the model catalog. The examples use
seedream-5-0-lite. - 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
| Model | Size tiers | Images per task | Extra output controls |
|---|---|---|---|
| Seedream 5.0 Lite | 2k / 3k / 4k | 1–15 in one task | batch generation via n |
| Seedream 5.0 Flash | 1k / 1.5k / 2k | exactly 1 | transparent PNG, layer decomposition |
| Seedream 5.0 Pro | 1k / 1.5k / 2k | exactly 1 | transparent PNG, layer decomposition |
Lite is the model to use when you need several variations of one prompt, or when you want 3K/4K output. It accepts n from 1 to 15 and returns that many files in one task. In exchange it does not accept background, layer_decomposition or optimize_prompt_options, and its size rules differ from Flash and Pro.
size and n follow Lite's own rules
Lite defaults to size: 1:1 with resolution: 2k. Only aspect ratios, auto and the 2k / 3k / 4k tiers are accepted — exact WxH pixels are not. image_urls count plus n must not exceed 15.
Model names describe capabilities, not access. All values below are placeholders only for the parts you must replace.
2. Quick start: create, poll, download
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-lite-001' \
--data '{"model":"seedream-5-0-lite","prompt":"A serene mountain lake at sunrise, soft mist over the water","size":"1:1","resolution":"2k","n":1}'{
"model": "seedream-5-0-lite",
"prompt": "A serene mountain lake at sunrise, soft mist over the water",
"size": "1:1",
"resolution": "2k",
"n": 1
}import json, os, urllib.request
body = {
"model": "seedream-5-0-lite",
"prompt": "A serene mountain lake at sunrise, soft mist over the water",
"size": "1:1",
"resolution": "2k",
"n": 1,
}
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-lite-001",
},
)
print(json.load(urllib.request.urlopen(request)))A 202 means the task was accepted, not that images exist:
{
"id": "dfc68868-d388-4d83-a173-d44e47a8bec7",
"model": "seedream-5-0-lite",
"status": "queued",
"assets": []
}Then poll and download:
curl "https://api.tokenlio.ai/v1/tasks/dfc68868-d388-4d83-a173-d44e47a8bec7" \
-H "Authorization: Bearer $TOKENLIO_API_KEY"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.jpegstatus moves queued → processing → succeeded or failed. Poll every 5–15 seconds; the default image timeout is 10 minutes, and a multi-image task naturally takes longer than a single one. 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
| Parameter | Type | Default | Contract |
|---|---|---|---|
model | string | required | Exact published API model ID |
prompt | string | required | Non-empty UTF-8 text |
n | integer | 1 | 1–15; also bounded by the reference count |
size | string | 1:1 | auto, a ratio, or nothing else — exact pixels and tiers go in resolution |
resolution | string | 2k | 2k / 3k / 4k |
output_format | string | jpeg | jpeg or png |
image_urls | string[] | empty | Public HTTPS URLs or complete Base64 Data URIs; input order is significant |
watermark | boolean | omitted | Send explicitly to control watermarking |
nsfw_check | boolean | omitted | Send explicitly to control content checking |
sequential_image_generation | string | disabled, or auto when n > 1 | auto or disabled |
sequential_image_generation_options | object | omitted | {"max_images": 1..15}; requires sequential_image_generation: "auto" |
Use real JSON booleans and integers — not strings, and not null. Unknown fields, duplicate keys, null values and trailing data are rejected.
Not accepted by this model
background, layer_decomposition and optimize_prompt_options are Flash/Pro controls and are rejected here. quality, mask_url, output_compression, moderation, aspect_ratio and response_format are not part of this integration either. There is no data[].b64_json response and no multipart /v1/images/edits; references go in image_urls.
4. Size, resolution and output count
size | resolution | Actual output |
|---|---|---|
1:1 (default) | 2k (default) | Square image at the 2K tier |
A ratio such as 16:9 | 2k / 3k / 4k | That ratio at the chosen tier |
auto | 2k / 3k / 4k | Follows the reference image; requires at least one reference |
- Supported ratios:
1:1,4:3,3:4,16:9,9:16,3:2,2:3,2:1,1:2,21:9. resolutionmust be2k,3kor4k.1kand1.5kbelong to Flash and Pro.- Exact
WxHpixels are rejected; use a ratio plus a tier instead. size: autowithout a reference image is rejected, because there is nothing to follow.
Batch generation
n requests between 1 and 15 images in one task, and image_urls.length + n must not exceed 15. Both n and the reference count therefore shrink each other:
| References | Maximum n |
|---|---|
| 0 | 15 |
| 5 | 10 |
| 10 | 5 |
| 14 | 1 |
sequential_image_generation defaults to disabled when n is 1 and to auto when n is above 1. If you send sequential_image_generation_options.max_images, it must equal n, and sequential_image_generation must be auto; sending disabled with n > 1 is rejected.
{
"model": "seedream-5-0-lite",
"prompt": "Four poster layouts for a mountain travel campaign, same palette",
"size": "3:4",
"resolution": "3k",
"n": 4
}{
"model": "seedream-5-0-lite",
"prompt": "Keep the product and vary the background three ways",
"size": "auto",
"resolution": "2k",
"image_urls": ["https://YOUR_PUBLIC_CDN/product.png"],
"n": 3
}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.
| Limit | Lite |
|---|---|
| Reference images per request | bounded by image_urls.length + n ≤ 15 |
| Bytes per reference file | ≤ 10 MiB |
| Decoded inline images, total | ≤ 45 MiB |
| Whole JSON request body | ≤ 64 MiB |
| Pixels per side | more than 14 px, at most 24,000 px |
| Total pixels per image | ≤ 36 megapixels |
| Aspect ratio | between 1:3 and 3:1 |
| Accepted formats | PNG, JPEG |
Every reference must be a single, fully decodable static image. Lite accepts only PNG and JPEG — WebP, GIF, BMP and TIFF belong to Flash and Pro, and HEIC/HEIF are not supported at all, so 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.
import base64, json
from pathlib import Path
data = Path("reference.png").read_bytes()
request = {
"model": "seedream-5-0-lite",
"prompt": "Keep the subject and change the lighting to a soft window light",
"size": "auto",
"resolution": "2k",
"n": 2,
"image_urls": ["data:image/png;base64," + base64.b64encode(data).decode("ascii")],
}
Path("request.json").write_text(json.dumps(request), encoding="utf-8")curl "https://api.tokenlio.ai/v1/images/generations" \
-H "Authorization: Bearer $TOKENLIO_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: seedream-lite-reference-001' \
--data-binary @request.json{
"model": "seedream-5-0-lite",
"prompt": "Place the same chair beside a large window, keep its material",
"size": "4:3",
"resolution": "2k",
"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. Watermark and content check
Send watermark or nsfw_check explicitly when you need a specific value — leaving them out means the platform does not set them. Both are ordinary booleans, for example "watermark": false.
7. Results and roles
{
"id": "dfc68868-d388-4d83-a173-d44e47a8bec7",
"model": "seedream-5-0-lite",
"status": "succeeded",
"assets": [
{
"role": "image_0",
"url": "https://private.example.com/signed-result-0",
"mime": "image/jpeg",
"width": 2048,
"height": 2048
},
{
"role": "image_1",
"url": "https://private.example.com/signed-result-1",
"mime": "image/jpeg",
"width": 2048,
"height": 2048
}
]
}| Field | Meaning |
|---|---|
assets[].role | image_0, image_1, … in requested order |
assets[].url | Private signed link; query the task again for a fresh one |
assets[].mime | Measured type of the delivered file |
assets[].width / height | Measured pixel size |
Sort by the numeric index in role, not as plain strings (image_2 before image_10), and use the real mime, width and height instead of guessing from a file extension. Download only the roles the task actually returned. Assets become readable only after the whole result is delivered: a partial list is never a partial success. Every GET /v1/tasks/{id} returns working private links, so refresh them instead of storing signed URLs.
Lite results contain one file per requested image and no layers, so there is no canvas and no layer object.
8. Pricing, idempotency and errors
Billing is per delivered image at the published price for the model and size tier. A task requesting n: 4 is billed for the images it actually delivers, at the same per-image price — not as a fixed task price. 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. A n change is a different request, so it needs a new key.
| HTTP | error.code | Typical cause |
|---|---|---|
| 400 | IMAGE_REQUEST_INVALID | Invalid or unsupported field; the message names the field and the limit |
| 400 | IMAGE_ASSET_INVALID | Reference image format, dimensions, size or transparency rejected |
| 401 / 404 | IMAGE_TASK_NOT_FOUND | Key disabled, wrong Workspace, or task not visible to it |
| 409 | IMAGE_IDEMPOTENCY_CONFLICT | Same Idempotency-Key used for a different request |
| 409 | IMAGE_PRICE_CHANGED | Options or price changed; retry the original request with the same key |
| 413 | IMAGE_REQUEST_TOO_LARGE | Body above 64 MiB, or inline images above 45 MiB decoded |
| 429 | IMAGE_RATE_LIMITED | Request rate or concurrency limit reached |
| 429 | IMAGE_AMOUNT_BUDGET_EXCEEDED | Workspace, member or key usage limit reached |
| 503 | IMAGE_SERVICE_UNAVAILABLE | Configuration unavailable for this model |
Messages are written for the field you got wrong, for example the number of image_urls plus n must not exceed 15, resolution must be 2k, 3k or 4k for this model or background is not supported for this model. When the task itself fails, read error.code — including TASK_TIMEOUT — instead of retrying blindly.
