Create a 5-second video using a text and image prompt
Table of contents
September 25, 2024 (December 3, 2024)
Equivalent of hailuoai.video.
How to prompt tutorial.
Use hailuoai.video account to generate videos, see Setup MiniMax for details.
To upload prompt image use POST /files.
Please take a look at the code provided in the article Fun with MiniMax API as it covers all aspects of video generation, multiple account load balancing and downloading of generated videos along with proper handling of corner cases.
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
API token
is required, see Setup useapi.net for details.
Request Body
{
"account": "Optional MiniMax API account",
"prompt": "Optional text prompt",
"promptOptimization": true,
"fileID": "user:user_id-minimax:account-file:file_id",
"model": "Optional model name",
"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 account from available accounts. -
prompt
is optional, describe your shot. How to prompt tutorial. -
promptOptimization
is optional.
Supported values:true
(default),false
. -
fileID
is optional, provide id of uploaded image via POST /files or existing image id retrieved via GET /files model
is optional.
Supported values:T2V-01
(default) model for text-to-videoI2V-01
(default) model for image-to-video with optional promptI2V-01-live
model for image-to-video with optional prompt, added December 3, 2024
-
replyUrl
is optional, if not provided value from account will be used.
Place here your callback URL. API will call the providedreplyUrl
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, if not specified value from accounts/account will be used.
Valid range: 1…10.
Please set this number according to your subscription plan. We recommend setting it to 2 (3 maximum) for Free, and 3 (4 maximum) for Standard and Unlimited plans. Although you can set it to higher values (3 for Free and 5 for Standard and Unlimited respectively), it won’t make any difference since only one video can be processed at a time for Free accounts, and no more than two for Standard and Unlimited accounts. It’s helpful to have a spare empty slot for cases where the MiniMax website is too busy and responds with502
or504
while still accepting jobs into the internal queue.
Responses
-
Use returned
videoId
to retrieve video status and results using GET /videos/videoId
. CheckvideoURL
and/ordownloadURL
(paid account, no watermarks) for generated video with thestatus
2 (Completed).If you specify the optional parameter
replyUrl
the API will call the providedreplyUrl
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>", }
-
{ "error": "<Error message>", "code": 400 }
-
{ "error": "Unauthorized", "code": 401 }
-
Insufficient credits. Please recharge to get more credits or try again next day.
{ "error": "Insufficient credits. Please recharge to get more credits or try again next day.", "statusInfo": { "code": 1500008, "message": "Insufficient credits. Please recharge to get more credits", "serviceTime": 1729045334, "requestID": "0fea7b23-c624-49e0-bcf2-05f6e4e0d2d9", "debugInfo": "1500008" } }
-
Moderated message.
{ "error": "Your prompt is too short, please provide more details", "statusInfo": { "code": 1500001, "httpCode": 0, "message": "An error occurred while generating the content, please try again", "serviceTime": 1727229272, "requestID": "3b12c24d-a645-4e9b-8772-5da959d90b02", "debugInfo": "1500001" } }
-
Wait in a loop for at least 10..30 seconds and retry again.
There are two possible cases for API response 429:
- API query is full and can not accept new videos/create requests. Size of query defined by
maxJobs
optional parameter.{ "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. Please refer to your subscription plan for the maximum allowed tasks in the queue.
{ "statusInfo": { "code": 1500006, "httpCode": 0, "message": "YOU CAN QUEUE 3 JOBS AT ONCE", "serviceTime": 1727229272, "requestID": "3b12c24d-a645-4e9b-8772-5da959d90b02", "debugInfo": "1500006" } }
- API query is full and can not accept new videos/create requests. Size of query defined by
-
596 Pending mod message
Your hailuoai.video account has been placed on hold, which may last a few hours. It may be a good idea to pause operations until then. You can reach out to the Discord support channel or send an email requesting your account to be unlocked. Based on the information we have gathered, this seems to be a temporary ban that will automatically unlock in just a few hours.
{ "error": "Unusual account activities detected. Please contact customer support at [email protected]", "statusInfo": { "code": 1500010, "httpCode": 0, "message": "Unusual account activities detected. Please contact customer support at [email protected]", "serviceTime": 1727229272, "requestID": "3b12c24d-a645-4e9b-8772-5da959d90b02", "debugInfo": "1500010" } }
Model
{ // TypeScript, all fields are optional
videoId: string
data: {
id: string
}
statusInfo: {
code: number
httpCode: number
message: string
serviceTime: number
requestID: string
debugInfo: string
serverAlert: number
}
runningVideos: {
[account: string]: {
account: string
id: string
scheduledVideo: string
videoId: string
started: string
replyUrl: string
replyRef: string
}[]
}
replyUrl: string
replyRef: string
error: string
code: number
}
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())