First and Last Frame
Generate a 1080p video with sound from a first frame, optionally with a last frame (MAGI-2 image_to_video).
MAGI-2 starts the video from your first frame and, if you send a second image, ends it on that last frame, generating the motion in between. aspect_ratio is required here too: pick the one of your first frame (results with a different ratio haven't been verified). This mode doesn't take reference videos or audio.
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 | image_to_video |
image_urls | string[] | Yes | 1–2 images: the first is the first frame, the optional second is the last frame. See Media. |
prompt | string | Yes | How the scene moves, at most 8000 characters. Best written in English. Refer to the images as @Image1, @Image2. |
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). Pick the aspect ratio of the first frame. |
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 first and a last frame, 1080p, 9:16 (the frames are portrait), 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": "image_to_video",
"image_urls": ["https://example.com/first.jpg", "https://example.com/last.jpg"],
"prompt": "The flower bud slowly opens into full bloom as morning light moves across the petals",
"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. One or two frames, 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.