ByteDance Seedance 2.5 影片生成模型的完整 API 參考。
模型版本
此 API 支援三種模型版本:
快速比較
支援的長寬比
文字生成影片和參考素材生成影片支援:
21:9, 16:9, 9:16, 1:1, 4:3, 3:4
圖片生成影片不支援 aspect_ratio 參數。
解析度選項
Seedance 2.5 Text to Video
端點
POST /api/v1/video/task
請求參數
必填
選填
請求範例
const response = await fetch('https://api.flaq.ai/api/v1/video/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'seedance-v2.5-text-to-video',
prompt: 'A golden retriever running through a sunlit meadow',
resolution: '720p',
duration: 8,
aspect_ratio: '16:9',
sound: true
})
});
const { data } = await response.json();
const taskId = data.task_id;
Seedance 2.5 Image to Video
請求參數
必填
選填
圖片生成影片的請求中不要包含 aspect_ratio。此模型不支援該參數。
請求範例
{
model_name: 'seedance-v2.5-image-to-video',
image_url: 'https://example.com/first-frame.jpg',
image_end_url: 'https://example.com/last-frame.jpg',
prompt: 'Camera slowly pulls back to reveal the full landscape',
resolution: '720p',
duration: 8,
sound: true
}
Seedance 2.5 Reference to Video
請求參數
必填
參考素材
所有參考素材皆為選填。支援僅圖片、僅影片、僅音訊,以及沒有參考素材的請求。若不使用參考素材,建議使用文字生成影片。
@ (AT) 參照預留位置
@ (AT) 參照功能透過帶有編號的 <<<...>>> 預留位置,將參考素材與提示詞連結。每種素材類型各自從 1 開始編號,並依照對應陣列的順序:
例如,若第一張圖片是角色參考,第二張是場景參考,請在 prompt 中使用 <<<image_1>>> 指定角色,並使用 <<<image_2>>> 指定場景。每個預留位置都必須指向對應陣列中實際存在的項目。
選填
請求範例
{
model_name: 'seedance-v2.5-reference-to-video',
prompt: 'Use image one for the subject, video one for the movement, and audio one for the atmosphere',
resolution: '720p',
duration: 8,
aspect_ratio: '16:9',
sound: true,
images: ['https://example.com/subject-reference.jpg'],
videos: ['https://example.com/motion-reference.mp4'],
audios: ['https://example.com/atmosphere-reference.mp3']
}
@ (AT) 參考素材生成影片請求範例
{
model_name: 'seedance-v2.5-reference-to-video',
prompt: 'Place the explorer from <<<image_1>>> in the environment from <<<image_2>>>, following the camera movement in <<<video_1>>> and speaking with the reference voice from <<<audio_1>>>',
resolution: '720p',
duration: 10,
aspect_ratio: '16:9',
sound: true,
images: [
'https://example.com/explorer-reference.jpg',
'https://example.com/environment-reference.png'
],
videos: ['https://example.com/camera-movement-reference.mp4'],
audios: ['https://example.com/voice-reference.mp3']
}
素材限制
以下限制適用於本頁模型的首幀圖片、尾幀圖片和參考素材。
參考音訊與參考影片的總時長限制各自為 30 秒,分別計算。數量限制也各自獨立:最多 30 張圖片、10 段影片和 10 段音訊。加入影片不會減少允許的圖片數量。
所有模型皆預設使用 720p,但仍須提供 resolution。聲音開關預設為 true;此開關及參考音訊均不影響價格。
回應格式
初始回應
所有模型皆會傳回用於輪詢的 task_id:
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "submitted"
}
}
輪詢回應
輪詢 GET /api/v1/video/{taskId} 以查詢狀態:
{
"code": 0,
"message": "success",
"data": {
"task_id": "{task_id}",
"response_url": "https://api.flaq.ai/api/v1/video/{task_id}",
"task_status": "succeed",
"task_status_msg": null,
"task_result": {
"credit": 0.2,
"videos": [
{
"url": "https://example.com/generated-video.mp4"
}
]
}
}
}
狀態值
submitted: 任務已接受,等待處理
processing: 影片生成中
succeed: 影片生成完成
failed: 影片生成失敗
處理時間
處理時間因時長、解析度和目前佇列狀況而異。
每 5-10 秒輪詢一次以查詢狀態。
最佳實務
- 必填參數:務必提供
resolution 和 duration;文字生成影片和參考素材生成影片還須提供 aspect_ratio
- 圖片生成影片的比例:圖片生成影片請求不要傳送
aspect_ratio
- 參考影片:影片為選填;每段影片時長及影片總時長均須符合文件限制
- 參考圖片:圖片獨立於影片和音訊,為選填項目;最多提交 30 個支援格式的圖片 URL
- 參考音訊:每段音訊維持在 2-30 秒且不超過 15 MB,總時長不得超過 30 秒
- 參考素材順序:依照預期順序排列
images、videos 和 audios,並在提示詞中一致地參照
- 聲音:省略
sound 即使用預設值 true,設為 false 則停用聲音生成