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

# Generate LiveKit room token

> Generates a LiveKit access token for joining a real-time voice room. The token includes encrypted credentials and model configuration for the voice agent.



## OpenAPI

````yaml https://apigw.mka1.com/speakeasy.json post /api/v1/llm/speech/livekit/token
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: Deployments
    description: Long-lived inference servers.
    x-displayName: Deployments
  - name: Fine-Tune Jobs
    description: Submit, monitor, and cancel fine-tune jobs.
    x-displayName: Fine-Tune Jobs
  - name: Container Images
    description: Custom container images for deployments and jobs.
    x-displayName: Container Images
  - name: Serving Models
    description: Models registered for deployment and fine-tuning.
    x-displayName: Serving Models
  - name: Volumes
    description: Persistent storage for weights and checkpoints.
    x-displayName: Volumes
  - name: Secrets
    description: Credentials injected into your workloads.
    x-displayName: Secrets
  - name: Accelerators
    description: Available accelerator types (GPU, NPU, TPU).
    x-displayName: Accelerators
paths:
  /api/v1/llm/speech/livekit/token:
    post:
      tags:
        - Speech
      summary: Generate LiveKit room token
      description: >-
        Generates a LiveKit access token for joining a real-time voice room. The
        token includes encrypted credentials and model configuration for the
        voice agent.
      operationId: livekitToken
      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/LivekitTokenRequest'
            example:
              llm:
                model: auto
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LivekitTokenResponse'
              example:
                token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
                url: wss://apigw.mka1.com/api/v1/livekit
                roomName: 550e8400-e29b-41d4-a716-446655440000
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: python
          label: Python (SDK)
          source: |-
            from meetkai_mka1 import SDK


            with SDK(
                bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
            ) as sdk:

                res = sdk.llm.speech.livekit_token(llm={
                    "model": "auto",
                })

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { SDK } from "@meetkai/mka1";

            const sdk = new SDK({
              bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
            });

            async function run() {
              const result = await sdk.llm.speech.livekitToken({
                livekitTokenRequest: {
                  llm: {
                    model: "auto",
                  },
                },
              });

              console.log(result);
            }

            run();
        - lang: csharp
          label: CSharp (SDK)
          source: >-
            using MeetKai.MKA1;

            using MeetKai.MKA1.Types.Components;


            var sdk = new SDK(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");


            var res = await sdk.Llm.Speech.LivekitTokenAsync(body: new
            MeetKai.MKA1.Types.Components.LivekitTokenRequest() {
                Llm = new MeetKai.MKA1.Types.Components.Llm() {
                    Model = "auto",
                },
            });


            // handle response
components:
  schemas:
    LivekitTokenRequest:
      type: object
      properties:
        llm:
          type: object
          properties:
            model:
              type: string
              description: The ID of the model to use for generating the response.
            instructions:
              type: string
              description: >-
                System or developer instructions inserted into the model's
                context before user input. Use this to guide the agent's
                behavior, set personality, define constraints, or provide
                domain-specific knowledge. Acts as a persistent system message
                for this response.
            conversation:
              anyOf:
                - anyOf:
                    - type: string
                    - $ref: '#/components/schemas/Conversation'
                - type: 'null'
              description: >-
                The conversation that this response belongs to. Can be a
                conversation ID string or a conversation object. Used to
                maintain context and history across multiple agent interactions.
                Optional - omit for one-off interactions.
            previous_response_id:
              type: string
              description: >-
                The unique ID of a previous response to continue from. Used for
                multi-turn conversations to maintain context and history. The
                agent will have access to all previous interactions in the
                chain.
            prompt:
              $ref: '#/components/schemas/PromptTemplate'
              description: >-
                Reference to a prompt template to use for this response, along
                with variables to substitute. Allows using predefined, versioned
                prompt templates instead of inline instructions. The template
                system supports variable interpolation.
            tools:
              type: array
              items:
                anyOf:
                  - $ref: '#/components/schemas/FunctionToolDefinition'
                  - $ref: '#/components/schemas/FileSearchToolDefinition'
                  - $ref: '#/components/schemas/ComputerUseToolDefinition'
                  - $ref: '#/components/schemas/WebSearchToolDefinition'
                  - $ref: '#/components/schemas/MCPToolDefinition'
                  - $ref: '#/components/schemas/CodeInterpreterToolDefinition'
                  - $ref: '#/components/schemas/ImageGenerationToolDefinition'
                  - $ref: '#/components/schemas/LocalShellToolDefinition'
                  - $ref: '#/components/schemas/ShellToolDefinition'
                  - $ref: '#/components/schemas/CustomToolDefinition'
                  - $ref: '#/components/schemas/WebSearchPreviewToolDefinition'
                  - $ref: '#/components/schemas/HostedToolDefinition'
                  - $ref: '#/components/schemas/SleepToolDefinition'
                  - $ref: '#/components/schemas/HistoryToolDefinition'
              description: >-
                Array of tool definitions that the agent can use during response
                generation. Supports built-in tools (web search, file search,
                code interpreter, computer use, image generation) and custom
                tools (functions, MCP, local shell). Each tool definition
                specifies its type and configuration.
            tool_choice:
              $ref: '#/components/schemas/ToolChoice'
              description: >-
                Controls how the agent selects which tools to use. Can be 'none'
                (no tools), 'auto' (model decides), 'required' (must use tools),
                or a specific tool selection object. Use this to force or
                prevent tool usage.
            parallel_tool_calls:
              type: boolean
              default: true
              description: >-
                Whether to allow the agent to execute multiple tool calls in
                parallel. When true, the agent can make concurrent tool calls
                for efficiency. When false, tools are called sequentially.
                Defaults to true for better performance.
            max_tool_calls:
              type: integer
              minimum: 1
              maximum: 300
              default: 64
              description: >-
                The maximum total number of tool calls the agent can make during
                this response. Useful for controlling execution time and
                preventing infinite loops. Applies to all built-in tools like
                web search, file search, code interpreter, etc. Must be a
                positive integer between 1 and 300. Defaults to 64.
            reasoning:
              $ref: '#/components/schemas/ReasoningConfiguration'
              description: >-
                Configuration options for reasoning models. Controls reasoning
                effort level (minimal, low, medium, high) and summary verbosity
                (auto, concise, detailed). Only applicable to specific
                reasoning-capable models.
            max_output_tokens:
              type: integer
              minimum: 1
              maximum: 9007199254740991
              description: >-
                The maximum number of tokens the model can generate in its
                output. Sets an upper bound to control costs and response
                length. The actual output may be shorter if the model finishes
                naturally. Must be a positive integer.
            temperature:
              type: number
              minimum: 0
              maximum: 2
              description: >-
                Controls randomness in the model's output. Higher values (e.g.,
                1.5-2.0) make output more random and creative, lower values
                (e.g., 0.0-0.5) make it more focused and deterministic. Must be
                between 0 and 2.
            top_p:
              type: number
              minimum: 0
              maximum: 1
              description: >-
                Nucleus sampling parameter. The model considers only the tokens
                with top_p cumulative probability. Lower values (e.g., 0.1) make
                output more focused, higher values (e.g., 0.9) allow more
                diversity. Must be between 0 and 1. Alternative to temperature.
            truncation:
              enum:
                - auto
                - disabled
              type: string
              default: auto
              description: >-
                The truncation strategy for handling inputs that exceed the
                model's context window. 'auto' automatically truncates old
                messages to fit, 'disabled' returns an error if context is too
                long. Defaults to 'auto'.
            presence_penalty:
              type: number
              minimum: -2
              maximum: 2
              description: >-
                Penalizes new tokens based on whether they appear in the text so
                far. Higher values increase the model's likelihood to talk about
                new topics.
            frequency_penalty:
              type: number
              minimum: -2
              maximum: 2
              description: >-
                Penalizes new tokens based on their frequency in the text so
                far. Higher values decrease the model's likelihood to repeat the
                same line verbatim.
            context_management:
              $ref: '#/components/schemas/ContextManagement'
              description: >-
                Context management strategies to apply during response
                generation. Supports compaction, which summarizes older
                conversation history when the context exceeds a token threshold.
            service_tier:
              enum:
                - auto
                - default
                - flex
                - priority
              type: string
              default: auto
              description: >-
                Specifies the processing tier for serving the request. 'auto'
                lets the system choose, 'default' uses standard processing,
                'flex' allows flexible scheduling for lower priority, 'priority'
                provides faster processing. Defaults to 'auto'.
            metadata:
              type: object
              propertyNames:
                type: string
                maxLength: 64
              additionalProperties:
                type: string
                maxLength: 512
              description: >-
                Custom metadata to attach to this response as key-value pairs.
                Keys must be strings up to 64 characters, values must be strings
                up to 512 characters. Maximum 16 pairs. Useful for tracking,
                categorization, or passing custom identifiers through your
                system.
            text:
              $ref: '#/components/schemas/TextConfiguration'
              description: >-
                Configuration options for text output from the model. Includes
                response format (text, JSON object, JSON schema) and verbosity
                level (low, medium, high). Use this to control output structure
                and detail level.
          required:
            - model
          description: >-
            LLM configuration for the voice session. Uses a subset of the
            responses create schema — fields like input, stream, background,
            webhooks, and store are excluded since the voice agent manages
            those. WARNING: This object is serialized into the LiveKit JWT
            metadata which is transmitted via HTTP headers. Keep payloads small
            — large tools arrays can exceed the ~8KB header size limit imposed
            by most servers and proxies.
        stt:
          $ref: '#/components/schemas/SttConfig'
          description: Optional STT (speech-to-text) VAD configuration.
      required:
        - llm
      description: >-
        Request parameters for generating a LiveKit room token with LLM
        configuration and optional STT settings.
    LivekitTokenResponse:
      type: object
      properties:
        token:
          type: string
          description: JWT access token for authenticating with the LiveKit room
        url:
          type: string
          format: uri
          description: >-
            LiveKit server WebSocket URL to connect to (e.g.,
            wss://apigw.mka1.com/api/v1/livekit)
        roomName:
          type: string
          description: Auto-generated UUID room name assigned to this session
      required:
        - token
        - url
        - roomName
      description: >-
        Response containing a LiveKit access token, server URL, and the
        generated room name.
      examples:
        - token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
          url: wss://apigw.mka1.com/api/v1/livekit
          roomName: 550e8400-e29b-41d4-a716-446655440000
    Conversation:
      type: object
      properties:
        id:
          type: string
      required:
        - id
    PromptTemplate:
      type: object
      properties:
        id:
          type: string
        variables:
          type: object
          propertyNames:
            type: string
          additionalProperties:
            anyOf:
              - type: string
              - {}
        version:
          type: string
      required:
        - id
    FunctionToolDefinition:
      type: object
      properties:
        type:
          const: function
        name:
          type: string
        parameters:
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
        strict:
          type: boolean
        description:
          type: string
        defer_loading:
          type: boolean
      required:
        - type
        - name
        - parameters
        - strict
      title: Function tool definition
      description: >-
        Function tool definition: Defines a callable function tool. Provide a
        tool name and parameters schema, with optional description and deferred
        loading.
    FileSearchToolDefinition:
      type: object
      properties:
        type:
          const: file_search
        vector_store_ids:
          type: array
          items:
            type: string
        filters:
          anyOf:
            - $ref: '#/components/schemas/ComparisonFilter'
            - $ref: '#/components/schemas/CompoundFilter'
        max_num_results:
          type: integer
          minimum: 1
          maximum: 50
        ranking_options:
          $ref: '#/components/schemas/RankingOptions'
      required:
        - type
        - vector_store_ids
      title: File search tool definition
      description: >-
        File search tool definition: Configures semantic search over one or more
        vector stores, with optional filters, ranking options, and result
        limits.
    ComputerUseToolDefinition:
      type: object
      properties:
        type:
          const: computer_use_preview
        display_height:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        display_width:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        environment:
          type: string
      required:
        - type
        - display_height
        - display_width
        - environment
      title: Computer use tool definition
      description: >-
        Computer use tool definition: Configures the computer-use preview tool,
        including required display dimensions and runtime environment.
    WebSearchToolDefinition:
      type: object
      properties:
        type:
          enum:
            - web_search
            - web_search_2025_08_26
          type: string
        filters:
          $ref: '#/components/schemas/WebSearchFilters'
        search_context_size:
          enum:
            - low
            - medium
            - high
          type: string
          default: medium
        user_location:
          $ref: '#/components/schemas/UserLocation'
      required:
        - type
      title: Web search tool definition
      description: >-
        Web search tool definition: Enables web search with optional domain
        filters, search context size, and approximate user location.
    MCPToolDefinition:
      type: object
      properties:
        type:
          const: mcp
        server_label:
          type: string
          minLength: 1
          maxLength: 255
          pattern: ^[A-Za-z0-9._-]+$
        mcp_server_id:
          type: string
          description: >-
            Reference to a gateway-managed MCP server. When provided, server_url
            is resolved from the MCP vault.
        mcp_credential_id:
          type: string
          description: >-
            Optional reference to a gateway-managed MCP credential owned by the
            run caller.
        allowed_tools:
          anyOf:
            - type: array
              items:
                type: string
            - $ref: '#/components/schemas/MCPToolFilter'
        authorization:
          type: string
        connector_id:
          enum:
            - connector_dropbox
            - connector_gmail
            - connector_googlecalendar
            - connector_googledrive
            - connector_microsoftteams
            - connector_outlookcalendar
            - connector_outlookemail
            - connector_sharepoint
          type: string
        headers:
          type: object
          propertyNames:
            type: string
            minLength: 1
            maxLength: 256
            pattern: ^[!#$%&'*+.^_`|~0-9A-Za-z-]+$
          additionalProperties:
            type: string
            minLength: 1
            maxLength: 8192
            pattern: ^[^\r\n]*$
        require_approval:
          anyOf:
            - const: always
            - const: never
            - $ref: '#/components/schemas/MCPToolApprovalFilter'
        server_description:
          type: string
        server_url:
          type: string
      required:
        - type
      title: MCP tool definition
      description: >-
        MCP tool definition: Connects to an MCP server and exposes its tools,
        with optional vault references, auth, headers, allow-lists, connector
        ID, and approval policy.
    CodeInterpreterToolDefinition:
      type: object
      properties:
        type:
          const: code_interpreter
        container:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/CodeInterpreterContainerAuto'
      required:
        - type
        - container
      title: Code interpreter tool definition
      description: >-
        Code interpreter tool definition: Enables code execution. Provide an
        explicit container ID or auto container configuration with optional file
        IDs and memory limit.
    ImageGenerationToolDefinition:
      type: object
      properties:
        type:
          const: image_generation
        background:
          enum:
            - transparent
            - opaque
            - auto
          type: string
          default: auto
        input_fidelity:
          enum:
            - high
            - low
          type: string
          default: low
        input_image_mask:
          $ref: '#/components/schemas/InputImageMask'
        model:
          type: string
          minLength: 1
          default: auto
          description: >-
            The model to use for image generation. Defaults to 'auto' for
            automatic model selection.
        moderation:
          enum:
            - auto
            - low
            - none
          type: string
          default: auto
        output_compression:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
          default: 100
        output_format:
          enum:
            - png
            - webp
            - jpeg
          type: string
          default: png
        partial_images:
          type: integer
          minimum: 0
          maximum: 3
          default: 0
        quality:
          enum:
            - low
            - medium
            - high
            - auto
          type: string
          default: auto
        size:
          enum:
            - 1024x1024
            - 1024x1536
            - 1536x1024
            - auto
          type: string
          default: auto
        prompt_guard:
          type: string
          description: >-
            Adds a guardrail to prevent the model from generating content that
            is not allowed.
      required:
        - type
      title: Image generation tool definition
      description: >-
        Image generation tool definition: Enables image generation and
        configures output settings like model, quality, size, format,
        moderation, and optional masking.
    LocalShellToolDefinition:
      type: object
      properties:
        type:
          const: local_shell
      required:
        - type
      title: Local shell tool definition
      description: 'Local shell tool definition: Enables the local shell execution tool.'
    ShellToolDefinition:
      type: object
      properties:
        type:
          const: shell
        environment:
          $ref: '#/components/schemas/ShellEnvironment'
          description: Container environment configuration. Defaults to container_auto.
      required:
        - type
      title: Shell tool definition
      description: >-
        Shell tool definition: Enables shell command execution in a managed
        container environment.
    CustomToolDefinition:
      type: object
      properties:
        type:
          const: custom
        name:
          type: string
        description:
          type: string
        format:
          $ref: '#/components/schemas/CustomToolFormat'
      required:
        - type
        - name
      title: Custom tool definition
      description: >-
        Custom tool definition: Defines a custom tool by name, with optional
        description and optional output format constraints.
    WebSearchPreviewToolDefinition:
      type: object
      properties:
        type:
          enum:
            - web_search_preview
            - web_search_preview_2025_03_11
          type: string
        search_context_size:
          enum:
            - low
            - medium
            - high
          type: string
        user_location:
          $ref: '#/components/schemas/UserLocation'
      required:
        - type
      title: Web search preview tool definition
      description: >-
        Web search preview tool definition: Enables the preview web search tool
        variant with optional context size and user location.
    HostedToolDefinition:
      type: object
      properties:
        type:
          enum:
            - file_search
            - web_search_preview
            - computer_use_preview
            - code_interpreter
            - image_generation
          type: string
      required:
        - type
      title: Hosted tool definition
      description: >-
        Hosted tool definition: Shorthand hosted-tool selector for built-in tool
        types. This is a compatibility form that overlaps with the detailed
        per-tool schemas.
    SleepToolDefinition:
      type: object
      properties:
        type:
          const: sleep
      required:
        - type
      title: Sleep tool definition
      description: >-
        Sleep tool definition: Allows an agent to pause the current response
        briefly and resume later or when woken.
    HistoryToolDefinition:
      type: object
      properties:
        type:
          const: history
      required:
        - type
      title: History tool definition
      description: >-
        History tool definition: Enables the internal conversation-history
        retrieval tool for semantic lookup of past interactions.
    ToolChoice:
      anyOf:
        - $ref: '#/components/schemas/ToolChoiceMode'
        - $ref: '#/components/schemas/AllowedTools'
        - $ref: '#/components/schemas/HostedToolChoice'
        - $ref: '#/components/schemas/FunctionToolChoice'
        - $ref: '#/components/schemas/MCPToolChoice'
        - $ref: '#/components/schemas/CustomToolChoice'
    ReasoningConfiguration:
      type: object
      properties:
        effort:
          anyOf:
            - enum:
                - none
                - minimal
                - low
                - medium
                - high
                - xhigh
              type: string
            - type: 'null'
        summary:
          anyOf:
            - enum:
                - auto
                - concise
                - detailed
              type: string
            - type: 'null'
      required:
        - effort
        - summary
    ContextManagement:
      type: array
      maxItems: 1
      items:
        $ref: '#/components/schemas/CompactionContextManagement'
      description: >-
        Array of context management strategies to apply during response
        generation.
    TextConfiguration:
      type: object
      properties:
        format:
          $ref: '#/components/schemas/ResponseFormat'
        verbosity:
          enum:
            - low
            - medium
            - high
          type: string
          default: medium
      required:
        - format
    SttConfig:
      type: object
      properties:
        silence_timeout_ms:
          type: integer
          minimum: 100
          maximum: 5000
          description: >-
            Server-side VAD silence timeout in ms (100–5000). Controls how long
            to wait after silence before finalizing speech.
        initial_silence_timeout_ms:
          type: integer
          minimum: 1000
          maximum: 30000
          description: Timeout in ms before any speech is detected (1000–30000).
      description: Optional STT (speech-to-text) VAD configuration for the voice session.
    ComparisonFilter:
      type: object
      properties:
        type:
          enum:
            - eq
            - ne
            - gt
            - gte
            - lt
            - lte
          type: string
        key:
          type: string
        value:
          anyOf:
            - type: string
            - type: number
            - type: boolean
      required:
        - type
        - key
        - value
    CompoundFilter:
      type: object
      properties:
        type:
          enum:
            - and
            - or
          type: string
        filters:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/ComparisonFilter'
              - $ref: '#/components/schemas/CompoundFilter'
      required:
        - type
        - filters
    RankingOptions:
      type: object
      properties:
        ranker:
          type: string
        score_threshold:
          type: number
    WebSearchFilters:
      type: object
      properties:
        allowed_domains:
          type: array
          items:
            type: string
          default: []
    UserLocation:
      type: object
      properties:
        type:
          const: approximate
          default: approximate
        city:
          type: string
        country:
          type: string
        region:
          type: string
        timezone:
          type: string
    MCPToolFilter:
      type: object
      properties:
        read_only:
          type: boolean
        tool_names:
          type: array
          items:
            type: string
    MCPToolApprovalFilter:
      type: object
      properties:
        always:
          $ref: '#/components/schemas/MCPToolFilter'
        never:
          $ref: '#/components/schemas/MCPToolFilter'
    CodeInterpreterContainerAuto:
      type: object
      properties:
        type:
          const: auto
        file_ids:
          anyOf:
            - type: array
              items:
                type: string
            - type: 'null'
        memory_limit:
          anyOf:
            - enum:
                - 1g
                - 4g
                - 16g
                - 64g
              type: string
            - type: 'null'
      required:
        - type
    InputImageMask:
      type: object
      properties:
        file_id:
          type: string
        image_url:
          type: string
    ShellEnvironment:
      anyOf:
        - $ref: '#/components/schemas/ShellEnvironmentContainerAuto'
        - $ref: '#/components/schemas/ShellEnvironmentContainerReference'
      discriminator:
        propertyName: type
        mapping:
          container_auto:
            $ref: '#/components/schemas/ShellEnvironmentContainerAuto'
          container_reference:
            $ref: '#/components/schemas/ShellEnvironmentContainerReference'
    CustomToolFormat:
      anyOf:
        - $ref: '#/components/schemas/TextFormat'
        - $ref: '#/components/schemas/GrammarFormat'
    ToolChoiceMode:
      enum:
        - none
        - auto
        - required
      type: string
      title: Tool choice mode
      description: >-
        Tool choice mode: Selects how the model decides tool usage. Use none,
        auto, or required.
    AllowedTools:
      type: object
      properties:
        type:
          const: allowed_tools
        mode:
          enum:
            - auto
            - required
          type: string
        tools:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              name:
                type: string
              server_label:
                type: string
            required:
              - type
      required:
        - type
        - mode
        - tools
      title: Allowed tools tool choice
      description: >-
        Allowed tools tool choice: Restricts tool use to a provided list and
        sets whether tool use is optional (auto) or mandatory (required).
    HostedToolChoice:
      type: object
      properties:
        type:
          enum:
            - file_search
            - web_search_preview
            - computer_use_preview
            - code_interpreter
            - image_generation
          type: string
      required:
        - type
      title: Hosted tool choice
      description: 'Hosted tool choice: Forces a specific built-in hosted tool type.'
    FunctionToolChoice:
      type: object
      properties:
        type:
          const: function
        name:
          type: string
      required:
        - type
        - name
      title: Function tool choice
      description: 'Function tool choice: Forces a specific function tool by name.'
    MCPToolChoice:
      type: object
      properties:
        type:
          const: mcp
        server_label:
          type: string
        name:
          type: string
      required:
        - type
        - server_label
      title: MCP tool choice
      description: >-
        MCP tool choice: Forces an MCP server, optionally narrowed to a specific
        MCP tool name.
    CustomToolChoice:
      type: object
      properties:
        type:
          const: custom
        name:
          type: string
      required:
        - type
        - name
      title: Custom tool choice
      description: 'Custom tool choice: Forces a specific custom tool by name.'
    CompactionContextManagement:
      type: object
      properties:
        type:
          const: compaction
        compact_threshold:
          type: integer
          minimum: 1000
          maximum: 9007199254740991
          description: >-
            The token threshold above which conversation context should be
            compacted. Must be at least 1000.
      required:
        - type
        - compact_threshold
    ResponseFormat:
      anyOf:
        - $ref: '#/components/schemas/TextResponseFormat'
        - $ref: '#/components/schemas/JSONSchemaResponseFormat'
        - $ref: '#/components/schemas/JSONObjectResponseFormat'
    ShellEnvironmentContainerAuto:
      type: object
      properties:
        type:
          const: container_auto
        network_policy:
          $ref: '#/components/schemas/ShellNetworkPolicy'
          description: Network policy restricting outbound access.
        skills:
          type: array
          items:
            $ref: '#/components/schemas/SkillEntry'
          description: Skills to inject into the container's /skills directory.
        memory_stores:
          type: array
          items:
            $ref: '#/components/schemas/MemoryStoreMount'
          description: Memory stores to mount into the container under /mnt/memory.
      required:
        - type
    ShellEnvironmentContainerReference:
      type: object
      properties:
        type:
          const: container_reference
        container_id:
          type: string
          description: ID of an existing container to reuse.
        network_policy:
          $ref: '#/components/schemas/ShellNetworkPolicy'
          description: Network policy restricting outbound access.
        skills:
          type: array
          items:
            $ref: '#/components/schemas/SkillEntry'
          description: Skills to inject into the container's /skills directory.
        memory_stores:
          type: array
          items:
            $ref: '#/components/schemas/MemoryStoreMount'
          description: Memory stores to mount into the container under /mnt/memory.
      required:
        - type
        - container_id
    TextFormat:
      type: object
      properties:
        type:
          const: text
      required:
        - type
    GrammarFormat:
      type: object
      properties:
        type:
          const: grammar
        definition:
          type: string
        syntax:
          enum:
            - lark
            - regex
          type: string
      required:
        - type
        - definition
        - syntax
    TextResponseFormat:
      type: object
      properties:
        type:
          const: text
      required:
        - type
    JSONSchemaResponseFormat:
      type: object
      properties:
        type:
          const: json_schema
        name:
          type: string
          maxLength: 64
          pattern: ^[a-zA-Z0-9_-]+$
        schema:
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
        description:
          type: string
        strict:
          type: boolean
          default: false
      required:
        - type
        - name
        - schema
    JSONObjectResponseFormat:
      type: object
      properties:
        type:
          const: json_object
      required:
        - type
    ShellNetworkPolicy:
      type: object
      properties:
        type:
          const: allowlist
        allowed_domains:
          type: array
          items:
            type: string
          description: Domains permitted for outbound network access.
        domain_secrets:
          type: array
          items:
            $ref: '#/components/schemas/ShellNetworkPolicyDomainSecret'
          description: Secrets injected per domain.
      required:
        - type
    SkillEntry:
      anyOf:
        - $ref: '#/components/schemas/SkillReference'
        - $ref: '#/components/schemas/PreconfiguredSkillReference'
      discriminator:
        propertyName: type
        mapping:
          skill_reference:
            $ref: '#/components/schemas/SkillReference'
          preconfigured:
            $ref: '#/components/schemas/PreconfiguredSkillReference'
    MemoryStoreMount:
      type: object
      properties:
        store_id:
          type: string
          minLength: 1
          description: ID of the memory store to mount into the container.
        label:
          type: string
          minLength: 1
          maxLength: 64
          pattern: ^(?!\.+$)[A-Za-z0-9._-]+$
          description: Directory name for this store under /mnt/memory.
        access:
          enum:
            - read_only
            - read_write
          type: string
          default: read_only
          description: Whether the mounted memory store can be modified.
        description:
          type: string
          maxLength: 2000
          description: Optional short description of the store for agent context.
        instructions:
          type: string
          maxLength: 4000
          description: >-
            Optional instructions for how the agent should use this mounted
            store.
      required:
        - store_id
        - label
    ShellNetworkPolicyDomainSecret:
      type: object
      properties:
        domain:
          type: string
          description: The domain to associate this secret with.
        name:
          type: string
          description: The name/placeholder for the secret (e.g., $API_KEY).
        value:
          type: string
          description: The secret value to substitute.
      required:
        - domain
        - name
        - value
    SkillReference:
      type: object
      properties:
        type:
          const: skill_reference
        skill_id:
          type: string
          description: ID of the skill to inject into the container.
        version:
          anyOf:
            - type: string
            - type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
          description: >-
            Version number, or 'latest' for the most recent version. Defaults to
            the skill's default_version.
      required:
        - type
        - skill_id
    PreconfiguredSkillReference:
      type: object
      properties:
        type:
          const: preconfigured
        name:
          type: string
          description: Name of a preconfigured skill (e.g., 'pdf', 'docx', 'xlsx', 'pptx').
      required:
        - type
        - name
  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>`.

````