How to Build an Image Generation and Editing Workflow with the Seedream Images API

If your product needs image generation, image-to-image editing, and reliable job handling, the hard part is not writing one prompt—it is designing a workflow that survives long-running requests, model differences, and output formats.
What you can do
The Seedream Images API gives you one main endpoint, POST /seedream/images, for several practical image workflows. According to the public integration guide, you can send a text prompt for image generation, provide an image URL or Base64 input for editing, request a specific size, choose a supported model, and decide whether the response should return an image url or b64_json.
For builder workflows, the useful part is that the same endpoint also covers more advanced patterns: asynchronous jobs with async, callbacks with callback_url, streaming output with stream, and Seedream 5.0 Pro layer decomposition with layer_decomposition.
How it works
A basic request is a JSON payload sent to https://api.acedata.cloud/seedream/images. The required headers are simple: accept: application/json, authorization: Bearer YOUR_API_KEY, and content-type: application/json. For basic generation, the guide shows an action field set to generate, plus a full model string and a prompt.
One detail worth baking into your integration early: model names must be passed as the full model string. For example, doubao-seedream-5-0-lite-260128 is valid, while an abbreviated form such as doubao-seedream-5.0-lite returns a 400. Treat the model value as an exact API contract, not a display label.
Start with a minimal generation request
Here is the smallest useful curl request from the integration pattern. It uses Seedream 5.0 Lite, the default current model described in the guide, and asks for a single clean studio object:
curl -X POST 'https://api.acedata.cloud/seedream/images' \
-H 'accept: application/json' \
-H 'authorization: Bearer YOUR_API_KEY' \
-H 'content-type: application/json' \
-d '{
"action": "generate",
"model": "doubao-seedream-5-0-lite-260128",
"prompt": "A single matte blue cube centered on a clean white studio background, neutral lighting"
}'
A successful response includes success, task_id, trace_id, and a data array. Each generated image item contains fields such as prompt, size, and image_url. In a real app, store both task_id and trace_id; the former helps associate the work item, while the latter is useful when debugging failures.
Choose the model and size deliberately
The guide lists several supported models: doubao-seedream-5-0-pro-260628, doubao-seedream-5-0-lite-260128, doubao-seedream-4-5-251128, and doubao-seedream-4-0-250828. The right choice depends on the workflow.
doubao-seedream-5-0-pro-260628is described as a flagship single-image model. It does not support image groups viasequential_image_generation, streaming viastream, or web search viatools.doubao-seedream-5-0-lite-260128,doubao-seedream-4-5-251128, anddoubao-seedream-4-0-250828supportsequential_image_generation, with the default set todisabled.response_formatdefaults tourl, withb64_jsonalso supported.watermarkdefaults totrue;output_formatsupportsjpegby default andpngfor Seedream 5.0 Pro and 5.0 Lite.
Size can be specified in two ways: preset resolution labels such as 1K, 2K, 3K, or 4K, depending on the model; or explicit width-by-height values such as 2048x2048. The defaults and valid pixel ranges vary by model, so it is safer to validate these values per model in your application rather than exposing one global dropdown.
Add image editing when you have a source image
For editing, pass an image field containing one or more image URLs or Base64 inputs, and describe the transformation in prompt. The public guide shows a Python request using doubao-seedream-4-0-250828, size: 2K, and watermark: False:
import requests
url = "https://api.acedata.cloud/seedream/images"
headers = {
"accept": "application/json",
"authorization": "Bearer YOUR_API_KEY",
"content-type": "application/json"
}
payload = {
"model": "doubao-seedream-4-0-250828",
"prompt": "Keep the model pose and the liquid garment flowing shape unchanged. Change the clothing material from silver metal to completely transparent water (or glass). Through the liquid flow, the details of the model skin are visible. The light and shadow effect shifts from reflection to refraction.",
"image": ["https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imageToimage.png"],
"size": "2K",
"watermark": false
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
This is the pattern I would use for product-image iteration, visual QA tooling, or internal creative review systems: keep the source image stable, make the edit instruction explicit, and save the returned image_url next to the original asset.
Handle long-running work with async, callbacks, or streaming
The guide notes that image generation may take around one to two minutes. If you do not want to keep an HTTP connection open, use callback_url so the result is POSTed back to your service with the matching task_id. If you do not have a public callback endpoint, set async to true and poll /seedream/tasks with the returned task_id.
For interactive interfaces, streaming is another option on Lite and 4.x models. When stream: true, set accept: application/x-ndjson. The API returns line-by-line events such as image_generation.partial_succeeded or image_generation.partial_failed, then a single final image_generation.completed event with final usage. Streaming cannot be combined with async or callback_url.
Use layer decomposition for editable assets
Seedream 5.0 Pro also supports layer_decomposition. In that mode, the API can split an input PNG or JPEG into one base image and up to 16 transparent PNG layers. You can omit prompt for automatic decomposition, or specify elements in natural language and normalized <bbox> coordinates. Returned layers include z_index, name, description, and bounding_box.absolute / bounding_box.normalized. To recompose, stack layers in ascending z_index, placing each layer by its absolute bounding box.
Practical error handling
Build your client around the documented error shape:
{
"success": false,
"error": {
"code": "api_error",
"message": "fetch failed"
},
"trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}
The guide lists common responses including 400 token_mismatched, 400 api_not_implemented, 401 invalid_token, 429 too_many_requests, and 500 api_error. In practice, log trace_id, show a retryable message for 429 and 500, and surface parameter validation clearly for 400.
The useful mental model is simple: use /seedream/images for generation, editing, streaming, callbacks, and decomposition; use task_id to connect long-running work back to your app; and keep model-specific constraints close to your UI. For the complete parameter reference, read the Seedream Images API integration guide.
Comments
Post a Comment