> ## Documentation Index
> Fetch the complete documentation index at: https://docs.powertokens.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Kling 多图生图

> 通过 `/kling/v1/images/multi-image2image` 提交 Kling 原生多图生图任务。



## OpenAPI

````yaml api-reference/zh-Hans/zmodelImage/kling/kling-v2-multi-image2image.json POST /kling/v1/images/multi-image2image
openapi: 3.0.1
info:
  title: Kling 多图生图任务 - 提交任务
  version: 1.0.0
  description: 通过 `/kling/v1/images/multi-image2image` 提交 Kling 原生多图生图任务。
servers:
  - url: https://api.powertokens.ai
    description: 当前 new-api 网关实例
security: []
tags:
  - name: Kling
    description: Kling 原生异步任务接口
paths:
  /kling/v1/images/multi-image2image:
    post:
      tags:
        - Kling
      summary: Kling 多图生图任务
      description: 通过 `/kling/v1/images/multi-image2image` 提交 Kling 原生多图生图任务。
      operationId: createKlingMultiReference2Image
      parameters:
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
            default: application/json
          description: 数据交换格式
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KlingRequest'
            examples:
              request:
                summary: 请求示例
                value:
                  model_name: kling-v2
                  prompt: 身着飘逸红色连衣裙,在草原上，吉卜力风格。
                  negative_prompt: ''
                  subject_image_list:
                    - subject_image: >-
                        https://v1-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-1.png
                    - subject_image: >-
                        https://v1-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/multi-2.png
                  scene_image: >-
                    https://v1-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/background.jpeg
                  style_image: >-
                    https://v1-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/16x9_jipuli.png
                  'n': 2
                  aspect_ratio: '9:16'
      responses:
        '200':
          description: 任务已接受。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
              examples:
                response:
                  summary: 响应示例
                  value:
                    code: 0
                    message: string
                    request_id: string
                    data:
                      task_id: string
                      task_info:
                        external_task_id: string
                      task_status: string
                      created_at: 1722769557708
                      updated_at: 1722769557708
      security:
        - bearerAuth: []
components:
  schemas:
    KlingRequest:
      type: object
      required:
        - model_name
        - subject_image_list
      properties:
        model_name:
          type: string
          description: 模型名称
          enum:
            - kling-v2
        prompt:
          type: string
          description: |-
            正向文本提示词
            - 不能超过2500个字符
          maxLength: 2500
        negative_prompt:
          type: string
          description: |-
            负向文本提示词
            - 不能超过2500个字符
          maxLength: 2500
        subject_image_list:
          type: array
          items:
            type: object
            required:
              - subject_image
            properties:
              subject_image:
                type: string
                description: 主体图片 URL 或 Base64 字符串。
          description: >-
            主体参考图片列表


            - 最多支持 4 张图片，最少支持 1 张图片，用 key:value 承载，如下：

            `"subject_image_list":[  { "subject_image":"image_url" },  {
            "subject_image":"image_url" },  { "subject_image":"image_url" },  {
            "subject_image":"image_url" }]`

            - API 端无裁剪逻辑，请直接上传已选主体后的图片

            - 支持传入图片 Base64 编码或图片 URL（确保可访问）

            - 注意：若您使用 Base64 方式，请不要在 Base64 编码字符串前添加任何前缀（如
            data:image/png;base64,），直接传递 Base64 编码后的字符串即可。

            - 正确的 Base64 编码参数：


            `iVBORw0KGgoAAAANSUhEUgAAAAUA...`


            - 错误的 Base64 编码参数（包含 data: 前缀）：


            `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...`


            - 图片格式支持 .jpg / .jpeg / .png

            - 图片文件大小不能超过 10MB，图片宽高尺寸不小于 300px，图片宽高比要在 1:2.5 ~ 2.5:1 之间
          minItems: 1
          maxItems: 4
        scene_image:
          type: string
          description: >-
            场景参考图


            - 支持传入图片 Base64 编码或图片 URL（确保可访问）

            - 注意：若您使用 Base64 方式，请不要在 Base64 编码字符串前添加任何前缀（如
            data:image/png;base64,），直接传递 Base64 编码后的字符串即可。

            - 正确的 Base64 编码参数：


            `iVBORw0KGgoAAAANSUhEUgAAAAUA...`


            - 错误的 Base64 编码参数（包含 data: 前缀）：


            `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...`


            - 图片格式支持 .jpg / .jpeg / .png

            - 图片文件大小不能超过 10MB，图片宽高尺寸不小于 300px，图片宽高比要在 1:2.5 ~ 2.5:1 之间
        style_image:
          type: string
          description: >-
            风格参考图


            - 支持传入图片 Base64 编码或图片 URL（确保可访问）

            - 注意：若您使用 Base64 方式，请不要在 Base64 编码字符串前添加任何前缀（如
            data:image/png;base64,），直接传递 Base64 编码后的字符串即可。

            - 正确的 Base64 编码参数：


            `iVBORw0KGgoAAAANSUhEUgAAAAUA...`


            - 错误的 Base64 编码参数（包含 data: 前缀）：


            `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...`


            - 图片格式支持 .jpg / .jpeg / .png

            - 图片文件大小不能超过 10MB，图片宽高尺寸不小于 300px，图片宽高比要在 1:2.5 ~ 2.5:1 之间
        'n':
          type: integer
          minimum: 1
          maximum: 9
          default: 1
          description: 生成图片数量
        aspect_ratio:
          type: string
          description: 生成图片的画面纵横比（宽:高）
          enum:
            - '1:1'
            - '16:9'
            - '4:3'
            - '3:2'
            - '2:3'
            - '3:4'
            - '9:16'
            - '21:9'
          default: '16:9'
        watermark_info:
          type: object
          description: |-
            是否同时生成含水印的结果。
            - 通过enabled参数定义，具体格式如下：

            ```json
             "watermark_info": { "enabled": boolean } ```

            - true 为生成，false 为不生成
            - 暂不支持自定义水印
          properties:
            enabled:
              type: boolean
              description: true 表示生成含水印结果，false 表示不生成。
        callback_url:
          type: string
          description: 本次任务结果回调通知地址，如果配置，服务端会在任务状态发生变更时主动通知
        external_task_id:
          type: string
          description: |-
            自定义任务ID。
            - 传入不会覆盖系统生成的任务ID，但支持通过该ID进行任务查询。
            - 请注意，单用户下需要保证唯一性。
    SubmitResponse:
      type: object
      properties:
        code:
          type: integer
          description: 错误码；具体定义见错误码
          example: 0
        message:
          type: string
          description: 错误信息
          example: string
        request_id:
          type: string
          description: 请求ID，系统生成，用于跟踪请求、排查问题
          example: string
        data:
          type: object
          properties:
            task_id:
              type: string
              description: 任务ID，系统生成
              example: string
            task_info:
              type: object
              description: 任务创建时的参数信息
              properties:
                external_task_id:
                  type: string
                  description: 客户自定义任务ID
                  example: string
            task_status:
              type: string
              description: 任务状态
              enum:
                - submitted
                - processing
                - succeed
                - failed
              example: submitted
            created_at:
              type: integer
              format: int64
              description: 任务创建时间，Unix时间戳、单位ms
              example: 1722769557708
            updated_at:
              type: integer
              format: int64
              description: 任务更新时间，Unix时间戳、单位ms
              example: 1722769557708
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: '在请求头中传入 `Authorization: Bearer <token>`。'

````