Skip to main content
POST
使用 CometAPI 相容於 OpenAI 的 POST /v1/images/generations 路由來執行 Seedream 圖像生成。當所選 model 支援這些控制項時,此端點支援文字轉圖像 Prompt、參考圖像請求,以及具上限的序列式圖像輸出。 本頁涵蓋用於 Pro 文字轉圖像請求的 seedream-5-0-pro-260628,以及用於 Seedream 5.0 參考圖像、序列式與非同步範例的 seedream-5-0-260128。如需確認帳戶可用性,請參閱模型頁面或查詢 /v1/models。如需 provider 參數詳細資訊,請參閱 BytePlus 的圖像生成 APISeedream 4.0-5.0 教學

選擇請求形式

  • 文字轉圖像:傳送 modelpromptsize,以及可選的輸出控制項,例如 response_formatoutput_formatwatermark
  • 圖像轉圖像:加入 image,其值為公開 HTTPS URL 或 data URI 的陣列。即使只傳送一張參考圖像,也請使用陣列。
  • 序列式 Prompt:將 sequential_image_generation 設為 auto,並使用 sequential_image_generation_options.max_images 作為上限。模型回傳的圖像數量可能少於最大值。
  • 非同步任務:當你希望建立請求回傳 data.task_id 而不是持續保持 HTTP 連線開啟時,加入 async: true
參考圖像與生成圖像的總數必須維持在 provider 限制內。請使用 max_images 為序列式請求設定上限。

執行非同步圖像任務

async 設為 true,用於你的用戶端應提交並輪詢的圖像工作。建立請求會回傳 data.task_id;請將此值搭配擷取 Seedream 圖像任務使用,直到 data.status 變為 successfailure 在非同步範例中,對 Seedream 5.0 請求使用 2K。支援的尺寸會依 model ID 而異,因此在提交非同步任務前,請先選擇該 model 支援的尺寸。

傳送參考圖像

對於內嵌圖像資料,請使用 data:image/png;base64,YOUR_BASE64_IMAGE,或使用 provider 可擷取的公開 HTTPS URL。API 參考範例展示了每種請求類型的完整 JSON 結構。

讀取輸出 URL

回傳的 url 是帶簽章的物件儲存連結,可能包含 &% 與其他特殊字元。請從已解析的 JSON 中擷取 URL,而不是複製終端機中的部分內容。在 shell 範例中,jq -r '.data[]?.url' 會保留完整的已簽章 URL。

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

主體

application/json

Parameters for Seedream image generation. Send JSON for text-to-image, image-to-image, and sequential prompt requests.

model
string
預設值:seedream-5-0-pro-260628
必填

Seedream model ID to use. Query /v1/models or open the Models page for available model IDs.

prompt
string
預設值:A clean product-style render of a blue ceramic mug on a white table, soft studio lighting.
必填

Text prompt describing the image or edit goal. Use a concrete visual request, such as a blue ceramic mug on a white table, soft studio lighting.

response_format
enum<string>
預設值:url

Response image format. Use url for a temporary signed image URL, or b64_json when you need base64 image data in the response.

可用選項:
url,
b64_json
size
string
預設值:2K

Output resolution. Use a model-supported tier such as 2K or a model-supported WIDTHxHEIGHT value such as 2048x2048. Not every model ID accepts every tier.

image
string[]

Optional reference images for image-to-image generation. Each item can be a public HTTPS URL or a data URI such as data:image/png;base64,YOUR_BASE64_IMAGE. Use an array even for one image. Reference images plus generated images must not exceed the provider limit.

watermark
boolean
預設值:false

When true, requests a visible AI-generated watermark on the output image. Set false when your workflow handles disclosure separately.

async
boolean
預設值:false

CometAPI asynchronous task mode. Set this to true to return immediately with data.task_id, then poll the Seedream image task endpoint GET /v1/images/generations/{task_id} for the final image data.

output_format
enum<string>
預設值:png

Output image file format. Use png when you need lossless output, or jpeg for smaller files.

可用選項:
png,
jpeg
guidance_scale
number

Optional prompt-adherence control for model versions that support it. Higher values can follow the prompt more closely but may reduce naturalness. Omit this field when you do not need model-specific tuning.

必填範圍: 1 <= x <= 10
seed
integer
預設值:-1

Optional random seed for reproducible attempts on model versions that support seeding. Use -1 or omit the field for a random seed.

必填範圍: -1 <= x <= 2147483647
sequential_image_generation
enum<string>
預設值:disabled

Controls sequential prompt handling. Use auto to let the model return a sequence when the prompt calls for one. Use disabled for ordinary single-image requests.

可用選項:
auto,
disabled
sequential_image_generation_options
object

Options for sequential prompt handling. This object is only used when sequential_image_generation is auto.

回應

200 - application/json

Image generation response. Synchronous requests return completed image data. Async requests return a task response with data.task_id.

created
integer
必填

Unix timestamp in seconds when the image response was created.

data
object[]
必填

Generated image results. The array can contain one or more images depending on the request and model response.

usage
object

Usage information for the request. Fields vary by model and route.