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

# [Deprecated] Chat completions for OpenAI SDK/client usage

> **Deprecated: Use the Responses API (`/api/v1/llm/responses`) instead.** OpenAI-compatible chat completion endpoint designed for use with the official OpenAI client libraries (Python, Node.js, etc.). Supports both streaming and non-streaming requests by setting the `stream` parameter. This endpoint handles the request/response directly and returns standard OpenAI-formatted responses. Use this when integrating with existing OpenAI client code. Note: The actual handler is registered at the Bun server level for optimal performance with the OpenAI SDK streaming format.



## OpenAPI

````yaml https://apigw.mka1.com/speakeasy.json post /api/v1/llm/chat/completions
openapi: 3.1.1
info:
  title: MKA1 API
  version: 1.1.0
  description: >-
    The MKA1 API is a RESTful API that provides access to the MKA1 platform.
    Learn how to get started with the API and the TypeScript SDK
    [here](https://mka1.apidocumentation.com/guides/getting-started).
  license:
    name: Proprietary
servers:
  - url: https://apigw.mka1.com
    description: MKA1 API Gateway
  - url: /
    description: Relative server URL (configurable via SDK constructor)
security: []
tags:
  - name: Resource Authorization
    description: >-
      Manage permissions for LLM resources. Create resources, grant/revoke
      permissions, and delete resources. Only resource owners can grant, revoke,
      or delete permissions.
    x-displayName: Resource Authorization
  - name: Embeddings
    description: >-
      Text embedding API endpoints for generating vector representations of
      text. Create semantic embeddings for search, clustering, and similarity
      matching using various embedding models.
    x-displayName: Embeddings
  - name: Feedback
    description: >-
      User feedback API for rating and commenting on chat completions. Collect
      thumbs up/down ratings and detailed feedback to improve model responses
      and track user satisfaction.
    x-displayName: Feedback
  - name: Images
    description: >-
      Image generation API endpoints for creating images from text descriptions.
      Generate images with control over size, quality, and style.
    x-displayName: Images
  - name: MCP Vault
    description: >-
      MCP vault API for storing user-owned MCP server configurations and
      encrypted credentials. Agents reference vault IDs so secrets are resolved
      only at tool execution time.
    x-displayName: MCP Vault
  - name: Speech
    description: >-
      Speech API endpoints for audio processing. Convert text to
      natural-sounding speech (TTS) or transcribe speech to text (STT) in
      different languages.
    x-displayName: Speech
  - name: Usage
    description: >-
      Usage tracking and analytics API for monitoring token consumption, request
      counts, and cost analysis. View detailed statistics per user, model, and
      time period.
    x-displayName: Usage
  - name: Extract
    description: >-
      Structured data extraction API for extracting information from files.
      Define JSON schemas to extract structured data from images, PDFs, and
      documents. Supports reusable schema templates.
    x-displayName: Extract
  - name: Text Classification
    description: >-
      Text classification API for categorizing text into predefined labels. Use
      AI models to classify text content for sentiment analysis, topic
      categorization, and content moderation.
    x-displayName: Text Classification
  - name: Responses
    description: >-
      Agent-powered responses API for creating AI agents with autonomous tool
      usage. Build conversational assistants that can use web search, file
      operations, image generation, code execution, computer use simulation, and
      MCP integrations. Supports background processing, streaming, and real-time
      status tracking.
    x-displayName: Responses
  - name: Files
    description: >-
      File management API for uploading, storing, and managing files with
      automatic expiration and S3 integration. Upload files that can be used
      with Assistants, Vector Stores, and other features. Files are stored in S3
      with metadata tracked in PostgreSQL. Supports automatic cleanup of expired
      files.
    x-displayName: Files
  - name: Vector Stores
    description: >-
      Vector store API for storing and searching documents using embeddings.
      Create vector stores, upload files with automatic chunking and embedding
      generation, and perform semantic search. Files are processed
      asynchronously using Temporal workflows for durability. Supports automatic
      cleanup of expired stores and LanceDB for efficient vector storage.
    x-displayName: Vector Stores
  - name: Conversations
    description: >-
      Conversation management API for storing and retrieving conversation state
      across Response API calls. Create conversations, add items (user messages,
      assistant messages, system messages), and maintain conversation history.
      Supports metadata tracking and multi-turn dialogue state management.
    x-displayName: Conversations
  - name: Guardrails
    description: >-
      AI safety guardrails API for configuring content moderation and security
      policies. Set up ban word lists, prompt injection detection, and system
      prompt leakage prevention. Guardrails apply to all requests from an
      account and can be tested before deployment.
    x-displayName: Guardrails
  - name: Models
    description: >-
      Model listing API for discovering available models. Returns model IDs,
      ownership, and metadata for all registered models in the gateway.
    x-displayName: Models
  - name: Skills
    description: >-
      Skills API for managing versioned bundles of instructions and files
      following the Agent Skills standard. Create, version, and download
      reusable skill packages that include SKILL.md manifests for agent
      environments.
    x-displayName: Skills
  - name: Chat Completions
    description: >-
      **Deprecated: Use the Responses API (`/api/v1/llm/responses`) instead.**
      Chat completion endpoints with support for streaming, tool calls, and
      multiple providers.
    x-deprecated: true
    x-displayName: Chat Completions
  - name: Batches
    x-displayName: Batches
  - name: Evals
    x-displayName: Evals
  - name: Fine-Tuning
    x-displayName: Fine-Tuning
  - name: Memory Stores
    x-displayName: Memory Stores
  - name: Prompts
    x-displayName: Prompts
  - name: API Key
    x-displayName: API Key
  - name: Organization
    x-displayName: Organization
  - name: Cluster Admin
    x-displayName: Cluster Admin
  - name: Sessions
    description: Create, inspect, access, and terminate sandbox sessions.
    x-displayName: Sessions
  - name: Browser
    description: >-
      Connect to browser sessions through the gateway port proxy. Browser
      sessions expose a Chrome DevTools Protocol endpoint on port 9222.
    x-displayName: Browser
  - name: Execution
    description: Run shell commands and code inside an existing sandbox session.
    x-displayName: Execution
  - name: Workspace
    description: >-
      Inspect the workspace manifest, transfer files or archives, and download
      generated artifacts.
    x-displayName: Workspace
  - name: Sandbox Usage
    description: >-
      Aggregate sandbox usage statistics across sessions, execution, and
      workspace operations.
    x-displayName: Sandbox Usage
  - name: Sandbox Pricing
    description: >-
      Cluster-admin management of the sandbox compute rate card used for
      budgeted spend.
    x-displayName: Sandbox Pricing
  - name: Agents
    description: Create and manage reusable agent definitions.
    x-displayName: Agents
  - name: Agent Versions
    description: Inspect an agent's configuration history and roll back to a prior version.
    x-displayName: Agent Versions
  - name: Agent Runs
    description: Execute saved agents and inspect persisted run results.
    x-displayName: Agent Runs
  - name: Agent Connectors
    description: >-
      Connect saved agents to external messaging channels such as Telegram,
      including text, photo, and supported document exchange.
    x-displayName: Agent Connectors
  - name: Agent Schedules
    description: Create and manage scheduled or recurring saved agent runs.
    x-displayName: Agent Schedules
  - name: schema-4_other
    x-displayName: other
  - name: Budgets
    x-displayName: Budgets
  - name: Settings
    x-displayName: Settings
  - name: Compute Jobs
    x-displayName: Compute Jobs
  - name: Compute Services
    x-displayName: Compute Services
  - name: Compute Catalog
    x-displayName: Compute Catalog
  - name: Compute Secrets
    x-displayName: Compute Secrets
  - name: Compute Usage
    x-displayName: Compute Usage
  - name: Compute Tenants
    x-displayName: Compute Tenants
  - description: Create, list, read, update, and delete repositories.
    name: Repositories
    x-displayName: Repositories
paths:
  /api/v1/llm/chat/completions:
    post:
      tags:
        - Chat Completions
      summary: '[Deprecated] Chat completions for OpenAI SDK/client usage'
      description: >-
        **Deprecated: Use the Responses API (`/api/v1/llm/responses`) instead.**
        OpenAI-compatible chat completion endpoint designed for use with the
        official OpenAI client libraries (Python, Node.js, etc.). Supports both
        streaming and non-streaming requests by setting the `stream` parameter.
        This endpoint handles the request/response directly and returns standard
        OpenAI-formatted responses. Use this when integrating with existing
        OpenAI client code. Note: The actual handler is registered at the Bun
        server level for optimal performance with the OpenAI SDK streaming
        format.
      operationId: createChatCompletion
      parameters:
        - name: X-On-Behalf-Of
          in: header
          required: false
          schema:
            type: string
          description: Optional external end-user identifier forwarded by the API gateway.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenAIChatCompletionRequestParams'
            example:
              model: meetkai:functionary-urdu-mini-pak
              messages:
                - role: user
                  content: What is the capital of France?
              temperature: 0.7
              max_tokens: 100
      responses:
        '200':
          description: >-
            Successful chat completion response. Returns JSON for non-streaming
            (stream=false) or Server-Sent Events for streaming (stream=true).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIChatCompletion'
              example:
                id: chatcmpl-abc123
                object: chat.completion
                created: 1704067200
                model: meetkai:functionary-urdu-mini-pak
                choices:
                  - index: 0
                    message:
                      role: assistant
                      content: The capital of France is Paris.
                    finish_reason: stop
                usage:
                  prompt_tokens: 15
                  completion_tokens: 8
                  total_tokens: 23
            text/event-stream:
              schema:
                type: string
              example: |+
                data: {"id":"chatcmpl-abc123"}

      deprecated: true
      security:
        - bearerAuth: []
components:
  schemas:
    OpenAIChatCompletionRequestParams:
      type: object
      properties:
        model:
          type: string
          minLength: 1
          description: >-
            ID of the model to use. You can use provider:model format or just
            the model name with a default provider.
        messages:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/OpenAIRequestMessage'
          description: >-
            A list of messages comprising the conversation so far. At least one
            message is required.
        tools:
          type: array
          items:
            $ref: '#/components/schemas/OpenAIToolDefinition'
          description: >-
            A list of tools the model may call. Use this to provide function
            definitions the model can invoke.
        tool_choice:
          anyOf:
            - const: none
              description: The model will not call any tool and instead generates a message
            - const: auto
              description: >-
                The model can pick between generating a message or calling one
                or more tools
            - const: required
              description: The model must call one or more tools
            - type: object
              properties:
                type:
                  const: function
                  description: >-
                    The type of the tool. Currently only 'function' is
                    supported.
                function:
                  type: object
                  properties:
                    name:
                      type: string
                      minLength: 1
                      description: The name of the function to call
                  required:
                    - name
                  description: The function to call
              required:
                - type
                - function
              description: Forces the model to call a specific function
          description: >-
            Controls which (if any) tool is called by the model. 'none' means
            the model will not call any tool. 'auto' means the model can pick.
            'required' forces a tool call.
        stream:
          type: boolean
          description: >-
            If set, partial message deltas will be sent as server-sent events.
            Note: This field is ignored by the streaming endpoint, used only by
            OpenAI-compatible client endpoints.
        'n':
          type: integer
          minimum: 1
          maximum: 9007199254740991
          description: >-
            How many chat completion choices to generate for each input message.
            Default is 1.
        max_tokens:
          type: integer
          minimum: 1
          maximum: 9007199254740991
          description: >-
            The maximum number of tokens that can be generated in the chat
            completion. The total length of input tokens and generated tokens is
            limited by the model's context length.
        temperature:
          type: number
          minimum: 0
          maximum: 2
          description: >-
            What sampling temperature to use, between 0 and 2. Higher values
            like 0.8 will make the output more random, while lower values like
            0.2 will make it more focused and deterministic.
        top_p:
          type: number
          minimum: 0
          maximum: 1
          description: >-
            An alternative to sampling with temperature, called nucleus
            sampling, where the model considers the results of the tokens with
            top_p probability mass. So 0.1 means only the tokens comprising the
            top 10% probability mass are considered.
        frequency_penalty:
          type: number
          description: >-
            Number between -2.0 and 2.0. Positive values penalize new tokens
            based on their existing frequency in the text so far, decreasing the
            model's likelihood to repeat the same line verbatim.
        presence_penalty:
          type: number
          description: >-
            Number between -2.0 and 2.0. Positive values penalize new tokens
            based on whether they appear in the text so far, increasing the
            model's likelihood to talk about new topics.
        seed:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            If specified, the system will make a best effort to sample
            deterministically. Determinism is not guaranteed, but the same seed
            should typically return similar results.
        stop:
          anyOf:
            - type: string
            - type: array
              maxItems: 4
              items:
                type: string
          description: >-
            Up to 4 sequences where the API will stop generating further tokens.
            The returned text will not contain the stop sequence.
        response_format:
          type: object
          properties:
            type:
              anyOf:
                - type: string
                - enum:
                    - text
                    - json_object
                  type: string
              description: >-
                The format type. Use 'json_object' to enable JSON mode,
                guaranteeing the message the model generates is valid JSON.
            json_schema:
              type: object
              properties:
                name:
                  type: string
                schema:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties: {}
                strict:
                  type: boolean
              required:
                - name
                - schema
              description: >-
                JSON Schema definition for structured output. Required when type
                is 'json_schema'.
          required:
            - type
          description: >-
            An object specifying the format that the model must output. Setting
            to { 'type': 'json_object' } enables JSON mode.
        logprobs:
          type: boolean
          description: >-
            Whether to return log probabilities of the output tokens. If true,
            returns the log probabilities of each output token returned in the
            content of message.
        top_logprobs:
          type: integer
          minimum: 0
          maximum: 20
          description: >-
            An integer between 0 and 20 specifying the number of most likely
            tokens to return at each token position, each with an associated log
            probability. logprobs must be set to true if this parameter is used.
        user:
          type: string
          description: >-
            A unique identifier representing your end-user, which can help
            monitor and detect abuse. Also used for usage tracking and
            analytics.
        stream_options:
          type: object
          properties:
            include_usage:
              type: boolean
              description: >-
                If set, an additional chunk with token usage statistics will be
                streamed before the data: [DONE] message. The usage field shows
                total token usage for the entire request.
          description: >-
            Options for streaming response. Only set this when you set stream:
            true.
        parallel_tool_calls:
          type: boolean
          default: true
          description: Whether to enable parallel function calling during tool use.
        reasoning_effort:
          anyOf:
            - enum:
                - none
                - minimal
                - low
                - medium
                - high
                - xhigh
              type: string
            - type: 'null'
          description: >-
            Constrains effort on reasoning for reasoning models. Lower effort
            results in faster responses and fewer reasoning tokens. Supported
            values: 'none', 'minimal', 'low', 'medium', 'high', 'xhigh', or
            null.
        auto_routing:
          type: boolean
          description: >-
            When true, the gateway analyzes request complexity and automatically
            routes between quantized, MoE, and dense variants of the requested
            model family.
      required:
        - model
        - messages
      additionalProperties: false
      description: >-
        Request parameters for creating a chat completion. Based on the OpenAI
        Chat Completions API.
      examples:
        - model: meetkai:functionary-urdu-mini-pak
          messages:
            - role: user
              content: What is the capital of France?
          temperature: 0.7
          max_tokens: 100
    OpenAIChatCompletion:
      type: object
      properties:
        id:
          type: string
          description: A unique identifier for the chat completion
        object:
          const: chat.completion
          description: The object type, always 'chat.completion'
        created:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: >-
            The Unix timestamp (in seconds) of when the chat completion was
            created
        model:
          type: string
          description: The model used for the chat completion
        choices:
          type: array
          items:
            $ref: '#/components/schemas/OpenAIChatCompletionChoice'
          description: >-
            A list of chat completion choices. Can be more than one if n is
            greater than 1.
        usage:
          type: object
          properties:
            prompt_tokens:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
              description: Number of tokens in the prompt
            completion_tokens:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
              description: Number of tokens in the generated completion
            total_tokens:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
              description: Total number of tokens used in the request (prompt + completion)
            completion_tokens_details:
              type: object
              properties:
                reasoning_tokens:
                  type: integer
                  minimum: -9007199254740991
                  maximum: 9007199254740991
                  description: Number of tokens used for reasoning
                audio_tokens:
                  type: integer
                  minimum: -9007199254740991
                  maximum: 9007199254740991
                  description: Number of tokens used for audio
              description: Breakdown of completion tokens by type
          required:
            - prompt_tokens
            - completion_tokens
            - total_tokens
          description: Usage statistics for the completion request
        system_fingerprint:
          type: string
          description: >-
            This fingerprint represents the backend configuration that the model
            runs with. Can be used in conjunction with the seed request
            parameter to understand when backend changes have been made that
            might impact determinism.
      required:
        - id
        - object
        - created
        - model
        - choices
        - usage
      description: Represents a chat completion response from the API
      examples:
        - id: chatcmpl-abc123
          object: chat.completion
          created: 1704067200
          model: meetkai:functionary-urdu-mini-pak
          choices:
            - index: 0
              message:
                role: assistant
                content: The capital of France is Paris.
              finish_reason: stop
          usage:
            prompt_tokens: 15
            completion_tokens: 8
            total_tokens: 23
      example:
        id: chatcmpl-abc123
        object: chat.completion
        created: 1704067200
        model: meetkai:functionary-urdu-mini-pak
        choices:
          - index: 0
            message:
              role: assistant
              content: The capital of France is Paris.
            finish_reason: stop
        usage:
          prompt_tokens: 15
          completion_tokens: 8
          total_tokens: 23
    OpenAIRequestMessage:
      type: object
      properties:
        role:
          enum:
            - system
            - user
            - assistant
            - tool
            - developer
          type: string
          description: >-
            The role of the message author. Determines how the message is
            interpreted by the model.
        name:
          type: string
          description: >-
            An optional name for the participant. For tool role messages, this
            is the name of the function called.
        tool_call_id:
          type: string
          description: >-
            Tool call that this message is responding to. Required when role is
            'tool'.
        content:
          anyOf:
            - type: string
            - type: array
              items:
                anyOf:
                  - type: object
                    properties:
                      type:
                        const: text
                        description: Content type identifier for text content
                      text:
                        type: string
                        description: The text content to include in the message
                    required:
                      - type
                      - text
                  - type: object
                    properties:
                      type:
                        const: image_url
                        description: Content type identifier for image URL content
                      image_url:
                        type: object
                        properties:
                          url:
                            type: string
                            description: >-
                              The URL of the image, or a base64-encoded image
                              data URL
                          detail:
                            enum:
                              - auto
                              - low
                              - high
                            type: string
                            description: >-
                              The detail level of the image analysis. 'low'
                              disables high-res mode, 'high' enables it, 'auto'
                              lets the model decide.
                        required:
                          - url
                    required:
                      - type
                      - image_url
                  - type: object
                    properties:
                      type:
                        const: input_audio
                        description: Content type identifier for audio input content
                      input_audio:
                        type: object
                        properties:
                          data:
                            type: string
                            description: Base64-encoded audio data
                          format:
                            enum:
                              - wav
                              - mp3
                            type: string
                            description: The format of the encoded audio data
                        required:
                          - data
                          - format
                    required:
                      - type
                      - input_audio
                  - type: object
                    properties:
                      type:
                        const: file
                        description: Content type identifier for file content
                      file:
                        anyOf:
                          - type: object
                            properties:
                              filename:
                                type: string
                                description: The name of the file
                              file_data:
                                type: string
                                description: Base64-encoded file data
                            required:
                              - filename
                              - file_data
                          - type: object
                            properties:
                              file_id:
                                type: string
                                description: >-
                                  The unique identifier of a previously uploaded
                                  file
                              filename:
                                type: string
                                description: Optional filename override
                            required:
                              - file_id
                        description: >-
                          The file to include in the message, either as raw data
                          or by reference
                    required:
                      - type
                      - file
                description: >-
                  A content part that can be included in a message. Supports
                  text, images, audio, and files.
            - type: 'null'
          description: >-
            The contents of the message. Can be a string, an array of content
            parts (for multimodal inputs), or null for assistant messages with
            tool calls.
        tool_calls:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: The ID of the tool call
              type:
                const: function
                description: The type of the tool. Currently only 'function' is supported.
              function:
                type: object
                properties:
                  name:
                    type: string
                    description: The name of the function to call
                  arguments:
                    type: string
                    description: The arguments to call the function with, as a JSON string
                required:
                  - name
                  - arguments
                description: The function to be called
            required:
              - id
              - type
              - function
          description: >-
            The tool calls generated by the model, such as function calls. Only
            present for assistant messages with tool calls.
      required:
        - role
        - content
      description: >-
        A message in the chat completion request. Represents a conversation turn
        from the user, assistant, system, or tool.
    OpenAIToolDefinition:
      type: object
      properties:
        type:
          const: function
          description: The type of the tool. Currently only 'function' is supported.
        function:
          type: object
          properties:
            name:
              type: string
              minLength: 1
              description: >-
                The name of the function to be called. Must be a-z, A-Z, 0-9,
                underscores and dashes, with a maximum length of 64 characters.
            description:
              type: string
              description: >-
                A description of what the function does. Used by the model to
                choose when and how to call the function.
            parameters:
              description: >-
                The parameters the function accepts, described as a JSON Schema
                object. Omit to accept no parameters.
          required:
            - name
          description: The function definition
      required:
        - type
        - function
      description: A tool the model may call while generating a response.
    OpenAIChatCompletionChoice:
      type: object
      properties:
        index:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: The index of this choice in the list of choices
        message:
          type: object
          properties:
            role:
              const: assistant
              description: >-
                The role of the message author, must be 'assistant' for
                assistant messages
            name:
              type: string
              description: >-
                An optional name for the participant. For tool role messages,
                this is the name of the function called.
            tool_call_id:
              type: string
              description: >-
                Tool call that this message is responding to. Required when role
                is 'tool'.
            content:
              anyOf:
                - type: string
                - type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          type:
                            const: text
                            description: Content type identifier for text content
                          text:
                            type: string
                            description: The text content to include in the message
                        required:
                          - type
                          - text
                      - type: object
                        properties:
                          type:
                            const: image_url
                            description: Content type identifier for image URL content
                          image_url:
                            type: object
                            properties:
                              url:
                                type: string
                                description: >-
                                  The URL of the image, or a base64-encoded
                                  image data URL
                              detail:
                                enum:
                                  - auto
                                  - low
                                  - high
                                type: string
                                description: >-
                                  The detail level of the image analysis. 'low'
                                  disables high-res mode, 'high' enables it,
                                  'auto' lets the model decide.
                            required:
                              - url
                        required:
                          - type
                          - image_url
                      - type: object
                        properties:
                          type:
                            const: input_audio
                            description: Content type identifier for audio input content
                          input_audio:
                            type: object
                            properties:
                              data:
                                type: string
                                description: Base64-encoded audio data
                              format:
                                enum:
                                  - wav
                                  - mp3
                                type: string
                                description: The format of the encoded audio data
                            required:
                              - data
                              - format
                        required:
                          - type
                          - input_audio
                      - type: object
                        properties:
                          type:
                            const: file
                            description: Content type identifier for file content
                          file:
                            anyOf:
                              - type: object
                                properties:
                                  filename:
                                    type: string
                                    description: The name of the file
                                  file_data:
                                    type: string
                                    description: Base64-encoded file data
                                required:
                                  - filename
                                  - file_data
                              - type: object
                                properties:
                                  file_id:
                                    type: string
                                    description: >-
                                      The unique identifier of a previously
                                      uploaded file
                                  filename:
                                    type: string
                                    description: Optional filename override
                                required:
                                  - file_id
                            description: >-
                              The file to include in the message, either as raw
                              data or by reference
                        required:
                          - type
                          - file
                    description: >-
                      A content part that can be included in a message. Supports
                      text, images, audio, and files.
                - type: 'null'
              description: >-
                The contents of the assistant message. Can be null when the
                message contains tool calls only.
            reasoning:
              anyOf:
                - type: string
                - type: 'null'
              description: >-
                The reasoning content generated by the model before producing
                the final response. Present for models that support
                chain-of-thought reasoning.
            tool_calls:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the tool call
                  type:
                    const: function
                    description: >-
                      The type of the tool. Currently only 'function' is
                      supported.
                  function:
                    type: object
                    properties:
                      name:
                        type: string
                        description: The name of the function to call
                      arguments:
                        type: string
                        description: >-
                          The arguments to call the function with, as a JSON
                          string
                    required:
                      - name
                      - arguments
                    description: The function that the model called
                required:
                  - id
                  - type
                  - function
              description: The tool calls generated by the model, such as function calls.
          required:
            - role
            - content
          description: The message generated by the model
        finish_reason:
          anyOf:
            - anyOf:
                - enum:
                    - stop
                    - length
                    - tool_calls
                    - content_filter
                  type: string
                  description: The reason why the model stopped generating tokens.
                - type: string
            - type: 'null'
          description: >-
            The reason the model stopped generating tokens. 'stop' means natural
            stop point or provided stop sequence, 'length' means max_tokens
            limit reached, 'tool_calls' means the model called a tool,
            'content_filter' means content was filtered due to policy
            violations.
        logprobs:
          anyOf:
            - type: object
              properties:
                tokens:
                  type: array
                  items:
                    type: string
                  description: The list of tokens
                token_logprobs:
                  type: array
                  items:
                    type: number
                  description: The log probability of each token
                top_logprobs:
                  type: array
                  items:
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties:
                      type: number
                  description: The top log probabilities for each token position
                text_offset:
                  type: array
                  items:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  description: >-
                    The character offset from the beginning of the returned text
                    for each token
              required:
                - tokens
                - token_logprobs
                - top_logprobs
                - text_offset
              description: Log probability information for the choice
            - type: 'null'
          description: Log probability information for the choice
      required:
        - index
        - message
        - finish_reason
      description: A chat completion choice generated by the model
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Gateway auth: send `Authorization: Bearer <mka1-api-key>`. For
        multi-user server-side integrations, you can also send `X-On-Behalf-Of:
        <external-user-id>`.

````