Overview
MAGI-2 Video Generationendpoint, 1080P (,, ), supported Method:
-Text-to-Video (t2v):video
-Image-to-Video (i2v):first frame image as video, can last frame
-Reference-to-Video (r2v):Reference image / Reference video / Reference audio, Scenario or
videoDuration 4~ 30 secondsany seconds, Per-second billing.
Base URL: https://mm-internal-cn.leonecloud.com
Authentication
All endpoints require a token in the request header for authentication:
Authorization: Bearer {YOUR_AUTH_TOKEN}Quick Start
cURL Example
Create Text-to-Video task
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/magi-2" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"genType": "t2v",
"prompt": ":,, in in.:,, in;,:“localized example text!”:,, and, after.",
"duration": 5,
"aspectRatio": "16:9"
}'Create Image-to-Video task (first frame )
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/magi-2" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"genType": "i2v",
"firstFrameImage": "https://example.com/first_frame.jpg",
"prompt": "first frame:, subject, and.: and Scenario, after.",
"duration": 5
}'Create Image-to-Video task (last frame )
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/magi-2" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"genType": "i2v",
"firstFrameImage": "https://example.com/first_frame.jpg",
"lastFrameImage": "https://example.com/last_frame.jpg",
"duration": 8
}'create Reference-to-Videotask
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/magi-2" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"genType": "r2v",
"prompt": "number images Reference image in the as,, and.,,:“localized example text.”,.:, and, after.",
"referenceImages": ["https://example.com/person.jpg"],
"referenceAudios": ["https://example.com/voice.wav"],
"duration": 10,
"aspectRatio": "9:16"
}'Query Task Status
curl -X GET "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/task_abc123" \
-H "Authorization: Bearer your_auth_token_here"Endpoints
1. create MAGI-2 Video Generationtask**POST** /api/v2/open/aigc/magi-2
Content-Type: application/json
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| genType | string | No | Method:t2v(Text-to-Video) / i2v(Image-to-Video) / r2v(Reference-to-Video).If omittedwhen: reference asset→ r2v, first frame image→ i2v, localized example textt2v |
| prompt | string | Condition | Prompt, maximum 15000 characters.t2v / r2v Required, i2v can ( when first frame image ).subject,, and; |
| firstFrameImage | string | Condition | first frame image URL (i2v Required).JPG / PNG / WEBP, videoimage, image |
| lastFrameImage | string | No | last frame image URL (onlyi2v).provide when video image |
| referenceImages | string[] | Condition | Reference image URL list, up to 10 images (JPG / PNG / WEBP) |
| referenceVideos | string[] | Condition | Reference video URL list, up to 5 (MP4 / MOV).2~ 30 seconds, with Reference video exceeds 30 seconds |
| referenceAudios | string[] | Condition | Reference audio URL list, up to 5 (MP3 / WAV).2~ 30 seconds, with Reference audio exceeds 30 seconds |
| duration | int | No | videoDuration (seconds):4 ~ 30 any, default 5.Per-second billing |
| resolution | string | No | Output resolution:onlysupported1080p (default) |
| aspectRatio | string | No | :21:9 / 16:9(default) / 4:3 / 1:1 / 3:4 / 9:16.i2v supported Parameter (first frame image ) |
| generateAudio | boolean | No | Generate Sound (,, ), defaulttrue.asfalse no video,Pricinglocalized example text |
| seed | int | No | random seed, range 0 ~ 2147483647.If omittedas |
| taskNickname | string | No | tasklocalized example text |
| callbackUrl | string | No | Callback notification URL after the task is complete |
Parameterlocalized example text
-r2vmustprovide reference asset (Reference image, Reference video or Reference audio), can be used together> -firstFrameImageand reference asset when provide:Image-to-Video and Reference-to-Video Method> - with asset URL must can> - Create Taskwhenduration, taskFailure#### Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | int | Status Code, 0 indicates success |
| msg | string | Message |
| data.taskId | string | Task ID, used to query task status |
| data.status | string | Task Status, fixed to processing |
| data.createdAt | string | Created Time |
Response Example
Success
{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_20261126150000_abc12345",
"status": "processing",
"createdAt": "2026-11-26 15:00:00"
}
}Insufficient balance
{
"code": 40001,
"msg": "Insufficient balance: first 0.0100, 0.4400",
"data": null
}2. Query Task Status
GET /api/v2/open/aigc/{taskId}
Response Example
Success
{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_20261126150000_abc12345",
"status": "success",
"result": [
"https://fc-gw-sh.oss-accelerate.aliyuncs.com/videos/2026/11/26/output_001.mp4"
],
"createdAt": "2026-11-26 15:00:00",
"updatedAt": "2026-11-26 15:03:30"
}
}Failure
{
"code": 0,
"msg": "success",
"data": {
"taskId": "task_20261126150000_abc12345",
"status": "failed",
"errorMsg": "Failure",
"createdAt": "2026-11-26 15:00:00",
"updatedAt": "2026-11-26 15:01:10"
}
}3. Batch Query Task Status
POST /api/v2/open/aigc/batch
query task execute Status (up to 100 ).
4. Query Account Balance
GET /api/v2/open/balance
Callback Notification
task complete (Success or Failure) when, if Create Task when providecallbackUrl, was provided when creating the task, the system sends a POST request to that URL.
Headers
Content-Type: application/json
X-Funcloud-Event: task.completed
X-Funcloud-Signature: {localized example text}Body
{
"event": "task.completed",
"taskId": "task_20261126150000_abc12345",
"status": "success",
"result": ["https://fc-gw-sh.oss-accelerate.aliyuncs.com/videos/output_001.mp4"],
"errorMsg": "",
"timestamp": "2026-11-26T15:03:30+08:00",
"signature": "a1b2c3d4e5f6..."
}Error Codes
| code | Description |
|---|---|
| 0 | Success |
| 10002 | Parametermissing or malformed |
| 10005 | API Key invalid or missing |
| 30003 | Task not found |
| 40001 | Insufficient balance |
| 90003 | Internal server error |
Billing
- localized example textvideoDuration:× Duration (seconds)
generateAudioasfalse, and- reference asset
- Method
- Create Task when RequestDuration, taskSuccess after, Failure---## Best Practices
1. Prompt Tips
- localized example text「/」, Model will
- in, Model will and
- -「:……」(,, ), and"after", - in when, and,### 2. Duration- 4~ 10 seconds:or, Success and height
- 10~ 30 seconds:, recommended in Prompt### 3. Polling Strategy
- first 60 seconds:query every 5 seconds
- 60 seconds after:query every 10 seconds
- recommendedCallback NotificationPolling### 4. Processing Time Reference
when Duration, 5 secondsUsually 1~ 3 minutes, 30 secondscan 5 minutes.when task will Failure and, after can.
5. Balance Management
- Create Taskfirst recommended query
- taskSuccess after in
- taskFailureto available balance