Wan-I2V
复制成功!
视频生成
概述
视频生成
全新升级的万相2.2图生视频,生成速度更快。优化视频生成稳定性与成功率,更强大的指令遵循能力,稳定保持图片文字、人像和商品一致性,精准运镜控制。
输入
图像
输出
视频
功能
定价
- 视频生成(480P)¥0.1每秒
- 视频生成(720P)¥0.2每秒
- 视频生成(1080P)¥0.48每秒
速率限制
- RPM每分钟请求数120
- 并发2并发
- 异步队列上限500个任务
API 参考
获取 API Key复制成功!
123456789101112131415161718192021222324252627282930313233343536373839404142434445
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
dashscope.base_http_api_url = 'https://dashscope.aliyuncs.com/api/v1'
# 从环境变量中获取 DashScope API Key(即阿里云百炼平台 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.2-i2v-flash',
prompt='一只猫在草地上奔跑',
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()