MAGI-2 AI Video
Generate 1080p MAGI-2 AI videos with native audio from text, first/last frames or reference images, paid with magi2aivideo.net credits.
Hosted MCP Server
npx add-mcp 'https://magi2aivideo.net/mcp'Installs into Claude Code, Codex, Cursor and more
Documentation
Quickstart
Three steps, and the same Credits you use on the website.
- 01
Create a key
Sign in and open Settings → API Keys. Copy the m2v_… key. - 02
Start a video
POST a prompt to /api/v1/videos. You get an id back at once. - 03
Fetch the result
Poll the id until status is "succeeded", then download video_url.
Pricing: 20 Credits per second of video, charged only when the video succeeds; failed videos are refunded automatically.
MAGI-2 REST API
Base URL https://magi2aivideo.net. Authenticate with "Authorization: Bearer m2v_…". Responses are JSON; errors look like { "error": { "code", "message" } }.
| POST | /api/v1/videos | Start a video. Returns its id right away (202). |
|---|---|---|
| GET | /api/v1/videos/{id} | Status and, when finished, video_url. |
| GET | /api/v1/videos | Your recent videos (?limit=1-100). |
| POST | /api/v1/uploads | Upload a reference image, video or audio file. |
| GET | /api/v1/credits | Available Credits. |
| GET | /api/v1/models | Modes, ratios, durations and pricing (no key). |
Create a video
curl https://magi2aivideo.net/api/v1/videos \
-H "Authorization: Bearer $MAGI2_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A skateboarder kickflips down a sunny street, fast tracking shot. Sound: wheels on asphalt, crowd cheering.",
"aspect_ratio": "16:9",
"duration": 8,
"generate_audio": true
}'
{
"id": "flow_…",
"status": "processing",
"progress": 0,
"mode": "text-to-video",
"credits": 160,
"video_url": null
}
Check status
curl https://magi2aivideo.net/api/v1/videos/flow_… \
-H "Authorization: Bearer $MAGI2_API_KEY"
Status goes queued → processing → succeeded (or failed). On success, video_url is a direct MP4 link valid for 24 hours.
Parameters
| prompt | string, required | English works best: subject, action, camera, then a "Sound:" line. |
|---|---|---|
| mode | text-to-video | image-to-video | reference-to-video | Optional; inferred from the media you send. |
| aspect_ratio | 16:9 | 9:16 | 1:1 | 4:3 | 3:4 | 21:9 | Default 16:9. |
| duration | integer 4–30 | Seconds. Default 5. |
| generate_audio | boolean | Native sound and dialogue. Default true. |
| first_frame, last_frame | URL or upload id | Image to video. |
| images, videos, audios | arrays of URL or upload id | Reference to video: up to 10 / 5 / 5. Mention them as @Image1, @Video1, @Audio1. |
| idempotency_key | string | Optional. Retrying with the same key never charges twice (or send an Idempotency-Key header). |
Reference to video in JavaScript
const res = await fetch('https://magi2aivideo.net/api/v1/videos', {
method: 'POST',
headers: {
Authorization: \`Bearer ${process.env.MAGI2_API_KEY}\`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
prompt: 'The woman from @Image1 walks through a neon market at night. Sound: rain, chatter.',
images: ['https://example.com/portrait.jpg'],
duration: 10,
}),
});
const video = await res.json();
// Poll GET /api/v1/videos/{id} every 30-60 s until status is "succeeded".
Media can be public https:// URLs or ids from POST /api/v1/uploads (multipart field file, or JSON { "url": … }); uploads are kept for 24 hours. Images up to 20 MB, video and audio up to 50 MB. Errors: 401 bad key, 402 not enough Credits (with a buy_url), 422 blocked content, 429 rate or daily key limit.
MAGI-2 MCP Server
Let Claude, Cursor or any MCP client generate videos for you. Tools: generate_video, get_video, list_videos, get_credits, estimate_cost.
Claude Code
claude mcp add --transport http magi2 https://magi2aivideo.net/mcp \
--header "Authorization: Bearer m2v_your_key"
Cursor, Windsurf and other clients with remote MCP
{
"mcpServers": {
"magi2": {
"url": "https://magi2aivideo.net/mcp",
"headers": { "Authorization": "Bearer m2v_your_key" }
}
}
}
Claude Desktop (via mcp-remote)
{
"mcpServers": {
"magi2": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://magi2aivideo.net/mcp",
"--header", "Authorization: Bearer m2v_your_key"]
}
}
}
Endpoint: https://magi2aivideo.net/mcp (Streamable HTTP). Tip: npx magi2aivideo mcp prints these snippets with your key filled in. Then just ask, for example: “Make an 8-second 9:16 video of a barista pouring latte art, with café sound.” The agent starts the video and checks back until it is ready.
MAGI-2 CLI
A small command-line tool for scripts and quick tests. Needs Node.js 18 or newer.
npx magi2aivideo login # paste your API key once
npx magi2aivideo generate "A red fox runs through fresh snow, low tracking shot. Sound: crunching snow." \
--duration 8 --ratio 16:9 --wait --out fox.mp4
npx magi2aivideo generate "Slow push-in, the character smiles" --first-frame ./photo.jpg --wait
npx magi2aivideo generate "@Image1 dances on a rooftop" --image ./dancer.png --audio ./beat.mp3
npx magi2aivideo status flow_… # check one video
npx magi2aivideo download flow_… --out clip.mp4
npx magi2aivideo list
npx magi2aivideo credits
npx magi2aivideo mcp # print MCP setup with your key filled in
# Use it often? Install once and use the short command:
npm install -g magi2aivideo
magi2 generate "…" --wait
The key is saved in ~/.config/magi2/config.json, or set MAGI2_API_KEY. Local files are uploaded automatically. Run npx magi2aivideo help for every option.
Package: magi2aivideo on npm · Source: GitHub (MIT, zero dependencies, Node.js 18.17+).
MAGI-2 API FAQ
How much does the MAGI-2 API cost?
The same as the website: 20 Credits per second of video (a 5-second clip is 100 Credits). Credits come from your subscription or Credit packs; there is no separate API plan.
How long does a video take?
Usually 10–20 minutes. Requests return immediately with an id; poll GET /api/v1/videos/{id} (or the get_video MCP tool) every 30–60 seconds.
How long are results available?
video_url is a direct MP4 link valid for 24 hours; request the video again for a fresh link. Finished videos also appear in My Videos on the website.
Can I limit what an API key spends?
Yes. Set a daily Credit limit when you create a key in Settings → API Keys, and delete a key at any time to stop it immediately.
Is this the official MAGI-2 API from Sand.ai?
No. MAGI-2 AI Video is an independent service that runs the MAGI-2 model and bills in its own Credits.