curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "wan2.6-flash",
"image_urls": ["https://example.com/photo.jpg"],
"prompt": "畫面中的人活躍起來",
"resolution": "1080p",
"duration": 5,
"audio": true
}'
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "wan2.6-flash",
"prompt": "角色在沙發上看電影",
"metadata": {
"reference_urls": ["https://cdn.example.com/ref-character.mp4"]
},
"resolution": "1080p",
"duration": 5,
"audio": true
}'
import requests
response = requests.post(
"https://toapis.com/v1/videos/generations",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json"
},
json={
"model": "wan2.6-flash",
"image_urls": ["https://example.com/photo.jpg"],
"prompt": "畫面中的人活躍起來",
"resolution": "1080p",
"duration": 5,
"audio": True
}
)
task = response.json()
print(f"Task ID: {task['id']}")
print(f"Status: {task['status']}")
const response = await fetch('https://toapis.com/v1/videos/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'wan2.6-flash',
image_urls: ['https://example.com/photo.jpg'],
prompt: '畫面中的人活躍起來',
resolution: '1080p',
duration: 5,
audio: true
})
});
const task = await response.json();
console.log(`Task ID: ${task.id}`);
console.log(`Status: ${task.status}`);
{
"id": "video_01K2ABJPQ9A0Z6JZ3V8M9W6PZ",
"object": "generation.task",
"model": "wan2.6-flash",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}
Wan2.6
Wan2.6 Flash 視頻生成
使用阿里雲萬相 Wan2.6 Flash 極速版生成視頻 — 支持圖生視頻和參考視頻,速度更快
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": "wan2.6-flash",
"image_urls": ["https://example.com/photo.jpg"],
"prompt": "畫面中的人活躍起來",
"resolution": "1080p",
"duration": 5,
"audio": true
}'
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "wan2.6-flash",
"prompt": "角色在沙發上看電影",
"metadata": {
"reference_urls": ["https://cdn.example.com/ref-character.mp4"]
},
"resolution": "1080p",
"duration": 5,
"audio": true
}'
import requests
response = requests.post(
"https://toapis.com/v1/videos/generations",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json"
},
json={
"model": "wan2.6-flash",
"image_urls": ["https://example.com/photo.jpg"],
"prompt": "畫面中的人活躍起來",
"resolution": "1080p",
"duration": 5,
"audio": True
}
)
task = response.json()
print(f"Task ID: {task['id']}")
print(f"Status: {task['status']}")
const response = await fetch('https://toapis.com/v1/videos/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'wan2.6-flash',
image_urls: ['https://example.com/photo.jpg'],
prompt: '畫面中的人活躍起來',
resolution: '1080p',
duration: 5,
audio: true
})
});
const task = await response.json();
console.log(`Task ID: ${task.id}`);
console.log(`Status: ${task.status}`);
{
"id": "video_01K2ABJPQ9A0Z6JZ3V8M9W6PZ",
"object": "generation.task",
"model": "wan2.6-flash",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}
中國大陸用戶請注意: 中國大陸用戶請使用
https://toapis.cn 作為接口地址(Base URL)。文檔示例中的 https://toapis.com 請替換為 https://toapis.cn。- 阿里雲萬相極速版視頻生成模型
- 支持圖生視頻(Image-to-Video)和參考視頻(Reference Video,r2v)兩種模式
- 不支持純文本生成(必須提供圖片或參考視頻 URL)
- 支持 720p/1080p 分辨率,有聲/無聲選項(影響計費)
- 生成速度更快,適合快速預覽和迭代
必須提供圖片或參考視頻 URL:
image_urls(圖生視頻)和 metadata.reference_urls(參考視頻)必須提供其中之一,否則接口將返回錯誤。路由邏輯
服務端根據請求參數自動選擇上游模型:| 提供的參數 | 上游模式 |
|---|---|
metadata.reference_urls(視頻 URL) | 參考視頻極速版(r2v-flash) |
image_urls(圖片) | 圖生視頻極速版(i2v-flash) |
僅 prompt | ❌ 返回錯誤 |
認證
string
必填
所有接口均需要使用 Bearer Token 進行認證獲取 API Key:訪問 API Key 管理頁面 獲取您的 API Key使用時在請求頭中添加:
Authorization: Bearer YOUR_API_KEY
請求參數
string
必填
視頻生成模型名稱,固定爲
wan2.6-flashstring[]
參考圖片 URL 數組(圖生視頻模式,僅支持 1 張圖片)與
metadata.reference_urls 二選一必填⚠️ 僅支持 URL 格式(不再支持 base64)- 公開可訪問的圖像 URL(http:// 或 https://)
- 可使用 上傳圖片接口 上傳本地圖片獲取 URL
["https://example.com/image.jpg"]string
視頻內容描述(可選)描述期望的動作或風格,幫助模型理解生成意圖示例:
"畫面中的人物動了起來,向鏡頭微笑"string
預設值:"1080p"
視頻分辨率可選值:
720p- 標清1080p- 高清(默認)
1080p不同分辨率計費不同,請參考模型市場價格integer
預設值:"5"
視頻時長(秒)支持:
5、10、15默認值:5boolean
預設值:"true"
是否生成有聲視頻
true- 生成有聲視頻(默認)false- 生成無聲視頻
trueboolean
在生成的視頻上添加阿里雲水印
object
擴展參數
顯示 展開查看 metadata 字段
顯示 展開查看 metadata 字段
string[]
參考視頻(r2v)模式 — 參考視頻 URL 數組當提供此字段時,服務端路由到參考視頻極速上游(wan2.6-r2v-flash)。模型將參考這些視頻生成具有一致角色或場景的新視頻。
- 每個條目必須是公開可訪問的視頻 URL(http:// 或 https://)
["https://cdn.example.com/ref1.mp4"]注意: 不能與 image_urls 同時使用有聲 vs 無聲計費說明
| 模式 | 720p 單價 | 1080p 單價 |
|---|---|---|
有聲(audio: true) | 0.3 元/秒 | 0.5 元/秒 |
無聲(audio: false) | 0.15 元/秒 | 0.25 元/秒 |
響應
string
唯一任務標識符,用於後續查詢狀態
string
對象類型,固定爲
generation.taskstring
使用的模型名稱
string
任務狀態
queued- 排隊等待in_progress- 處理中completed- 成功完成failed- 失敗
integer
任務進度百分比(0-100)
integer
任務創建時間戳(Unix 時間戳)
object
任務元數據
使用場景
場景一:圖生視頻(有聲)
{
"model": "wan2.6-flash",
"image_urls": ["https://example.com/photo.jpg"],
"prompt": "畫面中的人活躍起來",
"resolution": "1080p",
"duration": 5,
"audio": true
}
場景二:圖生視頻(無聲,降低成本)
{
"model": "wan2.6-flash",
"image_urls": ["https://example.com/photo.jpg"],
"resolution": "720p",
"duration": 5,
"audio": false
}
場景三:參考視頻(r2v-flash)
{
"model": "wan2.6-flash",
"prompt": "角色在沙發上看電影",
"metadata": {
"reference_urls": ["https://cdn.example.com/ref-character.mp4"]
},
"resolution": "1080p",
"duration": 5,
"audio": true
}
查詢任務結果視頻生成爲異步任務。提交後返回
task_id,使用 獲取視頻任務狀態 接口查詢生成進度和結果。curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "wan2.6-flash",
"image_urls": ["https://example.com/photo.jpg"],
"prompt": "畫面中的人活躍起來",
"resolution": "1080p",
"duration": 5,
"audio": true
}'
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "wan2.6-flash",
"prompt": "角色在沙發上看電影",
"metadata": {
"reference_urls": ["https://cdn.example.com/ref-character.mp4"]
},
"resolution": "1080p",
"duration": 5,
"audio": true
}'
import requests
response = requests.post(
"https://toapis.com/v1/videos/generations",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json"
},
json={
"model": "wan2.6-flash",
"image_urls": ["https://example.com/photo.jpg"],
"prompt": "畫面中的人活躍起來",
"resolution": "1080p",
"duration": 5,
"audio": True
}
)
task = response.json()
print(f"Task ID: {task['id']}")
print(f"Status: {task['status']}")
const response = await fetch('https://toapis.com/v1/videos/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'wan2.6-flash',
image_urls: ['https://example.com/photo.jpg'],
prompt: '畫面中的人活躍起來',
resolution: '1080p',
duration: 5,
audio: true
})
});
const task = await response.json();
console.log(`Task ID: ${task.id}`);
console.log(`Status: ${task.status}`);
{
"id": "video_01K2ABJPQ9A0Z6JZ3V8M9W6PZ",
"object": "generation.task",
"model": "wan2.6-flash",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}