Submit async image task
Submit an async image task and receive its id immediately. Poll GET /v1/images/async/{taskId} until a terminal status; processing time depends on the model and route.
The request body is multipart/form-data. Upload reference images with image or image[], or send URLs with image_urls or image_urls[].
URL fields accept one URL, a JSON URL array encoded as text, or repeated fields. Decomposition requires one reference through exactly one entry point. Omit references for regular text-to-image generation.
The estimated amount is frozen on submission and settled on actual usage at status=succeeded; failures, rejections, and errors release the frozen amount.
For successful decomposition, result.data contains the base image and layer metadata. When archiving outputs, the platform may replace inline b64_json with url while preserving layer fields such as z_index, name, description, and bounding_box.
Seedream 5.0 Pro / Flash layer decomposition
Select a Seedream 5.0 Pro / Flash model that supports layers, and send layer_decomposition: true with exactly one input image.
Layer decomposition accepts only PNG or JPEG input images, including uploaded files and Base64 data URIs.
Omit prompt to identify the main elements automatically, or specify which elements to separate. Regular image generation still requires prompt.
Layer decomposition accepts size values auto (default), 1K, 1.5K, and 2K; provide one input image and keep n at 1.
The response contains one base image and up to 16 PNG layers with alpha channels. output_format controls only the base image; layers always use PNG.
The data entries preserve z_index, name, description, and bounding_box. The base image has z_index=0; higher indices are placed above lower ones.
bounding_box.absolute uses pixels in the output base image. normalized uses a 0–1000 scale. Both contain [left, top, right, bottom].
To reconstruct the image, resize each layer to its bounding box, place it at the upper-left corner, and stack layers in ascending z_index order. Layer files can have different dimensions from the base image.
The base image and each successful output layer are billed separately by actual output resolution; n=1 does not limit billing to one image.
This differs from sequential_image_generation batch generation, which 5.0 Pro does not support.
Seedream 5.0 Pro billing
Regular generation and layer decomposition are billed by actual output resolution. Each successful image is classified by its actual width × height: up to and including 2,610,000 pixels is the lower tier, and larger images use the higher tier.
The base image counts as one output. Charge the base image and each successful layer separately by its own actual pixel tier; one request can contain both tiers. n=1 means one decomposition request, not a one-image charge.
Only successful outputs are billed. Failed requests incur no charge and release the frozen amount.
Pro's first reference image is free; references from the second onward are billed as input images. Reference fees per request are max(reference count − 1, 0) × your effective input rate, charged once and not multiplied by the output count. Output images are billed separately. Decomposition requires exactly one reference, so no input-image charge applies.
Applicable account discounts affect both input and output rates. See the model pricing list on your current site for rates and applicable discounts.
The request examples below use the China endpoint. For International calls, use the corresponding endpoint and model ID.
curl https://api.xrtoken.net/v1/images/async \
-H "Authorization: Bearer $XRTOKEN_API_KEY" \
-F "model=volcengine/doubao-seedream-5.0-pro" \
-F "[email protected]" \
-F "layer_decomposition=true" \
-F "size=auto" \
-F "response_format=url"You can also use an uploaded image URL. A decomposition URL array must still contain one URL only:
curl https://api.xrtoken.net/v1/images/async \
-H "Authorization: Bearer $XRTOKEN_API_KEY" \
-F "model=volcengine/doubao-seedream-5.0-pro" \
-F 'image_urls=["https://example.com/source.png"]' \
-F "layer_decomposition=true" \
-F "size=auto"Authorization
BearerAuth API key authentication (OpenAI format). Pass in the Authorization header:
Authorization: Bearer tr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In: header
Request Body
multipart/form-data
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X post "https://api.xrtoken.ai/v1/images/async" \ -F model="volcengine/doubao-seedream-5.0-pro" \ -F layer_decomposition="true"{
"id": "4efa6a93-c0c8-4418-b11f-60152b3ce130",
"request_id": "tr-req-2ee8d1734e29472c9c7a15c7bd07bc76",
"status": "queued",
"model": "string",
"created_at": 0
}{
"error": "model field is required",
"type": "invalid_request_error"
}{
"error": "invalid or missing API key",
"type": "auth_error"
}{
"error": "insufficient balance -- please top up or upgrade your plan",
"type": "billing_error"
}{
"error": "rate limit exceeded",
"type": "rate_limit_error"
}