Wan 2.6 API
阿里巴巴 Wan 2.6 影片生成模型的完整 API 參考文件。
模型變體
此 API 支援兩種模型變體:
快速對比
Wan 2.6 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: 'wan-2.6-text-to-video',
prompt: 'A cat playing with a ball of yarn',
duration: 5,
resolution: '1080p'
})
});
const { data } = await response.json();
const taskId = data.task_id;
Wan 2.6 Image to Video
請求參數
必填參數
可選參數
請求示例
{
model_name: 'wan-2.6-image-to-video',
image_url: 'https://example.com/image.jpg',
prompt: 'Gentle camera pan from left to right',
duration: 5,
resolution: '1080p'
}
回應格式
初始回應
兩種模型都回傳用於輪詢的 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"
}
}
輪詢回應
輪詢 /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: 影片生成失敗
處理時間
典型處理時間:2-5 分鐘,取决于時長和解析度设置。
较長的影片(10-15 秒)可能需要最多 8 分鐘。
最佳實踐
- 說明場景和運動:在提示詞中同時包含場景內容和鏡頭運動
- 解析度選擇:使用 720p 以加快處理速度,使用 1080p 以獲得最高品質
- 時長规划:较長的影片消耗更多费用(按秒计费)
- 音訊集成:可以透過
audio_url 參數添加自定义音訊
- 圖像品質:对于圖像到影片,使用高品質輸入圖像以獲得最佳效果
使用案例示例
产品演示影片
{
model_name: 'wan-2.6-text-to-video',
prompt: 'Smooth 360-degree rotation of a luxury watch on a pedestal',
duration: 8,
resolution: '1080p'
}
動畫肖像
{
model_name: 'wan-2.6-image-to-video',
image_url: 'portrait.jpg',
prompt: 'Subtle head movement, natural breathing, soft smile',
duration: 5,
resolution: '1080p'
}
带音訊的場景
{
model_name: 'wan-2.6-text-to-video',
prompt: 'Ocean waves crashing on a beach at sunset',
duration: 10,
resolution: '1080p',
audio_url: 'https://example.com/ocean-sounds.mp3'
}