跳轉到主要內容
POST
cURL
使用 POST /v1/images/generations 與 async: true 提交 Seedream 圖片任務,而無需保持 HTTP 連線開啟。 此非同步工作流程適用於以下模型 ID: 如需瞭解帳戶可用性,請參閱 模型頁面 或查詢 /v1/models。如需供應商參數詳細資料,請參閱 BytePlus 圖片生成 API 以及 Seedream 4.0-5.0 教學課程.

提交任務

傳送 model、prompt 和 async: true。此範例也會透過 2K 請求 watermark: false URL 回應。大小支援會因模型 ID 而異,因此請使用所選模型支援的大小。 建立回應會在任務處於待處理狀態時傳回 data.task_id、data.status,以及空的 data.data 陣列。儲存 data.task_id;請勿將頂層回應代碼當作任務識別碼。

輪詢任務

將儲存的任務 ID 傳遞給 擷取 Seedream 圖片任務。當 data.status 為 pending 時持續輪詢。當其變為 success 或 failure 時停止。

讀取圖片 URL

任務成功時,從已剖析的 JSON 讀取 data.data[0].url。在 shell 中,jq -r '.data.data[0].url' 會保留完整 URL 中的特殊字元。請立即下載或轉移圖片。URL 為暫時性;本文檔不假設其具有固定有效期限。

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

主體

application/json
model
string
必填

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"

prompt
string
必填

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."

async
boolean
必填

Asynchronous task mode. Set this to true, store data.task_id, and poll the task endpoint.

size
string

Requested output size. Use a value supported by the selected model.

範例:

"2K"

response_format
string

Response workflow for this async request. The example uses url and retrieves the URL from the completed task.

範例:

"url"

watermark
boolean

Whether to request a visible watermark on the generated image.

範例:

false

回應

200 - application/json

Seedream asynchronous task submission response.

code
string
必填

Request status code. A successful submission returns success.

範例:

"success"

message
string
必填

Status message. A successful submission can return an empty string.

data
object
必填
最後修改於 2026年7月31日