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

# Create chat completion

> Creates a model response for the given conversation. This is the OpenAI Chat Completions API.
Some models return chain-of-thought reasoning in the `reasoning` field of the response message. The `-instant` model variants do not produce reasoning on this endpoint.




## OpenAPI

````yaml /api-reference/corti-models/corti-models-openapi.yml post /chat/completions
openapi: 3.0.3
info:
  title: Corti S1 API
  description: >
    OpenAI-compatible API for Corti's LLM deployment. The API exposes two
    endpoints:

      * **`/v1/chat/completions`** - OpenAI Chat Completions API.
      * **`/v1/responses`** - OpenAI Responses API. Supports `instructions`
        as an alternative to system messages.

    Both endpoints support text generation, streaming (SSE), tool/function
    calling, and JSON mode.

    ## Available Models

    | Model | Description | |------|-------------| | `corti-s1` |
    Full-capability model | | `corti-s1-instant` | Fast variant of corti-s1 | |
    `corti-s1-mini` | Smaller model | | `corti-s1-mini-instant` | Fast variant
    of corti-s1-mini |

    `-instant` variants are optimized for speed and lower token usage.

    ## Key Characteristics

    * **No embeddings, vision, or file support**: Only text input/output. *
    **`reasoning` field**: Some models return chain-of-thought reasoning
      in a `reasoning` field (chat completions) or as structured output
      items with `type: "reasoning"` (responses API). The `-instant`
      variants do not produce reasoning on chat completions.
  version: 1.0.0
  contact:
    name: Corti AI
    url: https://corti.app
servers:
  - url: https://ai.eu.corti.app/v1
    description: Production (EU)
security:
  - bearerAuth: []
paths:
  /chat/completions:
    post:
      tags:
        - Chat
      summary: Create chat completion
      description: >
        Creates a model response for the given conversation. This is the OpenAI
        Chat Completions API.

        Some models return chain-of-thought reasoning in the `reasoning` field
        of the response message. The `-instant` model variants do not produce
        reasoning on this endpoint.
      operationId: createChatCompletion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              Basic:
                summary: Basic chat completion
                value:
                  model: corti-s1
                  messages:
                    - role: user
                      content: Count from 1 to 5
                  max_tokens: 500
              Streaming:
                summary: Streaming response
                value:
                  model: corti-s1
                  messages:
                    - role: user
                      content: Count from 1 to 5
                  max_tokens: 500
                  stream: true
              JSON Mode:
                summary: Structured JSON output
                value:
                  model: corti-s1
                  messages:
                    - role: user
                      content: >-
                        Return a JSON object with fields name and age for John
                        who is 30.
                  response_format:
                    type: json_object
                  max_tokens: 500
              Tool Calling:
                summary: Function/tool calling
                value:
                  model: corti-s1
                  messages:
                    - role: user
                      content: What is the weather in Copenhagen today?
                  tools:
                    - type: function
                      function:
                        name: get_weather
                        description: Get weather information for a city
                        parameters:
                          type: object
                          properties:
                            city:
                              type: string
                          required:
                            - city
                  tool_choice: auto
                  max_tokens: 500
              Multi-turn:
                summary: Multi-turn conversation
                value:
                  model: corti-s1
                  messages:
                    - role: user
                      content: Count from 1 to 5
                    - role: assistant
                      content: 1, 2, 3, 4, 5
                    - role: user
                      content: Now count from 10 to 15
                  max_tokens: 500
      responses:
        '200':
          description: >
            Successful response. For non-streaming requests, returns a complete
            chat completion. For streaming requests, returns Server-Sent Events
            (SSE) with incremental chunks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/ChatCompletionStreamResponse'
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          enum:
            - corti-s1
            - corti-s1-instant
            - corti-s1-mini
            - corti-s1-mini-instant
          default: corti-s1
        messages:
          type: array
          minItems: 1
          description: >
            Conversation messages. Supported roles: `user`, `assistant`, `tool`,
            and `system`.
          items:
            $ref: '#/components/schemas/Message'
        stream:
          type: boolean
          default: false
          description: >
            If true, returns SSE with `data: {chunk}` lines. Terminates with
            `data: [DONE]`.
        temperature:
          type: number
          format: float
          minimum: 0
          maximum: 1
          default: 1
        top_p:
          type: number
          format: float
          minimum: 0.01
          maximum: 1
          default: 0.95
        max_tokens:
          type: integer
          minimum: 1
          description: Maximum tokens to generate.
        tools:
          type: array
          description: Function tools the model may call. Max 128.
          items:
            $ref: '#/components/schemas/FunctionTool'
        tool_choice:
          type: string
          enum:
            - auto
          default: auto
        response_format:
          type: object
          properties:
            type:
              type: string
              enum:
                - json_object
          required:
            - type
        logprobs:
          type: boolean
          default: false
        top_logprobs:
          type: integer
          minimum: 0
          maximum: 20
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          enum:
            - chat.completion
        created:
          type: integer
        model:
          type: string
          description: The model name used for this response.
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              message:
                $ref: '#/components/schemas/ChatResponseMessage'
              logprobs:
                type: object
                nullable: true
              finish_reason:
                type: string
                enum:
                  - stop
                  - length
                  - tool_calls
              stop_reason:
                type: integer
                nullable: true
                description: Internal stop reason code from the inference engine.
              token_ids:
                type: array
                nullable: true
                items:
                  type: integer
              routed_experts:
                type: array
                nullable: true
                items: {}
                description: Only present on corti-s1 and corti-s1-instant.
        system_fingerprint:
          type: string
          nullable: true
        usage:
          type: object
          properties:
            prompt_tokens:
              type: integer
            completion_tokens:
              type: integer
            total_tokens:
              type: integer
            prompt_tokens_details:
              type: object
              nullable: true
        service_tier:
          type: string
          nullable: true
        prompt_logprobs:
          type: object
          nullable: true
        prompt_token_ids:
          type: array
          nullable: true
          items:
            type: integer
        prompt_text:
          type: string
          nullable: true
        kv_transfer_params:
          type: object
          nullable: true
    ChatCompletionStreamResponse:
      type: object
      description: 'SSE chunk. Stream terminates with `data: [DONE]`.'
      properties:
        id:
          type: string
        object:
          type: string
          enum:
            - chat.completion.chunk
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              delta:
                type: object
                properties:
                  role:
                    type: string
                  content:
                    type: string
                    nullable: true
                  reasoning:
                    type: string
                    nullable: true
              finish_reason:
                type: string
                nullable: true
                enum:
                  - stop
                  - length
                  - tool_calls
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message or object with message.
        detail:
          type: string
    Message:
      oneOf:
        - title: User Message
          type: object
          required:
            - role
            - content
          properties:
            role:
              type: string
              enum:
                - user
            content:
              type: string
        - title: System Message
          type: object
          required:
            - role
            - content
          properties:
            role:
              type: string
              enum:
                - system
            content:
              type: string
        - title: Assistant Message
          type: object
          required:
            - role
          properties:
            role:
              type: string
              enum:
                - assistant
            content:
              type: string
              nullable: true
            reasoning:
              type: string
              nullable: true
              description: >
                Chain-of-thought reasoning, if produced by the model. The
                `-instant` variants do not produce this field.
            tool_calls:
              type: array
              items:
                $ref: '#/components/schemas/ToolCall'
        - title: Tool Message
          type: object
          required:
            - role
            - content
            - tool_call_id
          properties:
            role:
              type: string
              enum:
                - tool
            content:
              type: string
            tool_call_id:
              type: string
    FunctionTool:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          enum:
            - function
        function:
          type: object
          required:
            - name
            - description
            - parameters
          properties:
            name:
              type: string
              pattern: ^[a-zA-Z0-9_-]+$
              maxLength: 64
            description:
              type: string
            parameters:
              type: object
    ChatResponseMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - assistant
        content:
          type: string
          nullable: true
        reasoning:
          type: string
          nullable: true
          description: >
            Chain-of-thought reasoning, if produced by the model. The `-instant`
            variants return `null` for this field.
        refusal:
          type: string
          nullable: true
        annotations:
          type: array
          nullable: true
          items: {}
        audio:
          type: object
          nullable: true
        function_call:
          type: object
          nullable: true
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/ToolCall'
    ToolCall:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - function
        function:
          type: object
          properties:
            name:
              type: string
            arguments:
              type: string
              description: JSON-encoded arguments.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Use a Corti-issued bearer token. The token is a Base64-encoded client
        credential string in the format
        `base:client_credentials:<client_id>:<client_secret>`.

````