创建 Seedream 图像任务
通过 CometAPI 提交异步 Seedream 图像任务,并保存返回的任务 ID 以供轮询。
POST /v1/images/generations 和 async: true 提交 Seedream 图像任务,无需保持 HTTP 连接打开。
此异步工作流适用于以下模型 ID:
/v1/models。有关提供商参数的详细信息,请参阅 BytePlus 图像生成 API 以及 Seedream 4.0-5.0 教程.
提交任务
发送model、prompt 和 async: true。示例还请求 2K URL 响应,并指定 watermark: false。不同模型 ID 支持的尺寸各不相同,因此请使用所选模型支持的尺寸。
创建响应会返回 data.task_id、data.status 以及空的 data.data 数组,此时任务处于待处理状态。请保存 data.task_id;不要将顶级响应代码用作任务标识符。
轮询任务
将存储的任务 ID 传递给 检索 Seedream 图像任务。当data.status 为 pending 时,继续轮询。当其变为 success 或 failure 时停止。
读取图像 URL
授权
Bearer token authentication. Use your CometAPI key.
请求体
Seedream model ID. This async workflow is documented for doubao-seedream-4-0-250828, doubao-seedream-4-5-251128, doubao-seedream-5-0-260128, and seedream-5-0-pro-260628. Query /v1/models or open the Models page for account availability.
"doubao-seedream-5-0-260128"
Text prompt describing the image to generate.
"A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text."
Asynchronous task mode. Set this to true, store data.task_id, and poll the task endpoint.
Requested output size. Use a value supported by the selected model.
"2K"
Response workflow for this async request. The example uses url and retrieves the URL from the completed task.
"url"
Whether to request a visible watermark on the generated image.
false