# MAGI-2 API: Video generation with native audio

Canonical: https://www.sandbase.ai/models/magi-2

Generate 1080p video from text, images or reference media. Choose 4 to 30 seconds and use one SandBase API key. Native audio is included in the price.

## Workflows and actual samples

### Text to video
Describe the setting, camera movement and sound. Turn your prompt into a clip, ready to preview or download.
Example prompt: At dawn, waves break gently against the rocks as the camera slowly moves forward.
[Watch the saved output](https://static.sandbase.ai/examples/1d4200c9-6604-4441-b072-5feeb88645eb/output/bfda1c1e-129c-4484-8491-2eedb9ca3e87.mp4)
[Open the playground](https://www.sandbase.ai/models/sandai/magi-2/text-to-video)

### Image to video
Upload a first frame, then describe what happens next. Add an optional end frame to guide the ending.
Example prompt: The jazz band starts playing; the camera slowly pushes in.
[Watch the saved output](https://static.sandbase.ai/examples/81388b0f-07c2-454c-b3d1-b5d1cc2a8680/output/dd756ccc-652e-487c-9703-c2d67ef59165.mp4)
[Open the playground](https://www.sandbase.ai/models/sandai/magi-2/image-to-video)

### Reference to video
Bring images, video or audio to guide your scene. Use up to 10 images, 5 video clips or 5 audio clips, subject to file and duration limits.
Example prompt: Use the slow forward camera move from video 1 at a frozen mountain lake at sunrise, thin mist drifting over the ice and snowy peaks behind.
[Watch the saved output](https://static.sandbase.ai/examples/a91d9da4-241c-4080-a7ba-61d429dc5561/output/d724f236-1fab-4f78-839a-a708ebcc8f4d.mp4)
[Open the playground](https://www.sandbase.ai/models/sandai/magi-2/reference-to-video)

## Pricing

Public estimates in USD per output second. Account rates may differ. Check the playground estimate before running. Video generation is paid usage; the daily free data API allowance does not apply.

| Workflow | List / sec | Public / sec | 5 sec | 10 sec | 30 sec |
| --- | --- | --- | --- | --- | --- |
| Text to video | $0.08 | $0.08 | $0.40 | $0.80 | $2.40 |
| Image to video | $0.08 | $0.08 | $0.40 | $0.80 | $2.40 |
| Reference to video | $0.08 | $0.08 | $0.40 | $0.80 | $2.40 |

## API quickstart

Keep your key on the server. Submit your model and inputs, save the returned run ID, then poll with a bounded retry loop. Read output after completed; handle failed and timeout states.

```bash
curl --fail-with-body "https://api.sandbase.ai/v1/run" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sandai/magi-2/text-to-video",
    "prompt": "At dawn, waves break gently against the rocks as the camera slowly moves forward.",
    "duration": 5,
    "resolution": "1080p",
    "aspect_ratio": "16:9",
    "generate_audio": true
  }'
```

```bash
# Set RUN_ID to the id returned by the submit request.
curl --fail-with-body "https://api.sandbase.ai/v1/run/$RUN_ID" \
  -H "Authorization: Bearer $SANDBASE_API_KEY"
```

## Frequently asked questions

### Can I try MAGI-2 without writing code?
Yes. Open a MAGI-2 playground, sign in, add credits and enter your inputs. Review the estimated price before running. You can preview and download the result in your browser.

### Is MAGI-2 included in the free API allowance?
No. MAGI-2 video generation is paid usage. The daily free data API allowance does not apply. Prices are in USD and depend on output duration and applicable discounts.

### What output can I generate?
MAGI-2 generates 1080p video from 4 to 30 seconds. Supported aspect ratios are 16:9, 9:16, 1:1, 4:3, 3:4 and 21:9. Native audio generation is enabled by default and included in the price; you can disable it with generate_audio: false.

### Which reference files can I use?
Image to video uses a first-frame image and an optional end-frame image. Reference to video accepts up to 10 images, 5 video clips and 5 audio clips. Video and audio clips must each be 2 to 30 seconds, with a 30-second total per media type. Check the playground schema for file-size limits.

### How do I receive the generated video through the API?
Submit your model and inputs to /v1/run. Save the returned run ID, then poll /v1/run/{id} until the run is completed and read the output. Handle failed and timeout states, and set a limit on polling. Keep your SandBase API key on your server.
