Skip to Content
模型用法Seedream(豆包)

Seedream(豆包)系列

字節跳動的豆包圖像模型,共三款,透過 OpenAI 相容介面 /v1/images/generations 呼叫,文生圖與改圖皆使用此端點。

模型選擇

重點5.0 Pro 每次生成一張,支援 1K 至 2K;組圖與 4K 由 5.0 Lite、4.5 提供。
Seedream 5.0 Pro旗艦
  • 支援 1K 尺寸
  • 不支援組圖與 4k 預設檔位
doubao-seedream-5.0-pro
Seedream 5.0 Lite
  • 支援組圖與 4K
  • 最低 2K
doubao-seedream-5.0-lite
Seedream 4.5上一代
  • 支援組圖與 n 多張
  • 最低 2K
doubao-seedream-4.5
模型 ID(呼叫時原樣複製)
5.0 Provolcengine/doubao-seedream-5.0-pro旗艦,支援 1K

即時價格請參閱模型頁 。

文生圖

seedream.py
import base64 from openai import OpenAI client = OpenAI(api_key="YOUR_OFOX_API_KEY", base_url="https://api.ofox.io/v1", timeout=600) resp = client.images.generate( model="volcengine/doubao-seedream-5.0-pro", prompt="白色桌面上的一顆紅蘋果", size="2560x1440", ) with open("output.jpg", "wb") as f: f.write(base64.b64decode(resp.data[0].b64_json))

輸出格式固定為 JPEG,儲存時請使用 .jpg 副檔名。預設回傳 base64;傳入 "response_format": "url" 可改為回傳圖片連結。

尺寸(size)

重點4.5 與 5.0 Lite 最低為 2K(3,686,400 像素),1k 與 1024×1024 都會被拒絕。

size 支援兩種寫法:

  • 解析度檔位 1k、2k、4k(不區分大小寫):僅指定解析度,比例由模型依提示詞決定。實測 4.5 傳入 2k 時,輸出既有 2048×2048,也有 1664×2496。
  • 精確寬高 寬x高:比例固定,須符合下表的像素範圍。
5.0 Pro5.0 Lite4.5
最少像素921,600(如 1280×720)3,686,400(如 2560×1440)3,686,400
最多像素——16,777,216(4096×4096)
1k支援,實測 1152×864不支援不支援
2k支援支援支援
4k不支援支援,實測 4096×4096支援
不傳 size實測 2368×1776——

「—」表示本次未實測,請以火山方舟官方文件 為準。

常用的合法寬高(符合 4.5 與 5.0 Lite 的最低像素):

比例寬高
1:12048x2048
16:92560x1440
9:161440x2560
4:32304x1728
3:41728x2304

改圖與多圖參考

重點參考圖使用 image 欄位,而非 input_images;不支援 /v1/images/edits。
seedream_edit.py
import base64 from openai import OpenAI client = OpenAI(api_key="YOUR_OFOX_API_KEY", base_url="https://api.ofox.io/v1", timeout=600) with open("apple.jpg", "rb") as f: ref = "data:image/jpeg;base64," + base64.b64encode(f.read()).decode() resp = client.images.generate( model="volcengine/doubao-seedream-5.0-pro", prompt="把蘋果改成紫色,其他保持不變", size="2k", extra_body={"image": [ref]}, ) with open("apple_purple.jpg", "wb") as f: f.write(base64.b64decode(resp.data[0].b64_json))
  • image 為陣列,每項為圖片 URL 或以 data:image/...;base64, 開頭的字串。多張參考圖依序放入陣列,並在提示詞中說明每張圖片的用途。
  • input_images 為 Qwen-Image 專用欄位,Seedream 不支援。
  • Seedream 不支援 /v1/images/edits,改圖請使用本節的 image 欄位。

組圖與多張

重點5.0 Lite 與 4.5 支援單次回傳多張;5.0 Pro 每次請求僅生成一張。
寫法5.0 Pro5.0 Lite4.5
n: 2回傳 400—實測回傳 2 張
sequential_image_generation: "auto"回傳 400實測回傳 3 張實測只回傳 1 張

組圖範例:

{ "model": "volcengine/doubao-seedream-5.0-lite", "prompt": "生成 3 張獨立的圖:同一隻狐狸分別在春天、夏天、秋天", "size": "2k", "sequential_image_generation": "auto", "sequential_image_generation_options": { "max_images": 3 } }
  • auto 表示由模型決定生成張數,max_images 僅為上限。實測相同請求下,4.5 將三格漫畫合成在一張圖中,只回傳 1 張。如需固定張數,請在提示詞中明確寫出「生成 N 張獨立的圖片」。
  • 每張圖片單獨計費,usage.output_tokens 為所有圖片的合計。

浮水印

實測透過 OfoxAI 呼叫時預設不帶浮水印,無需額外傳參。

耗時

實測 2K 約 12 至 40 秒,3 張組圖約 76 秒。用戶端逾時建議設定為 300 秒以上。

常見錯誤

重點尺寸相關錯誤最為常見,請先查看錯誤訊息中的像素數。
錯誤原文(節錄)原因處理方式
image size must be at least 3686400 pixels4.5 或 5.0 Lite 的尺寸低於 2K改為 2k 或 2560x1440 等,見尺寸
image area must be at least 921600 pixels5.0 Pro 的尺寸低於 1280×720加大尺寸
image size must be at most 16777216 pixels超過 4096×4096縮小尺寸
the specified size is not supported for model doubao-seedream-4-54.5 傳入了 1k改為 2k 或 4k
must be 'WIDTHxHEIGHT' or a supported size preset5.0 Pro 傳入了 4k改為 2k 或精確寬高
size must be one of 'WIDTHxHEIGHT', '1k', '2k', or '4k'傳入了 8K、2048 等無效值依上述四種格式填寫
the parameter sequential_image_generation is not supported by the current model5.0 Pro 傳入了 n 或組圖參數刪除 n;需要多張時請並行發出多次請求
the parameter output_format is not supported by the current model傳入了 output_format刪除該參數,輸出格式固定為 JPEG
does not support the /v1/images/edits endpoint呼叫了改圖端點改用 /v1/images/generations 的 image 欄位
參考圖未生效使用了 input_images改用 image

錯誤原文末尾的 Request id: 0217… 為上游請求編號,聯絡技術支援時請與回應中的 request_id 一併提供。

錯誤原文

The parameter `size` specified in the request is not valid: image size must be at least 3686400 pixels. The parameter `size` specified in the request are not valid: image area must be at least 921600 pixels. The parameter `size` specified in the request is not valid: image size must be at most 16777216 pixels. The parameter `size` specified in the request is not valid: the specified size is not supported for model doubao-seedream-4-5. The parameter `size` specified in the request are not valid: must be 'WIDTHxHEIGHT' or a supported size preset. The parameter `size` specified in the request is not valid: size must be one of 'WIDTHxHEIGHT', '1k', '2k', or '4k'. The parameter `sequential_image_generation` specified in the request are not valid: the parameter `sequential_image_generation` is not supported by the current model. The parameter `output_format` specified in the request is not valid: the parameter `output_format` is not supported by the current model.

官方文件

官方文件描述的是直連火山方舟時的行為;透過 OfoxAI 呼叫時,以本頁實測結論為準。

常見問題

Seedream 出現 image size must be at least 3686400 pixels 該如何處理?

Seedream 4.5 與 5.0 Lite 的最低尺寸是 2K,即 3,686,400 像素,1024x1024 與 1k 都不符合要求。請改為 2k,或 2048x2048、2560x1440、1440x2560 等寬高。需要較小尺寸時請使用 5.0 Pro,它最低 921,600 像素(1280x720),也支援 1k。

Seedream 如何改圖?用 input_images 沒有效果?

Seedream 的參考圖欄位是 image(陣列,每項是圖片 URL 或 data:image 開頭的 base64),不是 input_images,input_images 是 Qwen-Image 的欄位。此外 Seedream 不支援 /v1/images/edits,改圖同樣使用 /v1/images/generations。

Seedream 組圖如何一次生成多張?

傳入 sequential_image_generation: "auto" 與 sequential_image_generation_options.max_images。auto 表示由模型決定張數,max_images 是上限,在提示詞中寫明「生成 N 張獨立的圖」會更穩定。5.0 Lite 與 4.5 支援,5.0 Pro 不支援。

Seedream 5.0 Pro 傳入 n 出現 sequential_image_generation is not supported?

5.0 Pro 不支援一次生成多張,n 與組圖參數都會回傳此錯誤。請刪除 n,如需多張,請並行發出多次請求。

Seedream 生成的圖片有浮水印嗎?

透過 OfoxAI 呼叫,實測預設不帶浮水印,無需額外傳參。

Seedream 能輸出 PNG 嗎?

不能,輸出固定為 JPEG。傳入 output_format 會回傳 400,刪除該參數即可。

Seedream 的 size 傳入 2k 為什麼比例不固定?

1k、2k、4k 只指定解析度,比例由模型依提示詞決定。需要固定比例請傳入精確寬高,如 2560x1440。

最後更新於