Seedream
用 Seedream 生成和編輯圖片:參數、返回與注意事項。
| 項目 | 值 |
|---|---|
| Base URL | https://api.hop-base.com/v1 |
| 生成(含參考圖編輯) | POST /v1/images/generations |
| 編輯(multipart 相容入口) | POST /v1/images/edits |
| 金鑰分組 | 「Seedream 生圖分組」或「Seedance 海外 · Seedream」 |
Seedream 只支援同步呼叫,每次出 1 張,結果是 24 小時有效的圖片連結。
可用型號
| 型號 | 模型 ID | 尺寸簡寫 | 官方價 |
|---|---|---|---|
| Seedream 5.0 Pro | seedream-5-0-pro | 1K / 1.5K / 2K | $0.045起/ 張 |
| Seedream 5.0 Lite | seedream-5-0-lite | 2K / 3K / 4K | $0.035/ 張 |
| Seedream 4.5 | seedream-4-5 | 2K / 4K | $0.04/ 張 |
選型建議:要 1K 小圖只能用 Pro,Pro 的 1.5K 與 1K 同價、效果更好,建議優先 1.5K;Lite 與 4.5 最小輸出 2K。「Seedance 海外 · Seedream」只提供 seedream-5-0-pro。
請求參數
生成
POST /v1/images/generations,JSON 請求體。加上 image 即為單圖編輯、多圖融合或局部編輯。
| 參數 | 必填 | 型別與限制 | 預設 | 說明 |
|---|---|---|---|---|
model | 必填 | 字串,見上表 | — | 以目前金鑰 GET /v1/models 的返回為準 |
prompt | 必填 | 字串,去除首尾空白後非空 | — | 內容、構圖、風格或編輯指令 |
size | 選填 | 型號尺寸簡寫,或 寬x高 | — | 不接受 auto,像素範圍見下表 |
n | 選填 | 只能為 1 | 1 | 其他值(含 null)返回 400 |
response_format | 選填 | 只能為 url | url | 返回簽名直鏈 |
output_format | 選填 | 依型號,見下表 | — | 輸出圖片格式 |
optimize_prompt_options | 選填 | 物件,mode 依型號取值 | — | 提示詞優化模式 |
image | 選填 | URL / Data URL,字串或字串陣列 | — | 參考圖,傳入即圖生圖 / 編輯 |
依型號的限制:
| 模型 ID | size 總像素 | 參考圖上限 | output_format | optimize_prompt_options.mode |
|---|---|---|---|---|
seedream-5-0-pro | 921,600–4,624,220 | 10 | png / jpeg | standard / fast |
seedream-5-0-lite | 3,686,400–16,777,216 | 14 | png / jpeg | standard |
seedream-4-5 | 3,686,400–16,777,216 | 14 | jpeg | standard |
寬x高 的寬高比須在 1:16–16:1 之間。size 不合規時在生成前返回 400,不計費。
image 的每一項是 http(s) URL 或 base64 編碼的 Data URL,Data URL 單張 ≤ 30 MB。支援 JPEG、PNG、WebP、BMP、TIFF、GIF、HEIC、HEIF;URL 在提交時不下載、不檢查大小,須是服務端能取得的公開位址。
局部編輯不用遮罩:把標註直接畫在參考圖上,並在 prompt 中描述座標、bbox、箭頭或塗畫區域。
編輯
POST /v1/images/edits 是給既有 OpenAI Images 編輯程式碼用的相容入口,推薦 multipart/form-data,也接受與生成相同的 JSON。至少要帶 1 張參考圖。
| 參數 | 必填 | 型別與限制 | 預設 | 說明 |
|---|---|---|---|---|
image / image[] | 必填 | 檔案或 URL 字串,可重複 | — | 上傳檔案單張 ≤ 30 MB |
model、prompt | 必填 | 同「生成」 | — | — |
size、n、response_format、output_format | 選填 | 同「生成」 | — | — |
optimize_prompt_options[mode] | 選填 | 同「生成」的 mode | — | 也可寫 optimize_prompt_mode |
請求裡帶 mask 欄位即返回 400,傳 null 也一樣。multipart 中上表以外的欄位會被忽略。
返回結果
同步返回標準 OpenAI Images JSON,圖片在 data[].url。
| 欄位 | 型別 | 說明 |
|---|---|---|
created | integer | Unix 秒 |
model | string | 請求的模型 ID |
data[].url | string | 圖片簽名直鏈,24 小時有效 |
data[].size | string | 實際輸出的 寬x高 |
usage | object | 可能返回,含 generated_images 等用量 |
{
"model": "seedream-5-0-pro",
"created": 1760000000,
"data": [
{
"url": "https://…/result.jpeg?X-Signature=…",
"size": "2048x2048"
}
],
"usage": {
"generated_images": 1,
"output_tokens": 16384,
"total_tokens": 16384
}
}返回的 URL 是 24 小時有效的簽名直鏈,過期後無法重新取得、只能重新生成(會再次計費),請收到後立即下載。
示例
文生圖
curl https://api.hop-base.com/v1/images/generations \
-H "Authorization: Bearer sk-你的金鑰" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-0-pro",
"prompt": "霓虹夜色下的未來城市街景,電影感構圖",
"size": "2048x2048",
"response_format": "url"
}'參考圖編輯
curl https://api.hop-base.com/v1/images/generations \
-H "Authorization: Bearer sk-你的金鑰" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-0-pro",
"prompt": "把第一張圖中的杯子移到桌面右側,保持其餘內容不變",
"image": ["https://example.com/source.png"],
"size": "2K",
"output_format": "png",
"response_format": "url"
}'注意事項
- 每次只出 1 張,要多張請分多次請求。
- 只支援同步:
Prefer: respond-async會被忽略,照常同步返回。 - 結果只有
url,不支援b64_json。 size不接受auto,Lite 與 4.5 的最小輸出是 2K。seedream-4-5只輸出 JPEG。- 不支援傳統 mask,局部編輯請用帶標註的參考圖加 prompt 描述。
watermark由服務端固定為 false,傳了不生效。- 複數
images、quality、stream等欄位不生效,會被忽略。 seedream-5-0-lite是 Seedream 5.0 的輕量版,公開模型名為 Seedream 5.0 Lite,請勿當作 Pro 使用。- Data URL 必須是 base64 編碼,MIME 須與圖片一致。
- 官方規格:輸入單張最多 30 MB / 36MP。
常見報錯
參數不合規在生成前返回 400,不計費。內容安全攔截也返回 400、不計費,原因在 error.message 中。
| 報錯 | 改法 |
|---|---|
model seedream-5-0-pro only supports size 1K, 1.5K, 2K or a valid WIDTHxHEIGHT pixel size | 改用該型號的尺寸簡寫或合法 寬x高 |
model seedream-5-0-lite requires the total pixel count of size to be between 3686400 and 16777216 | 把寬高調到總像素區間內 |
size aspect ratio must be between 1:16 and 16:1 | 調整寬高比 |
only a single output is supported (n=1) | 去掉 n,多張分次請求 |
response_format only supports url | 去掉該欄位或改為 url |
model seedream-4-5 only supports output_format jpeg | 改傳 jpeg 或不傳 |
at most 10 reference images are supported | 減少參考圖張數 |
seedream does not accept a traditional mask; ... | 去掉 mask,改用帶標註的參考圖 |
model seedream-5-0-pro only supports size 1K, 1.5K, 2K or a valid WIDTHxHEIGHT pixel size # 例如 "size": "auto"
model seedream-5-0-lite requires the total pixel count of size to be between 3686400 and 16777216
size aspect ratio must be between 1:16 and 16:1
missing prompt
response_format only supports url
only a single output is supported (n=1)
model seedream-4-5 only supports output_format jpeg
model seedream-5-0-lite only supports optimize_prompt_options.mode standard
optimize_prompt_options must be an object
image must be a URL/data URL string or an array of strings
every item in the image array must be a URL or data URL string
image must not be empty
at most 10 reference images are supported
reference image 1 is invalid: data URL must be base64-encoded
reference image 1 is invalid: unsupported image format image/svg+xml
reference image 1 is invalid: a single image must not exceed 30 MB
image edits require at least one image reference # /v1/images/edits 未帶圖
seedream does not accept a traditional mask; ... # /v1/images/edits 帶 "mask" 即拒,null 也一樣計費
按輸出張數計費,5.0 Pro 每張參考圖另外計費;生成失敗與安全攔截不計費。5.0 Pro 按輸出像素分檔計價,1K 與 1.5K 同價。
單價見各型號的模型卡與登入後的模型廣場。