Skip to main content

Overview

Use model ID magi-2 to generate videos from a prompt, a first frame with an optional last frame, or a prompt with optional image, video, and audio references.

Output dimensions

1080p is the output tier. The actual pixel dimensions depend on aspect_ratio. Set aspect_ratio explicitly to control framing. If you omit it, text-to-video and reference-to-video use 16:9. Image-to-video uses the closest supported ratio to the first frame.

Endpoints and authentication

Base URL:
Send Authorization: Bearer YOUR_API_KEY with both requests and Content-Type: application/json with the POST body.

Request examples

Text-to-video

Image-to-video

This example requests square output and uses both a first and a last frame. To animate a single image, pass only the first URL.

Reference-to-video

Parameters

string
default:"async"
Supported values: async, callback. With async, poll until data.state is success or failed. With callback, read the final webhook payload. On success, parse data.resultJson as JSON and read resultUrls. On failure, read data.failCode and data.failMsg.
string
Required when request_type is callback. Use a public HTTPS URL that can receive the final task payload. See Webhooks.
object
required
MAGI-2 generation parameters.
Keep media URLs accessible while the task runs. The first frame may be cropped to fit the selected output ratio.

Task status and results

The creation response returns data.taskId.
For async requests, call the status endpoint with that ID and continue polling until data.state is success or failed. For callback requests, read the same result fields from the final webhook payload.
On success, parse data.resultJson as JSON and read the MP4 URLs from resultUrls. On failure, read data.failCode and data.failMsg. See Status Task and Error Codes for the shared response fields.

Billing

The standard price is $0.080 per requested output second** for all three modes. Aspect ratio, the sound setting, and reference media leave the rate unchanged. A 4-second request costs **$0.32 at the standard rate. See API Pricing for current rates.

MCP integration

The model schema declares video decoding in mcp.result and file bindings in mcp.attachments for image_urls, video_urls, and audio_urls. Preserve image order when binding first and last frames.