The HappyHorse reference-to-video model lets you provide multiple reference images and a text prompt to generate a video that combines subjects from the images into a scene based on the prompt.
Usage notes
To ensure successful API calls, you must use a model, endpoint URL, and API key that all belong to the same region. Cross-region calls will fail.
-
Select a model: Confirm the region where your model is located.
-
Select a URL: Choose the corresponding endpoint URL. Both HTTP and DashScope SDK URLs are supported.
-
Configure an API key: Select a region, get an API key, and then configure the API key as an 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 calls
Because reference-to-video tasks are time-consuming (typically 1–5 minutes), the API uses an asynchronous call. The workflow consists of two core steps: "Create a task -> Poll for the result".
Step 1: Create a task
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 Workspace ID.
China (Hong Kong)
POST https://{WorkspaceId}.cn-hongkong.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 |
Reference-to-video (multi-image)
|
Request 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 name of the model. Valid values:
|
|
|
input The model input, which includes the reference images and text prompt. |
|
|
parameters Parameters for video generation, such as video resolution, aspect ratio, and duration. |
Response parameters |
Successful responseSave the
Error responseTask creation failed. See Error codes.
|
|
output The output information for the task. |
|
|
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: Get the task result
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 Workspace ID.
China (Hong Kong)
GET https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/api/v1/tasks/{task_id}
Replace WorkspaceId with your actual Workspace ID.
-
Polling recommendation: Video generation can take several minutes. We recommend that you implement a polling mechanism with a reasonable query interval (for example, 15 seconds) to retrieve the result.
-
Task status flow: PENDING (Queued) → RUNNING (Processing) → SUCCEEDED (Succeeded) or FAILED (Failed).
-
Task ID validity: The task ID is valid for 24 hours. After this period, you can no longer query the result, and the API returns a task status of
UNKNOWN.
Request parameters |
Query task resultReplace |
Request headers |
|
|
Authorization Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx. |
|
URL 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 The output information for the task. |
|
|
usage Usage statistics for the task. You are only billed for successful tasks. |
|
|
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.