Wan-I2V

复制成功!
加入对比
视频生成

概述

视频生成

万相2.1-图生视频-Turbo,让图片变为动态视频。支持大幅度复杂运动、物理规律遵循、丰富艺术风格和影视级画面质感,指令遵循能力进一步提升,生成速度更快。

输入

图像

输出

视频

功能

前缀补全

函数调用

缓存

结构化输出

批量任务

联网搜索

微调

定价

  • 视频生成(std)
    ¥0.24每秒

速率限制

    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='wanx2.1-i2v-turbo',
                                        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()