Programmatic MAGI2 Video Generation via REST API
For developers, SaaS platforms, and enterprise media pipelines, MAGI2 provides REST API endpoints allowing programmatic video generation at scale. Whether you are generating personalized marketing videos, dynamic social clips, or automated storyboard drafts, the MAGI2 API delivers full 1080p 25fps audio-video renders with consistent JSON formatting.
API Cost Structure & Credit Conversion
Understanding the relationship between metered API pricing, platform credit packs, and generation seconds:
- Metered API Rate: Approximately $0.08 per generated output second of 1080p 25fps video with native audio included.
- Credit Conversion on magi2.best: 10 platform credits = 1 second of 1080p video.
- Per-Clip API Cost Equivalents:
- 4s Test Clip: ~$0.32 (40 credits)
- 5s Standard Clip: ~$0.40 (50 credits)
- 10s Dialogue Take: ~$0.80 (100 credits)
- 15s Multi-Cut Spot: ~$1.20 (150 credits)
- 30s Maximum Single Take: ~$2.40 (300 credits)
There is zero API surcharge for generating native audio or lip-sync speech—audio latents are generated within the same forward pass.
Quickstart: Making Your First MAGI2 API Request
1. Endpoint Overview
- Base URL:
https://api.magi2.best/v1(or partner inference gateway) - Method:
POST /v1/video/generations - Authentication:
Bearer YOUR_API_KEY - Content-Type:
application/json
2. cURL Example: Text-to-Video with Native Audio
curl https://api.magi2.best/v1/video/generations \
-H "Authorization: Bearer $MAGI2_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Cinematic 50mm shot of an architect speaking warmly to camera: \"Our timber pavilion design won first place.\" Sound: clear studio voice, quiet drafts table foley, no background music.",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"generate_audio": true,
"webhook_url": "https://your-domain.com/webhooks/magi2"
}'
3. Node.js / TypeScript SDK Example
import { Magi2Client } from "@magi2/sdk";
const client = new Magi2Client({ apiKey: process.env.MAGI2_API_KEY });
async function createVideo() {
const job = await client.videos.create({
prompt: "Product reveal of a carbon-fiber watch rotating on dark acrylic.",
start_image_url: "https://your-bucket.com/watch_hero.jpg",
duration: 8,
aspect_ratio: "9:16",
generate_audio: true
});
console.log(`Task submitted. Job ID: ${job.id}`);
const result = await client.videos.waitForCompletion(job.id);
console.log(`Finished 1080p video: ${result.video_url}`);
}
createVideo();
API Request Parameters Reference
| Field | Type | Required | Values & Description |
|---|---|---|---|
prompt |
String | Yes | Scene description, character actions, quoted dialogue, and Sound: directives |
duration |
Integer | Yes | 4, 5, 8, 10, 15, or 30 (in seconds) |
aspect_ratio |
String | No | "16:9", "9:16", "21:9", "1:1", "4:3", "3:4" (Default: "16:9") |
start_image_url |
String (URL) | No | Optional keyframe image URL for Image-to-Video conditioning |
end_image_url |
String (URL) | No | Optional closing keyframe to anchor final transition frame |
references |
Array | No | Up to 10 role-tagged image URLs (@Image1..@Image10) |
generate_audio |
Boolean | No | true (default) for synchronized dialogue & foley; false for silent MP4 |
webhook_url |
String (URL) | No | HTTP POST destination for async completion notification |
API vs Web Studio vs Self-Hosting
| Criteria | Cloud API | Web Studio (magi2.best) |
Self-Hosting 114B/480B |
|---|---|---|---|
| Best For | Automated batch pipelines, SaaS integrations | Visual directing, human creators, marketing teams | Internal air-gapped security, massive continuous volume |
| Setup Time | 10 minutes | Immediate (browser-based) | Hours/days (cluster configuration) |
| Cost Basis | ~$0.08 / second | $9.90 one-time packs (Pricing) | $20–$35/hour dedicated GPU node |
To structure prompt parameters and test API JSON payloads before writing code, use our free MAGI2 Prompt Generator or calculate monthly API usage with our Pricing Calculator.