# Sand AI MAGI-2 Reference to Video API

> MAGI-2 Reference to Video: 4-30 second 1080p video with native audio.

- Model ID: `sandai/magi-2/reference-to-video`
- Provider: MAGI
- Tasks: Video, Reference to Video
- Price: Provider cost $0.08 / second; native audio included
- Web page: https://scalingtensor.com/models/sandai/magi-2/reference-to-video

## How to call it

Authenticate with the `apiKey` request header. Submit a job, then poll for the result:

1. `POST https://restapi.scalingtensor.com/api/media/generate` with JSON `{ "model": "<model ID>", "params": { ... } }`. The response `data.jobId` identifies the job.
2. `GET https://restapi.scalingtensor.com/api/media/result?jobId=<jobId>` until the status is `completed` or `failed`.
3. A response `code` of 0 means success; otherwise read `msg`.

```bash
curl --request POST 'https://restapi.scalingtensor.com/api/media/generate' \
  --header 'apiKey: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "model": "sandai/magi-2/reference-to-video",
  "params": {
    "images": [
      "https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=1280&auto=format&fit=crop"
    ],
    "prompt": "Use the reference image for the beach scenery. Waves gently roll onto the sand as the camera slowly moves forward, with natural ocean sounds.",
    "duration": 5,
    "resolution": "1080p",
    "aspect_ratio": "16:9",
    "generate_audio": true
  }
}'
```

## Input parameters

Parameters go inside the `params` object.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `prompt` | string | Required | Describe how to use the references, the scene, motion and sound. |
| `images` | string[] | Optional | Up to 10 images (upload or public HTTPS URL), each under 30 MB.; maxItems: 10 |
| `videos` | string[] | Optional | Up to 5 MP4/MOV files or URLs, 2-30 s each and 30 s in total, up to 200 MB each.; maxItems: 5 |
| `audios` | string[] | Optional | Up to 5 WAV/MP3 files or URLs, 2-30 s each and 30 s in total, up to 15 MB each.; maxItems: 5 |
| `duration` | integer | Optional | Output video duration in seconds (4-30). Billed per second.; default: 5; minimum: 4; maximum: 30 |
| `aspect_ratio` | string | Optional | Output aspect ratio.; enum: ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9"]; default: "16:9" |
| `resolution` | string | Optional | Output resolution. MAGI-2 renders 1080p only.; enum: ["1080p"]; default: "1080p" |
| `generate_audio` | boolean | Optional | Generate a native audio track with the video. Included in the price.; default: true |
| `seed` | integer | Optional | Random seed for reproducibility (0-4294967295). Omit for a random seed.; minimum: 0; maximum: 4294967295 |

## FAQ

### How much does the Sand AI MAGI-2 Reference to Video API cost?

Sand AI MAGI-2 Reference to Video is billed at the provider's actual cost for each job ($0.08 / second; native audio included). The charge is deducted from your prepaid ScalingTensor wallet.

### How do I call the Sand AI MAGI-2 Reference to Video API?

Send POST /api/media/generate with "model": "sandai/magi-2/reference-to-video" and the parameters in a params object, using your apiKey header. The call returns a jobId. Poll GET /api/media/result?jobId=... until the status is completed, then read the output URL from the result.

### Which parameters does Sand AI MAGI-2 Reference to Video accept?

Required: prompt. Optional: images, videos, audios, duration, aspect_ratio, resolution, generate_audio and seed. The parameter table on this page describes each one.

### Do I need a MAGI account to use Sand AI MAGI-2 Reference to Video?

No. You call Sand AI MAGI-2 Reference to Video with your ScalingTensor API key and pay from your ScalingTensor wallet. The same key works for every other model in the catalog.
