Sand AI
MAGI 2
magi-2/image-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/image-to-video
Input
Showcases
View all showcasesOutput
videoPricing
magi-2/image-to-video $0.1258 per second
Overview
Generate a 4- to 30-second dynamic video clip starting from a single static image. The first frame determines the output aspect ratio and composition; you can optionally add a last-frame image to guide the ending. The prompt describes motion and sound. By default, dialogue, sound effects, and ambient sound are generated at the same time. This is suited to extending a finished key visual, storyboard, or character image into a playable shot.
Key Highlights
- The first frame defines the canvas — upload a jpeg, png, or webp first-frame image, and the output video's aspect ratio and composition follow that image.
- Two-way guidance from first and last frames — you can add a last-frame image to control where the shot lands; if omitted, the model decides how to conclude.
- Flexible, adjustable duration — a single clip can be set to any whole-second duration from 4 to 30 seconds, defaulting to 5 seconds, billed per second.
- Visuals and audio generated in one pass — synchronized dialogue, sound effects, and ambient sound are included by default, or you can disable them for silent visuals at the same price.
Capabilities
- First-frame-driven image-to-video: A first-frame image is required, supporting jpeg, png, and webp; you can upload a file or paste a public https link. The output aspect ratio and composition follow that frame.
- Last-frame landing control: You can optionally provide a second image as the last frame to guide the ending shot, in the same format as the first frame; if not provided, the model decides the ending on its own.
- Prompts describe motion: The prompt can be up to 15,000 characters and is used to describe subject action, camera movement, visual pacing, and sound, organizing the subsequent motion on top of the first frame.
- Duration and audio: Set from 4 to 30 seconds in whole seconds, defaulting to 5 seconds; synchronized audio is generated by default, and you can disable it to output a silent video at the same price.
- Resolution follows the first frame: Output follows the first frame's aspect ratio, with total pixel count roughly equivalent to 1080p, without cropping or stretching; for greater clarity, upscale the first-frame image first.
Use Cases
- Illustrators turning a single illustration into a short animated clip — use a finished illustration as the first frame, describe a slight camera push-in and element motion, and use it for a portfolio or social platform showcase of an animated version.
- Advertising teams producing storyboard previews — use concept art as the first frame and a last-frame image to fix the landing point, generating short clips to check shot continuity and pacing for client sign-off on direction.
- Story creators extending character scenes — use a character reference image as the first frame, describe actions and scene changes, and generate multiple short clips for narrative drafts or dynamic storyboard organization.
Limitations and Selection Advice
The first-frame image is a required input; without it, generation cannot be started. The last-frame image is optional, and if omitted the ending is decided by the model. Duration is limited to whole seconds from 4 to 30, the prompt can be up to 15,000 characters, and output follows the first frame's aspect ratio with a total pixel count of roughly 1080p class. Aspect ratio and composition follow the first frame; to change the aspect ratio, change the first-frame image. If audio generation is disabled, the output is a silent video at the same price. To start from text only, use text-to-video instead; to use multiple types of reference assets, use reference-to-video instead.
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/image-to-video
routestringOptionalCurrent fixed value: default
inputobjectRequired
Business parameters for magi-2/image-to-video and route default — see the parameter table below.
promptstringOptionalminLength 1maxLength 15000Optional motion and sound direction text describing the visual dynamics and audio direction, up to 15,000 characters.
durationintegerOptionalDefault: 5min 4max 30Video clip duration in seconds, ranging from 4 to 30, default 5; the cost increases with duration.
generate_audiobooleanOptionalDefault: trueWhether to generate dialogue, sound effects, and ambient sound synchronized with the visuals, default true; when disabled, outputs a silent video and does not affect the price.
last_frame_urlstringOptionalOptional ending frame image, supporting the same formats as the first frame, used to specify the closing frame of the shot; when omitted, the model decides how to end the shot.
first_frame_urlstringRequiredRequired starting frame image, supporting jpeg/png/webp; upload a file or paste a public https URL; the output canvas size follows this frame.
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/image-to-video",
"input": {
"duration": 5,
"generate_audio": true,
"first_frame_url": "…"
}
}' 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/image-to-video",
input: {
"duration": 5,
"generate_audio": true,
"first_frame_url": "…"
}
}),
});
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/image-to-video",
"input": {
"duration": 5,
"generate_audio": True,
"first_frame_url": "…"
}
},
)
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 →-
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.
-
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.
-
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
-
MiniMax H3 Max Turbo MiniMax $0.027 /second -
Hailuo 2.3 MiniMax $0.270 /video -
Wan 2.6 Flash Alibaba $0.029 /second -
HappyHorse 1.1 Alibaba $0.160 /second -
Kling 4.0 Kuaishou $0.204 /second -
Kling 4.0 Flash Kuaishou $0.122 /second -
P-Video 2 Pro Avatar Pruna AI $0.029 /second -
BRIA VRMBG 3.0 Bria $0.071 /second -
PixVerse V6 Max PixVerse $0.030 /second -
FLUX 3 Max Black Forest Labs $0.243 /second -
Wan 3.0 Video Alibaba $0.040 /second -
Kling 2.6 Kuaishou $0.100 /second