Reference to Video
Generate a new 1080p video with sound from reference images, videos and audio (MAGI-2 reference_to_video).
MAGI-2 builds a new video from your reference images, videos and audio. The movement follows the reference video pose by pose, the people and outfits come from the reference images, and the model generates the scene itself. Send at least one of image_urls, video_urls and audio_urls; reference audio alone is fine.
Reference images (image_urls) | Reference videos (video_urls) | Reference audio (audio_urls) | |
|---|---|---|---|
| Count | Up to 10 | Up to 5 | Up to 5 |
| Length | – | Each 2–30 seconds; together at most 30 seconds | Each, and all together, at most 30 seconds (at least 2 seconds each recommended) |
Write in the prompt which file plays which part, for example "The person from @Image1, copying the movements in @Video1". A reference video without sound usually gives an output with little sound. The other requirements are under Media.
Create a task
https://api.nanoapi.ai/v1/tasksUse the shared create endpoint with model: "magi-2.0".
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <API key>, see Authentication. |
Content-Type | Yes | application/json |
Idempotency-Key | No | A unique string for every new task, ideally a UUID (1–255 characters). See Preventing duplicate tasks. |
Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | magi-2.0 |
mode | string | Yes | reference_to_video |
image_urls | string[] | Conditional | At least one of image_urls, video_urls and audio_urls. Up to 10 reference images. |
video_urls | string[] | Conditional | At least one of image_urls, video_urls and audio_urls. Up to 5 reference videos: each 2–30 seconds, together at most 30 seconds. See Media. |
audio_urls | string[] | Conditional | At least one of image_urls, video_urls and audio_urls. Up to 5 reference audio files: each, and all of them together, at most 30 seconds. |
prompt | string | Yes | What the video shows, at most 8000 characters. Best written in English. Refer to the files as @Image1, @Video1, @Audio1, see Referring to files. |
resolution | string | Yes | 1080p, the only resolution (send it anyway). |
aspect_ratio | string | Yes | 21:9, 16:9, 4:3, 1:1, 3:4 or 9:16 (auto isn't accepted). |
duration | integer | Yes | Output length in seconds, 4–30. Billed per second, see Pricing. |
generate_audio | boolean | No | Whether the output has sound, default true. Doesn't affect the price. |
webhook_url | string | No | Notified when the task succeeds or fails: https, up to 2048 characters, not a private, loopback or reserved address. See Webhooks. |
A reference image and a reference video, 1080p, 9:16, 5 seconds:
curl https://api.nanoapi.ai/v1/tasks \
-H "Authorization: Bearer $NANOAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2.0",
"mode": "reference_to_video",
"image_urls": ["https://example.com/woman.png"],
"video_urls": ["https://example.com/dance.mp4"],
"prompt": "The woman from @Image1 dances in a bright kitchen, copying the movements of the dancer in @Video1.",
"resolution": "1080p",
"aspect_ratio": "9:16",
"duration": 5
}'Response: 200 OK, the new task (fields). Keep data.id to get the result: rendering takes about 13–20 minutes. The task can still fail, see Errors.
{
"code": 200,
"message": "success",
"data": {
"object": "task",
"id": "tk_01jbq5w8m2c4x7b0n3q6t9e1r5",
"model": "magi-2.0",
"status": "queued",
"error": null,
"created_at": "2026-11-25T08:30:00Z"
}
}Pricing
cost = duration × price per second (1080p)Loading the current prices…
Billed seconds are the duration you ask for. How many reference images, videos or audio files you send, how long they are, the aspect ratio and sound in the output (generate_audio) don't change the price. Current prices: GET /v1/products (the prices row of magi). The task's billing.frozen is the amount that counts; freezing and charging: Billing.
Errors
See MAGI-2 → Errors. This mode's parameter rules are in the table above.