# "/fal-ai/flux-pro/kontext/text-to-image"

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

> 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:
  /fal-ai/flux-pro/kontext/text-to-image:
    post:
      summary: /fal-ai/flux-pro/kontext/text-to-image
      deprecated: false
      description: >-
        Vui lòng dán nội dung tài liệu cần dịch vào đây. Tôi không thể truy cập
        trực tiếp nội dung từ URL đã cung cấp. Tôi sẽ giữ nguyên Markdown, mã
        nguồn, định danh, URL, đường dẫn, phần giữ chỗ, cấu trúc JSON và định
        dạng.
      operationId: fal_ai_fal_ai_flux_pro_kontext_text_to_image
      tags:
        - OpenAiHub Việt Nam/OpenAiHub Tiếng Việt/Hình ảnh/Fal.ai
        - Fal.ai
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - prompt
              properties:
                aspect_ratio:
                  type: string
                  description: >-
                    Tỷ lệ khung hình của hình ảnh được tạo. Giá trị mặc định:
                    "1:1". Hỗ trợ: 21:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16,
                    9:21
                guidance_scale:
                  type: number
                  description: >-
                    Thang CFG (Dẫn hướng không dùng bộ phân loại) là thước đo
                    mức độ bạn muốn mô hình bám sát các gợi ý khi tìm hình ảnh
                    liên quan. Giá trị mặc định: 3.5 Phạm vi giá trị: 1-20
                num_images:
                  type: integer
                  description: >-
                    Số lượng hình ảnh được tạo. Giá trị mặc định: 1 Giá trị
                    trong khoảng 1-4
                output_format:
                  type: string
                  description: >-
                    Định dạng của hình ảnh được tạo. Giá trị mặc định: "jpeg".
                    Hỗ trợ: default, png, jpeg
                prompt:
                  type: string
                  description: Mẹo tạo hình ảnh.
                safety_tolerance:
                  type: string
                  description: >-
                    Mức độ dung sai an toàn của hình ảnh được tạo. 1 là nghiêm
                    ngặt nhất và 5 là ít nghiêm ngặt nhất. Giá trị mặc định: "2"
              refName: PostFalAiFluxProKontextTextToImageRequest
              x-apifox-orders:
                - aspect_ratio
                - guidance_scale
                - num_images
                - output_format
                - prompt
                - safety_tolerance
              x-apidog-orders:
                - aspect_ratio
                - guidance_scale
                - num_images
                - output_format
                - prompt
                - safety_tolerance
            examples:
              fal_aiflux_prokontexttext_to_image_single:
                value:
                  aspect_ratio: '1:1'
                  guidance_scale: 3.5
                  num_images: 1
                  output_format: jpeg
                  prompt: >-
                    Cảnh cực cận của một mắt hổ duy nhất, nhìn thẳng từ chính
                    diện. Mống mắt và đồng tử chi tiết. Lấy nét sắc nét vào kết
                    cấu và màu sắc của mắt. Ánh sáng tự nhiên làm nổi bật độ
                    long lanh và chiều sâu chân thực của mắt. Từ "FLUX" được vẽ
                    đè lên trên bằng những nét cọ lớn màu trắng, với kết cấu
                    hiện rõ.
                  safety_tolerance: '2'
                summary: fal_aiflux_prokontexttext_to_image_single
                description: /fal-ai/flux-pro/kontext/text-to-image
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                x-apidog-orders: []
              examples:
                example:
                  summary: example
                  value:
                    cancel_url: >-
                      https://queue.fal.run/fal-ai/flux-pro/requests/acf05732-7cb3-445b-9f39-fdaeccb1d730/cancel
                    logs: []
                    metrics: {}
                    queue_position: 0
                    request_id: acf05732-7cb3-445b-9f39-fdaeccb1d730
                    response_url: >-
                      https://queue.fal.run/fal-ai/flux-pro/requests/acf05732-7cb3-445b-9f39-fdaeccb1d730
                    status: IN_QUEUE
                    status_url: >-
                      https://queue.fal.run/fal-ai/flux-pro/requests/acf05732-7cb3-445b-9f39-fdaeccb1d730/status
          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/Hình ảnh/Fal.ai
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1218648/apis/api-45208905-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.openaihub.net
    description: Prod Env
security: []

```
