MAGI-2 Text to Video API
sand-ai/magi-2/text-to-videoMAGI-2 Text to Video turns text prompts up to 15,000 characters into 4–30 second 1080p videos with synchronized dialogue, sound effects, and six aspect ratios. It maintains coherent motion and lighting across extended shots while keeping per-second billing predictable.
REST API
Quick Start
Submit a MAGI-2 Text 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/text-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/text-to-video",
"input": {
"prompt": "In a rainy neon-lit alley at night, an elderly street musician plays a slow saxophone melody and says: \"Thanks for staying till the last song.\"",
"duration": 5,
"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/text-to-video",
"input": {
"prompt": "In a rainy neon-lit alley at night, an elderly street musician plays a slow saxophone melody and says: \"Thanks for staying till the last song.\"",
"duration": 5,
"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, motion, camera, and audio description up to 15,000 characters. |
| 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/text-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 Text to Video API frequently asked questions
What is the MAGI-2 Text to Video API?
MAGI-2 Text to Video is Sand AI's text-driven audiovisual video generation model that turns prompts up to 15,000 characters into 4–30 second 1080p clips with native sound. It supports six aspect ratios, extended temporal continuity, and flat per-second billing regardless of audio toggle. Built on Sand AI's autoregressive video foundation, it preserves lighting, subject coherence, and camera pacing across longer shots. Call sand-ai/magi-2/text-to-video via API or test it directly in the playground above.
How much does MAGI-2 Text to Video cost per second?
MAGI-2 Text to Video costs a flat 16 credits ($0.08) per generated second. A default 5-second clip is 80 credits ($0.40), and a 30-second clip is 480 credits ($2.40).
What video durations does MAGI-2 Text to Video support?
You can request any integer duration from 4 seconds to 30 seconds, with 5 seconds as the default.
Does turning on generate_audio increase the MAGI-2 Text to Video price?
No. Synchronized audio generation is included in the flat 16 credits/s rate whether generate_audio is true or false.
Which aspect ratios work with MAGI-2 Text to Video?
MAGI-2 Text to Video supports 16:9 (default), 9:16, 1:1, 4:3, 3:4, and 21:9 at 1080p.
How long can a MAGI-2 Text to Video prompt be?
Prompts support up to 15,000 characters, giving enough room for detailed multi-beat action, camera blocking, and audio cues.
How can I reproduce results in MAGI-2 Text to Video?
Pass the same integer seed (0 to 2,147,483,647) alongside identical prompt and settings to stabilize generation output.



