Text to Video
Generate a 1080p video with sound from a prompt alone (MAGI-2 text_to_video).
MAGI-2 generates a 1080p video with sound from a prompt alone.
Create a task
POST
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 | text_to_video |
prompt | string | Yes | What the video shows, at most 8000 characters. Best written in English. |
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. |
1080p, 16:9, 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": "text_to_video",
"prompt": "A paper boat drifting down a rainy street, close-up tracking shot",
"resolution": "1080p",
"aspect_ratio": "16:9",
"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. 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.