# "Mở rộng hình ảnh"

Nguồn: https://docs.openaihub.net/api-45209018/

> API origin: `https://api.openaihub.net`. Chọn đúng nhóm API và model. Thông số dưới đây là bản tham chiếu kỹ thuật; chưa phải kết quả kiểm thử từng endpoint bằng tài khoản của bạn.


## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /kling/v1/images/editing/expand:
    post:
      summary: Mở rộng hình ảnh
      deprecated: false
      description: ''
      operationId: post-kling-v1-images-editing-expand
      tags:
        - OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Video/Kling/Mở rộng hình ảnh
        - kling
      parameters:
        - name: Content-Type
          in: header
          description: Content-Type của phần thân yêu cầu, thường là application/json
          required: false
          example: application/json
          schema:
            type: string
        - name: Authorization
          in: header
          description: Khóa API Bearer
          required: false
          example: Bearer {{YOUR_API_KEY}}
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - image
                - up_expansion_ratio
                - down_expansion_ratio
                - left_expansion_ratio
                - 'n'
                - right_expansion_ratio
              properties:
                callback_url:
                  type: string
                  description: URL gọi lại được kích hoạt khi tác vụ hoàn tất
                down_expansion_ratio:
                  type: number
                  description: >-
                    Mở rộng xuống dưới; hệ số nhân của chiều cao ban đầu

                    phạm vi: [0,2], diện tích ảnh mới không được vượt quá 3×
                    diện tích ban đầu

                    ví dụ: nếu chiều cao ban đầu là20 và tham số này là0.2, thì:

                    khoảng cách từ đáy ban đầu đến đáy mới =20 x 0.2 = 4, vùng
                    đó là vùng mở rộng
                external_task_id:
                  type: string
                  description: >-
                    Mã định danh tác vụ bên ngoài tùy chỉnh để đối chiếu phía
                    nghiệp vụ
                image:
                  type: string
                  description: >-
                    Hình ảnh tham chiếu

                    chấp nhận hình ảnh được mã hóa Base64 hoặc URL hình ảnh có
                    thể truy cập được
                left_expansion_ratio:
                  type: number
                  description: >-
                    Mở rộng sang trái; hệ số nhân của chiều rộng ban đầu

                    phạm vi: [0,2], diện tích ảnh mới không được vượt quá 3 lần
                    diện tích ban đầu

                    ví dụ: nếu chiều rộng ban đầu là 30 và tham số này là 0.3,
                    thì:

                    khoảng cách từ mép trái ban đầu đến mép trái mới = 30 x 0.3
                    = 9, vùng đó là vùng mở rộng
                'n':
                  type: integer
                  description: |-
                    Số lượng hình ảnh cần tạo
                    phạm vi: [1,9]
                prompt:
                  type: string
                  description: |-
                    Lời nhắc văn bản tích cực
                    Tối đa 2500 ký tự
                right_expansion_ratio:
                  type: number
                  description: >-
                    Mở rộng sang phải; hệ số nhân của chiều rộng ban đầu

                    phạm vi: [0,2], diện tích ảnh mới không được vượt quá 3 lần
                    diện tích ban đầu

                    ví dụ: nếu chiều rộng ban đầu là 30 và tham số này là 0.4,
                    thì:

                    khoảng cách từ cạnh phải ban đầu đến cạnh phải mới = 30 x
                    0.4 = 12, vùng đó là vùng mở rộng
                up_expansion_ratio:
                  type: number
                  description: >-
                    Mở rộng lên trên; hệ số nhân của chiều cao ban đầu

                    phạm vi: [0,2], diện tích ảnh mới không được vượt quá 3 lần
                    diện tích ban đầu

                    ví dụ: nếu chiều cao ban đầu là 20 và tham số này là 0.1,
                    thì:

                    khoảng cách từ mép trên ban đầu đến mép trên mới = 20 x 0.1
                    = 2, vùng đó là khu vực mở rộng
              x-apifox-orders:
                - callback_url
                - down_expansion_ratio
                - external_task_id
                - image
                - left_expansion_ratio
                - 'n'
                - prompt
                - right_expansion_ratio
                - up_expansion_ratio
              x-apidog-orders:
                - callback_url
                - down_expansion_ratio
                - external_task_id
                - image
                - left_expansion_ratio
                - 'n'
                - prompt
                - right_expansion_ratio
                - up_expansion_ratio
            examples:
              example:
                value:
                  callback_url: ''
                  down_expansion_ratio: 0.1
                  external_task_id: ''
                  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
                  left_expansion_ratio: 0.1
                  'n': 1
                  prompt: Trung tâm lấy nét
                  right_expansion_ratio: 0.1
                  up_expansion_ratio: 0.1
                summary: example
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                x-apidog-orders: []
              examples:
                example:
                  summary: example
                  value:
                    code: 0
                    data:
                      task_id: task_example_001
                    message: thành công
          headers: {}
          x-apidog-name: ''
        '400':
          description: Yêu cầu không hợp lệ hoặc xác thực thất bại
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - message
                      - type
                    properties:
                      message:
                        type: string
                        description: Thông báo lỗi (thường kết thúc bằng mã yêu cầu)
                      type:
                        type: string
                        description: Loại lỗi; các lỗi cổng cục bộ thường là new_api_error
                        examples:
                          - new_api_error
                    x-apifox-orders:
                      - message
                      - type
                    x-apidog-orders:
                      - message
                      - type
                refName: NewApiError
                x-apifox-orders:
                  - error
                x-apidog-orders:
                  - error
              examples:
                example:
                  summary: example
                  value:
                    error:
                      message: >-
                        Yêu cầu không hợp lệ (mã yêu cầu:
                        20260805120000123456789AbCdEfGh)
                      type: new_api_error
          headers: {}
          x-apidog-name: Yêu cầu không hợp lệ hoặc xác thực thất bại
        '401':
          description: Khóa API bị thiếu hoặc không hợp lệ
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - message
                      - type
                    properties:
                      message:
                        type: string
                        description: Thông báo lỗi (thường kết thúc bằng mã yêu cầu)
                      type:
                        type: string
                        description: Loại lỗi; các lỗi cổng cục bộ thường là new_api_error
                        examples:
                          - new_api_error
                    x-apifox-orders:
                      - message
                      - type
                    x-apidog-orders:
                      - message
                      - type
                refName: NewApiError
                x-apifox-orders:
                  - error
                x-apidog-orders:
                  - error
              examples:
                example:
                  summary: example
                  value:
                    error:
                      message: >-
                        Mã thông báo không hợp lệ (request id:
                        20260805120000123456789AbCdEfGh)
                      type: new_api_error
          headers: {}
          x-apidog-name: Khóa API bị thiếu hoặc không hợp lệ
      security: []
      x-apidog-folder: OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Video/Kling/Mở rộng hình ảnh
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1218648/apis/api-45209018-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.openaihub.net
    description: Prod Env
security: []

```
