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

# Сообщения Claude

<Note>
  Параметры запроса и ответа остаются совместимыми с официальным API.
  Подробнее см. в <a href="https://platform.claude.com/docs/en/api/messages" target="_blank">официальной документации Claude</a>.
</Note>


## OpenAPI

````yaml openapi/ru/llm.json POST /v1/messages
openapi: 3.1.0
info:
  title: Документация API языковых моделей
  version: 1.0.0
  description: TTAPI LLM API сервис.
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /v1/messages:
    post:
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClaudeMessagesRequest'
      responses:
        '200':
          description: Успешный ответ
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Уникальный идентификатор сообщения
                    example: msg_018zZJf8ZJf8ZJf8ZJf8ZJf8ZJf8
                  type:
                    type: string
                    description: Тип ответа
                    example: message
                  role:
                    type: string
                    description: Идентификатор роли
                    example: assistant
                  content:
                    type: array
                    description: Список содержимого сообщения
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          example: text
                        text:
                          type: string
                          description: Текстовое содержимое ответа
                          example: ' Hello! My name is Claude.'
                      required:
                        - type
                        - text
                  model:
                    type: string
                    description: Использованная версия модели
                    example: claude-2.0
                  stop_reason:
                    type:
                      - string
                      - 'null'
                    description: Причина остановки
                    example: stop_sequence
                  usage:
                    type: object
                    description: Статистика использования токенов
                    properties:
                      input_tokens:
                        type: integer
                        example: 15
                      output_tokens:
                        type: integer
                        example: 22
                    required:
                      - input_tokens
                      - output_tokens
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - x-api-key: []
components:
  schemas:
    ClaudeMessagesRequest:
      type: object
      properties:
        messages:
          type: array
          items:
            type: object
            properties:
              role:
                type: string
              content:
                type: string
          example:
            - role: user
              content: Hello!
        model:
          type: string
          example: claude-sonnet-4-5
          description: >-
            Модели, поддерживаемые TTAPI, см. [Поддерживаемые модели
            Claude](/grids/ru/start/pricing/llm)
        max_tokens:
          type: number
          default: 1024
          description: 'Максимальное число токенов до остановки генерации. Минимум: 1'
        stream:
          type: boolean
          default: 'false'
          description: >-
            Использовать ли события отправляемые сервером для передачи
            прогрессивного ответа
      required:
        - messages
        - model
        - max_tokens
  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:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Вы можете получить API-ключ в <a href='https://dashboard.ttapi.io'
        target='_blank'>панель управления TTAPI</a>.

````