Skip to content

创建图片生成任务

OpenAPI Specification

yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /ent/v2/reference2image:
    post:
      summary: 创建图片生成任务
      deprecated: false
      description: 官方文档:https://platform.vidu.cn/docs/reference-to-image
      tags:
        - 官方VIDU视频生成、图片生成、音频生成
      parameters:
        - name: Authorization
          in: header
          description: ''
          required: false
          example: Bearer {{YOUR_API_KEY}}
          schema:
            type: string
        - name: Content-Type
          in: header
          description: ''
          required: false
          example: application/json
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  description: >-
                    文本提示词

                    视频生成的文本描述,长度不能超过 2000 个字符

                    注1:viduq2模型支持文生图,在使用viduq2模型,且没有上传任何images时,模型会使用该参数的文本内容生成图片
                model:
                  type: string
                  description: |-
                    模型名称
                    可选值:viduq2、viduq1
                    viduq2:支持文生图、图片编辑、参考生图
                    viduq1:支持参考生图
                seed:
                  type: string
                  description: |-
                    随机种子参数
                    当默认不传或者传0时,会使用随机数替代
                    手动设置则使用设置的种子
                images:
                  type: array
                  items:
                    type: string
                  description: |-
                    图像参考
                    viduq2:支持输入 0~7 张图片
                    viduq1:支持输入 1~7 张图片
                    模型将以此参数中传入的图片中的主题为参考,生成与图片中主体一致的视频。
                    注1:支持传入图片 Base64 编码或图片URL(确保可访问)
                    注2:图片支持 png、jpeg、jpg、webp格式
                    注3:图片像素不能小于 128*128,且比例需要小于1:4或者4:1
                    注4: 且大小不超过50M
                    注5:请注意,http请求的post body不超过20MB,且编码必须包含适当的内容类型字符串,例如:

                    data:image/png;base64,{base64_encode}
                aspect_ratio:
                  type: string
                  description: |-
                    比例参数,不同模型支持不同的比例:
                    viduq1:默认值16:9,可选值:16:9、9:16、1:1、3:4、4:3
                    viduq2:默认值16:9,可选值如下:16:9、9:16、1:1、3:4、4:3、21:9、2:3、3:2
                    - auto:表示与首张输入图保持相同比例
                resolution:
                  type: string
                  description: |-
                    分辨率参数,不同模型支持的分辨率不同:
                    viduq1:默认1080p,可选项:1080p
                    viduq2:默认1080p,可选项:1080p、2K、4K
                payload:
                  type: string
                  description: |-
                    透传参数
                    不做任何处理,仅数据传输
                    注:最多 1048576个字符
                callback_url:
                  type: string
                  description: >-
                    Callback 协议

                    需要您在创建任务时主动设置 callback_url,请求方法为 POST,当视频生成任务有状态变化时,Vidu
                    将向此地址发送包含任务最新状态的回调请求。回调请求内容结构与查询任务API的返回体一致

                    回调返回的“status”包括以下状态:

                    - processing 任务处理中

                    - success 任务完成(如发送失败,回调三次)

                    - failed 任务失败(如发送失败,回调三次)

                    Vidu采用回调签名算法进行认证,详情见:回调签名算法
              required:
                - model
                - prompt
              x-apifox-orders:
                - model
                - images
                - prompt
                - seed
                - aspect_ratio
                - resolution
                - payload
                - callback_url
            example:
              model: viduq1
              prompt: 一只可爱的小猫坐在窗台上,阳光洒在它的身上,温馨的画面
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  task_id:
                    type: string
                  state:
                    type: string
                  model:
                    type: string
                  prompt:
                    type: string
                  images:
                    type: array
                    items:
                      type: string
                  seed:
                    type: integer
                  aspect_ratio:
                    type: string
                  callback_url:
                    type: string
                  payload:
                    type: string
                  cus_priority:
                    type: integer
                  credits:
                    type: integer
                  created_at:
                    type: string
                  watermark:
                    type: boolean
                required:
                  - task_id
                  - state
                  - model
                  - prompt
                  - images
                  - seed
                  - aspect_ratio
                  - callback_url
                  - payload
                  - cus_priority
                  - credits
                  - created_at
                  - watermark
                x-apifox-orders:
                  - task_id
                  - state
                  - model
                  - prompt
                  - images
                  - seed
                  - aspect_ratio
                  - callback_url
                  - payload
                  - cus_priority
                  - credits
                  - created_at
                  - watermark
              example:
                task_id: '911092490931552256'
                state: created
                model: viduq2
                prompt: 一只可爱的小猫坐在窗台上,阳光洒在它的身上,温馨的画面
                images: []
                seed: 616519648
                aspect_ratio: auto
                callback_url: ''
                payload: ''
                cus_priority: 0
                credits: 6
                created_at: '2026-01-20T07:08:12.262592985Z'
                watermark: false
          headers: {}
          x-apifox-name: 成功
      security: []
      x-apifox-folder: 官方VIDU视频生成、图片生成、音频生成
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/5443236/apis/api-407958636-run
components:
  schemas: {}
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
servers:
  - url: https://www.anyapi.vip
    description: 正式环境
security:
  - bearer: []

AnyAPI — 专业的 AI 接口聚合服务