MAGI-2 API: providers, parameters and code

MAGI-2 is sold by API through resellers such as NanoAPI, APIMart, KIE and Higgsfield at standard prices of $0.078–0.088 per second of 1080p video, and Sand AI lists its own platform at $0.080; every call takes a prompt, a duration of 4 to 30 seconds, an aspect ratio and optional images, video or audio references.

Updated . Independent site, not affiliated with Sand AI.

Where to call MAGI-2

MAGI-2 API providers
ProviderPer 1080p secondNotes
Sand AI (official)$0.080The model’s maker, at sand.ai; not accepting top-ups on 25 Nov (per Yir)
NanoAPI$0.078Lowest published price; typical time 21.9 min
APIMart$0.080
Higgsfield$0.080Also offers MAGI-2 inside its creative app
KIE$0.088Three endpoints: text, image (first + optional last frame), reference
Yir (router)Channel price, no markupOne model id; routes to the cheapest channel and fails over

Published prices from Yir’s MAGI-2 page and KIE’s MAGI-2 page, 26 November 2026.

Parameters

MAGI-2 API parameters
ParameterValues
modelsand-ai/magi-2 (Yir); each reseller has its own id
duration / seconds4–30 whole seconds, billed per second
resolution1080p (25 fps). There is no cheaper lower tier
aspect_ratio21:9, 16:9, 4:3, 1:1, 3:4, 9:16
generate_audiotrue or false; same price either way
first_frame / last_frameOne image each; last frame depends on the channel
reference images / videos / audioUp to 10 / 5 / 5 per request (20 in total)

TypeScript (Yir SDK)

import { createNodeYirClient } from "@yir-ai/sdk/server";

const client = createNodeYirClient(); // reads YIR_API_KEY

const job = await client.submitVideo({
  model: "sand-ai/magi-2",
  input: {
    type: "text",
    prompt: "A sea turtle glides over a coral reef; sunlight ripples on its shell. Gentle underwater ambience.",
  },
  parameters: {
    duration: 10,
    resolution: "1080p",
    aspect_ratio: "16:9",
    generate_audio: true,
    n: 1,
  },
});

const result = await client.waitForJob(job.id); // MAGI-2 usually takes 13–25 minutes
for (const file of result.result?.files ?? []) console.log(file.url);

cURL (OpenAI-compatible endpoint)

curl https://gateway.yir.ai/openai/v1/videos \
  -H "Authorization: Bearer $YIR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sand-ai/magi-2",
    "prompt": "A sea turtle glides over a coral reef; sunlight ripples on its shell.",
    "resolution": "1080p",
    "aspect_ratio": "16:9",
    "seconds": "10"
  }'

Python

import os, requests

r = requests.post(
    "https://gateway.yir.ai/openai/v1/videos",
    headers={"Authorization": f"Bearer {os.environ['YIR_API_KEY']}"},
    json={
        "model": "sand-ai/magi-2",
        "prompt": "A sea turtle glides over a coral reef; sunlight ripples on its shell.",
        "resolution": "1080p",
        "aspect_ratio": "16:9",
        "seconds": "10",
    },
    timeout=60,
)
r.raise_for_status()
video = r.json()
print(video["id"])  # store it, then poll the job status as described in the provider's docs

Because a clip takes 13–25 minutes, never block a web request on it. Submit, save the job id with the user’s request, and check status from a background worker or a webhook. Set a cost cap per job where the provider allows it (Yir takes max_cost) so a fallback channel can’t bill more than you planned.

Don’t want to write code?

The Magi2Gen generator runs the same model with one-time credit packs: no API key, no wallet top-up, and failed renders refund automatically.

Sign in to continue

No password. What you entered stays on the page

Get credits

Starter

$12.90

45 credits, never expire

Creator

$34.90

150 credits, never expire

Studio

$79.90

420 credits, never expire

Secure checkout. Failed generations refund their credits. Refund policy