Seedance:影片生成 API
用 Seedance 2.0 / 2.5 生成影片:參數、回傳與注意事項。
| 項目 | 值 |
|---|---|
| Base URL | https://api.hop-base.com/v1 |
| 提交任務 | POST /v1/video/generate |
| 查詢任務 | GET /v1/video/tasks/{task_id} |
| 任務列表 | GET /v1/video/tasks |
| 上傳素材(僅 2.0) | POST /v1/sd/assets |
| 密鑰分組 | 國內「Seedance 國內(Doubao)」,海外「Seedance 海外 · Seedream」 |
可用型號
| 型號 | 模型 ID | 解析度 | 時長(秒) | 官方價 |
|---|---|---|---|---|
| 2.0 標準版(國內) | doubao-seedance-2-0-260128-a | 480p / 720p / 1080p | 4–15 | $4.12起/ 百萬 tokens |
| 2.0 Fast(國內) | doubao-seedance-2-0-fast-260128-a | 480p / 720p | 4–15 | $2.43起/ 百萬 tokens |
| 2.0 Mini(國內) | doubao-seedance-2-0-mini-260615-a | 480p / 720p | 4–15 | $0.824起/ 百萬 tokens |
| 2.5(國內) | doubao-seedance-2-5-260628-a | 480p / 720p / 1080p | 4–30 | $6.18起/ 百萬 tokens |
| 2.0 標準版(海外) | dreamina-seedance-2-0-hcdreamina-seedance-2-0-epdreamina-seedance-2-0-260128 | 480p / 720p / 1080p / 4K | 4–15 | $2.40起/ 百萬 tokens |
| 2.0 Fast(海外) | dreamina-seedance-2-0-fast-hcdreamina-seedance-2-0-fast-epdreamina-seedance-2-0-fast-260128 | 480p / 720p | 4–15 | $3.30起/ 百萬 tokens |
| 2.0 Mini(海外) | dreamina-seedance-2-0-mini-hcdreamina-seedance-2-0-mini-epdreamina-seedance-2-0-mini-260615 | 480p / 720p | 4–15 | $2.10起/ 百萬 tokens |
| 2.5(海外) | dreamina-seedance-2-5-260628 | 480p / 720p / 1080p | 4–30 | $6.40起/ 百萬 tokens |
海外 2.5 的 1080p 須目前分組支援,不支援 4K。
國內型號由Seedance 國內(Doubao)分組提供,海外型號由Seedance 海外 · Seedream分組提供。國內分組已覆蓋標準、Fast、Mini 與 Seedance 2.5,只有 4K 需要海外分組的標準版。海外分組的密鑰不能調用 doubao-* ID。
每個型號的分檔價與完整規格見模型卡,例如 dreamina-seedance-2-5-260628、doubao-seedance-2-0-260128-a。
請求參數
以下都是 JSON 頂層欄位,不要巢狀進 parameters。整數和布林值寫成字串(如 "5"、"true")或把整數寫成小數會被拒。整個請求體上限 64 MB,內嵌 Data URL 也計入。
| 參數 | 必填 | 型別與限制 | 預設值 | 說明 |
|---|---|---|---|---|
model | 必填 | 上方型號表中的 ID | — | 決定時長、解析度與素材限制 |
content | 必填 | 非空陣列,寫法見下 | — | 提示詞寫在 text 元素裡 |
duration | 選填 | 整數;2.0:4–15 或 -1;2.5:4–30 或 -1 | 2.0:5;2.5:-1 | 時長(秒);-1 由模型自動決定 |
resolution | 選填 | 各型號可用檔見型號表 | 720p | 須為該型號支援的值 |
ratio | 選填 | 16:9 / 4:3 / 1:1 / 3:4 / 9:16 / 21:9 / adaptive | adaptive | adaptive 按參考圖或由模型自動選擇 |
generate_audio | 選填 | 布林值 | 2.5:true;2.0:不代填 | 2.0 請顯式傳 |
watermark | 選填 | 布林值 | 2.5:false;2.0:不代填 | 2.0 請顯式傳 |
return_last_frame | 選填 | 布林值 | 2.5:true | 取得末幀時返回 task.last_frame_url;2.0 不保證 |
priority | 選填 | 整數 0–9 | — | 任務排隊的調度提示,不保證完成時間 |
execution_expires_after | 選填 | 整數 3600–259200(秒) | — | 不改變 24 小時兜底 |
callback_url | 選填 | HTTP(S) URL | — | 不能替代輪詢 |
safety_identifier | 選填 | 1–64 個 ASCII 字符 | — | 標識你的終端使用者的穩定 ID,用於濫用監測;不要放個人資訊 |
frames、seed、camera_fixed、draft、draft_task、service_tier 在兩代模型中都會被拒絕(400)。完整欄位也可在 API 參考:提交影片任務中查看。
size、seconds、n、aspect_ratio 不是 Seedance 參數,不報錯但會被忽略,任務按預設時長與 720p 生成。請改用 duration、resolution、ratio。
content 元素
content 的元素為 text / image_url / video_url / audio_url:
"content": [
{ "type": "text", "text": "橘貓在草地上奔跑,鏡頭跟隨" },
{ "type": "image_url", "image_url": { "url": "https://example.com/cat.png" }, "role": "reference_image" },
{ "type": "video_url", "video_url": { "url": "https://example.com/ref.mp4" } }, // role 省略時為 reference_video
{ "type": "audio_url", "audio_url": { "url": "https://example.com/ref.mp3" } } // role 省略時為 reference_audio
]圖片的 role 為 first_frame、last_frame 或 reference_image:
- 只有一張圖且不寫 role 時按首幀處理。
- 多張圖必須寫 role。
- 帶影片或音訊參考時,圖片必須是
reference_image。 - 首尾幀最多 2 張:1 張須為
first_frame,2 張須各一張first_frame/last_frame,不能與參考素材混用。 - Seedance 2.0 的音訊參考須搭配圖片或影片,2.5 支援僅音訊。
圖片與音訊可用 base64 Data URL,影片不接受 Data URL;Seedance 2.0 還可用已就緒的 asset://素材ID。
參考素材規格
這套規則適用於 Seedance 2.0 與 2.5 的國內、海外模型,不是所有影片模型的通用規範。
提交時會下載並檢查每個參考素材,不符合即同步返回 400(沒有 code,按 message 識別),不產生任務費用。通過檢查的素材仍可能在執行階段因內容審核失敗。
| 項目 | 圖片 | 影片 | 音訊 |
|---|---|---|---|
| 數量上限 | 2.0:9 張;2.5:30 張 | 2.0:3 段;2.5:10 段 | 2.0:3 段;2.5:10 段 |
| 格式 | jpg / jpeg / png / webp / bmp / tif / tiff / gif / heic / heif | mp4 / mov(容器需為 MP4/ISO-BMFF) | wav / mp3 |
| 大小 | < 30 MiB | ≤ 200 MiB | ≤ 15 MiB |
| 尺寸 | 寬高各 300-6000 px | 寬高各 300-6000 px,總像素 409,600-8,295,044 | - |
| 寬高比 | 0.4-2.5 | 0.4-2.5 | - |
| 時長 | - | 2.0:2-15 秒;2.5:2-30 秒 | 2.0:2-15 秒;2.5:2-30 秒 |
| 幀率 | - | 24-60 FPS | - |
首尾幀模式最多 2 張圖。影片和音訊的多段總時長與單段時長同上限,且分別累計,不是兩者相加:例如 2.0 的所有參考影片合計 ≤ 15 秒,所有參考音訊合計也 ≤ 15 秒,且每一段都須 ≥ 2 秒。
生成影片的 duration 與參考素材時長是兩項獨立限制。1 MiB = 1,048,576 位元組。
素材 URL 必須是公網可存取的 http(s) 位址:
- 不允許內網 / 迴環 / 鏈路本地位址與帶認證資訊的 URL。
- 重新導向最多 3 次。
- 每個素材須在 2 分鐘內下載並解析完。
- Data URL 須為
data:<MIME>;base64,…。
素材庫(僅 Seedance 2.0)
素材庫接收一個已有的公網素材 URL,返回素材 ID,在 Seedance 2.0 生成時以 asset://素材ID 引用。普通參考素材也可直接用 URL,無需一律先入庫。
上傳。保存返回的 data.Id;受理不等於就緒。
curl https://api.hop-base.com/v1/sd/assets \
-H "Authorization: Bearer sk-你的密鑰" \
-H "Content-Type: application/json" \
-d '{
"URL": "https://example.com/your-image.jpg",
"Name": "avatar_front",
"AssetType": "Image"
}'{
"data": {
"Id": "assetEXAMPLE"
}
}等待就緒。用同一分組密鑰約每 5 秒查詢一次,設定逾時。data.Status 為 Active 表示就緒(相容 completed / succeeded,大小寫不敏感)。
curl https://api.hop-base.com/v1/sd/assets/assetEXAMPLE \
-H "Authorization: Bearer sk-your-key"{
"data": {
"Id": "assetEXAMPLE",
"Status": "Active",
"AssetType": "Image"
}
}處理中繼續等待。上傳或審核失敗時處理錯誤,不要繼續提交生成或無限輪詢。
引用。用完整的 data.Id 拼成 asset://素材ID 放入生成請求的 content,不要改用查詢回應裡的 URL。
curl https://api.hop-base.com/v1/video/generate \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "The subject waves gently at the camera"
},
{
"type": "image_url",
"image_url": {
"url": "asset://assetEXAMPLE"
},
"role": "reference_image"
}
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9"
}'上傳請求的欄位:
| 欄位 | 必填 | 型別與限制 | 預設值 | 說明 |
|---|---|---|---|---|
URL(或 url) | 必填 | 公網 HTTP(S) 位址;不接受 base64 或 multipart | — | 本地檔案需先自行託管 |
AssetType(或 asset_type) | 必填 | Image / Video / Audio,不區分大小寫 | — | 素材類型,按「參考素材規格」校驗 |
Name | 選填 | 字串 | — | 便於你識別的名稱,不參與生成 |
Duration(或 duration / duration_seconds) | 選填 | 整數秒 | — | 不替代實際時長檢測 |
上傳時會下載並按「參考素材規格」的 2.0 口徑檢測,影片、音訊須為 2–15 秒。上傳介面的 400 帶 error.code(如 invalid_asset_duration)。
按素材類型改寫 content 元素:
- 影片:
type: video_url、video_url.url: asset://…、role: reference_video。 - 音訊:對應
audio_url/reference_audio。 - 首幀圖片改用
role: first_frame,尾幀為last_frame;不能把首尾幀與多模態參考模式混用。
不要改寫素材 ID,也不要跨分組或跨使用者複用。生成仍會檢查狀態、類型、數量與規格,入庫既不豁免 2.0 的數量限制,也不豁免內容審核。
回傳結果
提交與單任務查詢都使用 task 包裝,不要讀成頂層 id / outputs。
提交回應
提交成功返回 200,task.id 形如 vt…,用於後續查詢。提交回應只含 id、model、status(pending 或 processing)、outputs(恆為空)、error、created_at、completed_at,結果請通過查詢獲取。
{
"task": {
"id": "vtEXAMPLE",
"model": "dreamina-seedance-2-5-260628",
"status": "pending",
"outputs": [],
"error": null,
"created_at": "2026-09-23T08:00:00Z",
"completed_at": null
}
}任務查詢欄位
| 欄位 | 說明 |
|---|---|
task.id | HopBase 任務 ID,vt… |
task.status | pending / processing / completed / failed 之一 |
task.outputs | 成片位址,字串陣列,不是 {url} 物件 |
task.duration_seconds | 成片秒數;自動時長任務請在完成後讀取 |
task.last_frame_url | 可選,取得末幀時才有;每次查詢都會重新簽名 |
task.usage.completion_tokens | 本次計費 tokens;是 tokens,不是金額 |
task.error.message | 失敗原因,英文,沒有 code 欄位 |
task.completed_at | 未完成時為 null |
usage.cost / usage.cost_cny / usage.cost_usd | 任務結束後的實際扣費,見影片總覽 |
task.status 只會返回這四個值之一,只在 completed 時讀取 task.outputs:結果連結就緒後才報 completed,此時 outputs 不會為空。pending / processing 繼續輪詢,推薦每 5 秒一次。
480p / 720p 通常 2-5 分鐘出片,1080p 與 4K 更久。成片位址支援瀏覽器直接播放與 Range 拖動,完成後 30 天有效。
進行中
{
"task": {
"id": "vtEXAMPLE",
"model": "dreamina-seedance-2-5-260628",
"status": "processing",
"outputs": [],
"error": null,
"created_at": "2026-09-23T08:00:00Z",
"completed_at": null
}
}成功
下例為查詢到已完成任務(HTTP 200)的結構節選,ID、URL 和用量均為示意值:
{
"task": {
"id": "vtEXAMPLE", // HopBase 任務 ID
"model": "dreamina-seedance-2-5-260628",
"status": "completed",
"duration_seconds": 5, // 自動時長任務請在完成後讀取
"outputs": ["https://api.hop-base.com/example-signed-video.mp4"], // 字串陣列,不是 {url} 物件
"last_frame_url": "https://api.hop-base.com/example-signed-last-frame.jpg", // 可選,取得末幀時才有
"usage": { "completion_tokens": 1000, "total_tokens": 1000 }, // 可選;是 tokens,不是金額
"error": null,
"created_at": "2026-09-23T08:00:00Z",
"completed_at": "2026-09-23T08:03:10Z" // 未完成時為 null
},
"usage": { "cost": 3.4, "currency": "CNY", "cost_cny": 3.4, "cost_usd": 0.5 }
}失敗
生成失敗時查詢仍返回 HTTP 200,status 為 failed,原因在 task.error.message。失敗不計費。
{
"task": {
"id": "vtEXAMPLE",
"status": "failed",
"outputs": [],
"error": { "message": "<English failure reason>" }
}
}message 是英文,沒有 code 欄位。其中的連結會被替換為 [URL_REDACTED],請求 ID 與內部錯誤碼會被去掉;生成端未給出原因時是一條通用的英文兜底說明。
任務列表
GET /v1/video/tasks 可追加 ?page=1&limit=20,返回 {"tasks": [...], "total": 1, "totalPages": 1},每個元素直接是任務物件。limit 預設 20、最大 100,只列出通過 API 提交的任務。
最小範例
# 1. 提交
curl https://api.hop-base.com/v1/video/generate \
-H "Authorization: Bearer sk-你的密鑰" \
-H "Content-Type: application/json" \
-d '{
"model": "dreamina-seedance-2-5-260628",
"content": [
{ "type": "text", "text": "一隻橘貓在陽光下的草地上奔跑,鏡頭跟隨" }
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9",
"generate_audio": false,
"watermark": false
}'
# 2. 用返回的 task.id 輪詢,推薦每 5 秒一次
curl https://api.hop-base.com/v1/video/tasks/vt你的任務ID \
-H "Authorization: Bearer sk-你的密鑰"注意事項
Seedance 2.5 的任務模式
Seedance 2.5 沒有顯式的"任務模式"參數。帶 reference_video 提交時,Seedance 會按提示詞內容把請求判成普通生成、影片擴展或影片編輯。寫成"延續 / 接著 / 擴展這段影片"這類提示詞會被判成影片擴展。
| 模式 | 必須傳 |
|---|---|
| 影片編輯 | duration: -1 且 ratio: "adaptive" |
| 影片擴展、首幀/首尾幀 | ratio: "adaptive" |
提交仍返回 200,直到輪詢時才變成 failed,不產生費用。帶參考影片且提示詞可能被理解為"延續原片"時,建議統一傳 ratio: "adaptive"。
報錯原文形如 identified your task as video extension based on your prompt。Seedance 2.0 沒有擴展 / 編輯模式,不受此影響。
真人參考圖
直接傳入(URL 或 Data URL)的含真人圖片可能在提交時被拒:同步返回 4xx,error.code 為 input_sensitive,message 說明改法。Seedance 2.0 請改走素材庫;2.5 不支援素材庫,暫不能使用真人參考圖。
Seedance 2.0:把同一張圖按上方「素材庫」上傳,就緒後以 asset://素材ID 引用再提交。需要真人參考圖時改用 2.0 並走素材庫。入庫不豁免其他內容審核。
逾時、取消與結果連結
- 任務建立超過 24 小時仍未結束會被自動判為失敗,不計費。
- 影片任務不支援取消;提交成功後不要重複提交,每次重提都是另一個計費任務。
- 成片位址是
api.hop-base.com下的簽名位址,完成後 30 天有效,再次查詢不會續期,過期存取返回 410。
從海外分組切到國內分組
國內分組同時接受上表海外 dreamina-* ID 作為相容別名(4K 仍會被拒絕)。存量客戶從海外切到國內只需更換密鑰,base_url、API 路徑、請求參數與輪詢邏輯都不變。
換 key 後請用新密鑰調 GET /v1/models 選擇完整模型 ID。已提交的歷史任務仍可用原任務 ID 查詢。
常見報錯 → 改法
照搬其他介面時的三處寫法會直接被拒:
| 寫法 | 改法 |
|---|---|
只傳頂層 prompt | 提示詞放在 content[].text |
image_url 寫成字串 | 寫成物件 {"url": …} |
type 寫成 image / input_image | 用 image_url / video_url / audio_url |
提交時的參數報錯
以下錯誤在提交時同步返回 400,不建立任務、不計費。回應體為 {"error":{"message":"…","type":"invalid_request_error"}},沒有 code 欄位,請按 message 識別(數字與序號隨請求變化):
# 類型與取值
duration must be an integer # priority / execution_expires_after 同理
watermark must be a boolean # generate_audio / return_last_frame 同理
Seedance 2.0 duration must be an integer in 4-15 or -1, got 20
Seedance 2.5 duration must be an integer in 4-30 or -1, got 40
model dreamina-seedance-2-0-hc does not support parameter seed # 被拒欄位;報錯裡是你請求的模型 ID
model dreamina-seedance-2-0-hc does not support ratio 2:1
model dreamina-seedance-2-0-fast-hc does not support resolution 1080p
request body must not exceed 64MB
priority must be within 0-9, got 10
execution_expires_after must be within 3600-259200 seconds
callback_url must be a valid http(s) URL
safety_identifier must be an ASCII string of 1-64 characters
# content 結構
missing content # 只傳了頂層 prompt
content[0].image_url must be an object # image_url 寫成了字串
content[0].type does not support image # type 寫成 image / input_image
content[0].text must not be empty
multi-image scenarios must specify first_frame/last_frame or reference_image roles
images in a multimodal reference scenario must set role=reference_image
first/last frame image-to-video cannot be mixed with the multimodal reference scenario
Seedance 2.0 supports at most 9 reference images
# 模型與分組
domestic doubao-seedance-2-0-fast-260128-a only supports 480p, 720p, got 1080p
model seedream-5-0-pro is an image generation model, use POST /v1/images/generations instead兩類情況不是上面的 400:
| 報錯 | 改法 |
|---|---|
404 The current group does not support the requested model: <模型 ID> | 模型 ID 不在目前密鑰的分組裡(如海外密鑰調 doubao-*),換用提供該模型的分組的密鑰 |
以 only supports 480p or 720p, got 1080p 結尾 | 海外 2.5 請求 1080p 而目前分組不支援,不會自動降檔;改用 720p 或換支援 1080p 的分組 |
404 會先於上述校驗返回,可用 ID 以 GET /v1/models 為準。
參考素材報錯
content[1] 為出錯素材在 content 中的序號:
content[1] media URL returned HTTP 403 # 素材位址拒絕下載(防盜鏈、簽名過期等)
content[1] unable to fetch media file, make sure the URL is publicly accessible
content[1] media URL hostname could not be resolved
content[1] media URL must point to a public address, not a private or reserved one
content[1] too many redirects for media URL
content[1] unable to parse media metadata of the video asset # 文件損壞或格式不符
content[1] media data URL must be base64-encoded
content[1] image data URL does not support MIME type image/svg+xml
# 允許:image/jpeg png webp bmp tiff gif heic heif;audio/wav audio/mpeg
content[1] reference image width and height must be within 300-6000 px, got 200x200
content[1] video asset duration must be within 2-15 seconds, got 16.000 seconds
total reference video duration must not exceed 15 seconds, got 18.000 seconds參考素材 2 分鐘內未能下載並解析完時,提交返回 503,code 為 upstream_timeout:
media validation timed out, please retry later這是服務端的臨時狀況,不是素材本身的問題,稍後原樣重試即可。
引用素材庫素材出錯時同樣是同步 400、沒有 code:
content[1] reference asset is not ready yet, current status is Processing # 繼續查詢素材,Active 後再提交
content[1] requires a image asset, got Video # AssetType 與 image_url / video_url / audio_url 不對應
content[1] references a retired Seedance 2.5 EP asset; ... # asset25-* 已退役,改傳原始公網 URL
... cannot be mixed in one task # 只引用同一批上傳的素材,或改為直接傳公網 URL任務失敗原因
OutputVideoSensitiveContentDetected / OutputAudioSensitiveContentDetected # 成片未通過審核;帶 PolicyViolation 為版權
rejected by content moderation # 成片、提示詞或參考素材未通過內容審核
InputImageSensitiveContentDetected 等 Input…Sensitive… # 輸入素材未通過審核,含真人隱私
InvalidParameter / is not valid / missing required / identified your task as # 參數或任務模式不合法
task no longer exists # 任務不存在或已被清理
task expired / timed out / did not finish within 24 hours # 任務逾時或已過期審核類與參數類(前四類)原樣重試仍會失敗,須先改提示詞、素材或參數;後兩類可直接重新提交。
計費
Seedance 按影片 token 計費,task.usage.completion_tokens 為本次計費 tokens。失敗任務與提交時的 400 不計費。
提交時按預估費用預留餘額,任務結束後釋放。duration: -1 時,2.5 按 30 秒、2.0 按 15 秒預留;餘額緊張時傳具體秒數可降低預留。餘額規則與 usage.cost 欄位見影片總覽,各型號官方價見上方型號表與模型卡,實際扣費見控制台「使用記錄」。
下一步
- 影片總覽:各影片系列對比與共用的任務流程
- API 參考:提交影片任務:請求欄位
- API 參考:查詢影片任務:返回欄位
- 錯誤碼與重試:各錯誤碼的含義以及是否該重試