Hailuo 02 Fast Serverless API

Transform any static image into a captivating, high-quality video clip effortlessly.

~79.70s
$0.125 - $0.188 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/hailuo-02-fast"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "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.",
12    "go_fast": true,
13    "duration": "6",
14    "prompt_optimizer": true,
15    "first_frame_image": "https://segmind-resources.s3.amazonaws.com/output/b372ccd3-7844-4c21-b1cb-4fc3c2e68db6-9d88374d-77b3-45d0-9bde-17d039e1bf7a.jpeg",
16    "last_frame_image": null
17}
18
19response = requests.post(url, headers=headers, json=data)
20
21if response.status_code == 200:
22    result = response.json()
23    print(json.dumps(result, indent=2))
24else:
25    print(f"Error: {response.status_code}")
26    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/hailuo-02-fast

Parameters

first_frame_imagerequired
string (uri)

Sets the starting image and aspect ratio for the video. Select a high-quality URL for better results.

Default: "https://segmind-resources.s3.amazonaws.com/output/b372ccd3-7844-4c21-b1cb-4fc3c2e68db6-9d88374d-77b3-45d0-9bde-17d039e1bf7a.jpeg"
last_frame_imagerequired
string (uri)

Sets the ending image.Select a high-quality URL for better results.

Default: null
promptrequired
string

Provides the text scenario for video generation. Use creative or specific prompts to tailor outputs.

durationoptional
integer

Defines the length of the video. Choose 6 for shorter and 10 for longer scenarios.

Default: 6
Allowed values :
610
go_fastoptional
boolean

Toggle to generate videos faster with slightly less quality. Use 'true' for quick drafts, 'false' for quality.

Default: false
prompt_optimizeroptional
boolean

Enhance the prompt's effectiveness. Use 'true' for better quality prompts.

Default: true

Response Type

Returns: Video

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out