1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const axios = require('axios');
const FormData = require('form-data');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/hailuo-02-fast";
const reqBody = {
"prompt": "sA 3D animated cartoon-style young boy sitting in a cozy recording studio, singing passionately into a professional podcast microphone. He is wearing large headphones, eyes expressive and wide, mouth open mid-song, showing emotion. One hand is lifted slightly as if feeling the music. There is a laptop, a sound mixer, and a coffee mug on the desk. Warm lighting and acoustic foam panels in the background. The scene feels lively, joyful, and full of musical energy.",
"go_fast": true,
"duration": 6,
"prompt_optimizer": true,
"first_frame_image": "https://segmind-resources.s3.amazonaws.com/output/b372ccd3-7844-4c21-b1cb-4fc3c2e68db6-9d88374d-77b3-45d0-9bde-17d039e1bf7a.jpeg"
};
(async function() {
try {
const formData = new FormData();
// Append regular fields
for (const key in reqBody) {
if (reqBody.hasOwnProperty(key)) {
formData.append(key, reqBody[key]);
}
}
// Convert and append images as Base64 if necessary
const response = await axios.post(url, formData, {
headers: {
'x-api-key': api_key,
...formData.getHeaders()
}
});
console.log(response.data);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);
}
})();
Provides the text scenario for video generation. Use creative or specific prompts to tailor outputs.
Toggle to generate videos faster with slightly less quality. Use 'true' for quick drafts, 'false' for quality.
Defines the length of the video. Choose 6 for shorter and 10 for longer scenarios.
Allowed values:
Enhance the prompt's effectiveness. Use 'true' for better quality prompts.
Sets the starting image and aspect ratio for the video. Select a high-quality URL for better results.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
MiniMax Hailuo 02 is an advanced generative AI model that transforms a single static image into a smooth, high-quality video clip. Designed for professional image-to-video workflows, it supports both 720p output at a consistent 25 frames per second. Whether you’re a developer building interactive apps, a creator crafting social media content, or a product manager prototyping marketing materials, MiniMax Hailuo 02 delivers fluid animations with controllable motion and seamless API integration.
go_fast=true
): Accelerated generation with minimal quality trade-offprompt_optimizer=true
): Enhances prompt clarity and output relevanceduration=10
.go_fast=true
. For final assets, keep it false
.prompt_optimizer=true
to automatically refine prompt language for better quality.Q: What resolutions and frame rates are supported?
A: MiniMax Hailuo 02 outputs at 720p at 25 fps for smooth, cinematic motion.
Q: Which image formats can I use?
A: Accepts PNG, JPEG, and WebP—just provide a valid URL in first_frame_image
.
Q: How do I integrate the model into my app?
A: Use the REST-based API endpoint. Send a JSON payload with prompt
, first_frame_image
, and optional flags (go_fast
, duration
, prompt_optimizer
).
Q: Can I customize the length of the video?
A: Yes. Set duration=6
for standard clips or duration=10
for extended sequences.
Q: How do I control motion style?
A: Describe desired motion in your prompt (e.g., “slow zoom out to reveal a mountain range”) and leverage prompt_optimizer
for clarity.