seedinteger
Random seed for reproducibility (0-4294967295). Omit for a random seed.
Tối thiểu: 0
Tối đa: 4294967295
sandai/magi-2MAGI-2 by Sand AI turns text, a first and last frame, or reference images, videos and audio into a 1080p video of 4 to 30 seconds with native audio. Call it from this page, through /v1/run, or with the Volcengine Ark compatible API that Sand AI documents for MAGI-2.
Thử model
PNG, JPEG, WebP hoặc GIF · tối đa 20 MiB
PNG, JPEG, WebP, or GIF · 20 MiB maximum each · up to 10
PNG, JPEG, WebP hoặc GIF · tối đa 20 MiB
Đầu ra của bạn sẽ xuất hiện ở đây
Hoàn tất đầu vào, rồi nhấp Run.
MAGI-2 by Sand AI generates a 1080p video of 4 to 30 seconds from text, a first and last frame, or reference images, videos and audio, with dialogue, sound effects and music generated together with the picture. See MAGI-2 results first if you want to judge the quality.
This one model takes every kind of input on two APIs, with the same API key and price:
/v1/run: SandBase's request format, with the flat fields below. The form on this page sends the same request.content array.See Two ways to call MAGI-2 to choose.
Pick one way to guide the video:
image, optionally end_image, with an optional prompt.images, 5 videos and 5 audios (videos and audio 2 to 30 seconds each and 30 seconds in total), with an optional prompt. Refer to them in the prompt as @Image1, @Video1, @Audio1.Frames and references cannot be combined in one request.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string | — | Scene, motion and sound. Up to 15,000 characters. Required for text only. |
image | image | — | First frame. |
end_image | image | — | Last frame. Requires image. |
images | image list, up to 10 | — | Reference images. |
videos | video list, up to 5 | — | Reference videos, MP4 or MOV. |
audios | audio list, up to 5 | — | Reference audio, WAV or MP3. |
duration | integer 4–30 | 5 | Output length in seconds. Billed per second. |
aspect_ratio | 21:9 / 16:9 / 4:3 / 1:1 / 3:4 / 9:16 | 16:9 | Output aspect ratio. |
resolution | 1080p | 1080p | MAGI-2 renders 1080p only. |
generate_audio | boolean | true | Native audio track, included in the price. |
seed | integer 0–4294967295 | random | Fix the seed for reproducible results. |
enhance_prompt | boolean | model default | Turn prompt enhancement on or off. |
omni_reference_task_type | auto | — | Optional. |
Set model to sandai/magi-2. The fields you send pick the input: prompt alone, image with an optional end_image, or images, videos and audios as references.
curl https://api.sandbase.ai/v1/run \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sandai/magi-2",
"prompt": "The camera moves from a clear dawn shore to sunset.",
"image": "https://example.com/first.jpg",
"end_image": "https://example.com/last.jpg",
"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"
pending and running mean keep polling. Stop when status is failed and read error.
SandBase implements Sand AI's Ark compatibility API for magi-2. Use your SandBase API key and point the Ark SDK or HTTP client at SandBase:
| Sand AI | SandBase | |
|---|---|---|
| Base URL | https://api.sand.ai/compatible/ark/api/v3 | https://api.sandbase.ai/api/v3 |
| Create a task | POST /contents/generations/tasks | POST /contents/generations/tasks |
| Retrieve a task | GET /contents/generations/tasks/{id} | GET /contents/generations/tasks/{id} |
model | magi-2 | magi-2 |
curl https://api.sandbase.ai/api/v3/contents/generations/tasks \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2",
"content": [
{"type": "text", "text": "The camera moves from a clear dawn shore to sunset."},
{"type": "image_url", "role": "first_frame", "image_url": {"url": "https://example.com/first.jpg"}},
{"type": "image_url", "role": "last_frame", "image_url": {"url": "https://example.com/last.jpg"}}
],
"duration": 5,
"ratio": "16:9",
"resolution": "1080p"
}'
In this API, duration (4 to 30) and ratio are required, either as top-level fields or as prompt suffixes such as --rt 16:9 --dur 5; top-level fields win. Omit watermark and the other fields Sand AI lists as unsupported: any value other than null returns 400.
The response is {"id": "..."}. Poll GET /api/v3/contents/generations/tasks/{id} every 10 seconds. queued and running mean keep polling. On succeeded, download content.video_url; the task also reports duration, framespersecond, resolution, ratio and generate_audio when known. failed, expired and cancelled are final; failed and expired tasks carry error.code and error.message.
Requests and responses use the format in the Sand AI documentation. Media URLs can be public HTTPS or data: URLs: images JPEG, PNG, WebP, GIF, BMP, TIFF, HEIC or HEIF under 30,000,000 bytes, audio MP3 or WAV up to 15,000,000 bytes. A request body can be up to 64,000,000 bytes, of which at most 2 MiB is not media; put model near the start of large requests. Also note:
X-Request-Id is returned only when a task is created.sandai/magi-2 runs on one provider on both APIs. The per-mode models can switch providers; see below.$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 |
Both APIs run this model and make the same video at the same price.
/v1/run | Ark compatible API | |
|---|---|---|
| Request | POST /v1/run with flat fields | POST /api/v3/contents/generations/tasks with a content array |
model | sandai/magi-2 | magi-2 |
| Result | GET /v1/run/{id}, then outputs[0].url | GET /api/v3/contents/generations/tasks/{id}, then content.video_url |
| Best for | New integrations and apps that call other SandBase models | Code already written for Sand AI's API or the Ark SDK |
| Price | $0.08 per second | $0.08 per second |
This model runs on one provider. If you need a switch to another provider when one is unavailable, call the per-mode models on /v1/run: Text to Video, Image to Video, Reference to Video. Compare the APIs on the MAGI-2 page. |
Bắt đầu xây dựng
Gửi model này qua 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",
"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"Tạo một SandBase API key và đặt nó trong môi trường máy chủ của bạn. Tất cả request sử dụng xác thực Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Giữ key trên máy chủ. Không hiển thị trong mã trình duyệt hoặc commit vào repository.
POST tới /v1/run với model ID này và các đầu vào của nó. Ví dụ request ở trên bao gồm cả bước gửi và polling.
Dùng run ID được trả về để poll cho đến khi trạng thái là completed, failed hoặc timeout. Chỉ đọc đầu ra sau khi completed.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Cung cấp một URL tệp có thể truy cập công khai trong trường image, video hoặc audio của model. Các định dạng và giới hạn được hỗ trợ hiển thị bên cạnh từng input trong Playground.
Dùng điều khiển upload hoặc replace trên các trường image được hỗ trợ trong Playground. Trường URL video chấp nhận một video driving được host; điều này không đồng nghĩa hỗ trợ tải lên video.
seedintegerRandom seed for reproducibility (0-4294967295). Omit for a random seed.
Tối thiểu: 0
Tối đa: 4294967295
imagestringOptional first frame (upload or public HTTPS URL). Cannot be combined with reference images, videos or audio.
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 reference images (upload or public HTTPS URL), each under 30 MB. Cannot be combined with a first or last frame.
promptstringDescribe the scene, motion and sound. Up to 15,000 characters. Required when no image, video or audio is given.
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.
Mặc định: 5
Tối thiểu: 4
Tối đa: 30
end_imagestringOptional last frame; requires a first frame.
resolutionstringOutput resolution. MAGI-2 renders 1080p only.
Mặc định: "1080p"
Giá trị có thể dùng: "1080p"
aspect_ratiostringOutput aspect ratio.
Mặc định: "16:9"
Giá trị có thể dùng: "16:9", "9:16", "1:1", "4:3", "3:4", "21:9"
enhance_promptbooleanTurn prompt enhancement on or off. Omit to use the model default.
generate_audiobooleanGenerate a native audio track with the video. Included in the price.
Mặc định: true
omni_reference_task_typestringOptional. Only auto is supported.
Giá trị có thể dùng: "auto"
{
"model": "sandai/magi-2",
"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
}Một run đã hoàn tất sẽ hiển thị kết quả trong output. Phần sau là ví dụ đã lưu của model, không phải một lần tạo mới.
Chưa có đầu ra ví dụ nào được công bố. Dùng Playground → Result → JSON sau khi run hoàn tất để xem phản hồi của bạn.