ToAPIsToAPIs
Muse Video

Muse Video 影片生成

透過文字提示詞或最多 9 張參考圖生成 720p 有聲 MP4 影片, 時長 2-10 秒

POST
/v1/videos/generations

中國大陸用戶請注意: 中國大陸用戶請使用 https://toapis.cn 作為 API 端點(Base URL)。文件範例中的 https://toapis.com 請替換為 https://toapis.cn。

  • 模型名稱:muse-video
  • 文生影片與參考圖生影片由 image_urls 是否傳入自動區分,沒有模式參數
  • 輸出為 720p 有聲 MP4,時長 2-10 秒,按秒計費
  • 非同步任務介面,提交後回傳統一的 generation.task

不支援首尾幀控制、參考影片/音訊、quality、seed 以及高於 720p 的解析度。audio 無法關閉,生成影片始終帶聲音。

認證

Authorizationstring請求頭必填

所有介面均需使用 Bearer Token 認證。

Authorization: Bearer YOUR_API_KEY

請求參數

modelstring請求體必填預設值: muse-video

影片生成模型名稱,固定為 muse-video。

promptstring請求體必填

影片內容描述。建議明確描述主體、動作、場景、鏡頭、風格與聲音要求。支援中英文提示詞。

durationinteger請求體預設值: 10

影片時長(秒),支援 2-10 的整數值。

resolutionstring請求體預設值: 720p

輸出解析度。僅支援 720p,傳入其他值會被上游拒絕。

aspect_ratiostring請求體預設值: 16:9

輸出影片寬高比。

可選值:1:1、16:9、9:16、4:3、3:4、3:2、2:3。

參考圖請求中省略該參數時,輸出比例跟隨參考圖。

image_urlsstring[]請求體

參考圖 URL 陣列,最多 9 張。支援 URL、Data URI 與 base64 輸入;所有圖片合計不得超過 11 MiB。

  • 不傳或傳空陣列為文生影片
  • 傳入一張或多張圖片為參考圖生影片
ninteger請求體預設值: 1

生成影片數量。僅支援 1。

client_business_idstring請求體

你的業務識別碼,例如訂單號或交易 ID。可透過同一狀態查詢介面用該值查詢任務。

callback_urlstring請求體

ToAPIs 任務完成回調位址。需先配置 Token URL 與簽名金鑰,詳見 任務 Webhook。

metadataobject請求體

轉發給上游模型的可選參數。

欄位說明
nsfw_checkboolean請求體

生成前對請求執行內容審核。

languagestring請求體

上游 webhook 錯誤訊息的語言。

輸入模式

模式請求方式aspect_ratio
文生影片僅 prompt指定比例,預設 16:9
參考圖生影片prompt + image_urls(1-9 張)指定比例,或省略跟隨參考圖

請求範例

文生影片

{
  "model": "muse-video",
  "prompt": "一位旅客走進霓虹燈下的車站,鏡頭向前推進,只有環境音",
  "duration": 10,
  "resolution": "720p",
  "aspect_ratio": "16:9"
}

參考圖生影片

{
  "model": "muse-video",
  "prompt": "圖中的瓶身在棚拍燈光下緩慢旋轉,保持瓶形與標籤一致",
  "duration": 6,
  "aspect_ratio": "9:16",
  "image_urls": [
    "https://example.com/bottle-front.png",
    "https://example.com/bottle-side.png"
  ]
}

回應

idstring

ToAPIs 任務 ID,用於查詢任務狀態。

objectstring

物件類型,固定為 generation.task。

modelstring

本次請求使用的模型,固定為 muse-video。

statusstring

任務狀態:queued、in_progress、completed 或 failed。

progressinteger

任務進度百分比,取值 0-100。

created_atinteger

任務建立時間,Unix 秒級時間戳。

提交後輪詢 查詢影片任務狀態。任務完成後,影片位址位於 result.data[0].url。

請求示例

curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "muse-video",
    "prompt": "海浪在日落時分輕輕拍打沙灘,鏡頭緩慢平移,自然海聲",
    "duration": 10,
    "resolution": "720p",
    "aspect_ratio": "16:9"
  }'
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "muse-video",
    "prompt": "圖中的產品在棚拍燈光下緩慢旋轉",
    "duration": 6,
    "aspect_ratio": "9:16",
    "image_urls": [
      "https://example.com/front.png",
      "https://example.com/side.png"
    ]
  }'
import requests

response = requests.post(
    "https://toapis.com/v1/videos/generations",
    headers={
        "Authorization": "Bearer your-ToAPIs-key",
        "Content-Type": "application/json",
    },
    json={
        "model": "muse-video",
        "prompt": "圖中的產品在棚拍燈光下緩慢旋轉",
        "duration": 6,
        "aspect_ratio": "9:16",
        "image_urls": [
            "https://example.com/front.png",
            "https://example.com/side.png",
        ],
    },
)

print(response.json())
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: "muse-video",
    prompt: "圖中的產品在棚拍燈光下緩慢旋轉",
    duration: 6,
    aspect_ratio: "9:16",
    image_urls: [
      "https://example.com/front.png",
      "https://example.com/side.png"
    ]
  })
});

console.log(await response.json());

響應示例

{
  "id": "vid_01M840FXWTM23BKN1JR68C5XEM",
  "object": "generation.task",
  "model": "muse-video",
  "status": "queued",
  "progress": 0,
  "created_at": 1795431069
}