MiniMax Video Generation API Reference

Updated at:

The MiniMax Video Generation model supports text-to-video, image-to-video (first frame), image-to-video (last frame), image-to-video (first and last frames), and multimodal reference-to-video .

ImportantThis document applies only to the China (Beijing) region. Use an API key from this region.

Activate the Service

Go to the Alibaba Cloud Model Studio console, search for "MiniMax", find the MiniMax model card, click Enable Now, and confirm the activation and authorization in the pop-up window.

Applicable Scope

To ensure successful API calls, make sure that the model, Endpoint URL, and API Key all belong to the same region. Cross-region calls will fail.

HTTP Call

Since video generation tasks take a long time (typically 1-5 minutes), the API uses asynchronous calls. The entire process includes two core steps: "Create task -> Poll for results", as described below:

Step 1: Create a Task and Obtain the Task ID

Beijing region: POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Replace {WorkspaceId} with your actual workspace ID.

Note

  • After the task is created successfully, use the task_id returned by the API to query the result. The task_id is valid for 24 hours. Do not create the task repeatedly; poll to obtain the result.
  • For beginner guidance, see Postman.

Request Parameters

Request Headers

Content-Type string (Required)

The content type of the request. Must be application/json.

Authorization string (Required)

Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx.

X-DashScope-Async string (Required)

Asynchronous processing configuration parameter. HTTP requests support asynchronous mode only, and it must be set to enable.

ImportantIf this request header is missing, the error "current user api does not support synchronous calls" is returned.

Request Body

model string (Required)

The model name.

Valid values:

  • MiniMax/MiniMax-H3

input object (Required)

The input information, such as prompts and media assets.

Properties

prompt string (Required)

The text prompt that describes the desired elements and visual characteristics for the generated video.

Supports both Chinese and English. The length is calculated by character count and must not exceed 7,000 characters. Exceeding this limit will return an error.

media array (Optional)

This parameter is not required for text-to-video tasks.

A list of media assets used to specify image, video, or audio materials.

Supported input combinations (corresponding to different generation scenarios):

  • Image-to-video (first frame): 1 first_frame image.
  • Image-to-video (last frame): 1 last_frame image.
  • Image-to-video (first and last frames): 1 first_frame + 1 last_frame image.
  • Multimodal reference-to-video: A combination of reference images (image_url) + reference videos (feature) + reference audio (driving_audio).

NoteImage-to-video and multimodal reference-to-video are mutually exclusive: when any of image_url / feature / driving_audio types appear in media, first_frame / last_frame cannot be used (and vice versa). The two modes cannot be mixed.

Properties

type string (Required)

The media asset type. Valid values:

  • first_frame: First frame image.
  • last_frame: Last frame image.
  • image_url: Reference image (multimodal reference-to-video).
  • feature: Reference video (multimodal reference-to-video).
  • driving_audio: Reference audio (multimodal reference-to-video).

url string (Required)

The URL of the media asset. Assets include images, videos, and audio files.

Image input (type=first_frame, last_frame, or image_url)

The image URL.

Image requirements:

  • Formats: JPG, JPEG, PNG, WEBP, HEIC, HEIF.
  • Resolution: Width and height must be in the range of [256, 5760] pixels.
  • Aspect ratio (width/height): [0.4, 2.5].
  • File size: Up to 30 MB.
  • Quantity limits: Up to 1 first frame, up to 1 last frame, and up to 9 reference images.

Video input (type=feature)

The video file URL. Used only in multimodal reference-to-video scenarios.

Video requirements:

  • Formats: MP4, MOV.
  • Encoding: Video H.264/AVC, H.265/HEVC; Audio AAC, MP3.
  • Duration per clip: [2, 15] seconds; total duration must not exceed 15 seconds.
  • Resolution: Width and height must be in the range of [256, 5760] pixels.
  • Aspect ratio (width/height): [0.4, 2.5].
  • Frame rate: [23.976, 60] fps.
  • File size: Up to 50 MB.
  • Quantity limit: Up to 3 videos.

Audio input (type=driving_audio)

The audio file URL. Used only in multimodal reference-to-video scenarios.

Audio requirements:

  • Formats: WAV, MP3.
  • Duration per clip: [2, 15] seconds; total duration must not exceed 15 seconds.
  • File size: Up to 15 MB.
  • Quantity limit: Up to 3 audio files.

parameters object (Optional)

Video generation parameters, such as resolution, aspect ratio, and video duration.

Properties

resolution string (Required)

The video resolution tier.

  • 768P: Standard resolution.
  • 2K: 2K high-definition resolution.

ratio string (Optional)

The aspect ratio of the generated video. Defaults to adaptive (automatic, adaptively selects the most suitable aspect ratio based on input).

Valid values:

  • adaptive: Adaptive (default)
  • 16:9
  • 9:16
  • 1:1
  • 4:3
  • 3:4
  • 21:9

Rules for different scenarios:

  • Text-to-video: Required, and must not be adaptive. A specific ratio must be specified.
  • Image-to-video: The aspect ratio is determined by the input image, always adaptive. Other values will not cause an error but will be ignored.
  • Multimodal reference-to-video: Optional, defaults to adaptive. A specific ratio can also be specified.

duration integer (Required)

ImportantThe duration directly affects the cost. Billing is per second - the longer the duration, the higher the cost. Please check pricing on the Model Studio console.

The duration of the generated video in seconds. Must be an integer in the range [4, 15].

Example: 5.

watermark boolean (Optional)

Whether to add a watermark to the generated video. The watermark is located at the bottom-right corner of the video with the fixed text "AI-generated".

  • false: Default. No watermark is added.
  • true: Add a watermark.
# 以下为华北2(北京)地域的URL。请将 {WorkspaceId} 替换为您的百炼业务空间ID。
curl --location 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "MiniMax/MiniMax-H3",
    "input": {
        "prompt": "史诗级太空歌剧院线预告:女舰长独自站在巨大观景窗前,最后一支舰队正在集结并跃迁离去,强光爆闪、舰桥震动,她被留在原地。"
    },
    "parameters": {
        "resolution": "768P",
        "ratio": "16:9",
        "duration": 5,
        "watermark": true
    }
}'
import dashscope
import os
from dashscope import DashScopeError

# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
# 获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
client = dashscope.Client(api_key=os.getenv("DASHSCOPE_API_KEY"))

def sample_async_call():
    # 异步提交视频生成任务
    try:
        job = client.videos.jobs.create(model='MiniMax/MiniMax-H3',
                                        prompt='史诗级太空歌剧院线预告:女舰长独自站在巨大观景窗前,最后一支舰队正在集结并跃迁离去,强光爆闪、舰桥震动,她被留在原地。',
                                        resolution='768P',
                                        ratio='16:9',
                                        duration=5,
                                        watermark=True)
        print(job)
        print("task_id: %s" % job.task_id)
    except DashScopeError as e:
        print(f"HTTP返回码:{e.status_code}")
        print(f"错误码:{e.code}")
        print(f"错误信息:{e.message}")
        print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
        return

    # 查询任务状态
    try:
        snapshot = client.videos.jobs.fetch(job.task_id)
        print(snapshot.status)
    except DashScopeError as e:
        print(f"HTTP返回码:{e.status_code}")
        print(f"错误码:{e.code}")
        print(f"错误信息:{e.message}")
        print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")

    # 等待任务完成
    try:
        done = client.videos.jobs.wait(job)
        print(done)
        print(done.video_url)
    except DashScopeError as e:
        print(f"HTTP返回码:{e.status_code}")
        print(f"错误码:{e.code}")
        print(f"错误信息:{e.message}")
        print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")

if __name__ == '__main__':
    sample_async_call()
# 以下为华北2(北京)地域的URL。请将 {WorkspaceId} 替换为您的百炼业务空间ID。
curl --location 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "MiniMax/MiniMax-H3",
    "input": {
        "prompt": "让图片中的人物动起来,头发被微风吹动",
        "media": [
            {
                "type": "first_frame",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260121/zlpocv/wan-i2v-haigui.webp"
            }
        ]
    },
    "parameters": {
        "resolution": "768P",
        "duration": 5,
        "watermark": true
    }
}'
# 以下为华北2(北京)地域的URL。请将 {WorkspaceId} 替换为您的百炼业务空间ID。
curl --location 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "MiniMax/MiniMax-H3",
    "input": {
        "prompt": "镜头缓慢推进,画面逐渐聚焦到图片中的场景",
        "media": [
            {
                "type": "last_frame",
                "url": "https://wanx.alicdn.com/material/20250318/last_frame.png"
            }
        ]
    },
    "parameters": {
        "resolution": "768P",
        "duration": 5,
        "watermark": true
    }
}'
# 以下为华北2(北京)地域的URL。请将 {WorkspaceId} 替换为您的百炼业务空间ID。
curl --location 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "MiniMax/MiniMax-H3",
    "input": {
        "prompt": "写实风格,一只黑色小猫好奇地看向天空,镜头从平视逐渐上升,最后俯拍它的好奇的眼神。",
        "media": [
            {
                "type": "first_frame",
                "url": "https://wanx.alicdn.com/material/20250318/first_frame.png"
            },
            {
                "type": "last_frame",
                "url": "https://wanx.alicdn.com/material/20250318/last_frame.png"
            }
        ]
    },
    "parameters": {
        "resolution": "768P",
        "duration": 5,
        "watermark": true
    }
}'
# 以下为华北2(北京)地域的URL。请将 {WorkspaceId} 替换为您的百炼业务空间ID。
curl --location 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "MiniMax/MiniMax-H3",
    "input": {
        "prompt": "参考视频中的角色缓缓转头,微笑着挥手致意,背景光影柔和流转",
        "media": [
            {
                "type": "image_url",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260320/knsple/wan-r2v-role-frame.jpg"
            },
            {
                "type": "feature",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4"
            }
        ]
    },
    "parameters": {
        "resolution": "768P",
        "ratio": "16:9",
        "duration": 5,
        "watermark": true
    }
}'

Response Parameters

output object

The task output information.

Properties

task_id string

The task ID. Valid for queries for 24 hours.

task_status string

The status of the task.

Enumeration values

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN: The task does not exist or its status is unknown.

request_idstring

Unique request identifier for tracing and troubleshooting.

codestring

Error code. Returned only for failed requests. See Error codes.

messagestring

Detailed error message. Returned only for failed requests. See Error codes.

Successful response

Save the task_id, which is used to query the task status and results.

{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

Error response

Task creation failed. See Error codes.

{
    "code": "InvalidApiKey",
    "message": "No API-key provided.",
    "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}

Step 2: Query Results by Task ID

Beijing region: GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}

Note

  • Polling recommendation: Video generation typically takes several minutes. We recommend using a polling mechanism with a reasonable query interval (e.g., 15 seconds) to retrieve results.
  • Task status flow: PENDING (queued) → RUNNING (processing) → SUCCEEDED (success) / FAILED (failure).
  • task_id validity period: 24 hours. After expiration, the results cannot be queried, and the API will return a task status of UNKNOWN.
  • RPS limit: The default RPS for the query API is 20. For higher-frequency queries or event notifications, we recommend Configure asynchronous task callbacks.
  • More operations: For batch queries, task cancellation, and other operations, see Manage asynchronous tasks.

Request Parameters

Request Headers

Authorization string (Required)

Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx.

URL Path Parameters

task_id string (Required)

The ID of the task.

Query Task Result

Replace {task_id} with the task_id value returned by the previous API call. The task_id is valid for queries for 24 hours, Replace {WorkspaceId} with your actual workspace ID.

curl -X GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

Response Parameters

outputobject

The task output information.

Properties

task_id string

The task ID. Valid for queries for 24 hours.

task_status string

The status of the task.

Enumeration values

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN: The task does not exist or its status is unknown.
State transitions during polling:
  • PENDING → RUNNING → SUCCEEDED or FAILED.
  • The initial query status is usually PENDING or RUNNING.
  • When the status changes to SUCCEEDED, the response contains the generated video URL.
  • If the status is FAILED, check the error message and retry the task.

submit_time string

The time when the task was submitted. format is YYYY-MM-DD HH:mm:ss.SSS.

scheduled_time string

The time when the task was executed. format is YYYY-MM-DD HH:mm:ss.SSS.

end_time string

The time when the task was completed. format is YYYY-MM-DD HH:mm:ss.SSS.

video_urlstring

The video URL. Only returned when task_status is SUCCEEDED.

The video format is MP4 (H.264 encoding). The video URL is valid for 30 days, but it is not recommended to rely on it for long-term storage. Please download it promptly.

orig_prompt string

The original input prompt, corresponding to the request parameter prompt.

codestring

Error code. Returned only for failed requests. See Error codes.

messagestring

Detailed error message. Returned only for failed requests. See Error codes.

usage object

Output statistics. Only counts successful results.

Properties

duration integer

The total billable seconds, equal to input_seconds + output_seconds.

size string

The resolution of the generated video. Example: 1344*768.

SR string

The resolution tier of the generated video. Example: 768.

video_count integer

The number of generated videos. Fixed at 1.

image_count integer

The billable image count. The first 5 input images are free (returns 0). When more than 5 images are provided, returns the excess count (e.g., 7 images returns 2, i.e., 7-5=2).

input_seconds integer

The total duration of input reference videos in seconds. The millisecond-level durations of all input videos are summed and then rounded to the nearest integer. 0 when no reference video is used.

output_seconds integer

The total duration of the output video in seconds.

total_seconds integer

The total seconds, equal to input_seconds + output_seconds.

request_idstring

Unique request identifier for tracing and troubleshooting.

Task Succeeded

{
    "request_id": "bde5ed1a-86de-9fac-xxxx-xxxxxxxxxxxx",
    "output": {
        "task_id": "ca7eaceb-2b00-4f29-xxxx-xxxxxxxxxxxx",
        "task_status": "SUCCEEDED",
        "submit_time": "2026-08-20 13:54:07.204",
        "scheduled_time": "2026-08-20 13:54:07.249",
        "end_time": "2026-08-20 13:55:58.633",
        "video_url": "https://xxx.oss-cn-shanghai.aliyuncs.com/xxx/output.mp4?Expires=xxx&Signature=YOUR_SIGNATURE"
    },
    "usage": {
        "SR": "768",
        "duration": 5,
        "image_count": 0,
        "input_seconds": 0,
        "output_seconds": 5,
        "size": "1344*768",
        "total_seconds": 5,
        "video_count": 1
    }
}

Task Failed

If the task execution fails, task_status will be set to FAILED, and an error code and message will be provided. See Error codes for troubleshooting.

{
    "request_id": "e5d70b02-ebd3-98ce-9fe8-759d7d7b107d",
    "output": {
        "task_id": "86ecf553-d340-4e21-af6e-a0c6a421c010",
        "task_status": "FAILED",
        "code": "InvalidParameter",
        "message": "The parameter is invalid xxxxxx"
    }
}

Task Query Expired

The task_id is valid for queries within 24 hours. After it expires, the query will no longer be available, and the following error message will be returned.

{
    "request_id": "a4de7c32-7057-9f82-8581-xxxxxx",
    "output": {
        "task_id": "502a00b1-19d9-4839-a82f-xxxxxx",
        "task_status": "UNKNOWN"
    }
}

Error codes

If the model call fails and returns an error message, see Error codes for resolution.