Create an image using a text prompt
Table of contents
March 17, 2025
Use hailuoai.video account to retrieve list of generated images, see Setup MiniMax for details.
To retrieve generated image(s), use:
https://api.useapi.net/v1/minimax/images/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,
"model": "image-01",
"aspectRatio": "9:16",
"quantity": 4,
"replyUrl": "Place your call back URL here",
"replyRef": "Place your reference id here",
}
-
account
is optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required. -
prompt
is required, describe your image.
Maximum length 1250 characters. -
promptOptimization
is optional.
Supported values:true
(default),false
. model
is optional.
Supported values:image-01
(default).
-
aspectRatio
is optional. Supported values:21:9
,16:9
(default),4:3
,1:1
,3:4
,9:16
. -
quantity
is optional. Supported range: 1…4, default 1. -
replyUrl
is optional, if not provided value from account will be used.
Place here your callback URL. API will call the providedreplyUrl
once MiniMax image 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 image response/result.
Maximum length 1024 characters.
Responses
-
Use returned in array
imageIds
values to retrieve image status and results using GET images/imageId
. CheckvideoURL
and/ordownloadURL
(paid account, no watermarks) for generated image with thestatus
2 (Completed).If you specify the optional parameter
replyUrl
the API will call the providedreplyUrl
with image progress updates until the image is complete or fails.{ "id": "<image_id_1>", "task": { "batchID": "<batch_id>", "videoIDs": [ "<image_id_1>", "<image_id_2>", "<image_id_3>", "<image_id_4>" ] }, "isFirstGenerate": false, "imageIds": [ "user:<user>-minimax:<account>-image:<image_id_1>", "user:<user>-minimax:<account>-image:<image_id_2>", "user:<user>-minimax:<account>-image:<image_id_3>", "user:<user>-minimax:<account>-image:<image_id_4>" ], "replyUrl": "https://webhook.site/…", "replyRef": "2025-03-11T17:23:05.795Z", "code": 200 }
-
{ "error": "<Error message>" }
-
{ "error": "Unauthorized" }
-
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." }
-
Moderated message.
{ "error": "Your prompt is too short, please provide more details" }
-
Wait in a loop for at least 10..30 seconds and retry again.
{ "error": "There are currently multiple tasks in the queue, and only <number> can be generated at once" }
-
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]" }
Model
{ // TypeScript, all fields are optional
id: string
task: {
batchID: string
videoIDs: string[]
}
isFirstGenerate: boolean
imageIds: string[]
replyUrl: string
replyRef: 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/images/create" \ -d '{"prompt": "…"}'
-
const prompt = "text prompt"; const apiUrl = `https://api.useapi.net/v1/minimax/images/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/images/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())