curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{"model":"seedance-2-5","prompt":"電影感產品特寫,鏡頭緩慢推進。","duration":10,"aspect_ratio":"16:9","resolution":"720p","generate_audio":true}'
{
"model": "seedance-2-5",
"prompt": "向後延長影片1,鏡頭繼續推進並展示窗外的城市。",
"video_operation": "extend",
"duration": 11,
"aspect_ratio": "adaptive",
"output_format": "mov",
"video_with_roles": [{"url": "https://example.com/source.mov", "role": "reference_video"}]
}
{"id":"tsk_vid_xxx","object":"generation.task","model":"seedance-2-5","status":"in_progress","progress":10,"created_at":1781577600}
seedance-2-5
seedance-2.5 影片生成
使用 seedance-2-5 模型生成影片
POST
/
v1
/
videos
/
generations
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{"model":"seedance-2-5","prompt":"電影感產品特寫,鏡頭緩慢推進。","duration":10,"aspect_ratio":"16:9","resolution":"720p","generate_audio":true}'
{
"model": "seedance-2-5",
"prompt": "向後延長影片1,鏡頭繼續推進並展示窗外的城市。",
"video_operation": "extend",
"duration": 11,
"aspect_ratio": "adaptive",
"output_format": "mov",
"video_with_roles": [{"url": "https://example.com/source.mov", "role": "reference_video"}]
}
{"id":"tsk_vid_xxx","object":"generation.task","model":"seedance-2-5","status":"in_progress","progress":10,"created_at":1781577600}
中國大陸用戶請注意: 中國大陸用戶請使用
https://toapis.cn 作為接口地址(Base URL)。文檔示例中的 https://toapis.com 請替換為 https://toapis.cn。seedance-2-5,火山引擎上游模型 ID 為 doubao-seedance-2-5-260628。
- 支援文生影片、首幀/首尾幀圖生影片、影片編輯、影片延長及多模態參考生影片。
- 支援圖片、影片和音訊參考,也支援純音訊參考。
- 介面採用非同步任務;提交後返回
generation.task,完成後透過任務狀態介面取得影片。
Authorizations
string
必填
所有請求都需要 Bearer Token。請在 API Key 管理頁面 取得金鑰,並加入:
Authorization: Bearer YOUR_API_KEY
Body
string
預設值:"seedance-2-5"
必填
ToAPIs 公共模型名稱,固定使用
seedance-2-5。boolean
預設值:false
選填, 預設
false. 設為 true 時依所選渠道能力準備並審核素材; 不支援私有素材庫的渠道略過提審, 沿用原有生成流程.僅用於包含以下媒體欄位的非同步生成請求: image_urls, image_with_roles, video_with_roles, audio_with_roles.純文字或僅在 metadata 中提供素材的請求請省略或設為 false. 不適用於獨立的 remix 或 extend API. 設為 true 時拒絕 asset://, 模型原有的媒體格式與數量限制不變. 詳見按需素材審核.本 API 的 video_operation=edit 或 video_operation=extend 可以使用此開關, 仍須符合對應的素材與時長要求.string
描述場景、鏡頭運動、主體動作、風格與聲音氛圍。引用素材時使用「圖片1」「影片1」「音訊1」等標籤。
string
預設值:"generate"
視頻業務類型:
generate、edit 或 extend。編輯和延長至少需要一個 video_with_roles;編輯使用 duration=-1,延長使用 4–30 或 -1。三種操作共用此接口。string
客戶側訂單號或業務任務 ID。可用
GET /v1/videos/generations/{client_business_id} 查詢。integer
輸出影片時長(秒),範圍為
4–30;-1 表示由模型自動選擇時長。編輯任務只能使用 -1,輸出時長與輸入影片基本一致;延長任務可使用 4–30 或 -1,此時按延長後的輸出總時長計算。string
可選
21:9、16:9、4:3、1:1、3:4、9:16、adaptive。編輯、延長和首尾幀任務按上游要求使用 adaptive。string[]
相容模式圖片 URL 陣列。新接入建議使用
image_with_roles;兩個欄位不能同時傳送。array
帶角色的圖片陣列,每項含必填
url 和 role。角色可為 first_frame、last_frame 或 reference_image,最多 30 張。首尾幀模式與參考圖模式不可混用。array
參考影片陣列,每項含
url,角色固定為 reference_video,最多 10 段。array
參考音訊陣列,每項含
url,角色固定為 reference_audio,最多 10 段;支援純音訊參考。string
解析度:
480p、720p 或 1080p。string
預設值:"mp4"
支持
mp4 和 mov。boolean
預設值:true
是否生成同步音訊。
boolean
預設值:false
是否在完成結果中返回生成影片的尾幀圖片。
array
可選工具:
[{ "type": "web_search" }]。僅適用純文生影片,不能與圖片、影片或音訊輸入同時使用。string
ToAPIs 任務完成回呼地址,詳見任務 Webhook。
string
呼叫方自訂的鏈路追蹤 ID。
參考素材限制
最多共 50 個參考素材:圖片 30 張、影片 10 段、音訊 10 段。請使用明確角色,避免首幀/尾幀與參考素材被錯誤推斷。非法任務組合可能失敗。編輯和延長任務會明確指定上游任務類型,特殊限制不符合時在提交階段立即返回錯誤;其餘任務類型由模型按素材和提示詞判斷,不符合時在異步階段失敗並返回
InvalidParameter.TaskTypeConstraint。編輯、延長和首尾幀任務按上游要求將 aspect_ratio 設為 adaptive。Response
string
任務 ID,用於查詢狀態。
string
請求傳入此欄位時返回。
string
固定為
generation.task。string
本次請求的模型名稱。
string
queued、in_progress、completed 或 failed。integer
0–100 的任務進度。integer
建立時間戳。
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{"model":"seedance-2-5","prompt":"電影感產品特寫,鏡頭緩慢推進。","duration":10,"aspect_ratio":"16:9","resolution":"720p","generate_audio":true}'
{
"model": "seedance-2-5",
"prompt": "向後延長影片1,鏡頭繼續推進並展示窗外的城市。",
"video_operation": "extend",
"duration": 11,
"aspect_ratio": "adaptive",
"output_format": "mov",
"video_with_roles": [{"url": "https://example.com/source.mov", "role": "reference_video"}]
}
{"id":"tsk_vid_xxx","object":"generation.task","model":"seedance-2-5","status":"in_progress","progress":10,"created_at":1781577600}