MAGI-2 Video API
Generate 1080p videos with optional synchronized audio from text, first and last frames, or media references.
MAGI-2 Video API
Generate 1080p videos with optional synchronized audio from text, first and last frames, or media references.
Submit and download
Create an API key in the console. Submit JSON with Bearer authentication, save the returned task ID, and poll the same task until it succeeds or fails. A polling timeout does not stop the task. Download the completed MP4 using the same key.
curl --fail-with-body "https://apimaster.ai/v1/videos/generations" \
-H "Authorization: Bearer $APIMASTER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: magi2-cup-001" \
-d '{"model":"magi-2","prompt":"A slow camera move toward a ceramic cup in soft daylight.","duration":5,"aspect_ratio":"16:9"}'
{"id":"task_…","task_id":"task_…","object":"video","model":"magi-2","status":"queued"}
TASK_ID="task_..."
curl --fail-with-body "https://apimaster.ai/v1/videos/$TASK_ID" \
-H "Authorization: Bearer $APIMASTER_API_KEY"
curl --fail-with-body --location "https://apimaster.ai/v1/videos/$TASK_ID/content" \
-H "Authorization: Bearer $APIMASTER_API_KEY" -o magi-2.mp4
queued → in_progress → completed / failed
Generation modes
Text-to-video
{"model":"magi-2","prompt":"A blue cup on a table. Slow camera push in with quiet room tone.","duration":4,"generate_audio":true}
First and last frames
{"model":"magi-2","prompt":"Move from the first composition to the final composition.","first_frame_image":"https://example.com/start.jpg","last_frame_image":"https://example.com/end.jpg","aspect_ratio":"auto","generate_audio":false}
Multimodal references
{
"model": "magi-2",
"prompt": "Use the image for appearance, the clip for camera movement and the audio for mood.",
"duration": 6,
"omni_reference_task_type": "reference",
"image_with_roles": [{"url": "https://example.com/object.jpg", "role": "reference_image"}],
"video_urls": ["https://example.com/camera.mp4"],
"audio_urls": ["https://example.com/room-tone.mp3"]
}
Use direct public HTTP(S) URLs that download without authentication. References guide the result. Video editing, extension and intermediate keyframes are unsupported.
Parameters
| Field | Type | Rules |
|---|---|---|
model |
string |
magi-2 |
prompt |
string |
Required for every mode. Up to 15,000 characters. |
duration / seconds |
integer |
Output duration in whole seconds from 4 to 30. Default 5. The two names must agree when both are present. |
resolution |
string |
Only 1080p. The field is optional. |
aspect_ratio |
string |
Text and reference modes default to 16:9 and also allow 9:16, 1:1, 4:3, 3:4 and 21:9. With keyframes omit the field or use auto to follow the first frame. Keyframe mode excludes 21:9. |
generate_audio / audio |
boolean |
Audio generation defaults to true. The alias must agree if both fields are supplied. Reference audio goes in audio_urls. |
nsfw_check |
boolean |
Optional pre-submit moderation of the prompt and input images. Defaults to false. |
seed |
integer |
Omit or use -1 for random. A fixed integer from 0 to 2147483647 helps reproduce settings without guaranteeing identical output. |
omni_reference_task_type |
string |
Use auto or reference. A reference video, audio or reference_image role automatically selects reference mode. Use reference explicitly for image_urls alone when they are visual references. |
image_urls |
string[] |
One or two images for keyframe mode. In reference mode combine this array and reference_image roles for up to ten images. |
first_frame_image / last_frame_image |
string |
Use instead of image_urls. The last frame requires the first frame. |
image_with_roles |
object[] |
Each object has url and role. Choose first_frame, last_frame or reference_image. |
video_urls / audio_urls |
string[] |
Up to five clips of each kind. Each clip is 2–30 seconds and the combined duration of each kind must be at most 30 seconds. |
Billing and errors
The Sand AI base price is USD 0.08 per requested output second. A 5-second request has a base price of USD 0.40. Audio, references and aspect ratio do not change the base rate. An invalid submission or a failed generation is not charged. Read message / error.message on submission or on a failed task. To retry a timed-out submission, keep the same Idempotency-Key and body.
