Skip to main content
POST
MAGI-2 is a video generation model from Sand AI. Submit to POST /v1/videos/generations, read data[0].task_id, then use the task status API to retrieve the result.
string
required
Use Authorization: Bearer <token>, where <token> is your APIMart API key.

Generation modes

The input materials determine the mode first. Automatically selected reference mode behaves the same as explicit reference. In reference mode, all images are references; images in image_urls and entries with role: "reference_image" in image_with_roles share a combined limit of 10 images. The reference examples explicitly set omni_reference_task_type: "reference". Describe the purpose of each input in the prompt. References guide generation; source videos are not spliced into the output and source audio is not preserved verbatim.

Request parameters

string
required
magi-2
boolean
default:"false"
Whether to run content moderation before submitting the video task.
  • true: use omni-moderation-latest to review prompts and input images
  • false or omitted: do not send a moderation request, adding no moderation cost or latency (default)
string
required
Required in all three modes, up to 15,000 characters. Describe the scene, action, camera and sound; put spoken dialogue in quotation marks.
integer
default:"5"
Whole seconds from 4 to 30, default 5. Explicit 0, fractional values and out-of-range values return HTTP 400. Omit this field to use the default.
integer
Alias for duration. If both are sent, their values must match.
string
default:"1080p"
Only 1080p is supported; omitting the field also produces 1080p. Other values return HTTP 400.
string
Text-to-video and reference-to-video support 16:9 (default), 9:16, 1:1, 4:3, 3:4 and 21:9. Image-to-video supports the first five ratios, excluding 21:9; omit the field or use auto to follow the first frame’s aspect ratio. Output resolution remains 1080p.
boolean
default:"true"
Whether to generate audio, default true. Set to false for output without an audio track. If audio is also sent, the values must match.
boolean
Alias for generate_audio; the values must not conflict. Send reference audio through audio_urls.
integer
An integer from 0 to 2147483647. Omit it or send -1 for a random seed. A fixed seed can make results with identical parameters more similar, but does not guarantee identical output.
string
default:"auto"
Supports auto (default) and reference. Explicitly set reference when using multiple image_urls as reference images. edit and extend are unsupported.
string[]
Each item must be a public HTTP(S) image URL. The 2-image limit applies only to image-to-video: the first frame and optional last frame. This mode applies when only images are supplied, with no reference video or audio, no explicit reference, and no reference_image role. In reference mode, this entire array contains references and shares a combined limit of 10 with reference_image entries in image_with_roles, whether the mode is selected automatically or explicitly.
string
Public HTTP(S) URL of the first frame. Choose either the dedicated frame fields or image_urls.
string
Optional public HTTP(S) URL of the last frame, used together with a first frame. Choose either the dedicated frame fields or image_urls.
object[]
Each item contains url (a public HTTP(S) image URL) and role: first_frame, last_frame or reference_image. Image-to-video allows at most one first frame and one last frame. The reference_image role selects reference mode; these images and those in image_urls share a combined limit of 10.
string[]
Up to 5 reference videos, each 2–30 seconds, with a combined duration of at most 30 seconds recommended; the upstream service may truncate excess duration. Use an array of public HTTP(S) URLs. The singular video_url field is unsupported.
string[]
Up to 5 reference audio clips, each 2–30 seconds, with a combined duration of at most 30 seconds recommended; the upstream service may truncate excess duration. Each item must be a public HTTP(S) URL.

Input requirements

All inputs must use publicly accessible direct HTTP(S) URLs. Login requirements, hotlink protection or download failures can cause the task to fail. For local files, first use image upload, video upload or audio upload to obtain a URL.

Request examples

First and last frames

With one image, only a first frame is supplied. Omitting aspect_ratio follows its aspect ratio. You may use first_frame_image and last_frame_image instead of the example’s image_urls.

Image-only references

Mixed image, video and audio references

Task polling and results

Poll the task status API until completed or failed. Generation usually takes several minutes and may take longer under load. A fixed waiting period alone does not mean the task failed. Stopping polling does not cancel the task.

Unsupported features

The following return HTTP 400 on submission: mode, negative_prompt, watermark: true, camera_control, multi_shot / multi_prompt, element_list, video_list, voice_list, audio_setting, intermediate keyframe inputs, omni_reference_task_type: "edit" / "extend", singular video_url, and any resolution other than 1080p. Video editing and extension are not available.

Common errors

For submission failures, read error.message. For failures after task creation, read data.error.message from the task status response.