Skip to content

扩图

OpenAPI Specification

yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /kling/v1/images/editing/expand:
    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:
                image:
                  type: string
                  description: |-
                    参考图片
                    支持传入图片Base64编码或图片URL(确保可访问)
                up_expansion_ratio:
                  type: number
                  description: |-
                    向上扩充范围;基于原图高度的倍数而计算
                    取值范围:[0,2],新图片整体面积不得超过原图片3倍
                    如原图高20,当前参数值为0.1,则:
                    原图顶边距离新图顶边为20 x 0.1 = 2,区域内均为扩图范围
                down_expansion_ratio:
                  type: number
                  description: |-
                    向下扩充范围;基于原图高度的倍数而计算
                    取值范围:[0,2],新图片整体面积不得超过原图片3倍
                    如原图高20,当前参数值为0.2,则:
                    原图底边距离新图底边为20 x 0.2 = 4,区域内均为扩图范围
                left_expansion_ratio:
                  type: number
                  description: |-
                    向左扩充范围;基于原图宽度的倍数而计算
                    取值范围:[0,2],新图片整体面积不得超过原图片3倍
                    如原图宽30,当前参数值为0.3,则:
                    原图左边距离新图左边为30 x 0.3 = 9,区域内均为扩图范围
                right_expansion_ratio:
                  type: number
                  description: |-
                    向右扩充范围;基于原图宽度的倍数而计算
                    取值范围:[0,2],新图片整体面积不得超过原图片3倍
                    如原图宽30,当前参数值为0.4,则:
                    原图右边距离新图右边为30 x 0.4 = 12,区域内均为扩图范围
                prompt:
                  type: string
                  description: |-
                    正向文本提示词
                    不能超过2500个字符
                'n':
                  type: integer
                  description: |-
                    生成图片数量
                    取值范围:[1,9]
                callback_url:
                  type: string
                external_task_id:
                  type: string
              required:
                - image
                - up_expansion_ratio
                - down_expansion_ratio
                - left_expansion_ratio
                - 'n'
                - right_expansion_ratio
              x-apifox-orders:
                - image
                - up_expansion_ratio
                - down_expansion_ratio
                - left_expansion_ratio
                - right_expansion_ratio
                - prompt
                - 'n'
                - callback_url
                - external_task_id
            example:
              image: >-
                https://h2.inkwai.com/bs2/upload-ylab-stunt/se/ai_portal_queue_mmu_image_upscale_aiweb/3214b798-e1b4-4b00-b7af-72b5b0417420_raw_image_0.jpg
              up_expansion_ratio: 0.1
              down_expansion_ratio: 0.1
              left_expansion_ratio: 0.1
              right_expansion_ratio: 0.1
              prompt: 聚焦中心
              'n': 1
              callback_url: ''
              external_task_id: ''
      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-386284418-run
components:
  schemas: {}
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
servers:
  - url: https://www.anyapi.vip
    description: 正式环境
security:
  - bearer: []

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