Skip to main content
MAGIAI
核心 API 規格實測驗證 2026-12-02

MAGI-2 API 參考手冊:Sand.ai Magi AI 影片端點與結構規範

Sand.ai 旗艦級 480B MAGI-2 在 Atlas Cloud 上開放三個標準 Magi AI 影片 API 模型 ID——`sand-ai/magi-2/text-to-video`、`sand-ai/magi-2/image-to-video` 與 `sand-ai/magi-2/reference-to-video`——一律透過 `POST https://api.atlascloud.ai/api/v1/model/generateVideo` 提交任務,並透過 `GET /api/v1/model/prediction/{request_id}` 進行狀態核對。所有端點皆採批發價 $0.08/秒統一計費(4–30 秒整數級距),內含原生音軌及最多 20 組全能參考素材。

基礎來源網址
https://api.atlascloud.ai
端點數量
3 個旗艦端點
時長範圍
4–30 秒整數(步進 1 秒)
提示詞上限
15,000 字元

Atlas Cloud OpenAPI 即時端點結構 (2026-12-02)

MAGI-2 Text-to-Video

model: "sand-ai/magi-2/text-to-video"
$0.08/s
欄位型別必填限制與行為
modelstring必填
Literal "sand-ai/magi-2/text-to-video"
Canonical Atlas Cloud model identifier for flagship MAGI-2 T2V.
promptstring必填
1–15,000 characters
Structured director brief describing subjects, camera moves, lighting, timestamped shot cuts, dialogue lines, foley, and explicit "no music" if score is unwanted.
durationinteger選填 (5)
Integer 4–30 (1-second steps)
Requested clip duration in seconds. Billed per integer second.
aspect_ratioenum選填 (16:9)
"16:9" | "9:16" | "21:9" | "4:3" | "3:4" | "1:1"
Target 1080p-class framing ratio.
JSON 請求範例 (sand-ai/magi-2/text-to-video)
json
{
  "model": "sand-ai/magi-2/text-to-video",
  "prompt": "[00:00-00:04] Medium close-up in a rain-streaked diner booth under warm tungsten overhead lamps, slow 50mm dolly-in. A tired detective sets a chipped ceramic mug on Formica and says calmly: \"You left the ledger at Pier Nine.\" Audio: muffled rain on glass, ceramic clink, no music.",
  "duration": 4,
  "aspect_ratio": "16:9"
}

MAGI-2 Image-to-Video (First / Last Frame)

model: "sand-ai/magi-2/image-to-video"
$0.08/s
欄位型別必填限制與行為
modelstring必填
Literal "sand-ai/magi-2/image-to-video"
Canonical Atlas Cloud model identifier for flagship MAGI-2 I2V.
imagestring必填
Public HTTPS image URL or Base64 data URI (JPEG/PNG/WebP)
Opening keyframe. Output aspect ratio automatically follows this image.
last_imagestring選填
Public HTTPS image URL or Base64 data URI matching start aspect ratio
Optional closing keyframe for guided start-to-end camera and subject transitions.
promptstring必填
1–15,000 characters
Motion, camera choreography, dialogue, foley, and lighting progression between keyframes.
durationinteger選填 (5)
Integer 4–30 (1-second steps)
Requested clip duration in seconds. Billed per integer second.
JSON 請求範例 (sand-ai/magi-2/image-to-video)
json
{
  "model": "sand-ai/magi-2/image-to-video",
  "image": "https://assets.magiai.ai/examples/espresso-start.webp",
  "last_image": "https://assets.magiai.ai/examples/espresso-pour-end.webp",
  "prompt": "Macro 100mm locked push-in as tiger-striped espresso crema flows smoothly from a naked portafilter into a preheated stoneware demitasse. Steam rises against a dark slate background. Audio: pump hum, steady espresso drip, subtle ceramic resonance, no music.",
  "duration": 6
}

MAGI-2 Reference-to-Video (Omni-Reference)

model: "sand-ai/magi-2/reference-to-video"
$0.08/s
欄位型別必填限制與行為
modelstring必填
Literal "sand-ai/magi-2/reference-to-video"
Canonical Atlas Cloud model identifier for flagship MAGI-2 Omni-Reference.
promptstring必填
1–15,000 characters referencing @image_n, @video_n, @audio_n roles
Director brief explicitly binding each uploaded reference slot to its subject, motion, or audio role.
durationinteger選填 (5)
Integer 4–30 (1-second steps)
Requested clip duration in seconds. Flat $0.08/s regardless of reference count.
aspect_ratioenum選填 (16:9)
"16:9" | "9:16" | "21:9" | "4:3" | "3:4" | "1:1"
Target 1080p-class framing ratio.
imagesstring[]選填
Max 10 items (public HTTPS URLs or Base64)
Identity portraits, product angles, wardrobe sheets, or set plates.
videosstring[]選填
Max 5 public HTTPS URLs; 2–30s each; combined duration <= 30s
Camera movement, actor blocking, or performance pacing references.
audiosstring[]選填
Max 5 public HTTPS URLs; 2–30s each; combined duration <= 30s
Voice timbre samples, spoken stems, musical grooves, or foley beds.
JSON 請求範例 (sand-ai/magi-2/reference-to-video)
json
{
  "model": "sand-ai/magi-2/reference-to-video",
  "prompt": "Using the speaker in @image_1 wearing the linen jacket in @image_2 inside the sunlit studio from @image_3, match the natural voice timbre of @audio_1 and slow handheld framing of @video_1. [00:00-00:05] She holds the serum bottle toward camera and says clearly: \"Three drops after cleansing keeps winter redness calm all day.\" Audio: crisp room tone, soft glass click, no music.",
  "duration": 8,
  "aspect_ratio": "9:16",
  "images": [
    "https://assets.magiai.ai/examples/founder-portrait.webp",
    "https://assets.magiai.ai/examples/serum-bottle.webp",
    "https://assets.magiai.ai/examples/bathroom-vanity.webp"
  ],
  "videos": [
    "https://assets.magiai.ai/examples/handheld-framing-4s.mp4"
  ],
  "audios": [
    "https://assets.magiai.ai/examples/founder-voice-5s.wav"
  ]
}

身分驗證、標頭與基礎端點

所有直接向 Atlas Cloud 發起的請求皆須使用 HTTPS,並帶入 `Authorization: Bearer <API_KEY>` 與 `Content-Type: application/json`。回應內容會將預測中繼資料封裝於頂層 `data` 物件內(建議用戶端解析器同時保留頂層欄位的防禦性備援讀取)。MagiAI Studio 的統一工作區則提供需要驗證的 `/api/jobs` 端點(POST 用於預扣點數並派發任務,GET 用於核對狀態與查詢帳本餘額),以及用於簽發受限範圍 `mgk_live_*` 憑證的 `/api/keys`。

標準 HTTP 端點與計費語意
操作項目方法與網址成功狀態碼備註
送出 MAGI-2 任務(Atlas 直連)POST https://api.atlascloud.ai/api/v1/model/generateVideo200 / 201 / 202非同步派發文生影片、圖生影片或全能參考任務;回傳 `data.id`
輪詢預測狀態(Atlas 直連)GET https://api.atlascloud.ai/api/v1/model/prediction/{request_id}200 OK每 20–30 秒輪詢一次,直到回傳 `completed`、`succeeded`、`failed` 或 `canceled`
送出任務(MagiAI Studio)POST https://magiai.ai/api/jobs201 Created驗證提示詞與參考素材、於 R2V 強制檢查 `likenessConsent`,並原子化預扣 10 點/秒
列出並核對任務(MagiAI Studio)GET https://magiai.ai/api/jobs200 OK輪詢進行中的算圖任務,並對失敗或遭過濾的任務自動執行 100% 點數退款

欄位命名差異:Atlas Cloud 直連與 MagiAI Studio `/api/jobs`

在串接 MagiAI Studio 任務與原始 Atlas Cloud 呼叫時,請留意兩項結構細節:第一,`sand-ai/magi-2/image-to-video` **不**接受 `aspect_ratio` 參數(系統會固定繼承首張輸入 `image` 的長寬比);第二,MagiAI Studio 的 `/api/jobs` 端點採用駝峰式命名欄位(`aspectRatio`、`lastImage`、`referenceImages`、`referenceVideos`、`referenceAudios`、`likenessConsent`),並在追蹤統一信用點數錢包的同時,自動將其轉換為上游供應商所需的請求負載格式。

MagiAI Studio POST /api/jobs 請求負載(附帶肖像授權鎖定的全能參考模式)
json
{
  "mode": "reference-to-video",
  "prompt": "Using Mara (@image_1) in the diner booth (@image_2) with dry voice (@audio_1) and dolly pacing (@video_1): [00:00-00:05] She sets down the ceramic mug and says calmly: \"You left the ledger at Pier Nine.\" Audio: rain on glass, ceramic clink, no music.",
  "duration": 8,
  "aspectRatio": "16:9",
  "referenceImages": [
    "https://assets.magiai.ai/examples/founder-portrait.webp",
    "https://assets.magiai.ai/examples/diner-booth.webp"
  ],
  "referenceVideos": ["https://assets.magiai.ai/examples/handheld-framing-4s.mp4"],
  "referenceAudios": ["https://assets.magiai.ai/examples/founder-voice-5s.wav"],
  "likenessConsent": true
}
工程備註: 在 reference-to-video 模式下,除非 likenessConsent 明確設為 true 且至少提供一組參考素材槽位,否則 MagiAI Studio 將回傳 HTTP 400 予以拒絕。

HTTP 狀態碼與預測終止狀態

務必區分可重試的傳輸層錯誤(HTTP 429 速率/併發上限、HTTP 502/503/504 暫時性邊緣節點逾時)與不可重試的請求負載錯誤(HTTP 400/422 無效時長、超過 20 組參考素材、參考影片與音訊合計超過 30 秒,或使用 HEIC 格式影像)。

回應狀態碼與確定性用戶端恢復動作
狀態碼 / 狀態意義點數 / 計費影響用戶端處理動作
processing / queued正在上游 480B 叢集運算或排隊中預扣額度鎖定中持續每 20–30 秒輪詢一次(通常耗時 7–26 分鐘)
completed / succeeded + outputs[0]1080p @ 25fps MP4 成品已就緒正式結算預扣額度($0.08/秒 / 10 點/秒)立即下載 MP4 並歸檔轉存至 R2/S3
completed + empty outputs[]輸出結果遭 PG-13 安全過濾器清除上游計費 $0 · 自動全額退還 100% 點數標記為 `policy_filtered`、退還錢包餘額並顯示 PG-13 修改建議
failed / canceled上游錯誤或內容審核攔截上游計費 $0 · 自動全額退還 100% 點數檢查 `error` 訊息;調整提示詞或素材後再行重試
HTTP 402錢包信用點數不足(MagiAI Studio)未進行任何扣款引導使用者購買無期限的隨用隨付(PAYG)點數包
HTTP 429已達帳戶併發數或請求速率上限未進行任何扣款遵守 Retry-After 標頭,或於本地佇列排隊等待執行中槽位釋出

選擇 API 託管商與多模型路由架構

直接串接 MAGI-2 的團隊可選用第一方 Sand.ai Direct(`platform.sand.ai`)、Atlas Cloud(`atlascloud.ai`)、WaveSpeedAI(`wavespeed.ai`)、Runware(`runware.ai`)或 Higgsfield API——截至 2026-12-02,上述平台皆列出 $0.08/秒的基準費率。如果你的後端需要在單一 API 金鑰與統一帳單下同時編排 MAGI-2、Kling 4.0、Seedance 2.5、Google Veo 3.1 與文字 LLM,採用諸如 SpicyAPI(`https://spicyapi.ai`)等多模型開發者閘道,即可免去為各供應商個別維護 SDK 轉接器的負擔。請留意截至 2026-12-02,fal.ai(依 `r/fal` 討論串顯示仍在開發路線圖中)與 Replicate 皆尚未託管旗艦版 480B MAGI-2。

相關工程文件

MAGI-2 API 參考:Sand.ai Magi AI 影片端點規範