MAGI-2 Image to Video API
sand-ai/magi-2/image-to-videoMAGI-2 Image to Video animates a start frame and an optional end frame into 4–30 second 1080p videos with synchronized native sound and automatic framing. It preserves the subject's composition and lighting while steering motion cleanly toward your target ending.
Drag and drop files, paste from clipboard, or provide a URL. 1–2 images (JPEG, PNG, or WebP, up to 15 MB each). First image sets the start frame; optional second sets the end frame.
1/2 files added
REST API
Quick Start
Submit a MAGI-2 Image 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/image-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/image-to-video",
"input": {
"prompt": "Slow push-in as warm sunlight drifts across the window and coffee steam rises gently.",
"image_urls": [
"https://example.com/opening-frame.jpg"
],
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "auto",
"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/image-to-video",
"input": {
"prompt": "Slow push-in as warm sunlight drifts across the window and coffee steam rises gently.",
"image_urls": [
"https://example.com/opening-frame.jpg"
],
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "auto",
"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 | — | Motion, camera path, transition, and sound description up to 15,000 characters. |
| input.image_urls | string[] | Yes | — | 1–2 public image URLs (JPEG, PNG, WebP). First is start frame; optional second is end frame. |
| 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 | auto | Fixed at auto to match the input image proportions. |
| input.generate_audio | boolean | No | true | Generates synchronized sound matching the animated scene. |
| 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/image-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 Image to Video API frequently asked questions
What is the MAGI-2 Image to Video API?
MAGI-2 Image to Video is Sand AI's keyframe animation model that transforms one start image and an optional end image into 4–30 second 1080p videos with synchronized audio. It automatically preserves source proportions via auto framing and supports prompts up to 15,000 characters for detailed motion direction. Built on Sand AI's temporal video architecture, it keeps subject identity, texture, and lighting faithful to your frames across long transitions. Call sand-ai/magi-2/image-to-video via API or try it in the playground above.
How many images can I pass to MAGI-2 Image to Video?
Pass 1 or 2 images in image_urls. The first image anchors the opening frame, and an optional second image guides the closing frame.
Does using a closing frame change MAGI-2 Image to Video pricing?
No. Both single-frame and first-to-last-frame jobs cost the same flat 16 credits ($0.08) per second.
How does MAGI-2 Image to Video choose output aspect ratio?
Image to Video uses auto aspect ratio so the generated 1080p video automatically matches your input frame's proportions.
What image formats are accepted by MAGI-2 Image to Video?
Upload or link JPEG, PNG, or WebP images up to 15 MB each via public HTTPS URLs.
Can MAGI-2 Image to Video add sound effects and voice to a still photo?
Yes. With generate_audio set to true (default), MAGI-2 synthesizes synchronized ambience, foley, or dialogue guided by your prompt.
What is the maximum duration for MAGI-2 Image to Video?
You can generate any integer duration from 4 seconds up to 30 seconds at 1080p.



