The action template generation modelof AnimateAnyone extracts movements from a motion video and generates an action template for video generation. This topic describes how to call the action template generation API.
This document applies only to the China (Beijing) region. To use the model, you must use an API key for the China (Beijing) region.
Model overview
Model | Description |
animate-anyone-template-gen2 | Extracts character movements from a motion video to generate a character action template. |
Examples
Correct examples
Examples of videos that meet the requirements for creating action templates | |
The person in the uploaded video must be fully visible, with a clear face and no obscured body parts.
The person must appear from the first frame of the video. The action must be continuous and captured in a single take. Split videos with scene changes into multiple segments.
For best results, the person should face the camera in the first frame. Avoid actions such as excessive bending, squatting, or crouching.
Incorrect examples
Curled postures and self-occlusion | Multiple people in the frame | Blurry person | Person too small (Unclear face) | Person too large (Person not fully visible) |
|
|
|
|
|
To ensure the quality of the generated template, make sure that no frame in the uploaded video contains any of the preceding errors.
If the first frame of the video contains any of the preceding errors, the submitted task may fail and be aborted.
Make sure that the source of the uploaded video file complies with relevant laws and regulations.
The audio of the generated action template is the same as the audio in the uploaded video file. If you do not want to use this audio, or if you have not obtained a license for it, such as for background music, remove the audio from the video file before you upload it.
HTTP
Feature description
Generates a character action template. This template can be used as an input for the AnimateAnyone video generation API to generate a character action video.
Prerequisites
You have activated Alibaba Cloud Model Studio and created an API key, see Get an API key.
Input limits
Video format: MP4, AVI, or MOV.
The video file size cannot exceed 200 MB.
The length of each side of the video must be between 200 and 2,048 pixels. The video frame rate must be 24 frames per second (fps) or higher. The video must be encoded in H.264 or H.265.
The video duration must be from 2 seconds to 60 seconds.
The aspect ratio of the video must be between 1:3 and 3:1.
Only HTTP URLs are supported. Local file paths are not supported.
Step 1: Create a task and obtain the task ID
POST https://dashscope.aliyuncs.com/api/v1/services/aigc/image2video/aa-template-generation/This API call is time-consuming. Therefore, the task is submitted asynchronously.
After you submit the task, the system returns a task ID. You can then use the task ID to query the task status and result.
Request parameters
Field | Type | Location | Required | Description | Example |
Content-Type | String | Header | Yes | Request body format. | application/json |
Authorization | String | Header | Yes | Your API key with the | Bearer d1**2a |
X-DashScope-Async | String | Header | Yes | Set to | enable |
model | String | Body | Yes | Model to use. | animate-anyone-template-gen2 |
input.video_url | String | Body | No | URL of the video to generate an action template from.
Note File uploads support only HTTP or HTTPS links. Local file paths are not supported. | http://aaa/bbb.mp4 |
Response parameters
Field | Type | Description | Example |
output.task_id | String | ID of the submitted asynchronous task. Use this ID to query the task result. | a8532587-fa8c-4ef8-82be-0c46b17950d1 |
output.task_status | String | Task status after submission. | "PENDING" |
request_id | String | Unique request identifier. | 7574ee8f-38a3-4b1e-9280-11c33ab46e51 |
Request example
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/aigc/image2video/aa-template-generation/' \
--header 'X-DashScope-Async: enable' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "animate-anyone-template-gen2",
"input": {
"video_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241210/cwjmsz/1.mp4"
}
}'Response example
{
"output": {
"task_id": "a8532587-fa8c-4ef8-82be-xxxxxx",
"task_status": "PENDING"
},
"request_id": "7574ee8f-38a3-4b1e-9280-xxxxxx"
}Step 2: Query the result by task ID
GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}Request parameters
Field | Type | Location | Required | Description | Example |
Authorization | String | Header | Yes | Your API key with the | Bearer d1**2a |
task_id | String | URL Path | Yes | ID of the task to query. | a8532587-fa8c-4ef8-82be-0c46b17950d1 |
Response parameters
Field | Type | Description | Example |
output.task_id | String | ID of the queried task. | a8532587-fa8c-4ef8-82be-0c46b17950d1 |
output.task_status | String | Status of the queried task. | Task statuses: PENDING RUNNING SUCCEEDED FAILED UNKNOWN: The task does not exist or its status is unknown. |
output.template_id | String | Action template ID returned by the platform. Use this ID as input for the AnimateAnyone video generation API. The template_id is permission-verified. The Alibaba Cloud account using the template must be the same as the account that generated it. | AACT.xxx.xxx-xxx.xxx |
usage.video_duration | Float | Duration of the generated template, in seconds. | "video_duration": 10.23 |
usage.video_ratio | String | Aspect ratio type of the generated template. Value: | "video_ratio": "standard" |
request_id | String | Unique request identifier. | 7574ee8f-38a3-4b1e-9280-11c33ab46e51 |
Request example
curl -X GET \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
https://dashscope.aliyuncs.com/api/v1/tasks/<YOUR_TASK_ID>Response example
{
"request_id": "7574ee8f-38a3-4b1e-9280-11c33ab46e51",
"output": {
"task_id": "a8532587-fa8c-4ef8-82be-0c46b17950d1",
"task_status": "SUCCEEDED",
"template_id": "AACT.xxx.xxx-xxx.xxx"
},
"usage": {
"video_duration": 10.23,
"video_ratio": "standard"
}
}Error response example
{
"request_id": "7574ee8f-38a3-4b1e-9280-11c33ab46e51",
"output": {
"task_id": "a8532587-fa8c-4ef8-82be-0c46b17950d1",
"task_status": "FAILED",
"code": "xxx",
"message": "xxxxxx"
}
}What to do next
Use the action template for AnimateAnyone video generation.
Error codes
For common status codes, see Error messages.




