> ## Documentation Index
> Fetch the complete documentation index at: https://docs2.speech.palatine.ru/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat Completions

> Эндпоинт чат-комплишенов, совместимый с OpenAI.

**Аутентификация:** Bearer токен в заголовке Authorization.

**Тарификация:** Входные и выходные токены тарифицируются раздельно через
правила `input_llm_per_unit` и `output_llm_per_unit`.



## OpenAPI

````yaml post /api/llm/v1/chat/completions
openapi: 3.1.0
info:
  title: Palatine Cloud API
  description: >-
    Облачный API для транскрипции аудио, диаризации, анализа тональности и AI
    суммаризации
  version: 2.0.0
servers:
  - url: https://api.palatine.ru
    description: Продакшн сервер
security: []
paths:
  /api/llm/v1/chat/completions:
    post:
      tags:
        - OpenAI Chat Completions
      summary: Chat Completions
      description: >-
        Эндпоинт чат-комплишенов, совместимый с OpenAI.


        **Аутентификация:** Bearer токен в заголовке Authorization.


        **Тарификация:** Входные и выходные токены тарифицируются раздельно
        через

        правила `input_llm_per_unit` и `output_llm_per_unit`.
      operationId: chat_completions_api_llm_v1_chat_completions_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ChatCompletionRequest:
      properties:
        model:
          type: string
          title: Model
          description: Идентификатор используемой модели (например, 'palatine:m').
          examples:
            - palatine:m
        messages:
          items:
            $ref: '#/components/schemas/ChatMessage-Input'
          type: array
          minItems: 1
          title: Messages
          description: Список сообщений, составляющих историю диалога.
        temperature:
          anyOf:
            - type: number
              maximum: 2
              minimum: 0
            - type: 'null'
          title: Temperature
          description: >-
            Температура сэмплирования от 0 до 2. Более высокие значения делают
            вывод более случайным, более низкие — более детерминированным.
          default: 1
        max_tokens:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Max Tokens
          description: >-
            Максимальное количество токенов для генерации в ответе. Если не
            указано, модель будет генерировать до появления стоп-токена.
        thinking:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Thinking
          description: >-
            Включить расширенный режим размышления для сложных задач
            рассуждения. При включении модель тратит больше времени на
            обдумывание задачи.
          default: false
        format:
          anyOf:
            - type: object
            - type: 'null'
          title: Format
          description: >-
            Схема структурированного вывода (JSON Schema). Используйте для
            ограничения модели выводом валидного JSON, соответствующего схеме.
        response_format:
          anyOf:
            - type: object
            - type: 'null'
          title: Response Format
          description: >-
            OpenAI-совместимая спецификация формата ответа. Используйте {'type':
            'json_object'} для режима JSON или {'type': 'json_schema',
            'json_schema': {'name': '...', 'schema': {...}}} для
            структурированного вывода.
      type: object
      required:
        - model
        - messages
      title: ChatCompletionRequest
      description: >-
        Тело запроса для эндпоинта chat completion.


        Совместим с OpenAI Chat Completions API с дополнительными

        параметрами для расширенной функциональности (режим размышления,
        структурированный вывод).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ChatMessage-Input:
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
          title: Role
          description: >-
            Роль автора сообщения. 'system' для системных инструкций, 'user' для
            сообщений пользователя, 'assistant' для ответов модели.
        content:
          type: string
          title: Content
          description: Содержимое сообщения.
      type: object
      required:
        - role
        - content
      title: ChatMessage
      description: |-
        Одно сообщение в чате.

        Представляет один ход в диалоге, с ролью, указывающей
        кто отправил сообщение, и содержимым сообщения.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.