MAGI-2 API docs
Sand.aiThe MAGI-2 API on apimodels.app is one API key and one video endpoint for MAGI-2, the audio-video model from Sand.ai: it turns a prompt, a first and last frame, or up to 20 reference assets into a 4–30 second, 1080p, 25 fps clip with sound. The model id is simply magi-2, and the mode follows the fields you send. Billing is $0.10 per requested second with sound included, and failed or moderated generations are not charged.
Last updated: 2026-11-26
Precios
MAGI-2 has a single 1080p tier, so the price depends only on the seconds you request: $0.10 per second, with or without sound.
| Length | Price (1080p, sound included) |
|---|---|
| 4 s | $0.40 |
| 5 s (default) | $0.50 |
| 10 s | $1.00 |
| 30 s | $3.00 |
- Billed on duration, any whole number from 4 to 30: total = seconds × $0.10.
- Failed or moderated generations are not charged. An invalid request returns a 400 before any task is created and is not charged either.
- Result files are deleted after 30 days, so download or re-host them promptly.
Four input modes, picked from your fields
There is no separate image-to-video or reference model id: model is always magi-2. A first frame makes it image-to-video (add a last frame for first + last frame), reference assets make it reference-to-video, and neither makes it text-to-video. Frames and references cannot be combined in one request; mixing them returns a 400.
| Modo | Triggered by | Notas |
|---|---|---|
| Text-to-video | prompt only | prompt is required |
| Image-to-video (first frame) | first_frame_url | The clip opens on this image; prompt optional |
| First + last frame | first_frame_url + last_frame_url | The model fills in the motion between the two images; prompt optional |
| Reference-to-video | reference_image_urls / reference_video_urls / reference_audio_urls | Up to 10 images, 5 videos and 5 audio clips, at least one; prompt optional |
Create a task and poll for the result
POST /v1/video/generations is asynchronous: the create call returns a taskId, then you poll GET /v1/video/generations?task_id= until state is completed and read data.resultUrls[0]; or pass callback_url and we call your URL when the task ends.
curl -X POST https://api.apimodels.app/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2",
"prompt": "A street violinist plays under a railway bridge at dusk. A passing train rumbles overhead; she looks up and says, \"Right on time.\" Slow dolly in, warm sodium lights.",
"duration": 10,
"aspect_ratio": "16:9"
}'
# Response: a task is created
# { "code": 200, "msg": "success", "data": { "taskId": "clxxx", "state": "pending" } }
# Poll every 10-20 s until state is "completed" (or "failed")
curl "https://api.apimodels.app/v1/video/generations?task_id=TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
# { "code": 200, "data": { "state": "completed",
# "resultUrls": ["https://r2.apimodels.app/videos/clxxx.mp4"] } }- state has three values: pending (queued or generating), completed (success) and failed (terminal, not charged).
- MAGI-2 takes minutes, not seconds: in our test on 2026-11-25 a 4-second text-to-video clip completed 194 seconds after submission, as a 1920×1080, 25 fps MP4 with H.264 video and AAC stereo sound. That is one run, not a benchmark. At busy times jobs wait in a queue before they render, so poll every 10–20 seconds or use callback_url.
Three request examples
Each example is copy-paste ready; replace YOUR_API_KEY and the media URLs with your own.
1. Text-to-video (dialogue in quotes)
curl -X POST https://api.apimodels.app/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2",
"prompt": "A street violinist plays under a railway bridge at dusk. A passing train rumbles overhead; she looks up and says, \"Right on time.\" Slow dolly in, warm sodium lights.",
"duration": 10,
"aspect_ratio": "16:9"
}'2. First + last frame
curl -X POST https://api.apimodels.app/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2",
"prompt": "The flower bud on the windowsill opens petal by petal as morning light moves across the room; soft birdsong outside.",
"first_frame_url": "https://your-domain.com/bud.jpg",
"last_frame_url": "https://your-domain.com/bloom.jpg",
"duration": 6,
"aspect_ratio": "1:1"
}'3. Reference-to-video (images + video + audio)
curl -X POST https://api.apimodels.app/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2",
"prompt": "The woman from the reference images walks through the night market holding the red umbrella, matching the camera move of the reference video, to the rhythm of the reference track.",
"reference_image_urls": [
"https://your-domain.com/character-front.jpg",
"https://your-domain.com/red-umbrella.png"
],
"reference_video_urls": ["https://your-domain.com/camera-move.mp4"],
"reference_audio_urls": ["https://your-domain.com/beat.mp3"],
"duration": 12,
"aspect_ratio": "9:16",
"seed": 42
}'Parámetros de la solicitud
A MAGI-2 request takes only the fields below; switches it does not support (watermark, negative_prompt and so on) return a 400 instead of being silently ignored.
| Field | Required | Type | Description |
|---|---|---|---|
| model | Yes | string | "magi-2" |
| prompt | Text-to-video only | string | Up to 15,000 characters. Describe subject, action, camera and the sound you want; put dialogue in quotes. Optional when a first frame or references are sent |
| duration | No | integer | Whole seconds from 4 to 30, default 5. Billed for this many seconds |
| aspect_ratio | No | string | 21:9, 16:9, 4:3, 1:1, 3:4 or 9:16, default 16:9 |
| resolution | No | string | Only "1080p"; can be left out |
| generate_audio | No | boolean | Default true: dialogue, effects and music are generated with the picture. false returns a silent video at the same price |
| seed | No | integer | 0–4294967295; -1 or omitted means random |
| first_frame_url | No | string | First frame: an https link or a base64 data URI. image / image_url are accepted too |
| last_frame_url | No | string | Last frame; requires first_frame_url |
| reference_image_urls | No | string[] | Up to 10 reference images (characters, products, scenes or style), https links or base64 data URIs |
| reference_video_urls | No | string[] | Up to 5 reference videos, https links only; each 2–30 s, 30 s combined |
| reference_audio_urls | No | string[] | Up to 5 reference audio clips, https links only; each 2–30 s, 30 s combined |
| callback_url | No | string | Webhook URL called when the task ends; omit it and poll the GET endpoint instead |
Errors and failures
An invalid request returns a 400 before any task is created and is not charged; these are the most common MAGI-2 messages, verbatim.
| Status | Cuándo | Returned msg |
|---|---|---|
| 400 | duration outside 4–30 or not whole | duration must be a whole number of seconds from 4 to 30 |
| 400 | Unsupported aspect ratio | aspect_ratio must be one of 21:9, 16:9, 4:3, 1:1, 3:4, 9:16 |
| 400 | Frames mixed with references | first / last frame cannot be combined with reference images, videos or audio |
| 400 | Last frame without a first frame | last_frame_url requires first_frame_url |
| 400 | An http (not https) media link | first_frame_url must use https links |
| 400 | Reference clip too short or too long | each reference video must be 2–30 seconds long |
| 400 | Text-to-video without a prompt | prompt is required |
| 401 | Clave API ausente o no válida | — |
| 402 | Balance below the price of the clip | — |
| state: failed | Content review rejected it, or the generation failed | Not charged; adjust the input and retry |
Limits
- Output is 1080p at 25 fps only, with no 720p, 2K or 4K. Length is whole seconds from 4 to 30.
- Frames and references cannot be mixed; reference videos and audio take https links only, while images may also be base64.
- A clip takes minutes and can queue at busy times. If you need a result within a minute, a clip under 4 seconds, or 720p / 2K / 4K output, use another video model.
- Success is not 100%: content review or a failed generation can end a task, and failed tasks are not charged.
- Weak spots Sand.ai names itself: extreme high-speed motion, fine local motion in medium and wide 2D animation, and layered soundscapes.
Sources
Checked 2026-11-26; prices are apimodels.app prices, and model capabilities are as Sand.ai describes them.
Related
Preguntas frecuentes
How do I call the MAGI-2 API?
POST https://api.apimodels.app/v1/video/generations with model "magi-2", a prompt and a duration (whole seconds 4-30, default 5), using the same API key as every other model on apimodels.app. The call returns a taskId; poll GET /v1/video/generations?task_id=... until state is "completed" and read data.resultUrls[0], or pass callback_url. Add first_frame_url for image-to-video or reference_image_urls for reference-to-video; the mode follows the fields you send.
How much does the MAGI-2 API cost?
$0.10 per requested second at 1080p, with sound included: 4 seconds is $0.40, 5 seconds $0.50, 10 seconds $1.00 and 30 seconds $3.00. Turning sound off with generate_audio: false does not change the price. Failed or moderated generations are not charged, and an invalid request returns a 400 before any task is created.
Does the MAGI-2 API support image-to-video and first and last frame?
Yes. Send first_frame_url and the clip opens on that image; add last_frame_url and the model fills in the motion between the two. Frames can be https links or base64 data URIs. last_frame_url needs first_frame_url, and frames cannot be combined with reference assets in the same request (400).
How many reference images, videos and audio clips can MAGI-2 take?
Up to 10 images in reference_image_urls, 5 videos in reference_video_urls and 5 audio clips in reference_audio_urls, at least one in total. Each video or audio clip must be 2-30 seconds, and each type may total at most 30 seconds. Videos and audio take https links only; images may also be base64.
How long does a MAGI-2 video take to generate?
Plan for minutes. In our test on 2026-11-25 a 4-second text-to-video clip was ready 194 seconds after submission, as a 1920x1080, 25 fps MP4 with AAC stereo sound; that is one run, not a benchmark. At busy times jobs queue before they render, so poll every 10-20 seconds or use callback_url. If you need a clip within a minute, use another video model.