跳转到主要内容
PixVerse

PixVerse — 创建任务

提交 PixVerse 参考生视频任务

POST
/services/aigc/video-generation/video-synthesis
curl --location 'https://maas.qianwenaiapi.com/api/v1/services/aigc/video-generation/video-synthesis' \
  -H 'X-DashScope-Async: enable' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "pixverse/pixverse-v6-r2v-omni",
  "input": {
    "media": [
      {
        "type": "video_url",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4",
        "ref_name": "参考视频"
      },
      {
        "type": "image_url",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260320/knsple/wan-r2v-role-frame.jpg",
        "ref_name": "男人"
      },
      {
        "type": "image_url",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png",
        "ref_name": "咖啡厅"
      }
    ],
    "prompt": "@男人 在@咖啡厅 中弹吉他 参考@参考视频"
  },
  "parameters": {
    "resolution": "720P",
    "aspect_ratio": "16:9",
    "duration": 0,
    "audio": true,
    "watermark": false
  }
}'
{
  "request_id": "<string>",
  "output": {
    "task_id": "<string>",
    "task_status": "PENDING"
  }
}
基于参考图片与文本提示词,使用 PixVerse 模型生成视频。
  • 模型选型:pixverse/pixverse-c1-r2v 适用于打斗、法术特效及高速运动等动态场景以及多宫格场景;pixverse/pixverse-v6-r2v 通用场景推荐使用。
  • 参考图绑定:通过 media 数组提供最多 7 张参考图片,在提示词中使用 @ref_name 精确绑定角色或物体。
  • 灵活分辨率:支持从 360P 到 1080P 多种分辨率与画面比例(16:9、4:3、1:1、3:4、9:16 等)。
  • 音频与水印:可选生成带音频的视频,支持添加"AI生成"水印。
  • 可复现结果:通过 seed 参数固定随机种子,实现结果复现。
  • Python SDK
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os

# 若没有配置环境变量,请用千问AI平台API Key将下行替换为:api_key="sk-xxx"
# 获取API Key:https://platform.qianwenai.com/home/api-keys
api_key = os.getenv("DASHSCOPE_API_KEY")

media = [{'type': 'video_url', 'url': 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4', 'ref_name': '参考视频'}, {'type': 'image_url', 'url': 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260320/knsple/wan-r2v-role-frame.jpg', 'ref_name': '男人'}, {'type': 'image_url', 'url': 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png', 'ref_name': '咖啡厅'}]

def sample_async_call():
    # 异步提交视频生成任务
    rsp = VideoSynthesis.async_call(api_key=api_key,
                                model='pixverse/pixverse-v6-r2v-omni',
                                media=media,
                                prompt='@男人 在@咖啡厅 中弹吉他 参考@参考视频',
                                resolution='720P',
                                aspect_ratio='16:9',
                                duration=0,
                                audio=True,
                                watermark=False)
    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))

    # 查询任务状态
    status = VideoSynthesis.fetch(task=rsp, api_key=api_key)
    if status.status_code == HTTPStatus.OK:
        print(status.output.task_status)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (status.status_code, status.code, status.message))

    # 等待任务完成
    rsp = VideoSynthesis.wait(task=rsp, api_key=api_key)
    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()

鉴权

string
header
必填

千问AI平台 API Key。详见获取 API Key。

Header 参数

enum<string>
必填

异步处理配置参数。HTTP 请求只支持异步,必须设置为 enable。缺少此请求头将报错:"current user api does not support synchronous calls"。

enable
string
必填

请求内容类型。此参数必须设置为 application/json。

string
必填

千问AI平台 API Key。详见获取 API Key。

请求体

application/json
enum<string>
必填

模型名称。可选值:pixverse/pixverse-v6-r2v-omni(需要图片+视频融合参考生成时推荐)、pixverse/pixverse-c1-r2v(适用于打斗、法术特效及高速运动等动态场景以及多宫格场景)、pixverse/pixverse-v6-r2v(通用场景推荐)、pixverse/pixverse-v5.6-r2v(建议升级至v6)。

pixverse/pixverse-v6-r2v-omni,pixverse/pixverse-c1-r2v,pixverse/pixverse-v6-r2v,pixverse/pixverse-v5.6-r2v
pixverse/pixverse-c1-r2v
object
必填

输入的基本信息,包括参考图片和提示词。

object

视频生成参数,如设置视频分辨率、时长、是否生成音频等。

响应

200-application/json
string

请求唯一标识。可用于请求明细溯源和问题排查。

object

任务输出信息。

PixVerse — 创建任务 - 千问AI平台