HappyHorse video editing API reference
The HappyHorse video editing model takes a video and a reference image as input, and performs editing tasks such as style transfer and local replacement based on text instructions.
Availability
Make sure that the model, endpoint URL, and API key all belong to the same region. Cross-region calls will fail.
-
Select a model: Check which region the model belongs to.
-
Select a URL: Use the endpoint URL for the corresponding region. HTTP URLs are supported.
-
Configure an API key: Select a region and Create an API key, then Export API key as environment variable.
The sample code in this topic applies to the Singapore region.
Model Studio has released workspace-specific domains for the China (Beijing) and Singapore regions. The new dedicated domains deliver superior performance and higher stability for inference requests. We recommend migrating to the new domains:
-
China (Beijing): from
https://dashscope.aliyuncs.comtohttps://{WorkspaceId}.cn-beijing.maas.aliyuncs.com -
Singapore: from
https://dashscope-intl.aliyuncs.comtohttps://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
{WorkspaceId} is your workspace ID, which can be found on the Workspace Details page in the Model Studio console. The existing domain remains fully functional.
HTTP request
Video editing tasks are time-consuming (typically 1–5 minutes), so the API uses asynchronous calls. The workflow has two steps: "Create a task -> Poll for result" as described below:
Step 1: Create a task and get the task ID
Singapore
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
Replace WorkspaceId with your actual Workspace ID.
US (Virginia)
POST https://dashscope-us.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
China (Beijing)
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
Replace WorkspaceId with your actual Workspace ID.
Germany (Frankfurt)
POST https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
Replace WorkspaceId with your actual Workspace ID.
-
After the task is created, use the returned
task_idto query the result. Thetask_idis valid for 24 hours. Do not create duplicate tasks. Instead, use polling to retrieve the result. -
For guidance for beginners, see Call APIs with Postman or cURL.
Request parameters |
Video editing (instruction + reference image)
|
Headers |
|
|
Content-Type The content type of the request. Must be |
|
|
Authorization Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx. |
|
|
X-DashScope-Async Enables asynchronous processing. HTTP requests support only asynchronous calls. Must be Important
If this request header is missing, the error "current user api does not support synchronous calls" is returned. |
|
Request body |
|
|
model The model name. Fixed value: happyhorse-1.0-video-edit. |
|
|
input The input information, including the video to edit, reference images, and the prompt. |
|
|
parameters Video editing parameters such as resolution. |
Response parameters |
Successful responseSave the
Error responseTask creation failed. See Error codes.
|
|
output The task output information. |
|
|
request_id Unique request identifier for tracing and troubleshooting. |
|
|
code Error code. Returned only for failed requests. See Error codes. |
|
|
message Detailed error message. Returned only for failed requests. See Error codes. |
Step 2: Query results by task ID
Singapore
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}
Replace WorkspaceId with your actual Workspace ID.
US (Virginia)
GET https://dashscope-us.aliyuncs.com/api/v1/tasks/{task_id}
China (Beijing)
GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}
Replace WorkspaceId with your actual Workspace ID.
Germany (Frankfurt)
GET https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/api/v1/tasks/{task_id}
Replace WorkspaceId with your actual Workspace ID.
-
Polling: Video editing takes several minutes. Use a polling mechanism with a reasonable interval (for example, 15 seconds) to check for results.
-
Task status flow: PENDING (queued) → RUNNING (processing) → SUCCEEDED / FAILED.
-
task_id expiration: The task_id expires after 24 hours. After expiration, results can no longer be retrieved and the API returns a task status of
UNKNOWN.
Request parameters |
Query task resultReplace |
Headers |
|
|
Authorization Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx. |
|
Path parameters |
|
|
task_id The ID of the task. |
Response parameters |
Task succeededVideo URLs are valid for only 24 hours and then automatically purged. Save generated videos promptly.
Task failedWhen a task fails,
Task query expiredThe
|
|
output Task output information. |
|
|
usage Usage statistics. Only counts successful results. |
|
|
request_id Unique request identifier for tracing and troubleshooting. |
Error codes
If the model call fails and returns an error message, see Error codes for resolution.