The Video Style Transform API converts input videos into various preset artistic styles. It ensures smooth motion and content coherence. The API supports eight preset styles: Japanese manga, American comic, fresh comic, 3D cartoon, Chinese cartoon, paper art, simple illustration, and Chinese ink wash painting.
This model service is available only in the China (Beijing) region. You must use an API key from this region for API calls.
Performance showcase
Input video | Output video (Japanese manga) |
For more examples, see Appendix: More style effect demonstrations.
Prerequisites
Before making an API call, get an API key and set it as environment variable.
HTTP
Video processing is time-consuming. To prevent requests from timing out, video style transform uses asynchronous invocation. The process involves two steps:
Submit an asynchronous task: Send a
POSTrequest with the source video URL and desired style parameters to obtain a uniquetask_id.Query the task result: Use the
task_idto poll the task status through aGETrequest until the task is complete. Then, retrieve the URL of the resulting video.
Step 1: Submit a video style transform task
POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesisRequest | Generate a 720p videoGenerate a 540p video |
Headers | |
Content-Type The content type of the request. Set this parameter to | |
Authorization The identity authentication credentials for the request. This API uses an Model Studio API key for identity authentication. Example: Bearer sk-xxxx. | |
X-DashScope-Async The asynchronous processing configuration parameter. HTTP requests support only asynchronous processing. You must set this parameter to Important If this request header is missing, the error message "current user api does not support synchronous calls" is returned. | |
Request Body | |
model The model name. Set this to | |
input The input content. | |
parameters The video processing parameters. |
Response | Successful responseAbnormal response |
output The task output information. | |
request_id The unique request ID. You can use this ID to trace and troubleshoot issues. | |
code The error code for a failed request. This parameter is not returned if the request is successful. For more information, see Error messages. | |
message The detailed information about a failed request. This parameter is not returned if the request is successful. For more information, see Error messages. |
Step 2: Query the task status and result
GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}Task result data, such as the task status and the generated video URL, is valid for 24 hours. After this period, the data is automatically purged. Query and save the results promptly.
Request | Get the task resultYou need to replace |
Headers | |
Authorization The identity authentication credentials for the request. This API uses an Model Studio API key for identity authentication. Example: Bearer sk-xxxx. | |
Path parameters | |
task_id The task ID. |
Response | Task succeededTask runningAfter a task is submitted, it is placed in a queue. After it is scheduled, its status changes to RUNNING. Task failed |
request_id The unique ID of the request. You can use this ID to trace request details and troubleshoot issues. | |
output The task output information. | |
usage Usage statistics for the task. |
Billing and rate limiting
You are charged only for successful tasks. The fee is calculated based on the actual duration (in seconds) of the output video and the selected resolution.
Billing formula: Total fee = Output video duration (seconds) × Unit price for the corresponding resolution (Note: The final fee is calculated based on the duration and SR fields in the usage object that is returned for a successful task.)
Model | Unit price | Rate limit (shared by Alibaba Cloud accounts and RAM users) | ||
QPS limit for task submission API | Number of concurrent tasks | |||
video-style-transform | 720p | $0.071677/second | 2 | 1 |
540p | $0.028671/second | |||
Billing example
For example, assume you submit a 10-second video and select the 720p resolution for style transform. If the task is successful and the generated video is 10 seconds long, the fee for this task is: 10 seconds × $0.071677/second = $0.71677.
Error codes
If a call fails, see Error messages for troubleshooting.
Appendix: More style effect demonstrations
Style name | Original video | Repaint Effect |
Japanese manga (style=0) | ||
American comic (style=1) | ||
Fresh comic (style=2) | ||
3D cartoon (style=3) | ||
Chinese cartoon (style=4) | ||
Paper art style (style=5) | ||
Simple illustration (style=6) | ||
Chinese ink wash painting (style=7) |