seedinteger
Random seed for reproducibility (0-4294967295). Omit for a random seed.
ขั้นต่ำ: 0
สูงสุด: 4294967295
sandai/magi-2/reference-to-videoMAGI-2 by Sand AI creates a 1080p video of 4 to 30 seconds with native audio, guided by up to 10 reference images, 5 video clips and 5 audio clips.
ลองใช้โมเดล
PNG, JPEG, WebP, or GIF · 20 MiB maximum each · up to 10
ต้องการทำอะไรต่อ
เลือกตัวอย่างเพื่อโหลดอินพุตและผลลัพธ์ลงใน playground
{
"aspect_ratio": "16:9",
"duration": 5,
"images": [
"https://static.sandbase.ai/examples/eeb92b90-3c1a-4979-9860-1c508e732417/input/776a14fa-b948-478b-bae6-a45c68da5ac7.jpg",
"https://static.sandbase.ai/examples/eeb92b90-3c1a-4979-9860-1c508e732417/input/e53fed62-fd62-44db-a206-3cf944d6d8e8.webp"
],
"prompt": "The pink-haired basketball player in the blue jersey from image 2 walks into the jazz bar from image 1 and dances in front of the band while the camera tracks alongside."
}{
"aspect_ratio": "16:9",
"duration": 5,
"prompt": "Use the slow forward camera move from video 1 at a frozen mountain lake at sunrise, thin mist drifting over the ice and snowy peaks behind.",
"videos": [
"https://static.sandbase.ai/examples/a91d9da4-241c-4080-a7ba-61d429dc5561/input/20fe7b20-b825-40c4-b777-b37f2a70589e.mp4"
]
}MAGI-2 reference-to-video API by Sand AI: guide a 1080p video of 4 to 30 seconds with up to 10 reference images, 5 videos and 5 audio clips, to keep a character, a location, a camera move or a voice consistent. Sound is generated with the picture. Use it through SandBase with one API key, pay per second of output, and switch providers automatically if one is unavailable.
curl https://api.sandbase.ai/v1/run \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sandai/magi-2/reference-to-video",
"prompt": "Use the woman in image 1 as the lead and keep her face, hair and outfit the same. She walks into a sunlit flower market, picks up white tulips, turns to the camera and says: \"These are for you.\" Slow tracking shot. Sound: soft market chatter and her voice from audio 1.",
"images": [
"https://example.com/character.jpg"
],
"audios": [
"https://example.com/voice.wav"
],
"duration": 5,
"aspect_ratio": "16:9"
}'
The response contains an id. Poll the run every 10 seconds until status is completed, then download outputs[0].url:
curl https://api.sandbase.ai/v1/run/$RUN_ID \
-H "Authorization: Bearer $SANDBASE_API_KEY"
Stop polling when status is failed and read the error message. You can also run the same request in the Playground on this page without writing code.
| This model | MAGI-2, all inputs | |
|---|---|---|
model | sandai/magi-2/reference-to-video | sandai/magi-2 |
| APIs | POST /v1/run with the fields below | POST /v1/run with the same flat fields, or the Ark compatible API (POST /api/v3/contents/generations/tasks with "model": "magi-2" and a content array) |
| Inputs | Reference images, videos and audio | Text, first and last frame, or references, all in one model |
| Providers | Switches to another provider if one is unavailable | One provider |
| Price | $0.08 per second | $0.08 per second |
Use this model when you want a switch to another provider if one is unavailable. Use MAGI-2 with all inputs to send every kind of input to one model on /v1/run, or if your code already calls Sand AI's API or the Ark SDK. Compare the APIs on the MAGI-2 page. |
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Describe how to use the references, the scene, motion and sound. |
images | string[] (≤10) | — | Up to 10 images (upload or public HTTPS URL), each under 30 MB. |
videos | string[] (≤5) | — | Up to 5 MP4/MOV files or URLs, 2-30 s each and 30 s in total, up to 200 MB each. |
audios | string[] (≤5) | — | Up to 5 WAV/MP3 files or URLs, 2-30 s each and 30 s in total, up to 15 MB each. |
duration | integer 4–30 | 5 | Output video duration in seconds (4-30). Billed per second. |
aspect_ratio | 16:9 / 9:16 / 1:1 / 4:3 / 3:4 / 21:9 | 16:9 | Output aspect ratio. |
resolution | 1080p | 1080p | Output resolution. MAGI-2 renders 1080p only. |
generate_audio | boolean | true | Generate a native audio track with the video. Included in the price. |
seed | integer 0–4294967295 | random | Random seed for reproducibility (0-4294967295). Omit for a random seed. |
keep the face and outfit from image 1, use the location in image 2, follow the camera move in video 1 or use the voice in audio 1.$0.08 per second of output video, with native audio included in the price. Resolution is fixed at 1080p. Failed runs are not billed.
| Output length | Price |
|---|---|
| 4s | $0.32 |
| 5s (default) | $0.40 |
| 10s | $0.80 |
| 30s | $2.40 |
Up to 10 images, 5 videos and 5 audio clips in one request. Each video or audio clip must be 2 to 30 seconds long, and all clips of one type together at most 30 seconds. Reference files do not change the price.
Images: JPEG, PNG, WebP and other common formats under 30 MB. Videos: MP4 or MOV up to 200 MB. Audio: WAV or MP3 up to 15 MB. Upload them in the Playground or pass public HTTPS URLs.
Any whole number of seconds from 4 to 30, set with duration. The video is rendered at 1080p and 25 fps in one of six aspect ratios: 16:9, 9:16, 1:1, 4:3, 3:4 or 21:9.
Yes. Dialogue, sound effects, ambience and music are generated together with the picture. Set generate_audio to false for a silent video; the price is the same.
$0.08 per second of output video, from your SandBase balance. A 5-second clip costs $0.40 and a 30-second clip $2.40. Failed runs, including ones rejected by content moderation, are not billed.
Yes. If your code already calls Sand AI's API or the Ark SDK, use MAGI-2 with all inputs with "model": "magi-2" at https://api.sandbase.ai/api/v3. Compare both ways.
Browse the most-liked MAGI-2 videos on X, credited to the people who made them: MAGI-2 videos from X. Short films, ads and anime.
เริ่มสร้าง
ส่งโมเดลนี้ผ่าน SandBase Unified Run API
# The quoted heredoc keeps Unicode and shell metacharacters unchanged.
result=$(curl --fail-with-body --silent \
-X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'SANDBASE_JSON'
{
"model": "sandai/magi-2/reference-to-video",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"generate_audio": true
}
SANDBASE_JSON
)
run_id=$(printf '%s' "$result" | jq -r .id)
for attempt in $(seq 1 120); do
status=$(printf '%s' "$result" | jq -r .status)
case "$status" in completed|failed|timeout) break ;; esac
sleep 2
result=$(curl --fail-with-body --silent \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
"https://api.sandbase.ai/v1/run/$run_id")
done
status=$(printf '%s' "$result" | jq -r .status)
[ "$status" = completed ] || { echo "Generation ended: $status" >&2; exit 1; }
printf '%s\n' "$result"สร้าง SandBase API key และตั้งค่าไว้ในสภาพแวดล้อมฝั่งเซิร์ฟเวอร์ คำขอทั้งหมดใช้การยืนยันตัวตนแบบ Bearer
export SANDBASE_API_KEY="YOUR_API_KEY"เก็บ key ไว้บนเซิร์ฟเวอร์ อย่าเปิดเผยในโค้ดฝั่งเบราว์เซอร์หรือคอมมิตลง repository
POST ไปที่ /v1/run ด้วย model ID นี้และอินพุตของมัน ตัวอย่างคำขอด้านบนมีทั้งการส่งและการ polling
ใช้ run ID ที่ส่งกลับมาเพื่อ polling จนกว่าสถานะจะเป็น completed, failed หรือ timeout ให้อ่าน output หลังจาก completed เท่านั้น
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"ส่ง URL ไฟล์ที่เข้าถึงได้สาธารณะในช่อง image, video หรือ audio ของโมเดล รูปแบบและข้อจำกัดที่รองรับแสดงอยู่ข้างแต่ละอินพุตใน Playground
ใช้ตัวควบคุม upload หรือ replace ในช่องรูปภาพที่รองรับใน Playground ช่อง URL ของวิดีโอรองรับวิดีโอ driving ที่โฮสต์ไว้; ไม่ได้หมายความว่าสามารถอัปโหลดวิดีโอได้
seedintegerRandom seed for reproducibility (0-4294967295). Omit for a random seed.
ขั้นต่ำ: 0
สูงสุด: 4294967295
audiosarrayUp to 5 WAV/MP3 files or URLs, 2-30 s each and 30 s in total, up to 15 MB each.
imagesarrayUp to 10 images (upload or public HTTPS URL), each under 30 MB.
promptstringจำเป็นDescribe how to use the references, the scene, motion and sound.
videosarrayUp to 5 MP4/MOV files or URLs, 2-30 s each and 30 s in total, up to 200 MB each.
durationintegerOutput video duration in seconds (4-30). Billed per second.
ค่าเริ่มต้น: 5
ขั้นต่ำ: 4
สูงสุด: 30
resolutionstringOutput resolution. MAGI-2 renders 1080p only.
ค่าเริ่มต้น: "1080p"
ค่าที่เป็นไปได้: "1080p"
aspect_ratiostringOutput aspect ratio.
ค่าเริ่มต้น: "16:9"
ค่าที่เป็นไปได้: "16:9", "9:16", "1:1", "4:3", "3:4", "21:9"
generate_audiobooleanGenerate a native audio track with the video. Included in the price.
ค่าเริ่มต้น: true
{
"model": "sandai/magi-2/reference-to-video",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"generate_audio": true
}run ที่เสร็จสมบูรณ์จะแสดงผลลัพธ์ใน output ต่อไปนี้เป็นตัวอย่างที่บันทึกไว้ของโมเดล ไม่ใช่การสร้างใหม่
[
{
"url": "https://static.sandbase.ai/examples/eeb92b90-3c1a-4979-9860-1c508e732417/output/d2d4c16f-12c5-4149-9204-87f8ceb701cb.mp4"
}
]