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

# Ответы OpenAI

> Создаёт ответ модели из текста, изображения или файла. Поддерживает структурированный вывод, вызовы инструментов, состояние диалога, фоновую обработку и потоковую передачу.

<Note>
  Параметры запроса и поля ответа соответствуют формату официального Responses API. Полную спецификацию см. в
  <a href="https://developers.openai.com/api/reference/resources/responses/methods/create" target="_blank">официальной документации OpenAI</a>.
</Note>

Эндпоинт поддерживает текст, изображения и файлы, структурированный вывод,
вызовы инструментов, многошаговые диалоги, фоновую обработку и потоковые ответы.


## OpenAPI

````yaml openapi/ru/llm.json POST /v1/responses
openapi: 3.1.0
info:
  title: Документация API языковых моделей
  version: 1.0.0
  description: TTAPI LLM API сервис.
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /v1/responses:
    post:
      summary: Создать ответ модели
      description: >-
        Создаёт ответ модели из текста, изображения или файла. Поддерживает
        структурированный вывод, вызовы инструментов, состояние диалога, фоновую
        обработку и потоковую передачу.
      operationId: createResponse
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesRequest'
      responses:
        '200':
          description: >-
            Успешный ответ. При stream=true возвращается поток Server-Sent
            Events.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseObject'
            text/event-stream:
              schema:
                type: string
                description: Поток событий Responses API в формате Server-Sent Events.
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - Authorization: []
components:
  schemas:
    ResponsesRequest:
      type: object
      description: Тело запроса для OpenAI-совместимого Responses API.
      properties:
        model:
          type: string
          example: gpt-5.4-mini
          description: >-
            Идентификатор модели для генерации ответа. См. [Поддерживаемые
            модели](/grids/ru/start/pricing/llm).
        input:
          description: >-
            Текст, изображение или файл для модели. Строка интерпретируется как
            сообщение пользователя.
          oneOf:
            - type: string
              example: Объясни квантовые вычисления простыми словами.
            - type: array
              items:
                $ref: '#/components/schemas/ResponseInputItem'
        instructions:
          type: string
          description: >-
            Инструкция system или developer, добавляемая в контекст модели. При
            использовании previous_response_id инструкция прошлого ответа не
            наследуется.
        previous_response_id:
          type: string
          description: >-
            Идентификатор предыдущего ответа для многошагового диалога. Нельзя
            использовать вместе с conversation.
        conversation:
          description: Диалог, к которому относится этот ответ.
          oneOf:
            - type: string
            - type: object
              properties:
                id:
                  type: string
              required:
                - id
        background:
          type: boolean
          default: false
          description: Запускать ли генерацию ответа в фоновом режиме.
        include:
          type: array
          description: Дополнительные данные, которые нужно включить в ответ.
          items:
            type: string
            enum:
              - file_search_call.results
              - web_search_call.results
              - web_search_call.action.sources
              - message.input_image.image_url
              - computer_call_output.output.image_url
              - code_interpreter_call.outputs
              - reasoning.encrypted_content
              - message.output_text.logprobs
        max_output_tokens:
          type: integer
          minimum: 1
          description: >-
            Максимальное число сгенерированных токенов, включая видимый вывод и
            токены рассуждений.
        max_tool_calls:
          type: integer
          minimum: 1
          description: >-
            Максимальное общее число вызовов встроенных инструментов в этом
            ответе.
        metadata:
          type: object
          maxProperties: 16
          additionalProperties:
            type: string
            maxLength: 512
          description: До 16 строковых пар ключ-значение, прикреплённых к ответу.
        parallel_tool_calls:
          type: boolean
          default: true
          description: Разрешены ли параллельные вызовы инструментов.
        prompt:
          type: object
          description: Ссылка на многократно используемый шаблон промпта.
          properties:
            id:
              type: string
            version:
              type: string
            variables:
              type: object
              additionalProperties: true
          required:
            - id
        prompt_cache_key:
          type: string
          description: Стабильный ключ для повышения вероятности попадания в кэш промпта.
        prompt_cache_retention:
          type: string
          enum:
            - in-memory
            - 24h
          description: Политика хранения кэша промпта.
        reasoning:
          type: object
          description: Параметры рассуждений для поддерживаемых моделей.
          properties:
            effort:
              type: string
              enum:
                - none
                - minimal
                - low
                - medium
                - high
                - xhigh
            summary:
              type: string
              enum:
                - auto
                - concise
                - detailed
        safety_identifier:
          type: string
          description: >-
            Стабильный идентификатор конечного пользователя для обнаружения
            злоупотреблений.
        service_tier:
          type: string
          enum:
            - auto
            - default
            - flex
            - scale
            - priority
        store:
          type: boolean
          description: >-
            Сохранять ли сгенерированный ответ для последующего получения через
            API.
        stream:
          type: boolean
          default: false
          description: Передавать ли события ответа потоково через Server-Sent Events.
        stream_options:
          type: object
          description: Параметры потоковой передачи. Указывайте только при stream=true.
          properties:
            include_obfuscation:
              type: boolean
              default: true
        temperature:
          type: number
          minimum: 0
          maximum: 2
          description: >-
            Температура сэмплирования. Обычно изменяют temperature или top_p, но
            не оба параметра одновременно.
        text:
          $ref: '#/components/schemas/ResponseTextConfig'
        tool_choice:
          description: Управляет выбором инструментов моделью.
          oneOf:
            - type: string
              enum:
                - none
                - auto
                - required
            - type: object
              additionalProperties: true
        tools:
          type: array
          description: Функции и поддерживаемые встроенные инструменты, доступные модели.
          items:
            type: object
            additionalProperties: true
        top_logprobs:
          type: integer
          minimum: 0
          maximum: 20
        top_p:
          type: number
          minimum: 0
          maximum: 1
        truncation:
          type: string
          enum:
            - auto
            - disabled
          default: disabled
    ResponseObject:
      type: object
      properties:
        id:
          type: string
          example: resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b
        object:
          type: string
          const: response
        created_at:
          type: number
          example: 1741476542
        status:
          type: string
          enum:
            - completed
            - failed
            - in_progress
            - cancelled
            - queued
            - incomplete
        error:
          oneOf:
            - type: object
              properties:
                code:
                  type: string
                message:
                  type: string
            - type: 'null'
        incomplete_details:
          oneOf:
            - type: object
              properties:
                reason:
                  type: string
                  enum:
                    - max_output_tokens
                    - content_filter
            - type: 'null'
        model:
          type: string
        output:
          type: array
          items:
            $ref: '#/components/schemas/ResponseOutputItem'
        output_text:
          type: string
          readOnly: true
          description: Вспомогательное поле SDK с объединённым текстовым выводом.
        previous_response_id:
          type:
            - string
            - 'null'
        store:
          type: boolean
        usage:
          $ref: '#/components/schemas/ResponseUsage'
        metadata:
          type: object
          additionalProperties:
            type: string
      required:
        - id
        - object
        - created_at
        - status
        - model
        - output
    ResponseInputItem:
      type: object
      description: Входное сообщение, результат инструмента или ссылка на элемент.
      properties:
        type:
          type: string
        role:
          type: string
          enum:
            - user
            - assistant
            - system
            - developer
        content:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ResponseInputContent'
        id:
          type: string
        call_id:
          type: string
        output:
          description: Результат, возвращённый вызовом инструмента.
      additionalProperties: true
    ResponseTextConfig:
      type: object
      properties:
        format:
          type: object
          description: 'Формат вывода: обычный текст, JSON-объект или JSON Schema.'
          additionalProperties: true
        verbosity:
          type: string
          enum:
            - low
            - medium
            - high
    ResponseOutputItem:
      type: object
      description: >-
        Сообщение, элемент рассуждений, вызов инструмента или другой элемент
        вывода.
      properties:
        type:
          type: string
        id:
          type: string
        status:
          type: string
        role:
          type: string
          enum:
            - assistant
        content:
          type: array
          items:
            $ref: '#/components/schemas/ResponseOutputContent'
        call_id:
          type: string
        name:
          type: string
        arguments:
          type: string
      additionalProperties: true
    ResponseUsage:
      type: object
      properties:
        input_tokens:
          type: integer
        input_tokens_details:
          type: object
          properties:
            cached_tokens:
              type: integer
        output_tokens:
          type: integer
        output_tokens_details:
          type: object
          properties:
            reasoning_tokens:
              type: integer
        total_tokens:
          type: integer
    ResponseInputContent:
      type: object
      properties:
        type:
          type: string
          enum:
            - input_text
            - input_image
            - input_file
        text:
          type: string
        image_url:
          type: string
        file_id:
          type: string
        file_url:
          type: string
        file_data:
          type: string
        filename:
          type: string
        detail:
          type: string
          enum:
            - low
            - high
            - auto
      required:
        - type
    ResponseOutputContent:
      type: object
      properties:
        type:
          type: string
          enum:
            - output_text
            - refusal
        text:
          type: string
        refusal:
          type: string
        annotations:
          type: array
          items:
            type: object
            additionalProperties: true
        logprobs:
          type: array
          items:
            type: object
            additionalProperties: true
      required:
        - type
  responses:
    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:
    Authorization:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Вы можете получить API-ключ в <a href='https://dashboard.ttapi.io'
        target='_blank'>панель управления TTAPI</a>.

````