Video Generation (Hailuo Video)
Hailuo AI-based video generation interface. Supports text-to-video and image-to-video, with selectable resolution and duration options.
API Endpoints
POST
/video_generationCreate video generation task
GET
/query/video_generationQuery video generation status
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Required | Model name: Hailuo-2.3, Hailuo-2.3-Fast, etc. |
prompt | string | Required | Video description text |
resolution | string | Optional | Resolution: 768P or 1080P |
duration | integer | Optional | Video duration (seconds), default 6 |
first_frame_image | string | Optional | First frame image URL (for image-to-video) |
Request Example
Request Example
{
"model": "Hailuo-2.3",
"prompt": "一只可爱的猫咪在阳光下伸懒腰",
"resolution": "1080P",
"duration": 6
}Response Example
Response Example
{
"task_id": "video_task_xxxxx",
"status": "processing",
"message": "视频生成任务已创建"
}
// 查询结果
{
"task_id": "video_task_xxxxx",
"status": "completed",
"video_url": "https://...",
"duration": 6,
"resolution": "1080P"
}Code Examples
import requests
import time
API_BASE = "https://your-proxy-domain.com/v1"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
# 创建视频生成任务
data = {
"model": "Hailuo-2.3",
"prompt": "一只可爱的猫咪在阳光下伸懒腰",
"resolution": "1080P",
"duration": 6
}
resp = requests.post(f"{API_BASE}/video_generation", headers=headers, json=data)
task_id = resp.json()["task_id"]
# 轮询查询任务状态
while True:
status_resp = requests.get(
f"{API_BASE}/query/video_generation?task_id={task_id}",
headers=headers
)
result = status_resp.json()
if result["status"] == "completed":
print("视频已生成:", result["video_url"])
break
time.sleep(10)