On this page
Hailuo 2.3 API
Create Hailuo 2.3 text-to-video and image-to-video tasks through one asynchronous API. Hailuo 2.3 Fast is available for lower-latency image-to-video.
REST API · v1 · Async tasks
Make your first request
Create a task with a unique idempotency key, save the returned task ID, then poll until the result is ready.
- 1
Create an API key
Generate a key from your imya account settings.
- 2
Create a task
Choose Hailuo 2.3 or Hailuo 2.3 Fast and send the inputs.
- 3
Retrieve the result
Poll the task ID until it succeeds or fails.
Authentication and idempotency
Send your API key as a Bearer token. Every generation POST also requires a unique Idempotency-Key so safe retries cannot create a second charge.
Authorization: Bearer YOUR_IMYA_API_KEY
Content-Type: application/json
Idempotency-Key: YOUR_UNIQUE_REQUEST_KEYCreate a video generation
Creates an asynchronous Hailuo task and returns the live credits_reserved value calculated for this request.
/v1/videos/generations# Text to video (Hailuo 2.3)
curl https://imya.ai/v1/videos/generations \
-H "Authorization: Bearer YOUR_IMYA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: hailuo-t2v-order-001" \
-d '{
"model": "hailuo-2.3",
"prompt": "A paper boat crossing a rain-soaked neon street",
"duration": 6,
"resolution": "768p",
"prompt_optimizer": true
}'
# Image to video (Hailuo 2.3 Fast)
curl https://imya.ai/v1/videos/generations \
-H "Authorization: Bearer YOUR_IMYA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: hailuo-i2v-order-001" \
-d '{
"model": "hailuo-2.3-fast",
"prompt": "Slow camera push-in with warm moving light",
"image_url": "https://cdn.example.com/first-frame.jpg",
"duration": 6,
"resolution": "1080p"
}'Legacy Beta compatibility
Existing integrations may keep using POST /api/video/generate with x-api-key, but generation POSTs now also require Idempotency-Key for safe retries. New integrations should use /v1/videos/generations.
curl https://imya.ai/api/video/generate \
-H "x-api-key: YOUR_IMYA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: legacy-hailuo-order-001" \
-d '{
"modelKey": "hailuo-2-3-standard-t2v",
"prompt": "A paper boat crossing a rain-soaked neon street",
"resolution": "720p",
"outputDurationSec": 6,
"promptExtend": true
}'Retrieve a task
Returns the latest task state, final credit usage, generated MP4, or a sanitized error. Poll no faster than every 5 seconds. Video result URLs may be temporary, so download them promptly; Production Beta does not yet guarantee 7/30-day API video retention.
/v1/tasks/{task_id}curl https://imya.ai/v1/tasks/task_0123456789abcdef0123456789abcdef \
-H "Authorization: Bearer YOUR_IMYA_API_KEY"Request parameters
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | hailuo-2.3 or hailuo-2.3-fast. |
| prompt | string | Yes | Generation instructions, up to 5,000 characters. |
| image_url | string | Conditional | Public HTTPS first frame. Required for Fast; omit on standard text-to-video. |
| duration | number | No | 6 or 10 seconds. Default is 6. |
| resolution | string | No | 768p or 1080p. 1080p supports only 6 seconds. |
| prompt_optimizer | boolean | No | Optimize the prompt. Default is true. |
Responses
{
"id": "task_0123456789abcdef0123456789abcdef",
"status": "pending",
"model": "hailuo-2.3",
"credits_reserved": 225
}{
"id": "task_0123456789abcdef0123456789abcdef",
"status": "succeeded",
"model": "hailuo-2.3",
"credits_used": 225,
"data": [
{
"url": "https://media.example.com/generated/example.mp4"
}
]
}Live credit billing
The server calculates credits_reserved from the selected model, workflow, resolution, duration, and the API key owner’s current plan. The numbers in the response examples illustrate the response shape only; always use the value returned for that request and never cache a Hailuo price in your client.
Task status
pendingThe task was accepted and is waiting to start.
processingThe model is generating the video.
succeededGeneration finished and data contains the MP4.
failedGeneration failed. Read the sanitized error object.
Errors
400Missing Idempotency-Key or malformed JSON.
401Missing or invalid API key.
402The account does not have enough credits.
403The API account is disabled.
409The idempotency key was reused with a different body.
413The request body exceeds 64 KiB.
422Invalid model, prompt, image, duration, or resolution.
429Rate or concurrent-task limit reached.
5xxThe request could not be completed or submitted.
Want to test Hailuo before integrating?
Open the hosted Hailuo 2.3 tool to compare Fast, standard, text, and image inputs.
Try Hailuo 2.3 online