Skip to content

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 via first_frame_image (string URL).
  • Frame-mode (first+last) is supported by minimax-hailuo-02 using images: [{ url: "..." }, { url: "..." }].

Request parameters (summary)

ParameterRequiredDescription
modelYesModel name, e.g. minimax-hailuo-2.3-Fast or minimax-hailuo-02
promptYesText prompt describing subject, action, shot, lighting
durationYesVideo duration in seconds (e.g., 5 or 6)
resolutionOptionalOutput resolution, e.g. 768P / 1080P
first_frame_imageConditionalURL for single-frame input (Fast models)
imagesConditionalArray of frame objects for frame-mode (minimax-hailuo-02)
modeOptionalQuality mode (std / pro)
aspect_ratioOptionalAspect ratio, e.g. 16:9
callback_urlOptionalAsync callback URL
external_task_idOptionalClient-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());
  }
}

This documentation is licensed under CC BY-SA 4.0.