Seedance 2.5 API
字節跳動 Seedance 2.5 影片生成模型的完整 API 參考。
模型變體
此 API 支援三種模型變體:
快速比較
支援的長寬比
文字生成影片和參考生成影片支援:
21:9, 16:9, 9:16, 1:1, 4:3, 3:4
圖像生成影片不支援 aspect_ratio 參數。
解析度選項
Seedance 2.5 文字生成影片
端點
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 圖像生成影片
請求參數
必填
選填
請勿在圖像生成影片請求中包含 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 參考生成影片
請求參數
必填
參考媒體
@ (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']
}
回應格式
初始回應
所有模型都會傳回用於輪詢的 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": {
"videos": [
{
"url": "https://example.com/generated-video.mp4"
}
]
}
}
}
狀態值
submitted:任務已接受,正在等待處理
processing:正在生成影片
succeed:影片生成完成
failed:影片生成失敗
處理時間
處理時間會因時長、解析度和目前佇列狀況而異。
每隔 5-10 秒輪詢一次以檢查狀態。
最佳實務
- 必填參數:一律提供
resolution 和 duration,並為文字生成影片和參考生成影片提供 aspect_ratio
- 圖像生成影片長寬比:請勿在圖像生成影片請求中傳送
aspect_ratio
- 參考影片:參考生成影片至少需要一個影片;每個影片和影片總時長都必須符合文件所述限制
- 參考圖像:提供參考影片時,圖像為選用項目;使用圖像時,請提交 1-30 個支援的圖像 URL
- 參考音訊:每個音訊片段須為 2-30 秒且不超過 15 MB,總時長不得超過 30 秒
- 參考順序:依預期順序排列
images、videos 和 audios,並在提示詞中保持一致的參考方式
- 聲音:省略
sound 可使用其預設值 true,或將其設為 false 以停用生成的聲音