---
title: "MAGI-2"
description: "Sand AI's 1080p video model with sound, generating 4–30 seconds in one pass from text, first and last frames, or mixed image, video and audio references."
seo:
  title: "MAGI-2 API Documentation: Parameters & Examples"
  description: "MAGI-2 API documentation: model ID sand-ai/magi-2, input modes, parameters, defaults and request examples. Sand AI's 1080p video model with sound, generating 4–30 seconds in one pass from text, first and last frames, or mixed image, video and audio references."
---

{/* Generated by scripts/generate-model-pages.mjs from openapi/model-contracts.json. Do not edit; write notes in docs/models/_notes/sand-ai/magi-2.mdx */}

| Model ID | Aliases | Endpoint |
| --- | --- | --- |
| `sand-ai/magi-2` | `magi-2`, `magi-2.0` | [Video generation](/docs/guides/video-generation) |

## Input modes

| Mode | References | Reference roles |
| --- | --- | --- |
| `text` Text only | — | — |
| `image` Image input | 1 to 2 | `first_frame` 1<br />`last_frame` 0 to 1 |
| `reference` Reference media | 1 to 20 | `reference_audio` 0 to 5<br />`reference_image` 0 to 10<br />`reference_video` 0 to 5 |

Prompt limit: 8,000 characters; longer prompts are rejected with 400.

## Parameters

| Parameter | Description | Values | Default | Required |
| --- | --- | --- | --- | --- |
| `duration` | Duration: Output video duration in seconds. | `4` to `30` | `5` | No |
| `resolution` | Resolution: Output resolution. | `1080p` | `1080p` | No |
| `aspect_ratio` | Aspect ratio: Output aspect ratio. | `21:9`, `16:9`, `4:3`, `1:1`, `3:4`, `9:16` | `16:9` | No |
| `generate_audio` | Generate audio: Generate native audio with the video. | `false`, `true` | `true` | No |
| `n` | Outputs per request: Number of outputs from one API request (one Job), not the application batch size. For multiple Jobs, submit separate requests; n=1 does not prevent application-managed batching. | `1` | `1` | No |

## Examples

`text` input:

```json
{
  "model": "sand-ai/magi-2",
  "input": {
    "type": "text",
    "prompt": "A paper boat drifting down a rainy city street, slow tracking shot"
  },
  "parameters": {
    "duration": 5,
    "resolution": "1080p",
    "aspect_ratio": "16:9",
    "generate_audio": true,
    "n": 1
  }
}
```

`image` input:

```json
{
  "model": "sand-ai/magi-2",
  "input": {
    "type": "image",
    "prompt": "A paper boat drifting down a rainy city street, slow tracking shot",
    "references": [
      {
        "role": "first_frame",
        "file_id": "file_..."
      }
    ]
  },
  "parameters": {
    "duration": 5,
    "resolution": "1080p",
    "aspect_ratio": "16:9",
    "generate_audio": true,
    "n": 1
  }
}
```

`reference` input:

```json
{
  "model": "sand-ai/magi-2",
  "input": {
    "type": "reference",
    "prompt": "A paper boat drifting down a rainy city street, slow tracking shot",
    "references": [
      {
        "role": "reference_image",
        "file_id": "file_..."
      }
    ]
  },
  "parameters": {
    "duration": 5,
    "resolution": "1080p",
    "aspect_ratio": "16:9",
    "generate_audio": true,
    "n": 1
  }
}
```

The authoritative contract is `GET /v1/models/sand-ai/magi-2?view=contract`. A valid parameter does not mean every channel can run it, so [quote](/docs/concepts/billing#get-a-quote) the complete request. Prices and channels are listed in [Model Market](https://yir.ai/models).

MAGI-2 outputs 1080p video at 25 fps. Generation is slow: allow about 13–25 minutes and use [webhooks](/docs/production/webhooks) or polling. The delivered file runs about 0.24 seconds longer than `duration`.

With `first_frame`, set `aspect_ratio` to match the frame. It does not follow the image, and the default is `16:9`.

Reference generation accepts audio alone. Each reference video or audio clip runs 2–30 seconds, with at most 30 seconds in total per type. Refer to files in the prompt as `@image_1`, `@video_1` and `@audio_1`, in order. With frames, use `@first_frame` and `@last_frame`. Images must be under 30 MB and 16 megapixels, 16–10,000 px per side. Reference videos must be MP4 files of at most 200 MB, and audio files at most 15 MB. Sand AI's `seed` and `enhance_prompt` parameters are not available.

Billing uses the requested `duration`. Aspect ratio, sound and reference media do not change the rate.

[Sand AI API reference](https://platform.sand.ai/docs/ark-generations/)
