MAGI-2
Use magi-2 to create video output. This page contains the complete request needed for this model.
Model facts
| Property | Value |
|---|---|
| Model ID | magi-2 |
| Endpoint | POST /api/v1/generation/create |
| Output | Video |
| Modes | text-to-video, image-to-video, video reference, audio reference |
| Pricing | View current pricing |
Minimal request
curl -X POST https://api.api-stock.com/api/v1/generation/create \
-H "Authorization: Bearer $API_STOCK_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2",
"input": {
"prompt": "A cinematic scene with soft natural light"
}
}'The create response contains a task ID:
{
"code": 200,
"data": {
"taskId": "019ca881-9503-7270-a560-f00fc2b15785",
"status": "not_started",
"createdAt": "2026-08-22T12:00:00.000Z"
}
}Parameters
Parameters belong inside the top-level input object. Unknown fields are rejected.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | No | — | Describe the scene, motion and sound. Required in text and reference modes. max 8000 chars |
duration | integer | No | 5 | Clip length in whole seconds. min 4, max 30 |
resolution | “1080p” | No | "1080p" | Output resolution. |
aspectRatio | “16:9” | “9:16” | “1:1” | “4:3” | “3:4” | “21:9” | No | — | Output aspect ratio for text and reference modes. Defaults to 16:9. Omit it when using firstFrameImage. |
generateAudio | boolean | No | true | Generate a synchronized soundtrack. This setting does not change the price. |
firstFrameImage | string | No | — | Public HTTPS URL of the first frame. The video follows its aspect ratio. Cannot be combined with reference media. |
lastFrameImage | string | No | — | Public HTTPS URL of the last frame. Requires firstFrameImage. |
imageUrls | string[] | No | — | Public HTTPS URLs of up to 10 reference images. |
videoUrls | string[] | No | — | Public HTTPS URLs of up to 5 reference videos. Each is 2–30 seconds, with at most 30 seconds in total. |
audioUrls | string[] | No | — | Public HTTPS URLs of up to 5 audio references. Each is 2–30 seconds, with at most 30 seconds in total. |
Modes
Minimal generation
{
"model": "magi-2",
"input": {
"prompt": "A cinematic scene with soft natural light"
}
}First and last frames
{
"model": "magi-2",
"input": {
"firstFrameImage": "https://example.com/start.jpg",
"lastFrameImage": "https://example.com/end.jpg",
"duration": 8
}
}Multimodal references
{
"model": "magi-2",
"input": {
"prompt": "Show the product from the reference image with the camera movement of the reference video and the supplied audio.",
"imageUrls": [
"https://example.com/product.jpg"
],
"videoUrls": [
"https://example.com/motion.mp4"
],
"audioUrls": [
"https://example.com/score.mp3"
]
}
}Constraints
prompt: maximum 8000 characters.duration: minimum 4; maximum 30.resolution: allowed:1080p.aspectRatio: allowed:16:9,9:16,1:1,4:3,3:4,21:9.- The video follows the aspect ratio of the first frame. Omit aspectRatio in this mode. Provide firstFrameImage before adding lastFrameImage, and keep keyframes and reference inputs in separate requests.
- Text and reference requests require a prompt. Audio references can be used on their own. Clips are charged by requested output seconds, including when the video is silent or uses references.
- A render can take around 20 minutes. Poll the task status or configure a webhook.
Invalid types, unsupported enum values, out-of-range numbers, and missing required fields return HTTP 400 with error.code: "invalid_input". Correct the request rather than retrying it unchanged.
Result
Poll the task or provide a top-level webhook URL in the create request:
curl https://api.api-stock.com/api/v1/task/status/$TASK_ID \
-H "Authorization: Bearer $API_STOCK_KEY"A successful media task returns one or more files:
{
"code": 200,
"data": {
"taskId": "019ca881-9503-7270-a560-f00fc2b15785",
"status": "finished",
"files": [
{
"fileUrl": "https://s3.api-stock.com/result.mp4",
"fileType": "video"
}
],
"createdTime": "2026-08-22T12:00:00.000Z"
}
}See Tasks and webhooks for terminal statuses, retries and webhook delivery.