> ## 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.

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

> Используйте API генерации изображений Flux для создания качественных изображений по текстовым промптам в креативных, продуктовых и автоматизированных визуальных сценариях.



## OpenAPI

````yaml openapi/ru/flux.json POST /flux/generate
openapi: 3.1.0
info:
  title: Документация Flux API
  version: 1.0.0
  description: >-
    Сервис TTAPI Flux API, в настоящее время интегрирующий самую совершенную
    большую видеомодель Sora2.
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /flux/generate:
    post:
      description: >-
        Генерация изображений моделью Flux.1 по текстовым промптам. Примечание:
        В отличие от Midjourney, этот интерфейс может генерировать только одно
        изображение за раз
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateRequest'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    GenerateRequest:
      type: object
      description: >-
        **Примечание**. Синхронный ответ интерфейса создания изображений Flux не
        является конечным результатом задачи. Окончательный результат необходимо
        получить через асинхронное уведомление с использованием параметра
        `hookUrl` или путем запроса через интерфейс <a href="fetch"
        target="_self">результат задачи Flux</a>.
      properties:
        prompt:
          type: string
          description: >-
            Описание изображения. Примечание. Flux поддерживает многоязычное
            понимание, но при тестировании лучше всего подходит английский.
        mode:
          type: string
          example: flux1-dev
          description: Версия модели
          enum:
            - flux1-dev
            - flux1-pro
            - flux-kontext-pro
            - flux-kontext-max
            - flux-2-pro
            - flux-2-flex
            - flux-2-max
            - flux-2-klein-4b
            - flux-2-klein-9b
        size:
          type: string
          example: 1024x1024
          description: Размер изображения
          enum:
            - 1024x1024
            - 1024x1792
            - 1792x1024
        aspect_ratio:
          type: string
          example: '1:1'
          description: Соотношение сторон
          enum:
            - '21:9'
            - '16:9'
            - '4:3'
            - '3:2'
            - '1:1'
            - '2:3'
            - '3:4'
            - '9:16'
            - '9:21'
        hookUrl:
          type: string
          description: URL обратного уведомления
      required:
        - prompt
        - mode
  responses:
    SuccessResponse:
      description: Запрос выполнен успешно
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: success
              data:
                type: object
                example:
                  jobId: jobId
            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>.

````