MAGI-2 API Reference

MAGI-2 is served through REST APIs that all share one shape: you POST a JSON body with a prompt, get a task id back, then poll until the video is ready. This page covers the endpoints, the request shape, and the real cost of a call; every parameter and its valid values live on the parameters reference.

Three task endpoints

Task What you send What you get
Text to video a prompt a 1080p, 25fps clip with synchronized audio
Image to video a prompt plus one or more stills the stills animated into a clip, audio included
Reference to video a prompt plus up to 10 images, 5 videos, 5 audio files a clip that keeps your characters, products, and voices consistent

The reference endpoint is the one worth planning around. That reference set — up to 20 media items in one request — is how you keep a face, a logo, or a jacket color stable across a 30-second spot. For the text that goes with it — how to label and scope each file — see MAGI-2 reference prompts.

Request parameters

Parameter Default
prompt required
aspect_ratio 16:9
duration 5
generate_audio true
seed random

Those are the defaults hosted platforms document. On Sand AI's own API, duration and aspectRatio are required rather than optional. Three details trip people up:

  • duration is a whole number of seconds from 4 to 30 — and the platform you pick may cap it lower.
  • Resolution and frame rate are not choices. The model outputs 1080p at 25fps; where a resolution field exists, 1080p is its only value.
  • prompt can run to 15,000 characters.

Full descriptions are on the MAGI-2 parameters reference.

Submit, then poll

Generation is asynchronous, and processing time varies with clip length and demand — WaveSpeed's docs say as much, and Sand AI's own guidance is to poll about every 10 seconds. Do not hold an HTTP connection open waiting for the result.

# 1. submit
curl -X POST "https://api.example.com/magi-2/text-to-video" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "...", "aspect_ratio": "16:9", "duration": 10, "generate_audio": true}'
# -> {"id": "task_8f21", "status": "queued"}

# 2. poll
curl "https://api.example.com/tasks/task_8f21" -H "Authorization: Bearer $API_KEY"
# -> {"status": "completed", "output": {"video_url": "..."}}

The host name and paths come from whichever provider you use. The body above is the shape hosted platforms such as Higgsfield and WaveSpeed document. Sand AI's own API spells the same settings in camelCase — aspectRatio, generateAudio, plus enhancePrompt to switch prompt enhancement on or off — and sends the prompt and any reference media as items in a parts array. Poll about every 10 seconds, treat a task as failed only after the provider's own timeout, and download the file rather than hotlinking the temporary URL — on Sand AI's API the download link is valid for 60 minutes.

What a call really costs

Sand AI lists MAGI-2 at $0.08 per second of output — $0.80 for a 10-second clip — with audio included and no change for aspect ratio. One trap to handle in code: creating a generation is not idempotent, so resubmitting after a timeout can start a second billable task. The full price table, per-platform notes, and batch math are on the MAGI-2 pricing calculator; the prompt generator builds the caption before you spend anything.

Open weights versus hosted API

Sand AI ships the preview weights openly, so you can also run MAGI-2 yourself on your own GPU. The trade is straightforward: self-hosting removes per-second charges but the preview checkpoint renders a fixed 10-second clip at 1088x1920, with no 30-second option and no aspect-ratio choice. If your product needs varying durations or the full reference set, the hosted API is the shorter path. For the full comparison — parameters, hardware, and when self-hosting pays off — see MAGI-2 Preview.

Failure modes worth handling

  • Duration rejected. Higgsfield and WaveSpeed both document 4 to 30 seconds; another host may expose less. Read the error and clamp to your provider's range.
  • Prompt too long. 15,000 characters is generous, but generated captions can blow past it if you concatenate blindly.
  • Silent video when you expected sound. You sent generate_audio as a string ("false") instead of a boolean.
  • Nothing happens for a while. Generation takes minutes, not seconds, and the time varies with clip length and demand. Keep polling instead of resubmitting — a resubmission can start a second billable task.

Written and last checked 26 November 2026. API details change — verify field names against your provider's docs before shipping.

Frequently asked questions

How long does one MAGI-2 API call take?
It varies with clip length and demand, so treat the call as asynchronous: submit, get a task id, then poll — Sand AI suggests every 10 seconds — instead of holding a connection open.
How much does a MAGI-2 API call cost?
Sand AI lists $0.08 per second of output: $0.40 for 5 seconds, $0.80 for 10 seconds, $2.40 for 30. Hosts such as Higgsfield and WaveSpeed quote the same rate, and turning audio off does not change it.
What is the reference-to-video endpoint for?
It accepts up to 10 images, 5 videos, and 5 audio files alongside the prompt, so a character, product, or voice stays consistent across a clip. That is up to 20 media items in one request, and it runs on the hosted flagship — not on the open-source preview.
Can I self-host MAGI-2 instead of paying per second?
Yes, the preview weights are open. But the preview checkpoint renders a fixed 10-second clip at 1088x1920 with no aspect-ratio choice, so hosted APIs are the shorter path if you need 30-second output or reference assets.
What is the maximum prompt length?
15,000 characters. Structure matters more than length: match how many actions you describe to the duration you request.
Is there a free tier?
Not on Sand AI's own platform: it lists magi-2 at a flat $0.08 per second, and when we checked on 26 November 2026 top-ups were not yet supported there. Hosted platforms set their own trial terms — one we checked gives new accounts a few free credits — so look at the platform you plan to use.
Can I get a watermark-free file?
We found no watermark policy in the documentation of Sand AI, Higgsfield, or WaveSpeed, so check your provider's terms if a clean file matters for your use.
Can I run MAGI-2 commercially?
Check the license that ships with the open weights — the preview is Apache 2.0 — and your provider's terms; they are two separate documents.