HappyHorse Videos API Integration Guide
This document introduces how to integrate with the HappyHorse Videos API. The API supports text-to-video, first-frame image-to-video, reference-image-to-video, and video editing through the unified /happyhorse/videos endpoint and the action parameter.
¶ Application Process
To use the HappyHorse Videos API, first obtain your API Token from the Ace Data Cloud Console and keep it for later use.

If you have not logged in or registered, you will be automatically redirected to the login page to register and log in. Once completed, you will be automatically returned to the current page.
The API Key for a general-purpose application can be used for services enabled for the account; a dedicated application's Key can be used within that application's service scope. Please check the Key's permissions, validity period, and limits, and confirm that the application balance is sufficient to pay for this request. Available trial credits are subject to what is displayed in the account. If the balance is insufficient, click the "Recharge" button.
📘 Full documentation: HappyHorse Videos API →
¶ Action Types
action determines the generation mode for the request:
generate: Text-to-video, the default action. Supportshappyhorse-1.0-t2vandhappyhorse-1.1-t2v;promptmust be provided.image_to_video: First-frame image-to-video. Supportshappyhorse-1.0-i2vandhappyhorse-1.1-i2v;image_urlmust be provided.reference_to_video: Reference-image-to-video. Supportshappyhorse-1.0-r2vandhappyhorse-1.1-r2v;promptand 1–9 images inimage_urlsmust be provided.video_edit: Video editing. Supportshappyhorse-1.0-video-edit;promptandvideo_urlmust be provided, and 0–5 reference images can additionally be provided inimage_urls.
Each action uses a 1.1 model by default; video_edit currently has only happyhorse-1.0-video-edit.
¶ Basic Usage
Text-to-video only requires a prompt; you can also specify parameters such as resolution, ratio, and duration:
{
"action": "generate",
"model": "happyhorse-1.1-t2v",
"prompt": "A cinematic white horse lifts its head, the mane moves gently in the sunrise wind, slow camera push in, warm film lighting",
"resolution": "720P",
"ratio": "16:9",
"duration": 5
}
An example response is shown below:
{
"success": true,
"task_id": "27837f92-d1c1-4db4-ad9a-4e6e81d9f6c1",
"trace_id": "6071ab5e-2f37-46f0-9e07-f1e378112e69",
"data": [
{
"id": "9650580f-6d9e-4bc1-823a-29011790c5cb",
"video_url": "https://cdn.acedata.cloud/assets/examples/happyhorse/27837f92-d1c1-4db4-ad9a-4e6e81d9f6c1-2c108ce23554.mp4",
"state": "succeeded",
"duration": 5,
"resolution": "720P",
"ratio": null
}
]
}
Field descriptions:
success: Whether the request was successful.task_id: The task ID on the Ace Data Cloud side, which can be used to query the task status.trace_id: The trace ID for the request, used for troubleshooting.data: The list of video results.id: The task ID on the HappyHorse side.video_url: The CDN URL of the generated video.state: The task status; possible values arepending/succeeded/error.duration: The billable video duration, in seconds; forvideo_edit, this is the combined duration of the input and output videos.resolution: The output resolution.ratio: The output aspect ratio.
The corresponding CURL code is as follows:
curl -X POST 'https://api.acedata.cloud/happyhorse/videos' \
-H 'authorization: Bearer ${bearer_token}' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-d '{
"action": "generate",
"model": "happyhorse-1.1-t2v",
"prompt": "A cinematic white horse lifts its head, the mane moves gently in the sunrise wind, slow camera push in, warm film lighting",
"resolution": "720P",
"ratio": "16:9",
"duration": 5
}'
The corresponding Python code is as follows:
import requests
url = "https://api.acedata.cloud/happyhorse/videos"
headers = {
"accept": "application/json",
"authorization": "Bearer {token}",
"content-type": "application/json",
}
payload = {
"action": "generate",
"model": "happyhorse-1.1-t2v",
"prompt": "A cinematic white horse lifts its head, the mane moves gently in the sunrise wind, slow camera push in, warm film lighting",
"resolution": "720P",
"ratio": "16:9",
"duration": 5,
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
¶ First-Frame Image-to-Video
When using image_to_video, image_url is used as the first frame of the video. The output aspect ratio follows the first-frame image as closely as possible, so there is no need to provide ratio for this action.
{
"action": "image_to_video",
"model": "happyhorse-1.1-i2v",
"image_url": "https://cdn.acedata.cloud/b1c82e4937.png",
"prompt": "A cinematic white horse lifts its head, the mane moves gently in the sunrise wind, slow camera push in, warm film lighting",
"resolution": "1080P",
"duration": 5
}
¶ Reference-Image-to-Video
When using reference_to_video, image_urls can contain 1–9 reference images. In the prompt, you can use character1, character2, and so on to refer to the images in their corresponding order.
{
"action": "reference_to_video",
"model": "happyhorse-1.1-r2v",
"prompt": "character1 walks forward through a sunrise meadow with the warm leather and gold trim style from character2",
"image_urls": [
"https://cdn.acedata.cloud/b1c82e4937.png",
"https://cdn.acedata.cloud/eb75d88a3f.png"
],
"resolution": "720P",
"ratio": "16:9",
"duration": 5
}
¶ Video Editing
The output duration and aspect ratio of video_edit are inherited from the source video; providing duration or ratio will not change them. The aspect ratio for image-to-video is also inherited from the source image. Editing costs are calculated based on the combined duration of the input and output videos.
When using video_edit, you must provide the video to be edited in video_url and the editing instructions in prompt. The optional image_urls are used as reference images, for example, for changing clothing, style transfer, or partial replacement. audio_setting can be set to auto or origin, where origin means retaining the original video's audio.
{
"action": "video_edit",
"model": "happyhorse-1.0-video-edit",
"prompt": "Apply the warm leather and gold trim style from the reference image while preserving the original camera motion",
"video_url": "https://cdn.acedata.cloud/assets/examples/happyhorse/27837f92-d1c1-4db4-ad9a-4e6e81d9f6c1-2c108ce23554.mp4",
"image_urls": [
"https://cdn.acedata.cloud/eb75d88a3f.png"
],
"resolution": "720P",
"audio_setting": "auto"
}
¶ Asynchronous Callback
Video generation requires some processing time. If you do not want to keep a connection open while waiting, you can pass callback_url. The API will then immediately return a task_id, and the final result will be POSTed to that address when the task is complete:
{
"action": "generate",
"prompt": "A horse running through a snowy forest",
"duration": 5,
"callback_url": "https://your-domain.com/callback/happyhorse"
}
The immediately returned result is as follows:
{
"task_id": "b8976e18-32dc-4718-9ed8-1ea090fcb6ea"
}
If you only want to poll and do not need a callback, you can also pass "async": true and then query the task result through the HappyHorse Tasks API.
¶ Billing
HappyHorse charges based on the duration and resolution of the output video:
720P: As low as approximately $0.105 / second.1080P: As low as approximately $0.18 / second.video_edit: Charged based on the combined duration of the input and output videos; the actual billable duration is determined by the statistics after the task is completed.
Failed tasks are not charged and do not consume the free quota.
¶ Error Handling
When a request encounters a problem, the API returns a corresponding error code and description. Common examples are as follows:
400: Invalid request parameters, such as a mismatch between action and model, a missingprompt/image_url/video_url, or adurationoutside the 3–15 second range.401: Authentication failed; the token is invalid or does not match the API.403: Insufficient balance, or the prompt was rejected by content moderation.429: Requests are too frequent, triggering rate limiting; please try again later.500: Internal server error or generation failed.
