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

# Генерация изображения

> Генерируйте качественные изображения с помощью Nano Banana API. Включает параметры запроса, форматы ответа и примеры использования.

<Note>
  Поскольку генерация изображений Nano Banana является синхронным ответом и занимает сравнительно много времени, рекомендуется использовать шлюз **[https://api.ttapi.org](https://api.ttapi.org)**.
</Note>

## Доступные модели

| Модели                           | Псевдоним            |
| :------------------------------- | :------------------- |
| `gemini-2.5-flash-image`         | `Nano Banana`        |
| `gemini-2.5-flash-image-preview` | `Nano Banana`        |
| `gemini-3-pro-image-preview`     | `Nano Banana Pro`    |
| `gemini-3.1-flash-image-preview` | `Nano Banana 2`      |
| `gemini-3.1-flash-lite-image`    | `Nano Banana 2 Lite` |


## OpenAPI

````yaml openapi/ru/gemini.json POST /gemini/image/generate
openapi: 3.1.0
info:
  title: Документация Gemini API
  version: 1.0.0
  description: >-
    Сервис TTAPI Gemini API: генерация изображений Nano Banana и генерация видео
    Gemini.
servers:
  - url: https://api.ttapi.org
security: []
paths:
  /gemini/image/generate:
    post:
      description: >-
        Генерация или изменение изображений по текстовым и визуальным промптам.
        Примечание: это формат диалогового взаимодействия, а не официальный
        исходный формат.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateRequest'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse1'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    GenerateRequest:
      type: object
      properties:
        prompt:
          type: string
          description: Описание изображения для генерации или изменения
        model:
          type: string
          description: Версия модели
          default: gemini-3-pro-image-preview
          enum:
            - gemini-2.5-flash-image-preview
            - gemini-2.5-flash-image
            - gemini-3-pro-image-preview
            - gemini-3.1-flash-image-preview
            - gemini-3.1-flash-lite-image
        refer_images:
          type: array
          description: Список эталонных изображений
          items:
            type: string
          example:
            - https://cdn.ttapi.io/xxx1.png
            - https://cdn.ttapi.io/xxx2.png
        aspect_ratio:
          type: string
          default: '1:1'
          enum:
            - '1:1'
            - '2:3'
            - '3:2'
            - '3:4'
            - '4:3'
            - '4:5'
            - '5:4'
            - '9:16'
            - '16:9'
            - '21:9'
            - '1:4'
            - '4:1'
            - '1:8'
            - '8:1'
          description: >-
            Соотношение сторон изображения, поддерживается только в gemini-3 и
            выше
        image_size:
          type: string
          default: 1K
          enum:
            - 1K
            - 2K
            - 4K
          description: 'Разрешение изображения. **Примечание: используйте заглавную ''K''**'
        google_search:
          type: boolean
          description: Включить веб-поиск Google
          default: 'false'
        image_search:
          type: boolean
          description: Включить поиск изображений Google
          default: 'false'
        thinking_level:
          type: string
          description: Уровень размышления
          enum:
            - Минимальный
            - Высокий
      required:
        - prompt
        - model
  responses:
    SuccessResponse1:
      description: Запрос выполнен успешно
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: success
              data:
                type: object
                description: Результат задачи
                properties:
                  prompt:
                    type: string
                    description: Промпт
                  refer_images:
                    type: array
                    description: >-
                      Список референс-изображений. Срок действия: см. [Хранение
                      и устойчивость](/grids/ru/faq/storage)
                  image_url:
                    type: string
                    description: >-
                      URL изображения. Срок действия: см. [Хранение и
                      устойчивость](/grids/ru/faq/storage)
                  quota:
                    type: string
                    description: Израсходованная quota
            example:
              status: SUCCESS
              message: success
              data:
                prompt: a cute cat
                refer_images: null
                image_url: >-
                  https://cdn.ttapi.io/other/2025-09-10/8b46aa28-4433-455f-bf5c-f5ccea48baf2.png
                quota: 2
            required:
              - status
              - message
              - data
    400Response:
      description: Ошибка параметров
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: '"prompt" cannot be empty.'
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: Ошибка авторизации
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: Wrong TT-API-KEY or email is not activated.
            required:
              - status
              - message
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        Вы можете получить API-ключ в <a href='https://dashboard.ttapi.io'
        target='_blank'>панель управления TTAPI</a>.

````