Hailuo 02 Fast Serverless API
Transform any static image into a captivating, high-quality video clip effortlessly.
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) 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
https://api.segmind.com/v1/hailuo-02-fastParameters
first_frame_imagerequiredstring (uri)Sets the starting image and aspect ratio for the video. Select a high-quality URL for better results.
"https://segmind-resources.s3.amazonaws.com/output/b372ccd3-7844-4c21-b1cb-4fc3c2e68db6-9d88374d-77b3-45d0-9bde-17d039e1bf7a.jpeg"last_frame_imagerequiredstring (uri)Sets the ending image.Select a high-quality URL for better results.
nullpromptrequiredstringProvides the text scenario for video generation. Use creative or specific prompts to tailor outputs.
durationoptionalintegerDefines the length of the video. Choose 6 for shorter and 10 for longer scenarios.
6610go_fastoptionalbooleanToggle to generate videos faster with slightly less quality. Use 'true' for quick drafts, 'false' for quality.
falseprompt_optimizeroptionalbooleanEnhance the prompt's effectiveness. Use 'true' for better quality prompts.
trueResponse Type
Returns: Video
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out