Sand AI
MAGI 2
magi-2/reference-to-video
Sand.ai's multimodal video generation series: text, image, video and audio references can all drive output, with visuals and synchronized sound generated in one pass, selectable durations from 4 to 30 seconds, and support for first/last frame continuity and multiple aspect ratio canvases
Try magi-2/reference-to-video
Input
Showcases
View all showcasesOutput
videoPricing
magi-2/reference-to-video $0.1258 per second
Overview
Generates video conditioned on reference assets: you can submit reference images, reference videos, and reference audio together, using the prompt to explain the role of each reference item in order, and output a clip of 4 to 30 seconds with synchronized sound. Aspect ratios cover six options from 21:9 to 9:16, and are not limited by the ratio of the reference assets. It is suitable for content production and creative previews that need to carry over existing characters, scene atmosphere, or sonic character.
Key Highlights
- Three reference types can be mixed — up to 10 reference images, up to 5 reference videos, and up to 5 reference audio clips, combining to constrain both visuals and sound.
- Describe reference items in order — the prompt explains each item in the order the references are listed, making it easy to control how each asset appears in the final video.
- Flexible duration and aspect ratio — 4 to 30 seconds per generation, with one of six aspect ratios chosen independently of the reference asset ratios.
- Synchronized sound generated with the video — dialogue, sound effects, and ambient sound are generated and synchronized with the visuals by default; audio can be turned off to output a silent video at the same price.
Capabilities
- Reference images constrain the visuals: up to 10 jpeg, png, or webp files; use the prompt to explain the role, scene, or style contribution of each image.
- Reference videos provide motion references: up to 5 mp4 or mov clips, each 2 to 30 seconds with a combined total of no more than 30 seconds; must be paired with other reference types.
- Reference audio guides the sound: up to 5 mp3 or wav clips, each 2 to 30 seconds with a combined total of no more than 30 seconds; must be used together with image or video references.
- Write the prompt following the reference order: the prompt can be up to 15,000 characters and describes the target visuals one by one in the order of the reference items; the more reference items there are, the more clearly each one's role must be stated.
- Duration, aspect ratio, and audio: 4 to 30 seconds set in whole seconds, defaulting to 5 seconds; one of six aspect ratios, defaulting to 16:9; synchronized audio is generated by default and can be turned off at the same price.
- Fixed 1080p output: resolution is fixed at 1080p.
Use Cases
- Social short-video teams maintaining character consistency — submit character reference images and describe the action and scene to generate a vertical short video with sound, ready for publishing or re-editing.
- Advertising creative previews — conditioned on product images and atmospheric reference videos, use a long prompt to describe the shots and performance and quickly obtain a dynamic sample for review.
- Multi-shot asset extension — use the same set of reference images to constrain characters and scenes, generating different clips in separate runs while keeping a consistent visual tone across a series.
- Short videos with musical-style references — upload reference audio and visual references to generate a final video whose sound style stays close to the reference, for a consistent auditory tone.
Limitations and Selection Advice
The prompt is required and can be up to 15,000 characters; at least one type of reference asset must be submitted, and audio references must be paired with image or video references. Reference videos and reference audio are each 2 to 30 seconds, with a combined total per type of no more than 30 seconds; up to 10 reference images. Duration is 4 to 30 whole seconds, and resolution is fixed at 1080p. Turning off audio generation outputs a silent video at the same price. The more references there are and the vaguer the descriptions, the harder it is to guarantee frame-by-frame reproduction of characters or visuals.
What's new
View changelog →- New model magi-2/text-to-video is live
- New model magi-2/image-to-video is live
- New model magi-2/reference-to-video is live
Frequently asked questions
View all FAQs →-
How do I choose between image-to-video, reference-to-video, and text-to-video?
If you already have a definite starting frame, use image-to-video; the first frame determines the composition and canvas. To keep characters or scenes consistent across multiple shots, use reference-to-video, which supports up to 10 reference images and up to 5 reference videos and 5 reference audio clips each. If you have no material at all and just want to generate from scratch based on a description, use text-to-video. Only text-to-video and reference-to-video let you directly specify the aspect ratio; image-to-video's canvas follows the first frame.
-
How long a video can this model generate?
duration can be set from 4 to 30 seconds; the default is 5 seconds. Billing is per second, so longer durations cost more. To get a clip of the length you need, just set duration to the corresponding integer.
-
Can the generated audio be turned off? Does turning it off save money?
Yes. generate_audio defaults to true and generates synchronized dialogue, sound effects, and ambient sound; set it to false to get a silent video. Turning off audio does not change the cost — it only removes the audio track — so feel free to turn it off when you need silent footage; there is no need to turn it off to save credits.
-
If I want audio-visual synchronization, how should I write the prompt?
This model's advantage is that it produces picture and sound together in a single generation, so the prompt needs to include the audio. We recommend writing in the order of "main subject and action, camera movement, ambient sound, dialogue or sound effects, pacing," including the original dialogue text along with the speaker, and specifying which action the sound effect occurs on. If you describe only the visuals without writing the audio, the model has no information to align with, and the matching between lip movements and sound effects will degrade.
Create a generation task
https://api.hiapi.ai/v1/tasks Headers
AuthorizationstringRequiredAccount API key. Required on every request. Example: Bearer YOUR_HIAPI_API_KEY. Get your API key
Content-TypestringOptionalThe request body is always parsed as JSON; when sent, only application/json (optionally with charset) is accepted — any other value returns 415. Example: application/json.
Idempotency-KeystringOptionalIdempotency key, up to 255 bytes. Retries with the same key from the same account create the task only once; replays return the original taskId.
On network timeouts or client retries, the same key creates the task only once — no double charges (scope: the API key's account). Use a business-unique identifier as the key (e.g. "order-42"); replays return the original taskId, and keys expire 24 hours after the first request. See the Unified Async API overview for the full scenario matrix.
Body
modelstringRequiredCurrent fixed value: magi-2/reference-to-video
routestringOptionalCurrent fixed value: default
inputobjectRequired
Business parameters for magi-2/reference-to-video and route default — see the parameter table below.
promptstringRequiredminLength 1maxLength 15000Prompt describing the target video content; must reference each reference material in order; maximum 15,000 characters.
durationintegerOptionalDefault: 5min 4max 30Duration of the generated video clip in seconds, range 4-30; cost increases with duration, default 5 seconds.
aspect_ratiostringOptionalDefault: "16:9"Output canvas aspect ratio, independent of the aspect ratios of the reference materials themselves; options are 16:9, 4:3, 1:1, 3:4, 9:16, 21:9; default 16:9.
21:916:94:31:13:49:16generate_audiobooleanOptionalDefault: trueWhether to generate dialogue, sound effects, and ambient sound synchronized with the visuals; when off, outputs a silent video with no effect on price; enabled by default.
reference_audio_urlsarrayOptionalmaxItems 5Array of reference audio URLs, up to 5 mp3/wav clips, each 2-30 seconds and no more than 30 seconds in total; must be used together with image or video references.
Array [ string ]
reference_image_urlsarrayOptionalmaxItems 10Array of reference image URLs, up to 10 jpeg/png/webp images; at least one of the three reference types (image, video, audio) must be provided.
Array [ string ]
reference_video_urlsarrayOptionalmaxItems 5Array of reference video URLs, up to 5 mp4/mov clips, each 2-30 seconds and no more than 30 seconds in total; must be used together with references of other types.
Array [ string ]
callbackobjectOptional
Terminal-state notification config. When omitted, no callback is delivered — poll the task yourself. See the callback note below.
Provide callback.url when creating a task and HiAPI POSTs to your service once the task reaches a terminal state — no polling needed. The callback payload mirrors the task detail structure; signature verification, delivery retries and idempotency are documented on the Unified Async API overview page.
urlstringRequiredRequired when callback is present. A POST is sent to this URL once the task reaches a terminal state; must be a valid http(s) URL.
whenstringOptionalDefault: "final"Only final is supported today — notified on both success and fail.
finalstoragestringOptionalDefault: "temp"Artifact storage tier: temp (default, retained about 7 days) or persistent (long-term, billed by size). Insufficient balance or exceeding the storage cap silently downgrades to temp; the effective tier is shown in the task detail response.
temppersistentRequest examples
# Submit an async task; returns a taskId immediately (no waiting for generation)
curl -X POST "https://api.hiapi.ai/v1/tasks" \
-H "Authorization: Bearer $HIAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2/reference-to-video",
"input": {
"prompt": "…",
"duration": 5,
"aspect_ratio": "16:9",
"generate_audio": true
}
}' const res = await fetch("https://api.hiapi.ai/v1/tasks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HIAPI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "magi-2/reference-to-video",
input: {
"prompt": "…",
"duration": 5,
"aspect_ratio": "16:9",
"generate_audio": true
}
}),
});
const task = await res.json();
// { code: 200, message: "success", data: { taskId } } import os, requests
res = requests.post(
"https://api.hiapi.ai/v1/tasks",
headers={"Authorization": f"Bearer {os.environ['HIAPI_API_KEY']}"},
json={
"model": "magi-2/reference-to-video",
"input": {
"prompt": "…",
"duration": 5,
"aspect_ratio": "16:9",
"generate_audio": True
}
},
)
print(res.json()) # { code, message, data: { taskId } } 200 OK
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR"
}
} 400 Bad Request
{
"code": 400,
"message": "invalid request",
"data": null,
"error_code": "INVALID_REQUEST"
} Get task detail
https://api.hiapi.ai/v1/tasks/:id Response fields
taskIdstringRequiredTask ID, always prefixed with tk-hiapi-.
modelstringRequiredResolved full model name. Tasks submitted with the route parameter return base@route (e.g. gpt-image-2/text-to-image@ext); otherwise identical to the name passed at creation.
routestringOptionalPresent only when the task was submitted with an explicit route parameter; echoes the submitted value.
statusstringRequiredTask status.
queued Queued, not started yet.
handling Being processed.
archiving Processing finished, artifacts being prepared.
success Terminal: completed, artifacts available (output returned).
fail Terminal: failed (error returned).
After submission, check status: success and fail are terminal, everything else is non-terminal. Poll every 1–3 seconds until terminal. On success, download artifacts from output[].url and transfer them before expireAt; pass storage: "persistent" at creation time when long-term retention is needed.
creatednumberRequiredTask creation time (Unix seconds).
completednumberRequiredUnix seconds when the task reached a terminal state; fixed to 0 while not terminal.
outputarrayOptional
Present only when status == success. Artifact list — always an array; a single task may return multiple types at once (e.g. video + first_frame).
Array [ object ]
Array items
urlstringRequiredArtifact URL, directly downloadable.
typestringRequiredCurrent possible values: video, image, audio, first_frame, last_frame, thumbnail; more may be added later.
expireAtnumberRequiredUnix seconds until which the artifact remains accessible; download or transfer before it expires.
errorobjectOptional
Present only when status == fail.
codestringRequiredBusiness error code.
messagestringRequiredError description.
Response examples
Success
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR",
"model": "happyhorse-1-0",
"status": "success",
"created": 1777282033,
"completed": 1777282099,
"output": [
{
"url": "https://cdn.hiapi.ai/tasks/.../video.mp4",
"type": "video",
"expireAt": 1777886899
}
]
}
} Processing (non-terminal)
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "archiving",
"created": 1777282033,
"completed": 0
}
} Failed
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "fail",
"created": 1777282033,
"completed": 1777282099,
"error": {
"code": "TASK_FAILED",
"message": "task failed"
}
}
} Articles
View all articles →-
Guide
Getting Started with magi-2: Generate a 4-Second Video with Sound from a Single Prompt
Three steps from prompt to finished video: describe the picture clearly, set the duration, and get a finished video with synchronized sound effects.
-
Tutorial
Hands-on: Turn a portrait poster into a 4-second short video with dialogue
Without changing the composition or redrawing the character, just add a line of motion and dialogue to make the still frame speak.
-
Comparison
How to choose between magi-2, Kling and Seedance: pick a video model by how you start
It is still video generation, but the difference is not in the spec sheet — it is in what starting point you have on hand: a sentence, an image, or a character design.
Related Models
View all models →Same Type
-
Kling 4.0 Flash Kuaishou $0.122 /second -
MiniMax H3 Max Turbo MiniMax $0.027 /second -
Wan 2.2 Animate Alibaba $0.043 /second -
Seedance 2.0 ByteDance $0.010 /second -
PixVerse V6 Max PixVerse $0.030 /second -
Grok Imagine 1.5 xAI $0.011 /second -
PixVerse V6 PixVerse $0.036 /second -
LTX 2.5 Pro Lightricks $0.172 /second -
Kandinsky 6.0 Pro Sber AI $1.93 /video -
OmniHuman 2.0 ByteDance $0.100 /second -
Gemini Omni 1.1 Google $0.450 /video -
Kling 3.0 Kuaishou $0.100 /second