ToAPIsToAPIs
Wan2.6

Wan2.6 Flash 視頻生成

使用阿里雲萬相 Wan2.6 Flash 極速版生成視頻 — 支持圖生視頻和參考視頻,速度更快

POST
/v1/videos/generations

中國大陸用戶請注意: 中國大陸用戶請使用 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❌ 返回錯誤

認證

Authorizationstring請求頭必填

所有接口均需要使用 Bearer Token 進行認證

獲取 API Key:訪問 API Key 管理頁面 獲取您的 API Key

使用時在請求頭中添加:

Authorization: Bearer YOUR_API_KEY

請求參數

modelstring請求體必填

視頻生成模型名稱,固定爲 wan2.6-flash

image_urlsstring[]請求體

參考圖片 URL 數組(圖生視頻模式,僅支持 1 張圖片)

與 metadata.reference_urls 二選一必填

⚠️ 僅支持 URL 格式(不再支持 base64)

  • 公開可訪問的圖像 URL(http:// 或 https://)
  • 可使用 上傳圖片接口 上傳本地圖片獲取 URL

示例:["https://example.com/image.jpg"]

promptstring請求體

視頻內容描述(可選)

描述期望的動作或風格,幫助模型理解生成意圖

示例:"畫面中的人物動了起來,向鏡頭微笑"

resolutionstring請求體預設值: 1080p

視頻分辨率

可選值:

  • 720p - 標清
  • 1080p - 高清(默認)

默認值:1080p

不同分辨率計費不同,請參考模型市場價格

durationinteger請求體預設值: 5

視頻時長(秒)

支持:5、10、15

默認值:5

audioboolean請求體預設值: true

是否生成有聲視頻

  • true - 生成有聲視頻(默認)
  • false - 生成無聲視頻

⚠️ 有聲/無聲計費標準不同,請確認後選擇

默認值:true

watermarkboolean請求體

在生成的視頻上添加阿里雲水印

metadataobject請求體

擴展參數

展開查看 metadata 字段
reference_urlsstring[]請求體

參考視頻(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 元/秒

響應

idstring

唯一任務標識符,用於後續查詢狀態

objectstring

對象類型,固定爲 generation.task

modelstring

使用的模型名稱

statusstring

任務狀態

  • queued - 排隊等待
  • in_progress - 處理中
  • completed - 成功完成
  • failed - 失敗
progressinteger

任務進度百分比(0-100)

created_atinteger

任務創建時間戳(Unix 時間戳)

metadataobject

任務元數據

使用場景

場景一:圖生視頻(有聲)

{
  "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": {}
}