seedinteger
Random seed for reproducibility (0-4294967295). Omit for a random seed.
Минимум: 0
Максимум: 4294967295
sandai/magi-2/text-to-videoMAGI-2 by Sand AI turns a text prompt into a 1080p video of 4 to 30 seconds with native audio, with strong instruction following, complex composition and long-shot stability.
Попробовать модель
Что вы хотите сделать дальше?
Выберите пример, чтобы загрузить его входные данные и результат в playground.
{
"aspect_ratio": "16:9",
"duration": 5,
"prompt": "Follow a woman under a clear umbrella on a rainy night street as the shot moves from a three-quarter view to her profile, then cuts in close."
}{
"aspect_ratio": "16:9",
"duration": 5,
"prompt": "At dawn, waves break gently against the rocks as the camera slowly moves forward."
}MAGI-2 text-to-video API by Sand AI: describe a scene and get a 1080p video of 4 to 30 seconds with dialogue, sound effects and music generated together 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/text-to-video",
"prompt": "A barista slides a latte across the counter and says: \"One oat latte, extra hot.\" Slow push-in, warm morning light. Sound: espresso machine hiss and soft cafe chatter.",
"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/text-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 | A prompt | 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 the scene, motion and sound. Up to 15,000 characters. |
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. |
she says: "Best noodles in town!". MAGI-2 lip-syncs the dialogue.Shot 1: ... Hard cut to Shot 2: .... You can also give the time of each cut, for example hard cut at 2.5s.Sound: rain on the awning and distant traffic, so the audio matches the picture to the last frame.$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 |
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/text-to-video",
"prompt": "At dawn, waves break gently against the rocks as the camera slowly moves forward.",
"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 и задайте его в окружении сервера. Все запросы используют аутентификацию Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Храните ключ на сервере. Не раскрывайте его в коде браузера и не коммитьте в репозиторий.
Отправьте POST на /v1/run с этим ID модели и её входными данными. Пример запроса выше включает отправку и опрос.
Используйте возвращённый ID запуска, чтобы опрашивать статус до завершения, ошибки или таймаута. Читайте вывод только после завершения.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Передайте публично доступный URL файла в поле image, video или audio модели. Поддерживаемые форматы и лимиты показаны рядом с каждым полем Playground.
Используйте управление загрузкой или заменой в поддерживаемых полях изображений в Playground. Поля URL видео принимают размещённое видео для вождения; это не означает поддержку загрузки видео.
seedintegerRandom seed for reproducibility (0-4294967295). Omit for a random seed.
Минимум: 0
Максимум: 4294967295
promptstringобязательноDescribe the scene, motion and sound. Up to 15,000 characters.
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/text-to-video",
"prompt": "At dawn, waves break gently against the rocks as the camera slowly moves forward.",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"generate_audio": true
}В завершённом запуске результат доступен в output. Ниже приведён сохранённый пример модели, а не новая генерация.
[
{
"url": "https://static.sandbase.ai/examples/7b14644a-2110-4c80-951a-b216233e04fb/output/81ab85dd-8eae-43d9-8814-5d97a8f60dd1.mp4"
}
]