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 .
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.
- Select a model: Confirm the region to which the model belongs.
- Select a URL: Select the corresponding regional Endpoint URL. HTTP URLs are supported.
- Configure API Key: Select a region and Obtain an API key, then Configure API key as an environment variable.
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.
- After the task is created, use the returned
task_idto query the result. Thetask_idis valid for 24 hours. Do not create duplicate tasks. Instead, use polling to retrieve the result. - For guidance for beginners, see Call APIs with Postman or cURL.
Request ParametersRequest HeadersContent-Typestring (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)Enables asynchronous processing. HTTP requests support only asynchronous calls. Must be enable.Request Bodymodelstring (Required)The model name.Valid values:
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 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:
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.
Video input (type=feature) The video file URL. Used only in multimodal reference-to-video scenarios.
Audio input (type=driving_audio) The audio file URL. Used only in multimodal reference-to-video scenarios.
object (Optional)Video generation parameters, such as resolution, aspect ratio, and video duration.
Properties resolution string (Required)The video resolution tier.
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:
integer (Required)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".
|
Response ParametersoutputobjectThe task output information.
Properties task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.
Enumeration values
stringUnique request identifier for tracing and troubleshooting.code stringError code. Returned only for failed requests. See Error codes.message stringDetailed error message. Returned only for failed requests. See Error codes. |
Save the task_id to query the task status and result. |
Step 2: Query Results by Task ID
Beijing region: GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}
- 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 ParametersRequest HeadersAuthorizationstring (Required)Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx.URL Path Parameterstask_idstring (Required)The ID of the task. |
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. |
Response ParametersoutputobjectThe task output information.
Properties task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.
Enumeration values
stringThe time when the task was submitted. format is YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringThe time when the task was executed. format is YYYY-MM-DD HH:mm:ss.SSS.end_time stringThe time when the task was completed. format is YYYY-MM-DD HH:mm:ss.SSS.video_urlstringThe 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 stringThe original input prompt, corresponding to the request parameter prompt.code stringError code. Returned only for failed requests. See Error codes.message stringDetailed error message. Returned only for failed requests. See Error codes.objectOutput statistics. Only counts successful results.
Properties duration integerThe total billable seconds, equal to input_seconds + output_seconds.size stringThe resolution of the generated video. Example: 1344*768.SR stringThe resolution tier of the generated video. Example: 768.video_count integerThe number of generated videos. Fixed at 1.image_count integerThe 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 integerThe 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 integerThe total duration of the output video in seconds.total_seconds integerThe total seconds, equal to input_seconds + output_seconds.stringUnique request identifier for tracing and troubleshooting. |
|