APIMaster.ai

MAGI-2 影片 API

以文字、首尾影格或多模態參考素材生成 1080p 影片,預設產生同步音軌。

MAGI-2 影片 API

以文字、首尾影格或多模態參考素材生成 1080p 影片,預設產生同步音軌。

提交與下載

在控制台建立 API Key,以 Bearer 驗證提交 JSON,保存任務 ID 並查詢同一任務直到完成或失敗。單次查詢逾時不會停止任務。以同一把 Key 下載 MP4。

API Key 控制台

curl --fail-with-body "https://apimaster.ai/v1/videos/generations" \
  -H "Authorization: Bearer $APIMASTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: magi2-cup-001" \
  -d '{"model":"magi-2","prompt":"A slow camera move toward a ceramic cup in soft daylight.","duration":5,"aspect_ratio":"16:9"}'
{"id":"task_…","task_id":"task_…","object":"video","model":"magi-2","status":"queued"}
TASK_ID="task_..."

curl --fail-with-body "https://apimaster.ai/v1/videos/$TASK_ID" \
  -H "Authorization: Bearer $APIMASTER_API_KEY"

curl --fail-with-body --location "https://apimaster.ai/v1/videos/$TASK_ID/content" \
  -H "Authorization: Bearer $APIMASTER_API_KEY" -o magi-2.mp4

queued → in_progress → completed / failed

生成模式

文字轉影片

{"model":"magi-2","prompt":"A blue cup on a table. Slow camera push in with quiet room tone.","duration":4,"generate_audio":true}

首尾影格

{"model":"magi-2","prompt":"Move from the first composition to the final composition.","first_frame_image":"https://example.com/start.jpg","last_frame_image":"https://example.com/end.jpg","aspect_ratio":"auto","generate_audio":false}

多模態參考

{
  "model": "magi-2",
  "prompt": "Use the image for appearance, the clip for camera movement and the audio for mood.",
  "duration": 6,
  "omni_reference_task_type": "reference",
  "image_with_roles": [{"url": "https://example.com/object.jpg", "role": "reference_image"}],
  "video_urls": ["https://example.com/camera.mp4"],
  "audio_urls": ["https://example.com/room-tone.mp3"]
}

請使用無需授權即可下載的公開 HTTP(S) 直連網址。素材僅用於引導生成。介面不支援編輯、延長或中間關鍵影格。

參數

欄位 型別 規則
model string magi-2
prompt string 所有模式都必填,最多 15,000 字元。
duration / seconds integer 輸出 4–30 整數秒,預設 5 秒。兩個欄位同時傳入時必須一致。
resolution string 僅支援 1080p,可省略。
aspect_ratio string 文字與參考模式預設 16:9,也支援 9:16、1:1、4:3、3:4 和 21:9。影格模式可省略或設 auto 以跟隨首影格,且不支援 21:9。
generate_audio / audio boolean 預設生成音軌。兩個欄位同時使用時必須一致。參考音訊請用 audio_urls。
nsfw_check boolean 可在提交前審核提示詞與輸入圖片,預設 false。
seed integer 省略或設 -1 表示隨機。固定種子為 0–2147483647 的整數,結果仍可能不同。
omni_reference_task_type string 可選 auto 或 reference。影片、音訊或 reference_image 角色會自動切換至參考模式。僅提供 image_urls 作為參考圖時須明確指定 reference。
image_urls string[] 影格模式可傳 1–2 張。參考模式與 reference_image 角色合計最多 10 張。
first_frame_image / last_frame_image string 與 image_urls 擇一。指定尾影格時必須提供首影格。
image_with_roles object[] 每項包含 url 和 role,支援 first_frame、last_frame 或 reference_image。
video_urls / audio_urls string[] 影片和音訊各最多 5 段,每段 2–30 秒,各類合計不超過 30 秒。

計費與錯誤

Sand AI 基礎價為每請求輸出秒 0.08 美元,5 秒為 0.40 美元。音軌、參考素材和畫面比例不改變基礎價。提交被拒或生成失敗不收費。失敗時讀取 message / error.message。提交逾時後沿用同一 Idempotency-Key 與相同請求內容。

Sand AI