Hailuo API Examples
Examples for Hailuo models via the Agentsflare gateway (e.g. minimax-hailuo-2.3, minimax-hailuo-2.3-Fast, minimax-hailuo-02).
-- Create: POST https://api.agentsflare.com/v1/videos/generations -- Query: GET https://api.agentsflare.com/v1/async-result/{task_id}
- Auth:
Authorization: Bearer <API_KEY>
Vendor reference: For detailed parameters see the Hailuo (海螺) reference: https://zhipu-ai.feishu.cn/wiki/LoMfwR0E0ih12ikR5a7cuS4fnwh
Quick notes
- Some Hailuo models (e.g.
minimax-hailuo-2.3-Fast) accept single-frame input viafirst_frame_image(string URL). - Frame-mode (first+last) is supported by
minimax-hailuo-02usingimages: [{ url: "..." }, { url: "..." }].
Request parameters (summary)
| Parameter | Required | Description |
|---|---|---|
model | Yes | Model name, e.g. minimax-hailuo-2.3-Fast or minimax-hailuo-02 |
prompt | Yes | Text prompt describing subject, action, shot, lighting |
duration | Yes | Video duration in seconds (e.g., 5 or 6) |
resolution | Optional | Output resolution, e.g. 768P / 1080P |
first_frame_image | Conditional | URL for single-frame input (Fast models) |
images | Conditional | Array of frame objects for frame-mode (minimax-hailuo-02) |
mode | Optional | Quality mode (std / pro) |
aspect_ratio | Optional | Aspect ratio, e.g. 16:9 |
callback_url | Optional | Async callback URL |
external_task_id | Optional | Client-specified task id |
cURL (single frame)
bash
curl -X POST "https://api.agentsflare.com/v1/videos/generations" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax-hailuo-2.3-Fast",
"prompt": "A cinematic sci-fi city skyline at dusk",
"duration": 6,
"resolution": "768P",
"first_frame_image": "https://example.com/first-frame.png"
}'javascript
const API_BASE = 'https://api.agentsflare.com';
const API_KEY = process.env.API_KEY;
async function createVideo() {
const payload = {
model: 'minimax-hailuo-2.3-Fast',
prompt: 'Camera slowly pulls back as the subject turns toward the light',
duration: 6,
resolution: '768P',
first_frame_image: 'https://example.com/first-frame.png'
};
const res = await fetch(`${API_BASE}/v1/videos/generations`, {
method: 'POST',
headers: {
Authorization: `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
});
console.log('HTTP', res.status);
console.log(await res.text());
}
createVideo().catch(console.error);python
import requests
import os
API_BASE = 'https://api.agentsflare.com/v1/videos/generations'
API_KEY = os.getenv('API_KEY')
payload = {
'model': 'minimax-hailuo-2.3-Fast',
'prompt': 'Camera slowly pulls back as the subject turns toward the light',
'duration': 6,
'resolution': '768P',
'first_frame_image': 'https://example.com/first-frame.png'
}
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
resp = requests.post(API_BASE, json=payload, headers=headers)
print(resp.status_code)
print(resp.text)java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class HailuoFast {
public static void main(String[] args) throws Exception {
String apiBase = "https://api.agentsflare.com/v1/videos/generations";
String apiKey = System.getenv("API_KEY");
String json = "{\"model\":\"minimax-hailuo-2.3-Fast\",\"prompt\":\"Camera slowly pulls back as the subject turns toward the light\",\"duration\":6,\"resolution\":\"768P\",\"first_frame_image\":\"https://example.com/first-frame.png\"}";
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create(apiBase))
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> resp = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode());
System.out.println(resp.body());
}
}