Skip to content

图像生成

OpenAPI Specification

yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /kling/v1/images/generations:
    post:
      summary: 图像生成
      deprecated: false
      description: ''
      tags:
        - 可灵 Kling 平台/图像生成
      parameters:
        - name: Content-Type
          in: header
          description: ''
          required: false
          example: application/json
          schema:
            type: string
        - name: Authorization
          in: header
          description: ''
          required: false
          example: Bearer {{YOUR_API_KEY}}
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model_name:
                  type: string
                  description: >-
                    模型名称 枚举值:kling-v1, kling-v1-5, kling-v2, kling-v2-new,
                    kling-v2-1,kling-v3
                prompt:
                  type: string
                  description: 正向文本提示词 不能超过2500个字符
                negative_prompt:
                  type: string
                  description: 负向文本提示词 不能超过2500个字符
                image:
                  type: string
                  description: 参考图像支持传入图片Base64编码或图片URL(确保可访问)
                image_reference:
                  type: string
                  description: |-
                    图片参考类型
                    枚举值:subject(角色特征参考), face(人物长相参考)
                    使用face(人物长相参考)时,上传图片需仅含1张人脸。
                    使用 kling-v1-5 且 image 参数不为空时,当前参数必填
                image_fidelity:
                  type: number
                  description: |-
                    生成过程中对用户上传图片的参考强度
                    取值范围:[0,1],数值越大参考强度越大
                human_fidelity:
                  type: number
                  description: |-
                    面部参考强度,即参考图中人物五官相似度
                    仅 image_reference 参数为 subject 时生效
                    取值范围:[0,1],数值越大参考强度越大
                resolution:
                  type: string
                  description: |-
                    生成图片的清晰度
                    枚举值:1k, 2k
                    1k:1K标清
                    2k:2K高清
                'n':
                  type: integer
                  description: |-
                    生成图片数量
                    取值范围:[1,9]
                aspect_ratio:
                  type: string
                  description: |-
                    生成图片的画面纵横比(宽:高)
                    枚举值:16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9
                callback_url:
                  type: string
              required:
                - model_name
                - prompt
                - 'n'
              x-apifox-orders:
                - model_name
                - prompt
                - negative_prompt
                - image
                - image_reference
                - image_fidelity
                - human_fidelity
                - resolution
                - 'n'
                - aspect_ratio
                - callback_url
            example: "{\r\n    \"model_name\": \"kling-v1\",\r\n    \"prompt\": \"生成一张海边的图\",\r\n    \"negative_prompt\": \"\",\r\n    \"image\": \"\",\r\n    \"image_reference\": \"\",\r\n    // \"image_fidelity\": \"0.5\",\r\n    \"human_fidelity\": 0.45,\r\n    \"resolution\": \"1k\",\r\n    \"n\": 2,\r\n    \"aspect_ratio\": \"16:9\",\r\n    \"callback_url\": \"\"\r\n}"
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
          headers: {}
          x-apifox-name: 成功
      security:
        - bearer: []
      x-apifox-folder: 可灵 Kling 平台/图像生成
      x-apifox-status: testing
      x-run-in-apifox: https://app.apifox.com/web/project/5443236/apis/api-386036840-run
components:
  schemas: {}
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
servers:
  - url: https://www.anyapi.vip
    description: 正式环境
security:
  - bearer: []

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