Wan - Image to Video
Copy success!
Overview
The upgraded Wan2.5 Preview image to video model, newly upgraded model architecture supports synchronized audio generation with visuals, enables 10-second long video generation, and offers enhanced instruction adherence, improved motion capabilities, and superior image quality.
Input
Image
Output
Video
Features
Prefix Completion
Enable Partial Mode when calling the Qwen API to make the model continue strictly from your provided prefix text.View docsFunction Calling
Use function calling to connect large language models with external tools and systems.View docsCache
Context Cache stores shared prefixes for long-context requests to reduce repeated computation, improve latency, and lower cost.View docsStructured Outputs
Structured Outputs help ensure the model returns a JSON string in the expected format.View docsPricing
- Video Generation(480P)$0.05Per second
- Video Generation(720P)$0.1Per second
- Video Generation(1080P)$0.15Per second
Rate Limits
- Concurrency5concurrent
- Async Queue Limit500tasks
- RPMRequests Per Minute300
API Reference
Call APICopy success!
123456789101112131415161718192021222324252627282930313233343536373839404142434445
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'
# Get DashScope API Key from environment variable (Model Studio API key)
api_key = os.getenv("DASHSCOPE_API_KEY")
img_url = "https://cdn.translate.alibaba.com/r/wanx-demo-1.png"
def sample_async_call_i2v():
# call async api, will return the task information
# you can get task status with the returned task id.
rsp = VideoSynthesis.async_call(model='wan2.5-i2v-preview',
prompt='A cat running on the grass',
img_url=img_url)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print("task_id: %s" % rsp.output.task_id)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
# get the task information include the task status.
status = VideoSynthesis.fetch(rsp)
if status.status_code == HTTPStatus.OK:
print(status.output.task_status) # check the task status
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(status.status_code, status.code, status.message))
# wait the task complete, will call fetch interval, and check it's in finished status.
rsp = VideoSynthesis.wait(rsp)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print(rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
sample_async_call_i2v()