众扬汇 AI 开放平台 API 文档

通用视频编辑

OpenAPI Specification

yaml
openapi: 3.0.1
info:
  title: ''
  description: "本页接口说明详见下方接口定义;参数取值与返回以本平台实测为准。"
  version: 1.0.0
paths:
  /qwen/api/v1/services/aigc/video-generation/video-synthesis:
    post:
      summary: 通用视频编辑
      deprecated: false
      description: "基于输入的文本提示词、图片和视频执行多种视频编辑任务,例如提取输入视频的运动特征并结合提示词生成新视频。接口参数与返回以本平台实测为准;上游文档外链已移除。"
      tags:
        - 视频模型/qwen视频模型
      parameters:
        - name: X-DashScope-Async
          in: header
          description: "该字段的取值与含义以本平台实际返回为准。"
          required: true
          example: enable
          schema:
            type: string
        - name: Content-Type
          in: header
          description: "该字段的取值与含义以本平台实际返回为准。"
          required: true
          example: application/json
          schema:
            type: string
        - name: Authorization
          in: header
          description: "该字段的取值与含义以本平台实际返回为准。"
          required: false
          example: Bearer {{YOUR_API_KEY}}
          schema:
            type: string
            default: Bearer {{YOUR_API_KEY}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                input:
                  type: object
                  properties:
                    function:
                      type: string
                      description: "功能名称,局部编辑设置为 video_edit。局部编辑支持对输入视频的指定区域进行增加、修改或删除元素,也可替换编辑区域的主体或背景。"
                    prompt:
                      type: string
                      description: "提示词,用于描述期望生成的视频元素与视觉特点;支持中英文,长度不超过 800 个字符(每个汉字/字母计 1 个字符),超出部分自动截断。"
                    ref_images_url:
                      type: array
                      items:
                        type: string
                      description: "参考图像 URL 数组。URL 需公网可访问,支持 HTTP/HTTPS;本地文件可先上传获取临时 URL。当前仅支持传入 1 张参考图像,可作为主体或背景用于替换输入视频中的对应内容。限制:格式 JPG、JPEG、PNG、BMP、TIFF、WEBP;宽高均在 360–2000 像素;不超过 10MB。"
                    video_url:
                      type: string
                      description: "输入视频 URL,需公网可访问,支持 HTTP/HTTPS。限制:格式 MP4;帧率不低于 16FPS;不超过 50MB;时长不超过 5 秒(超出则取前 5 秒);URL 中不能包含中文字符。输出分辨率规则以本平台实测为准。"
                    'mask_image_url ':
                      type: string
                      description: "掩码图像 URL,需公网可访问,支持 HTTP/HTTPS。用于指定视频的编辑区域,与 mask_video_url 二选一,推荐优先使用本参数。白色区域(像素值严格为 [255,255,255])表示需要编辑的部分,黑色区域(严格为 [0,0,0])表示保留不变。限制:格式 JPG、JPEG、PNG、BMP、TIFF、WEBP。"
                    mask_frame_id:
                      type: string
                      description: "当 mask_image_url 不为空时生效,用于标识掩码目标所在的帧(帧 ID)。默认值 1,即视频首帧;取值范围 [1, max_frame_id],其中 max_frame_id = 输入视频帧率 × 时长 + 1。例如帧率 16FPS、时长 5 秒时总帧数为 81。"
                    mask_video_url:
                      type: string
                      description: "掩码视频 URL,需公网可访问,支持 HTTP/HTTPS。用于指定视频的编辑区域,与 mask_image_url 二选一。掩码视频的格式、帧率、分辨率与长度需与输入视频完全一致。白色区域表示需要编辑的部分,黑色区域表示保留不变。"
                  required:
                    - function
                    - prompt
                    - video_url
                parameters:
                  type: object
                  properties:
                    prompt_extend:
                      type: boolean
                      description: "是否开启 prompt 智能改写:true(默认)使用大模型改写输入 prompt,对较短 prompt 提升明显但会增加耗时;false 关闭(推荐)。当文本描述与视频内容不一致时建议关闭,并在 prompt 中给出清晰具体的画面描述。"
                    obj_or_bg:
                      type: array
                      items:
                        type: string
                    size:
                      type: string
                      description: "生成视频的分辨率(宽×高)。目前支持 720P,取值为:1280*720(16:9,默认)、720*1280(9:16)、960*960(1:1)、832*1088(3:4)、1088*832(4:3)。"
                    'control_condition ':
                      type: string
                      description: "视频特征提取方式,默认为空字符串(不提取)。posebodyface:提取输入视频主体的脸部表情与肢体动作,适用于脸部占比较大、特征清晰的场景;depth:提取输入视频的构图与运动轮廓。"
                    mask_type:
                      type: string
                      description: "当 mask_image_url 不为空时生效,指定编辑区域的行为方式。tracking(默认)随目标物体运动轨迹动态跟随,适用于主体运动场景;fixed 编辑区域保持固定不变。"
                    expand_ratio:
                      type: string
                      description: "当 mask_type 为 tracking 时生效,表示掩码区域向外扩展的比例。取值范围 [0.0, 1.0],默认 0.05(推荐使用默认值);取值越小越贴合目标物体,越大扩展范围越广。"
                    expand_mode:
                      type: string
                      description: "当 mask_type 为 tracking 时生效,表示掩码区域的形状。算法基于输入的掩码图像生成对应形状的掩码视频,取值:hull(默认,多边形包裹掩码目标)、bbox(矩形包裹掩码目标)、original(尽量与原始掩码目标形状一致)。"
                    duration:
                      type: integer
                      description: "视频时长,单位秒;当前固定为 5 且不支持修改,模型始终输出 5 秒视频"
                    seed:
                      type: integer
                      description: "随机数种子,用于控制生成内容的随机性,取值范围 [0, 2147483647]。不提供时由算法自动生成;希望生成结果相对稳定时请使用相同的 seed。"
                    watermark:
                      type: boolean
                      description: "是否添加水印,水印位于视频右下角,文案为「AI 生成」。false(默认)不添加,true 添加。"
                  required:
                    - obj_or_bg
              required:
                - model
                - input
                - parameters
            example:
              model: wanx2.1-vace-plus
              input:
                function: image_reference
                prompt: >-
                  视频中,一位女孩自晨雾缭绕的古老森林深处款款走出,她步伐轻盈,镜头捕捉她每一个灵动瞬间。当女孩站定,环顾四周葱郁林木时,她脸上绽放出惊喜与喜悦交织的笑容。这一幕,定格在了光影交错的瞬间,记录下女孩与大自然的美妙邂逅。
                ref_images_url:
                  - >-
                    http://files.example.com/material/20250318/image_reference_2_5_16.png
                  - >-
                    http://files.example.com/material/20250318/image_reference_1_5_16.png
              parameters:
                prompt_extend: true
                obj_or_bg:
                  - obj
                  - bg
                size: 1280*720
      responses:
        '200':
          description: "该字段的取值与含义以本平台实际返回为准。"
          content:
            application/json:
              schema:
                type: object
                properties: {}
          headers: {}
      security: []
components:
  schemas: {}
  securitySchemes: {}
servers: []
security: []

使用提示:本页接口的 Base URL 为 https://api.allyang.cn,请求头需携带 Authorization: Bearer <令牌>(令牌在控制台「令牌管理」中创建)。示例中的任务 ID、时间戳与文件地址均为示意值,实际以平台返回为准。

模型名请在「模型广场」复制后填入,不要手输;计费、限流与在售清单以平台实测为准(部分数值待补)。