MiniMax Hailuo AI API Documentation

Generate Image To Video Request - Request Code

POST https://gateway.pixazo.ai/minimax-hailuo-ai/v1/imageToVideo HTTP/1.1
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "prompt": "Man walked into winter cave with polar bear",
  "first_frame_image": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/manwithbear.jpg",
  "duration": 6,
  "resolution": "768P",
  "prompt_optimizer": true,
  "fast_pretreatment": false,
  "aigc_watermark": false
}
import requests

url = "https://gateway.pixazo.ai/minimax-hailuo-ai/v1/imageToVideo"

headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}

data = {
    "prompt": "Man walked into winter cave with polar bear",
    "first_frame_image": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/manwithbear.jpg",
    "duration": 6,
    "resolution": "768P",
    "prompt_optimizer": True,
    "fast_pretreatment": False,
    "aigc_watermark": False
}

response = requests.post(url, json=data, headers=headers)
print(response.json())
const url = 'https://gateway.pixazo.ai/minimax-hailuo-ai/v1/imageToVideo';

const data = {
  prompt: 'Man walked into winter cave with polar bear',
  first_frame_image: 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/manwithbear.jpg',
  duration: 6,
  resolution: '768P',
  prompt_optimizer: true,
  fast_pretreatment: false,
  aigc_watermark: false
};

fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Cache-Control': 'no-cache',
    'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
  },
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
curl -v -X POST "https://gateway.pixazo.ai/minimax-hailuo-ai/v1/imageToVideo" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "prompt": "Man walked into winter cave with polar bear",
    "first_frame_image": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/manwithbear.jpg",
    "duration": 6,
    "resolution": "768P",
    "prompt_optimizer": true,
    "fast_pretreatment": false,
    "aigc_watermark": false
}'
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class Main {
    public static void main(String[] args) throws Exception {
        String url = "https://gateway.pixazo.ai/minimax-hailuo-ai/v1/imageToVideo";
        
        String json = "{" + "\n" +
            "  \"prompt\": \"Man walked into winter cave with polar bear\"," + "\n" +
            "  \"first_frame_image\": \"https://pub-582b7213209642b9b995c96c95a30381.r2.dev/manwithbear.jpg\"," + "\n" +
            "  \"duration\": 6," + "\n" +
            "  \"resolution\": \"768P\"," + "\n" +
            "  \"prompt_optimizer\": true," + "\n" +
            "  \"fast_pretreatment\": false," + "\n" +
            "  \"aigc_watermark\": false" + "\n" +
            "}";
        
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Content-Type", "application/json")
            .header("Cache-Control", "no-cache")
            .header("Ocp-Apim-Subscription-Key", "YOUR_SUBSCRIPTION_KEY")
            .timeout(Duration.ofSeconds(10))
            .POST(HttpRequest.BodyPublishers.ofString(json))
            .build();
            
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
<?php
$url = 'https://gateway.pixazo.ai/minimax-hailuo-ai/v1/imageToVideo';

$data = [
    'prompt' => 'Man walked into winter cave with polar bear',
    'first_frame_image' => 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/manwithbear.jpg',
    'duration' => 6,
    'resolution' => '768P',
    'prompt_optimizer' => true,
    'fast_pretreatment' => false,
    'aigc_watermark' => false
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Cache-Control: no-cache',
    'Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY'
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>

Output

Successful API response:

{\n  \"task_id\": \"11173647XXXXXXXXXX\",\n  \"base_resp\": {\n    \"status_code\": 0,\n    \"status_msg\": \"success\"\n  }\n}

Request Body - Generate Image To Video Request

Parameters for /imageToVideo:

ParameterRequiredTypeDescription
promptRequiredstringVideo description, maximum 2000 characters. Supports camera movement. syntax for precise camera control . Supports 15+ camera movement instructions for professional video control.
first_frame_imageRequiredstringImage URL to use as the starting frame. Supports public URLs or Base64 encoded Data URLs. Image requirements: JPG/JPEG/PNG/WebP, <20MB, short side >300px, aspect ratio 2:5 to 5:2.
prompt_optimizerOptionalbooleanDefault: true. Automatically optimizes the prompt for better video quality.
fast_pretreatmentOptionalbooleanDefault: false. Shortens prompt optimization time (only for MiniMax-Hailuo-2.3-Fast model).
durationOptionalintegerDefault: 6. Video duration in seconds. Must be 6 or 10 seconds for MiniMax-Hailuo-2.3-Fast model.
resolutionOptionalstringDefault: "768P". Video resolution. Must be '768P' or '1080P' for MiniMax-Hailuo-2.3-Fast model.
callback_urlOptionalstringURL to receive task status update notifications.
aigc_watermarkOptionalbooleanDefault: false. Whether to add AIGC watermark to the generated video.

Example Request - Generate Image To Video Request

JSON
{
  "prompt": "Man walked into winter cave with polar bear",
  "first_frame_image": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/manwithbear.jpg",
  "duration": 6,
  "resolution": "768P",
  "prompt_optimizer": true,
  "fast_pretreatment": false,
  "aigc_watermark": false
}

Response - Generate Image To Video Request

JSON
{
  "task_id": "11173647XXXXXXXXXX",
  "base_resp": {
    "status_code": 0,
    "status_msg": "success"
  }
}

Request Headers

HeaderDescription
Content-Typeapplication/json
Cache-Controlno-cache
Ocp-Apim-Subscription-KeyYour subscription key for authentication

Response Handling

The MiniMax Hailuo Ai returns specific HTTP status codes and response bodies to indicate the success or failure of a request. Developers should implement error handling in their applications to manage these responses effectively.

Common Status Codes and Responses

Status CodeDescriptionResponse Body
200Success - The request was successfully processed.{ "success": true, ... }
Bad Request - The request contains invalid parameters or missing fields.{ "error": "Invalid request parameters" }
401Unauthorized - The provided subscription key is missing or invalid.{ "error": "Invalid or missing authentication" }
403Forbidden - The subscription does not have access to this API or action.{ "error": "Access denied for this operation" }
404Not Found - The requested resource or endpoint could not be found.{ "error": "Endpoint not found" }
Too Many Requests - The request rate limit has been exceeded.{ "error": "Rate limit exceeded, please retry later" }
500Internal Server Error - An unexpected error occurred on the server.{ "error": "An unexpected error occurred, please try again later" }

Example Error Response

{
  "error": "Invalid parameters"
}

Retrieving Results

After submitting your request, use this endpoint to check status and retrieve results.

Endpoint

POST https://gateway.pixazo.ai/minimax-hailuo-ai-polling/v1/getStatus

Request Body

{
   "task_id": "11173647XXXXXXXXXX"
}
POST https://gateway.pixazo.ai/minimax-hailuo-ai-polling/v1/getStatus HTTP/1.1
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "task_id": "11173647XXXXXXXXXX"
}
import requests

url = "https://gateway.pixazo.ai/minimax-hailuo-ai-polling/v1/getStatus"

headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}

data = {
    "task_id": "11173647XXXXXXXXXX"
}

response = requests.post(url, json=data, headers=headers)
print(response.json())
const url = 'https://gateway.pixazo.ai/minimax-hailuo-ai-polling/v1/getStatus';

const data = {
  task_id: '11173647XXXXXXXXXX'
};

fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Cache-Control': 'no-cache',
    'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
  },
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
curl -v -X POST "https://gateway.pixazo.ai/minimax-hailuo-ai-polling/v1/getStatus" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "task_id": "11173647XXXXXXXXXX"
}'
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;

public class Main {
    public static void main(String[] args) throws Exception {
        String url = "https://gateway.pixazo.ai/minimax-hailuo-ai-polling/v1/getStatus";
        
        String json = "{" + "\n" +
            "  \"task_id\": \"11173647XXXXXXXXXX\"" + "\n" +
            "}";
        
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Content-Type", "application/json")
            .header("Cache-Control", "no-cache")
            .header("Ocp-Apim-Subscription-Key", "YOUR_SUBSCRIPTION_KEY")
            .timeout(Duration.ofSeconds(10))
            .POST(HttpRequest.BodyPublishers.ofString(json))
            .build();
            
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
<?php
$url = 'https://gateway.pixazo.ai/minimax-hailuo-ai-polling/v1/getStatus';

$data = [
    'task_id' => '11173647XXXXXXXXXX'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Cache-Control: no-cache',
    'Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY'
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>

Response

{
  "task_id": "11173647XXXXXXXXXX",
  "status": "Success",
  "file_id": "file_123456789",
  "video_url": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/minimax_videos/video-1234567890-123456.mp4",
  "video_width": 768,
  "video_height": 432,
  "base_resp": {
    "status_code": 0,
    "status_msg": "success"
  }
}

MiniMax Hailuo AI API Pricing

Resolution Seconds Price (USD)
All Resolution6$0.35

Ready to generate MiniMax Hailuo AI API assets?

Start with an API key, then automate your pipeline.