Wan 3.0 API
阿里巴巴 Wan 3.0 影片生成模型的完整 API 參考文件。
模型變體
此 API 支援四種模型變體:
快速比較
共用端點
所有 Wan 3.0 變體皆使用影片任務端點:
POST /api/v1/video/task
共用參數
必填
選填
Wan 3.0 文字轉影片
將 model_name 設為 "wan-3.0-text-to-video",並提供共用的必填參數。
請求範例
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-3.0-text-to-video',
prompt: 'A cinematic tracking shot follows a cyclist through a rain-soaked neon city at night',
duration: 8,
resolution: '1080p',
aspect_ratio: '16:9',
sound: true,
seed: 42
})
});
const { data } = await response.json();
const taskId = data.task_id;
Wan 3.0 圖像轉影片
必填圖像輸入
兩張圖像皆須採用 JPEG、JPG、無 Alpha 色版的 PNG、BMP 或 WEBP 格式。每張圖像各邊的長度必須介於 240 至 8000 像素。
請求範例
{
model_name: 'wan-3.0-image-to-video',
prompt: 'The camera glides forward as daylight gradually shifts into a warm evening glow',
image_url: 'https://example.com/start-frame.jpg',
image_end_url: 'https://example.com/end-frame.jpg',
duration: 8,
resolution: '1080p',
aspect_ratio: '16:9',
sound: true,
seed: 42
}
Wan 3.0 影片編輯
必填影片輸入
來源影片時長加上請求的輸出 duration 不得超過 30 秒。
請求範例
{
model_name: 'wan-3.0-video-edit',
prompt: 'Turn the daytime scene into a rainy evening while preserving the subject and camera movement',
video_url: 'https://example.com/source-video.mp4',
duration: 10,
resolution: '1080p',
aspect_ratio: '16:9',
sound: true,
seed: 42
}
Wan 3.0 參考生成影片
參考輸入為選填項目,且可組合使用,但 files 與 links 不可同時提交。
選填參考輸入
請求範例
{
model_name: 'wan-3.0-reference-to-video',
prompt: 'Use the references to create a cinematic product launch with coordinated motion and sound',
duration: 12,
resolution: '1080p',
aspect_ratio: '16:9',
sound: true,
images: ['https://example.com/product-reference.jpg'],
videos: ['https://example.com/motion-reference.mp4'],
audios: ['https://example.com/sound-reference.mp3'],
links: ['https://example.com/public-creative-brief'],
seed: 42
}
若要使用參考檔案而非網頁,請省略 links,並在 files 中傳入單一 URL。
回應格式
初始回應
所有模型皆會傳回用於輪詢的 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:影片生成失敗
最佳實務
- 提示詞說明:清楚描述主體、動作、鏡頭運動、節奏、環境和聲音意圖。
- 圖像輸入:使用符合請求長寬比的起始影格、結束影格與參考圖像。PNG 圖像不得包含 Alpha 色版。
- 影片編輯時長:選擇請求的輸出時長前,請先檢查來源影片時長,確保兩者合計不超過 30 秒。
- 參考內容限制:提交前,請驗證每組參考內容的數量、格式、尺寸及合計時長。
- 檔案和連結:僅提交一個參考檔案或一個公開網頁連結,切勿在同一請求中同時提交兩者。