MAGI-2 Reference to Video API
sand-ai/magi-2/reference-to-videoMAGI-2 Reference to Video turns combinations of up to 10 images, 5 videos, and 5 audio clips into 4–30 second 1080p videos across six aspect ratios. Reference assets directly via @Image, @Video, and @Audio tags to lock character identity, motion style, and voice.
Drag and drop files, paste from clipboard, or provide a URL. Up to 10 reference images (JPEG, PNG, or WebP, up to 15 MB each). Reference them in the prompt as @Image1, @Image2...
1/10 files added
Drag and drop files, paste from clipboard, or provide a URL. Up to 5 reference videos (MP4 or MOV, up to 100 MB each). Reference them in the prompt as @Video1, @Video2...
Drag and drop files, paste from clipboard, or provide a URL. Up to 5 reference audio clips (MP3 or WAV, up to 50 MB each). Reference them in the prompt as @Audio1, @Audio2...
REST API
Quick Start
Submit a MAGI-2 Reference to Video request to the unified submit endpoint, capture task_id, and read the MP4 video URL when the task finishes.
Connect to the Vidgo API
Create an API key, store it on the server, and send Authorization: Bearer VIDGO_API_KEY.
- Endpoint
- POST
https://api.vidgo.ai/api/generate/submit - Authentication
- Authorization: Bearer VIDGO_API_KEY
Submit a video task
Send model sand-ai/magi-2/reference-to-video with the parameters for this mode; the endpoint returns task_id immediately.
curl --request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "sand-ai/magi-2/reference-to-video",
"input": {
"prompt": "The musician from the reference image walks along a sunlit seaside boardwalk playing the melody from the reference audio.",
"reference_image_urls": [
"https://example.com/character.jpg"
],
"reference_audio_urls": [
"https://example.com/melody.mp3"
],
"duration": 8,
"resolution": "1080p",
"aspect_ratio": "16:9",
"generate_audio": true
}
}'Poll for the finished video
Poll only while status is not_started or running. Stop once status reaches finished or failed.
Track status
GET https://api.vidgo.ai/api/generate/status/{task_id}Poll every 5–10 seconds with backoff on 429/5xx, or provide top-level callback_url for terminal webhooks.
not_startedrunningfinishedfailed{
"code": 200,
"data": {
"task_id": "task-example-001",
"status": "not_started",
"created_time": "2026-11-29T10:30:00"
}
}{
"code": 200,
"data": {
"task_id": "task-example-001",
"status": "finished",
"created_time": "2026-11-29T10:30:00",
"progress": 100,
"files": [
{
"file_url": "https://example.com/output.mp4",
"file_type": "video"
}
]
}
}Complete runnable polling example
Expand for the end-to-end polling script using this payload, including business codes and error handling.
set -euo pipefail
: "${VIDGO_API_KEY:?Set VIDGO_API_KEY in your environment}"
REQUEST_BODY=$(cat <<'JSON'
{
"model": "sand-ai/magi-2/reference-to-video",
"input": {
"prompt": "The musician from the reference image walks along a sunlit seaside boardwalk playing the melody from the reference audio.",
"reference_image_urls": [
"https://example.com/character.jpg"
],
"reference_audio_urls": [
"https://example.com/melody.mp3"
],
"duration": 8,
"resolution": "1080p",
"aspect_ratio": "16:9",
"generate_audio": true
}
}
JSON
)
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
--request POST \
--url "https://api.vidgo.ai/api/generate/submit" \
--header "Authorization: Bearer $VIDGO_API_KEY" \
--header "Content-Type: application/json" \
--data "$REQUEST_BODY")
TASK_ID=$(printf '%s' "$SUBMIT_RESPONSE" | jq -r '.data.task_id // .task_id // empty')
if [ -z "$TASK_ID" ]; then
printf 'Submit response did not include task_id:
%s
' "$SUBMIT_RESPONSE" >&2
exit 1
fi
while true; do
STATUS_RESPONSE=$(curl --silent --show-error --fail-with-body \
--url "https://api.vidgo.ai/api/generate/status/$TASK_ID" \
--header "Authorization: Bearer $VIDGO_API_KEY")
STATUS=$(printf '%s' "$STATUS_RESPONSE" | jq -r '.data.status // .status // empty')
case "$STATUS" in
finished)
printf '%s' "$STATUS_RESPONSE" | jq -r '(.data.files // .files // [])[]?.file_url'
break
;;
failed)
printf '%s' "$STATUS_RESPONSE" | jq -r '.data.error_message // .error_message // "Generation failed"' >&2
exit 1
;;
not_started|running)
sleep 2
;;
*)
printf 'Unexpected task status: %s
' "$STATUS" >&2
exit 1
;;
esac
doneRequest Parameters
Public fields inside input. Place model and optional callback_url at the request root.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| input.prompt | string | Yes | — | Scene script referencing uploaded assets via @Image1, @Video1, @Audio1 (up to 15,000 chars). |
| input.reference_image_urls | string[] | No | — | Up to 10 public image URLs (JPEG, PNG, WebP) for character, product, or scene identity. |
| input.reference_video_urls | string[] | No | — | Up to 5 public video URLs (MP4, MOV) for motion, choreography, or camera reference. |
| input.reference_audio_urls | string[] | No | — | Up to 5 public audio URLs (MP3, WAV) for voice timbre, dialogue, or rhythm. |
| input.duration | integer | No | 5 | Output length in integer seconds from 4 to 30. |
| input.resolution | string | No | 1080p | Output video resolution. Fixed at 1080p. |
| input.aspect_ratio | string | No | 16:9 | Output framing: 16:9, 9:16, 1:1, 4:3, 3:4, or 21:9. |
| input.generate_audio | boolean | No | true | Generates synchronized dialogue, effects, and ambient audio. |
| input.seed | integer | No | Random | Non-negative integer up to 2,147,483,647 for reproducible runs. |
Response Fields
Submit returns task_id; status queries return the MP4 file URL once finished.
| Field | Type | Description |
|---|---|---|
| code | integer | Business code; 0 or 200 indicates success. |
| data.task_id | string | Unique task ID for status queries. |
| data.status | string | not_started, running, finished or failed. |
| data.progress | integer | Progress from 0 to 100. |
| data.files[].file_url | string | Direct URL to the generated 1080p MP4 video. |
| data.files[].file_type | string | video for generated video files. |
| data.error_message | string | null | Readable error message when failed. |
Task Lifecycle
Poll only while not_started or running; finished and failed are terminal.
not_startedQueued and waiting to start.
runningVideo generation in progress.
finishedCompleted; read the MP4 URL from data.files.
failedFailed; credits are refunded in full.
Polling and Errors
- AuthenticationSend Authorization: Bearer VIDGO_API_KEY from your server.
- Validation400 indicates an invalid field, range or cross-mode parameter.
- PollingPoll every 5–10 seconds and back off exponentially on 429/5xx.
- WebhooksPass a public root-level callback_url for terminal notifications.
Model Specifications
| Specification | Value | Details |
|---|---|---|
| Model ID | sand-ai/magi-2/reference-to-video | Pass in root-level model for POST /api/generate/submit. |
| Resolution & Duration | 1080p · 4–30s | 25 fps H.264 MP4, whole seconds from 4 to 30. |
| Audio | Synchronized AAC stereo (optional) | generate_audio defaults to true and does not change the price. |
| Billing | 16 credits / second ($0.08 / s) | Same rate across all three modes; failed tasks are refunded in full. |
Related Models
MAGI-2 Reference to Video API frequently asked questions
What is the MAGI-2 Reference to Video API?
MAGI-2 Reference to Video is Sand AI's multimodal video generation model that combines up to 10 reference images, 5 videos, and 5 audio clips into 4–30 second 1080p videos. Using explicit @Image, @Video, and @Audio tags in the prompt, teams control character identity, product appearance, camera motion, and voice across six aspect ratios. Built on Sand AI's unified audiovisual foundation, it holds subject details and motion cues steady throughout extended takes without extra reference surcharges. Call sand-ai/magi-2/reference-to-video via API or test it in the playground above.
How many reference files can MAGI-2 Reference to Video accept?
Each request accepts up to 10 images in reference_image_urls, up to 5 videos in reference_video_urls, and up to 5 audio clips in reference_audio_urls, with at least one asset required.
How do I refer to uploaded assets in a MAGI-2 Reference to Video prompt?
Use 1-based tags matching each array's order: @Image1–@Image10 for images, @Video1–@Video5 for videos, and @Audio1–@Audio5 for audio clips.
Do extra reference videos or audio tracks raise MAGI-2 Reference to Video cost?
No. MAGI-2 Reference to Video bills a flat 16 credits ($0.08) per output second regardless of how many reference files you include.
Can I pass only reference_image_urls to MAGI-2 Reference to Video?
Yes. You only need at least one asset across any of the three reference arrays—images alone, videos alone, audio alone, or any combination.
What file formats work for MAGI-2 Reference to Video inputs?
Images support JPEG, PNG, and WebP (up to 15 MB); videos support MP4 and MOV (up to 100 MB); audio supports MP3 and WAV (up to 50 MB).
Which aspect ratios can MAGI-2 Reference to Video output?
You can output 1080p video in 16:9 (default), 9:16, 1:1, 4:3, 3:4, or 21:9.



