MAGI-2 API Reference: Sand.ai Magi AI Video Endpoints & Schemas
Sand.ai's flagship 480B MAGI-2 exposes three canonical Magi AI video API model IDs on Atlas Cloud—`sand-ai/magi-2/text-to-video`, `sand-ai/magi-2/image-to-video`, and `sand-ai/magi-2/reference-to-video`—all submitted via `POST https://api.atlascloud.ai/api/v1/model/generateVideo` and reconciled via `GET /api/v1/model/prediction/{request_id}`. Every endpoint bills a flat $0.08/second wholesale (4–30s integer steps) with native audio and up to 20 Omni-References included.
- Base Origin
- https://api.atlascloud.ai
- Model Count
- 3 flagship endpoints
- Duration Range
- Integer 4–30s (step 1)
- Max Prompt
- 15,000 characters
Live Atlas Cloud OpenAPI endpoint schemas (verified 2026-12-02)
Imported directly from MagiAI Studio's canonical specification dataset (src/data/magi2-specs.ts). Every endpoint submits to POST https://api.atlascloud.ai/api/v1/model/generateVideo and polls GET /api/v1/model/prediction/{request_id}.
MAGI-2 Text-to-Video
Generates 4–30s 1080p @ 25fps video with synchronized single-pass dialogue, foley, and ambience directly from a timestamped director prompt up to 15,000 characters.
| Parameter | Type | Required | Constraints & Behavior |
|---|---|---|---|
| model | string | Required | Literal "sand-ai/magi-2/text-to-video" Canonical Atlas Cloud model identifier for flagship MAGI-2 T2V. |
| prompt | string | Required | 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. |
| duration | integer | Optional (5) | Integer 4–30 (1-second steps) Requested clip duration in seconds. Billed per integer second. |
| aspect_ratio | enum | Optional (16:9) | "16:9" | "9:16" | "21:9" | "4:3" | "3:4" | "1:1" Target 1080p-class framing ratio. |
{
"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)
Animates a start keyframe—and optional closing last_image keyframe—at 1080p @ 25fps with synchronized sound while preserving the start frame aspect ratio.
| Parameter | Type | Required | Constraints & Behavior |
|---|---|---|---|
| model | string | Required | Literal "sand-ai/magi-2/image-to-video" Canonical Atlas Cloud model identifier for flagship MAGI-2 I2V. |
| image | string | Required | Public HTTPS image URL or Base64 data URI (JPEG/PNG/WebP) Opening keyframe. Output aspect ratio automatically follows this image. |
| last_image | string | Optional | Public HTTPS image URL or Base64 data URI matching start aspect ratio Optional closing keyframe for guided start-to-end camera and subject transitions. |
| prompt | string | Required | 1–15,000 characters Motion, camera choreography, dialogue, foley, and lighting progression between keyframes. |
| duration | integer | Optional (5) | Integer 4–30 (1-second steps) Requested clip duration in seconds. Billed per integer second. |
{
"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)
Combines up to 20 multimodal assets (10 images, 5 videos <=30s combined, 5 audios <=30s combined) to lock identity, wardrobe, props, camera motion, and voice timbre across 4–30s takes.
| Parameter | Type | Required | Constraints & Behavior |
|---|---|---|---|
| model | string | Required | Literal "sand-ai/magi-2/reference-to-video" Canonical Atlas Cloud model identifier for flagship MAGI-2 Omni-Reference. |
| prompt | string | Required | 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. |
| duration | integer | Optional (5) | Integer 4–30 (1-second steps) Requested clip duration in seconds. Flat $0.08/s regardless of reference count. |
| aspect_ratio | enum | Optional (16:9) | "16:9" | "9:16" | "21:9" | "4:3" | "3:4" | "1:1" Target 1080p-class framing ratio. |
| images | string[] | Optional | Max 10 items (public HTTPS URLs or Base64) Identity portraits, product angles, wardrobe sheets, or set plates. |
| videos | string[] | Optional | Max 5 public HTTPS URLs; 2–30s each; combined duration <= 30s Camera movement, actor blocking, or performance pacing references. |
| audios | string[] | Optional | Max 5 public HTTPS URLs; 2–30s each; combined duration <= 30s Voice timbre samples, spoken stems, musical grooves, or foley beds. |
{
"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"
]
}Authentication, headers & base endpoints
All direct Atlas Cloud requests require HTTPS with `Authorization: Bearer <API_KEY>` and `Content-Type: application/json`. Responses wrap prediction metadata under a top-level `data` object (with defensive top-level fallback fields recommended in client parsers). MagiAI Studio's unified workspace exposes authenticated endpoints at `/api/jobs` (POST to reserve credits and dispatch, GET to reconcile status and retrieve ledger balance) and `/api/keys` for provisioning scoped `mgk_live_*` credentials.
| Operation | Method & URL | Success Status | Notes |
|---|---|---|---|
| Submit MAGI-2 Job (Atlas Direct) | POST https://api.atlascloud.ai/api/v1/model/generateVideo | 200 / 201 / 202 | Dispatches T2V, I2V, or Omni-Ref asynchronously; returns `data.id` |
| Poll Prediction (Atlas Direct) | GET https://api.atlascloud.ai/api/v1/model/prediction/{request_id} | 200 OK | Poll every 20–30s until `completed`, `succeeded`, `failed`, or `canceled` |
| Submit Job (MagiAI Studio) | POST https://magiai.ai/api/jobs | 201 Created | Validates prompt/refs, enforces `likenessConsent` on R2V, holds 10 cr/s atomically |
| List & Reconcile Jobs (MagiAI Studio) | GET https://magiai.ai/api/jobs | 200 OK | Polls open renders and posts automatic 100% credit refunds on failed/filtered jobs |
Field naming differences: Direct Atlas Cloud vs. MagiAI Studio `/api/jobs`
Keep two schema nuances top of mind when bridging MagiAI Studio jobs with raw Atlas Cloud calls: first, `sand-ai/magi-2/image-to-video` does **not** accept `aspect_ratio` (it always inherits the aspect ratio of the supplied opening `image`); second, MagiAI Studio's `/api/jobs` endpoint uses camelCase keys (`aspectRatio`, `lastImage`, `referenceImages`, `referenceVideos`, `referenceAudios`, `likenessConsent`) and translates them automatically to upstream provider payloads while tracking your unified credit wallet.
{
"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
}HTTP status codes & terminal prediction states
Always distinguish retryable transport errors (HTTP 429 rate/concurrency limits, HTTP 502/503/504 transient edge timeouts) from non-retryable payload errors (HTTP 400/422 invalid duration, >20 references, >30s combined reference video/audio duration, or HEIC images).
| Code / State | Meaning | Credit / Billing Effect | Client Action |
|---|---|---|---|
| processing / queued | Active on upstream 480B cluster | Debit hold active | Continue polling every 20–30s (7–26 min typical) |
| completed / succeeded + outputs[0] | 1080p @ 25fps MP4 ready | Hold finalized ($0.08/s / 10 cr/s) | Download MP4 immediately & archive to R2/S3 |
| completed + empty outputs[] | Output scrubbed by PG-13 safety filter | $0 upstream · 100% auto-refund | Mark `policy_filtered`, refund wallet, surface PG-13 edit tips |
| failed / canceled | Upstream error or moderation block | $0 upstream · 100% auto-refund | Inspect `error` message; revise prompt or assets before retrying |
| HTTP 402 | Insufficient wallet credits (MagiAI Studio) | No debit taken | Prompt user to top up non-expiring PAYG pack |
| HTTP 429 | Account concurrency or rate limit reached | No debit taken | Respect Retry-After / queue locally until active slot finishes |
Choosing an API host & multi-model routing architecture
Teams building directly against MAGI-2 can connect to first-party Sand.ai Direct (`platform.sand.ai`), Atlas Cloud (`atlascloud.ai`), WaveSpeedAI (`wavespeed.ai`), Runware (`runware.ai`), or Higgsfield API—all listing $0.08/s baseline rates as of 2026-12-02. If your backend orchestrates MAGI-2 alongside Kling 4.0, Seedance 2.5, Google Veo 3.1, and text LLMs under a single API key and unified invoice, multi-model developer gateways such as SpicyAPI (`https://spicyapi.ai`) eliminate maintaining separate SDK adapters for every provider. Note that neither fal.ai (still on roadmap per `r/fal`) nor Replicate hosts flagship 480B MAGI-2 as of 2026-12-02.
First-party MAGI-2 API ($0.08/s)
Verified live T2V/I2V/R2V REST schemas ($0.08/s)
Live MAGI-2 inference host ($0.08/s)
Live inference router (~$0.08/s)
Unified multi-model gateway combining MAGI-2 with Kling, Seedance, Veo & LLMs under one key