# "Hình ảnh"

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

> 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/generations:
    post:
      summary: Hình ảnh
      deprecated: false
      description: Tạo hình ảnh dựa trên các từ trong lời nhắc bằng văn bản.
      operationId: kling_images_generations
      tags:
        - OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Video/Kling
        - Kling
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - model_name
                - prompt
              properties:
                aspect_ratio:
                  type: string
                  enum:
                    - '16:9'
                    - '9:16'
                    - '1:1'
                    - '4:3'
                    - '3:4'
                  description: 'Tỷ lệ khung hình, ví dụ: 16:9, 9:16, 1:1'
                callback_url:
                  type: string
                  description: URL gọi lại
                image_fidelity:
                  type: number
                  description: Độ trung thực hình ảnh (cảnh chuyển từ ảnh sang ảnh)
                model_name:
                  type: string
                  enum:
                    - kling-v1
                    - kling-v1-5
                    - kling-v2
                    - kling-v2-1
                  description: Phiên bản mô hình hình ảnh
                  examples:
                    - kling-v1-5
                'n':
                  type: integer
                  description: Tạo số lượng
                negative_prompt:
                  type: string
                  description: từ gợi ý phủ định
                prompt:
                  type: string
                  description: Các từ dùng trong câu lệnh mô tả hình ảnh
                resolution:
                  type: string
                  enum:
                    - 1k
                    - 2k
                  description: Độ phân giải đầu ra
              refName: PostKlingV1ImagesGenerationsRequest
              x-apifox-orders:
                - aspect_ratio
                - callback_url
                - image_fidelity
                - model_name
                - 'n'
                - negative_prompt
                - prompt
                - resolution
              x-apidog-orders:
                - aspect_ratio
                - callback_url
                - image_fidelity
                - model_name
                - 'n'
                - negative_prompt
                - prompt
                - resolution
            examples:
              example_single:
                value:
                  aspect_ratio: '1:1'
                  model_name: kling-v1-5
                  'n': 1
                  prompt: >-
                    Một chú mèo mướp cam đáng yêu đang ngồi trên bậu cửa sổ,
                    theo phong cách màu nước
                  resolution: 1k
                summary: example_single
                description: Hình ảnh Vinh Sơn
      responses:
        '200':
          description: Tác vụ đã được gửi thành công
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: Mã trạng thái nghiệp vụ
                    examples:
                      - 0
                  data:
                    type: object
                    properties:
                      created_at:
                        type: integer
                        description: Thời điểm tạo (mili giây)
                      task_id:
                        type: string
                        description: ID tác vụ, được dùng để kiểm tra định kỳ
                      task_status:
                        type: string
                        enum:
                          - submitted
                          - processing
                          - succeed
                          - failed
                        description: Trạng thái tác vụ
                      updated_at:
                        type: integer
                        description: Cập nhật dấu thời gian (mili giây)
                    description: >-
                      Phần dữ liệu (thường là Base64 hoặc một đối tượng có cấu
                      trúc)
                    x-apifox-orders:
                      - created_at
                      - task_id
                      - task_status
                      - updated_at
                    x-apidog-orders:
                      - created_at
                      - task_id
                      - task_status
                      - updated_at
                  message:
                    type: string
                    description: Vui lòng cung cấp nội dung tài liệu cần dịch.
                    examples:
                      - thành công
                  request_id:
                    type: string
                    description: ID truy vết yêu cầu
                refName: KlingTaskSubmitResponse
                x-apifox-orders:
                  - code
                  - data
                  - message
                  - request_id
                x-apidog-orders:
                  - code
                  - data
                  - message
                  - request_id
              examples:
                example:
                  summary: example
                  value:
                    code: 0
                    data:
                      created_at: 0
                      task_id: chuỗi
                      task_status: đã gửi
                      updated_at: 0
                    message: thành công
                    request_id: chuỗi
          headers: {}
          x-apidog-name: Tác vụ đã được gửi thành công
        '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
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1218648/apis/api-45208982-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.openaihub.net
    description: Prod Env
security: []

```
