Use this API to create a video generation task from start and end frame images, with optional text input.
HTTP: Bearer Auth
Bearer API_key, can be found in Account Management>API Keys.The media type of the request body. Must be set to application/json to ensure the data is sent in JSON format.
application/json Model name. Supported values: MiniMax-Hailuo-02.
Note: First & last frame generation does not support 512P resolution.
MiniMax-Hailuo-02 Image to be used as the last frame of the video. Supports public URLs or Base64-encoded Data URLs (data:image/jpeg;base64,...).
⚠️ Video resolution is determined by the first frame. If first and last frames differ in size, the last frame will be cropped to match the first
Text description of the video, up to 2000 characters.
For MiniMax-Hailuo-02, you can use [commands] syntax for camera movement control.
Camera movement commands can be embedded in prompt using the [command] format for precise control.
Supported 15 camera commands:
[Truck left], [Truck right][Pan left], [Pan right][Push in], [Pull out][Pedestal up], [Pedestal down][Tilt up], [Tilt down][Zoom in], [Zoom out][Shake][Tracking shot][Static shot]Usage rules:
[] take effect simultaneously (e.g., [Pan left,Pedestal up]). Recommended max: 3."...[Push in], then...[Push out]".Image to be used as the first frame of the video. Supports public URLs or Base64-encoded Data URLs (data:image/jpeg;base64,...).
⚠️ Video resolution follows the first frame image
Whether to automatically optimize the prompt. Defaults to true. Set to false for more precise control.
Video duration (in seconds). Default: 6. Available values for first & last frame generation depend on resolution:
| Model | 768P | 1080P |
|---|---|---|
| MiniMax-Hailuo-02 | 6 or 10 | 6 |
Video resolution. First & last frame generation supports 768P and 1080P:
| Model | 6s | 10s |
|---|---|---|
| MiniMax-Hailuo-02 | 768P (default), 1080P | 768P |
768P, 1080P A callback URL to receive asynchronous task status updates.
POST request with a challenge field. Your server must echo this value within 3s to validate.Callback status values:
"processing" – Task in progress"success" – Task completed successfully"failed" – Task failedfrom fastapi import FastAPI, HTTPException, Request
import json
app = FastAPI()
@app.post("/get_callback")
async def get_callback(request: Request):
try:
json_data = await request.json()
challenge = json_data.get("challenge")
if challenge is not None:
# Validation request, echo back challenge
return {"challenge": challenge}
else:
# Status update request, handle accordingly
# {
# "task_id": "115334141465231360",
# "status": "success",
# "file_id": "205258526306433",
# "base_resp": {
# "status_code": 0,
# "status_msg": "success"
# }
# }
return {"status": "success"}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
if __name__ == "__main__":
import uvicorn
uvicorn.run(
app, # Required
host="0.0.0.0", # Required
port=8000, # Required, port can be customized
# ssl_keyfile="yourname.yourDomainName.com.key", # Optional, enable if using SSL
# ssl_certfile="yourname.yourDomainName.com.key", # Optional, enable if using SSL
)