Skip to main content
POST
cURL
Dùng POST /v1/images/generations với async: true để gửi một tác vụ hình ảnh Seedream mà không cần giữ kết nối HTTP mở. Quy trình bất đồng bộ này áp dụng cho các ID model sau: Để biết khả dụng theo tài khoản, hãy xem trang Models hoặc truy vấn /v1/models. Để biết chi tiết về tham số của nhà cung cấp, hãy xem BytePlus API tạo hình ảnhhướng dẫn Seedream 4.0-5.0.

Gửi tác vụ

Gửi model, promptasync: true. Ví dụ cũng yêu cầu phản hồi URL 2K với watermark: false. Khả năng hỗ trợ kích thước khác nhau tùy theo ID model, vì vậy hãy dùng kích thước được model đã chọn hỗ trợ. Phản hồi tạo trả về data.task_id, data.status và một mảng data.data trống trong khi tác vụ đang chờ. Lưu data.task_id; không dùng mã phản hồi cấp cao nhất làm mã định danh tác vụ.

Thăm dò tác vụ

Truyền ID tác vụ đã lưu vào Truy xuất một tác vụ hình ảnh Seedream. Tiếp tục thăm dò khi data.statuspending. Dừng khi giá trị này trở thành success hoặc failure.

Đọc URL hình ảnh

Khi tác vụ thành công, hãy đọc data.data[0].url từ JSON đã phân tích cú pháp. Trong shell, jq -r '.data.data[0].url' giữ nguyên các ký tự đặc biệt trong URL hoàn chỉnh.Tải xuống hoặc chuyển hình ảnh ngay. URL là tạm thời; tài liệu này không giả định thời hạn cố định.

Ủy quyền

Authorization
string
header
bắt buộc

Bearer token authentication. Use your CometAPI key.

Nội dung

application/json
model
string
bắt buộc

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.

Ví dụ:

"doubao-seedream-5-0-260128"

prompt
string
bắt buộc

Text prompt describing the image to generate.

Ví dụ:

"A clean studio photograph of a small red ceramic teapot on a pale blue table, soft window light, no text."

async
boolean
bắt buộc

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.

Ví dụ:

"2K"

response_format
string

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

Ví dụ:

"url"

watermark
boolean

Whether to request a visible watermark on the generated image.

Ví dụ:

false

Phản hồi

200 - application/json

Seedream asynchronous task submission response.

code
string
bắt buộc

Request status code. A successful submission returns success.

Ví dụ:

"success"

message
string
bắt buộc

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

data
object
bắt buộc
Lần sửa đổi cuối 31 tháng 7, 2026