Create a 5-second-long video using text prompt

Table of contents

  1. Request Headers
  2. Request Body
  3. Responses
  4. Model
  5. Examples
  6. Try It

Equivalent of hailuoai.com/video.

How to prompt tutorial.

https://api.useapi.net/v1/minimax/videos/create

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
Request Body
{
    "account": "Optional MiniMax API account",
    "prompt": "Required text prompt",
    "promptOptimization": true,
    "replyUrl": "Place your call back URL here",
    "replyRef": "Place your reference id here",
    "maxJobs": 1
}
  • account is optional, if not specified API will randomly select available account.

  • prompt is required. Describe your shot. How to prompt tutorial.

  • promptOptimization is optional.
    Supported values: true (default), false.

  • replyUrl is optional, if not provided value from account will be used.
    Place here your callback URL. API will call the provided replyUrl once MiniMax video completed or failed.
    Maximum length 1024 characters.
    We recommend using sites like webhook.site to test callback URL functionality.

  • replyRef is optional, place here your reference id which will be stored and returned along with this MiniMax video response / result.
    Maximum length 1024 characters.

  • maxJobs is optional.
    Valid range: 1…10.

Responses
  • 200 OK

    Use returned videoId to retrieve video status and results using GET /videos/videoId. Check videoURL for generated video with the status 2 (Completed).

    If you specify the optional parameter replyUrl the API will call the provided replyUrl with video progress updates until the video is complete or fails.

    {
        "data": {
            "id": "998877665544332211"
        },
        "statusInfo": {
            "code": 0,
            "httpCode": 0,
            "message": "<Message from chairman Xi>",
            "serviceTime": 1727040219,
            "requestID": "e3a57a49-cec1-4e53-8807-2dca557f50b1",
            "debugInfo": "",
            "serverAlert": 0
        },
        "videoId": "user:1234-minimax:987654321-video:998877665544332211",
        "code": 200,
        "replyUrl": "https://webhook.site/abc",
        "replyRef": "<your optional reference id>",
    }
    
  • 400 Bad Request

    {
      "error": "<Error message>",
      "code": 400
    }
    
  • 401 Unauthorized

    {
      "error": "Unauthorized",
      "code": 401
    }
    
  • 422 Unprocessable Content

    Moderated message.

    {
      "statusInfo": {
        "code": 1000060,
        "httpCode": 0,
        "message": "<Message from chairman Xi>",
        "serviceTime": 1727229272,
        "requestID": "3b12c24d-a645-4e9b-8772-5da959d90b02",
        "debugInfo": "",
        "serverAlert": 0
      }
    }
    
  • 429 Too Many Requests

    Wait in a loop for at least 10..30 seconds and retry again.

    There are two possible cases for API response 429:

    {
        "error": "Account <MiniMax account> is busy executing <Account maxJobs> videos",
        "runningVideos": {
            "<MiniMax account>": [
                {
                    "account": "<MiniMax account>",
                    "id": "id1",
                    "scheduledVideo": "<scheduled video id1>",
                    "videoId": "user:user_id-minimax:account-video:id1",
                    "started": "2024-09-25T01:55:16.128Z",
                    "replyUrl": "<optional callback URL>",
                    "replyRef": "<optional reference>"
                },
                {
                    "account": "<MiniMax account>",
                    "id": "idN",
                    "scheduledVideo": "<scheduled video idN>",
                    "videoId": "user:user_id-minimax:account-video:idN",
                    "started": "2024-09-25T01:55:16.128Z",
                    "replyUrl": "<optional callback URL>",
                    "replyRef": "<optional reference>"
                }
            ]
        },
        "code": 429
    }
    
    • The API received an HTTP response status 429 from MiniMax. MiniMax has dynamic query management and may limit the number of simultaneously executed videos based on internal service load and policies.
    {
      "statusInfo": {
        "code": 1000061,
        "httpCode": 0,
        "message": "<Message from chairman Xi>",
        "serviceTime": 1727229272,
        "requestID": "3b12c24d-a645-4e9b-8772-5da959d90b02",
        "debugInfo": "",
        "serverAlert": 0
      }
    }
    
Model
{ // TypeScript, all fields are optional
    data: {
        id: string
    }
    statusInfo: {
        code: number
        httpCode: number
        message: string
        serviceTime: number
        requestID: string
        debugInfo: string
        serverAlert: number
    }
    videoId: string
    code: number
    replyUrl: string
    replyRef: string
}
Examples
  • curl -H "Accept: application/json" \
         -H "Content-Type: application/json" \
         -H "Authorization: Bearer …" \
         -X POST "https://api.useapi.net/v1/minimax/videos/create" \
         -d '{"prompt": "…"}'
    
  • const prompt = "text prompt";      
    const apiUrl = `https://api.useapi.net/v1/minimax/videos/create`; 
    const token = "API token";
    const data = { 
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json' }
    };
    data.body = JSON.stringify({ 
      prompt
    });
    const response = await fetch(apiUrl, data);
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    prompt = "text prompt"      
    apiUrl = f"https://api.useapi.net/v1/minimax/videos/create" 
    token = "API token"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    body = {
        "prompt": f"{prompt}"
    }
    response = requests.post(apiUrl, headers=headers, json=body)
    print(response, response.json())
    
Try It