> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aiid.edu.kg/llms.txt
> Use this file to discover all available pages before exploring further.

# Hình ảnh Gemini (Nano Banana)

> Tạo hình ảnh với Gemini.

Chuỗi Nano Banana hỗ trợ định dạng Dall-E của OpenAI (xem chi tiết tại liên kết [Định dạng DALL-E cho tạo ảnh OpenAI](#tag/%E5%9B%BE%E7%89%87%E7%94%9F%E6%88%90OpenAI%20DALL-E%E6%A0%BC%E5%BC%8F)).

Giao diện tương thích tạo ảnh Gemini. Đặt đầu vào văn bản hoặc hình ảnh trong `contents[].parts`, `generationConfig.responseModalities` thường truyền `IMAGE`, kích thước ảnh được kiểm soát qua `generationConfig.imageConfig.imageSize`.



## OpenAPI

````yaml api-reference/vi/openapi.json POST /v1beta/models/{model}:generateContent
openapi: 3.0.0
info:
  title: Tài liệu tham khảo API của 出海营
  version: 1.0.0
  description: Public AI Gateway API Reference
servers:
  - url: https://api.aiid.edu.kg
security:
  - BearerAuth: []
tags:
  - name: Định dạng OpenAI (Chat)
  - name: Định dạng OpenAI (Responses)
  - name: Định dạng Gemini cho tạo ảnh
  - name: Tạo hình ảnhOpenAI định dạng DALL-E
  - name: Lấy danh sách mô hình
  - name: Tạo video HappyHorse và Wan
  - name: Định dạngKling tạo video
  - name: Định dạng Video Generation Omni và Veo
  - name: Tạo video Seedance
  - name: Định dạng tương thích Sora cho tạo video
  - name: Tạo video Vidu
  - name: Định dạng tác vụ tạo nhạc
paths:
  /v1beta/models/{model}:generateContent:
    post:
      tags:
        - Định dạng Gemini cho tạo ảnh
      summary: Hình ảnh Gemini (Nano Banana)
      description: >-
        Tạo hình ảnh với Gemini.


        Chuỗi Nano Banana hỗ trợ định dạng Dall-E của OpenAI (xem chi tiết tại
        liên kết [Định dạng DALL-E cho tạo ảnh
        OpenAI](#tag/%E5%9B%BE%E7%89%87%E7%94%9F%E6%88%90OpenAI%20DALL-E%E6%A0%BC%E5%BC%8F)).


        Giao diện tương thích tạo ảnh Gemini. Đặt đầu vào văn bản hoặc hình ảnh
        trong `contents[].parts`, `generationConfig.responseModalities` thường
        truyền `IMAGE`, kích thước ảnh được kiểm soát qua
        `generationConfig.imageConfig.imageSize`.
      operationId: geminiRelayV1Beta
      parameters:
        - name: model
          in: path
          description: Tên mô hình
          required: true
          example: gemini-3-pro-image-preview
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                contents:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        description: >-
                          Vai trò của tin nhắn, các giá trị phổ biến là `user`
                          hoặc `model`.
                      parts:
                        type: array
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                              description: Nội dung đầu vào văn bản.
                            inlineData:
                              type: object
                              description: >-
                                Đối tượng nội dung nhị phân nội tuyến, phù hợp
                                cho đầu vào như hình ảnh base64.
                              properties:
                                mimeType:
                                  type: string
                                  description: >-
                                    Loại MIME của nội dung nội tuyến, ví dụ:
                                    `image/png`.
                                data:
                                  type: string
                                  description: >-
                                    Nội dung dữ liệu nhị phân sau khi được mã
                                    hóa Base64.
                        description: >-
                          Mảng các đoạn thông điệp; mọi đầu vào như văn bản,
                          hình ảnh, v.v. đều được đặt ở đây.
                  description: >-
                    Bắt buộc. Mảng nội dung đầu vào của Gemini, thường chứa ít
                    nhất một thông điệp user.
                generationConfig:
                  type: object
                  properties:
                    responseModalities:
                      type: array
                      items:
                        type: string
                      description: >-
                        Danh sách các chế độ phản hồi; tạo ảnh thường truyền
                        `IMAGE`.
                    imageConfig:
                      type: object
                      properties:
                        aspectRatio:
                          type: string
                          description: 'Tỷ lệ khung hình, ví dụ: `16:9`, `1:1`, `9:16`.'
                        imageSize:
                          type: string
                          description: 'Mức độ phân giải đầu ra, ví dụ: `1K`, `2K`, `4K`.'
                      description: Đối tượng cấu hình tạo ảnh.
                  required:
                    - responseModalities
                  description: Tạo đối tượng cấu hình.
              required:
                - contents
                - generationConfig
            example:
              contents:
                - role: user
                  parts:
                    - text: draw a cat
              generationConfig:
                responseModalities:
                  - TEXT
                  - IMAGE
                imageConfig:
                  aspectRatio: '16:9'
                  imageSize: 4K
      responses:
        '200':
          description: Thành công
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeminiResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    GeminiResponse:
      type: object
      properties:
        candidates:
          type: array
          items:
            type: object
            properties:
              content:
                type: object
                properties:
                  role:
                    type: string
                  parts:
                    type: array
                    items:
                      type: object
                      properties: {}
              finishReason:
                type: string
              safetyRatings:
                type: array
                items:
                  type: object
                  properties: {}
        usageMetadata:
          type: object
          properties:
            promptTokenCount:
              type: integer
            candidatesTokenCount:
              type: integer
            totalTokenCount:
              type: integer
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |-
        Sử dụng xác thực Bearer Token.
        Định dạng: `Authorization: Bearer sk-xxxxxx`

````