Create a 5-second video using a text and image prompt
Table of contents
September 25, 2024 (October 14, 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.
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": "Required text prompt",
"promptOptimization": true,
"fileID": "user:user_id-minimax:account-file:file_id",
"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 required. 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 -
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.
For video accounts please set this number according to your subscription plan: 3 for Free and 5 for Standard and Unlimited plans.
For music accounts please set this number to 1.
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 }
-
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
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())