> ## Documentation Index
> Fetch the complete documentation index at: https://allhandsai-chore-regenerate-agent-sdk-openapi.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Set Conversation Security Analyzer

> Set the security analyzer for a conversation.



## OpenAPI

````yaml /openapi/agent-sdk.json post /api/conversations/{conversation_id}/security_analyzer
openapi: 3.1.0
info:
  description: OpenHands Agent Server - REST/WebSocket interface for OpenHands AI Agent
  title: OpenHands Agent Server
  version: 1.52.0
servers: []
security: []
paths:
  /api/conversations/{conversation_id}/security_analyzer:
    post:
      tags:
        - Conversations
      summary: Set Conversation Security Analyzer
      description: Set the security analyzer for a conversation.
      operationId: >-
        set_conversation_security_analyzer_api_conversations__conversation_id__security_analyzer_post
      parameters:
        - in: path
          name: conversation_id
          required: true
          schema:
            format: uuid
            title: Conversation Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetSecurityAnalyzerRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Success'
          description: Successful Response
        '404':
          description: Item not found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - APIKeyHeader: []
components:
  schemas:
    SetSecurityAnalyzerRequest:
      description: Payload to set security analyzer for a conversation
      properties:
        security_analyzer:
          anyOf:
            - $ref: '#/components/schemas/SecurityAnalyzerBase-Input'
            - type: 'null'
          description: The security analyzer to set
      required:
        - security_analyzer
      title: SetSecurityAnalyzerRequest
      type: object
    Success:
      properties:
        success:
          default: true
          title: Success
          type: boolean
      title: Success
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    SecurityAnalyzerBase-Input:
      discriminator:
        mapping:
          openhands__sdk__security__defense_in_depth__pattern__PatternSecurityAnalyzer-Input__1: '#/components/schemas/PatternSecurityAnalyzer-Input'
          openhands__sdk__security__defense_in_depth__policy_rails__PolicyRailSecurityAnalyzer-Input__1: '#/components/schemas/PolicyRailSecurityAnalyzer-Input'
          openhands__sdk__security__ensemble__EnsembleSecurityAnalyzer-Input__1: '#/components/schemas/EnsembleSecurityAnalyzer-Input'
          openhands__sdk__security__grayswan__analyzer__GraySwanAnalyzer-Input__1: '#/components/schemas/GraySwanAnalyzer-Input'
          openhands__sdk__security__llm_analyzer__LLMSecurityAnalyzer-Input__1: '#/components/schemas/LLMSecurityAnalyzer-Input'
          openhands__sdk__security__toolshield_llm_analyzer__ToolShieldLLMSecurityAnalyzer-Input__1: '#/components/schemas/ToolShieldLLMSecurityAnalyzer-Input'
        propertyName: kind
      oneOf:
        - $ref: '#/components/schemas/PatternSecurityAnalyzer-Input'
        - $ref: '#/components/schemas/PolicyRailSecurityAnalyzer-Input'
        - $ref: '#/components/schemas/EnsembleSecurityAnalyzer-Input'
        - $ref: '#/components/schemas/GraySwanAnalyzer-Input'
        - $ref: '#/components/schemas/LLMSecurityAnalyzer-Input'
        - $ref: '#/components/schemas/ToolShieldLLMSecurityAnalyzer-Input'
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    PatternSecurityAnalyzer-Input:
      description: >-
        Catch dangerous agent actions through deterministic signature scanning.


        Use this when you want fast, local, no-network threat detection at the

        action boundary. It returns ``SecurityRisk.HIGH``, ``MEDIUM``, or
        ``LOW``

        -- pair it with ``ConfirmRisky`` to decide what gets confirmed.


        The key design choice: shell-destructive patterns only scan what the

        agent will *execute* (tool arguments), never what it *thought about*

        (reasoning text). Injection patterns scan everything, because

        "ignore all previous instructions" is dangerous wherever it appears.


        Normalization is always on -- invisible characters and fullwidth

        substitutions are collapsed before matching.


        Example::

            from openhands.sdk.security import PatternSecurityAnalyzer, ConfirmRisky

            analyzer = PatternSecurityAnalyzer()
            policy = ConfirmRisky(threshold=SecurityRisk.MEDIUM)
      properties:
        high_patterns:
          description: HIGH patterns scanned against executable fields only
          items:
            maxItems: 3
            minItems: 3
            prefixItems:
              - type: string
              - type: string
              - type: string
            type: array
          title: High Patterns
          type: array
        injection_high_patterns:
          description: HIGH patterns scanned against all fields
          items:
            maxItems: 3
            minItems: 3
            prefixItems:
              - type: string
              - type: string
              - type: string
            type: array
          title: Injection High Patterns
          type: array
        injection_medium_patterns:
          description: MEDIUM patterns scanned against all fields
          items:
            maxItems: 3
            minItems: 3
            prefixItems:
              - type: string
              - type: string
              - type: string
            type: array
          title: Injection Medium Patterns
          type: array
        kind:
          const: PatternSecurityAnalyzer
          title: Kind
          type: string
        medium_patterns:
          description: MEDIUM patterns scanned against executable fields only
          items:
            maxItems: 3
            minItems: 3
            prefixItems:
              - type: string
              - type: string
              - type: string
            type: array
          title: Medium Patterns
          type: array
      title: PatternSecurityAnalyzer
      type: object
    PolicyRailSecurityAnalyzer-Input:
      description: |-
        Catch composed threats that plain regex signatures would miss.

        Use this when you need to detect threats defined by *combinations*
        of tokens (e.g., ``curl`` piped to ``bash``) rather than individual
        signatures. While these rails *could* each be expressed as a single
        regex, keeping them as named rules with per-segment evaluation makes
        the threat model more interpretable, the rules easier to maintain,
        and the audit trail clearer than a flat pattern list.

        Evaluates normalized executable segments only -- reasoning text is
        never scanned.

        Returns ``SecurityRisk.HIGH`` when a rail fires, ``LOW`` otherwise.
        Pair with ``ConfirmRisky`` and compose via ``EnsembleSecurityAnalyzer``.

        v1 rails: fetch-to-exec, raw-disk-op, catastrophic-delete.

        Example::

            from openhands.sdk.security import PolicyRailSecurityAnalyzer

            analyzer = PolicyRailSecurityAnalyzer()
            # risk = analyzer.security_risk(action)
      properties:
        kind:
          const: PolicyRailSecurityAnalyzer
          title: Kind
          type: string
      title: PolicyRailSecurityAnalyzer
      type: object
    EnsembleSecurityAnalyzer-Input:
      description: |-
        Wire multiple analyzers together and take the worst-case risk.

        Use this as the top-level analyzer you set on a conversation. It
        calls each child analyzer, collects their risk assessments, and
        returns the highest concrete risk. It does not perform any detection,
        extraction, or normalization of its own.

        How UNKNOWN works (default, ``propagate_unknown=False``): if *all*
        children return UNKNOWN, the ensemble returns UNKNOWN (which
        ``ConfirmRisky`` confirms by default). If any child returns a
        concrete level, UNKNOWN results are filtered out and the highest
        concrete level wins.

        With ``propagate_unknown=True``: if *any* child returns UNKNOWN, the
        ensemble returns UNKNOWN regardless of other results. Use this in
        stricter environments where incomplete assessment should trigger
        confirmation.

        If a child analyzer raises an exception, it contributes HIGH
        (fail-closed, logged). This prevents a broken analyzer from silently
        degrading safety.

        Example::

            from openhands.sdk.security import (
                EnsembleSecurityAnalyzer,
                PatternSecurityAnalyzer,
                PolicyRailSecurityAnalyzer,
                ConfirmRisky,
                SecurityRisk,
            )

            analyzer = EnsembleSecurityAnalyzer(
                analyzers=[
                    PolicyRailSecurityAnalyzer(),
                    PatternSecurityAnalyzer(),
                ]
            )
            policy = ConfirmRisky(threshold=SecurityRisk.MEDIUM)
      properties:
        analyzers:
          description: Analyzers whose assessments are combined via max-severity
          items:
            $ref: '#/components/schemas/SecurityAnalyzerBase-Input'
          minItems: 1
          title: Analyzers
          type: array
        kind:
          const: EnsembleSecurityAnalyzer
          title: Kind
          type: string
        propagate_unknown:
          default: false
          description: >-
            When True, any child returning UNKNOWN causes the ensemble to return
            UNKNOWN. When False (default), UNKNOWN is filtered out if any child
            returns a concrete level.
          title: Propagate Unknown
          type: boolean
      required:
        - analyzers
      title: EnsembleSecurityAnalyzer
      type: object
    GraySwanAnalyzer-Input:
      description: >-
        Security analyzer using GraySwan's Cygnal API for AI safety monitoring.


        This analyzer sends conversation history and pending actions to the
        GraySwan

        Cygnal API for security analysis. The API returns a violation score
        which is

        mapped to SecurityRisk levels.


        Environment Variables:
            GRAYSWAN_API_KEY: Required API key for GraySwan authentication
            GRAYSWAN_POLICY_ID: Optional policy ID for custom GraySwan policy

        Example:
            >>> from openhands.sdk.security.grayswan import GraySwanAnalyzer
            >>> analyzer = GraySwanAnalyzer()
            >>> risk = analyzer.security_risk(action_event)
      properties:
        api_key:
          anyOf:
            - format: password
              type: string
              writeOnly: true
            - type: 'null'
          description: GraySwan API key (via GRAYSWAN_API_KEY env var)
          title: Api Key
        api_url:
          default: https://api.grayswan.ai/cygnal/monitor
          description: GraySwan Cygnal API endpoint
          title: Api Url
          type: string
        history_limit:
          default: 20
          description: Number of recent events to include as context
          title: History Limit
          type: integer
        kind:
          const: GraySwanAnalyzer
          title: Kind
          type: string
        low_threshold:
          default: 0.3
          description: Risk threshold for LOW classification (score <= threshold)
          title: Low Threshold
          type: number
        max_message_chars:
          default: 30000
          description: Max characters for conversation processing
          title: Max Message Chars
          type: integer
        medium_threshold:
          default: 0.7
          description: Risk threshold for MEDIUM classification (score <= threshold)
          title: Medium Threshold
          type: number
        policy_id:
          anyOf:
            - type: string
            - type: 'null'
          description: GraySwan policy ID (via GRAYSWAN_POLICY_ID env var)
          title: Policy Id
        timeout:
          default: 30
          description: Request timeout in seconds
          title: Timeout
          type: number
      title: GraySwanAnalyzer
      type: object
    LLMSecurityAnalyzer-Input:
      description: >-
        LLM-based security analyzer.


        This analyzer respects the security_risk attribute that can be set by
        the LLM

        when generating actions, similar to OpenHands' LLMRiskAnalyzer.


        It provides a lightweight security analysis approach that leverages the
        LLM's

        understanding of action context and potential risks.
      properties:
        kind:
          const: LLMSecurityAnalyzer
          title: Kind
          type: string
      title: LLMSecurityAnalyzer
      type: object
    ToolShieldLLMSecurityAnalyzer-Input:
      description: |-
        Evaluate each action via a separate guardrail LLM.

        Pairs with the existing ``ConfirmRisky`` policy unchanged: this
        analyzer only *assigns* the risk level; ``ConfirmRisky`` decides
        whether to pause for user confirmation.

        By default the analyzer runs as a bare guardrail (no distilled
        safety experiences). To enable the ToolShield seed, install
        ``pip install openhands-sdk[toolshield]`` and pass the rendered
        experiences via the ``safety_experiences`` field -- typically via
        one of the helpers (``default_safety_experiences()``,
        ``load_safety_experiences(...)``, ``auto_detect_safety_experiences()``).
        Tested against ``toolshield>=0.1.3,<0.2``.

        Note: ``reasoning_content`` and ``thinking_blocks`` from extended-
        thinking models are deliberately excluded from the guardrail
        context. The risk signal lives in the tool call's name and
        arguments; including reasoning text would inflate the prompt
        without proportional safety gain. Subclasses needing reasoning
        visibility should override :func:`_format_action_for_guardrail`.

        Lifecycle: instances maintain a per-conversation deque of recent
        actions (``history_window`` items) for guardrail context. Each
        instance is intended for SINGLE-CONVERSATION use. Reusing one
        analyzer instance across multiple conversations will leak action
        history between them, which is both a privacy issue (conversation
        A's tool arguments visible in conversation B's guardrail prompt)
        and a correctness issue (the guardrail evaluates conversation B's
        actions against irrelevant history). Construct one analyzer per
        conversation, OR call :meth:`reset_history` at conversation
        boundaries.

        The recent-action-context propagation across analyzers (this one,
        :class:`LLMSecurityAnalyzer`, :class:`GraySwanAnalyzer`) is tracked
        for convergence in a separate follow-up; until that lands,
        single-conversation lifecycle is the contract.

        Failure modes are consistent and ensemble-safe -- both an
        infrastructure error (network, rate limit) and a parse failure
        (the guardrail responded but its output had no parseable
        ``RISK:`` label) return ``SecurityRisk.UNKNOWN``. ``ConfirmRisky``
        with ``confirm_unknown=True`` then pauses for user confirmation,
        matching the conservative posture without dominating ``max()`` in
        ensemble fusion.
      properties:
        history_window:
          default: 20
          description: Number of prior actions to include as context.
          title: History Window
          type: integer
        kind:
          const: ToolShieldLLMSecurityAnalyzer
          title: Kind
          type: string
        llm:
          $ref: '#/components/schemas/LLM-Input'
          description: >-
            LLM used as the guardrail. Can be a smaller/cheaper model than the
            actor LLM; only the model's ability to classify action risk matters.
        safety_experiences:
          default: ''
          description: >-
            Pre-generated safety guidelines injected into the guardrail's system
            prompt.

            - ``""`` (default): bare guardrail -- no experiences. The analyzer
            still separates actor from judge; it just classifies without
            distilled tool-specific guidance.

            - Any non-empty string: used as-is. The intended pattern is to call
            one of the helpers (``default_safety_experiences()``,
            ``load_safety_experiences(tool_names)``,
            ``auto_detect_safety_experiences()``) which require the
            ``[toolshield]`` optional extra (``pip install
            openhands-sdk[toolshield]``). Callers with their own source of
            guidelines can pass any custom string.
          title: Safety Experiences
          type: string
      required:
        - llm
      title: ToolShieldLLMSecurityAnalyzer
      type: object
    LLM-Input:
      description: >-
        Language model interface for OpenHands agents.


        The LLM class provides a unified interface for interacting with various

        language models through the litellm library. It handles model
        configuration,

        API authentication, retry logic, and tool calling capabilities.


        Attributes:
            model: Model name (e.g., "gpt-5.6").
            api_key: API key for authentication.
            base_url: Custom API base URL.
            num_retries: Number of retry attempts for failed requests.
            timeout: Request timeout in seconds.

        Example:
            ```python
            from openhands.sdk import LLM
            from pydantic import SecretStr

            llm = LLM(
                model="gpt-5.6",
                api_key=SecretStr("your-api-key"),
                usage_id="my-agent"
            )
            # Use with agent or conversation
            ```
      properties:
        api_key:
          anyOf:
            - type: string
            - format: password
              type: string
              writeOnly: true
            - type: 'null'
          description: API key.
          openhands_settings:
            depends_on: []
            label: API Key
            prominence: critical
          title: Api Key
        api_mode:
          default: auto
          description: >-
            LLM API endpoint mode. 'auto' resolves from model metadata and SDK
            fallbacks; use 'chat' or 'responses' to override endpoint selection
            for proxy aliases and newly released models.
          enum:
            - auto
            - chat
            - responses
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Api Mode
          type: string
        api_version:
          anyOf:
            - type: string
            - type: 'null'
          description: API version (e.g., Azure).
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Api Version
        auth_type:
          default: api_key
          description: Authentication mode for the LLM.
          enum:
            - api_key
            - subscription
          openhands_settings:
            depends_on: []
            label: Authentication
            prominence: critical
          title: Auth Type
          type: string
        aws_access_key_id:
          anyOf:
            - type: string
            - format: password
              type: string
              writeOnly: true
            - type: 'null'
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Aws Access Key Id
        aws_bedrock_runtime_endpoint:
          anyOf:
            - type: string
            - type: 'null'
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Aws Bedrock Runtime Endpoint
        aws_profile_name:
          anyOf:
            - type: string
            - type: 'null'
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Aws Profile Name
        aws_region_name:
          anyOf:
            - type: string
            - type: 'null'
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Aws Region Name
        aws_role_name:
          anyOf:
            - type: string
            - type: 'null'
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Aws Role Name
        aws_secret_access_key:
          anyOf:
            - type: string
            - format: password
              type: string
              writeOnly: true
            - type: 'null'
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Aws Secret Access Key
        aws_session_name:
          anyOf:
            - type: string
            - type: 'null'
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Aws Session Name
        aws_session_token:
          anyOf:
            - type: string
            - format: password
              type: string
              writeOnly: true
            - type: 'null'
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Aws Session Token
        base_url:
          anyOf:
            - type: string
            - type: 'null'
          description: Custom base URL.
          openhands_settings:
            depends_on: []
            prominence: major
          title: Base Url
        caching_prompt:
          default: true
          description: Enable caching of prompts.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Caching Prompt
          type: boolean
        capability_overrides:
          additionalProperties:
            anyOf:
              - type: boolean
              - type: string
          description: >-
            Explicit model capability overrides. Supported keys include
            supports_reasoning_effort, thinking_mode (adaptive, manual, none, or
            unknown), supports_sampling_params, supports_prompt_cache,
            supports_stop_words, supports_responses_api, supports_vision, and
            supports_prompt_cache_retention. Overrides take precedence over
            LiteLLM metadata and SDK fallbacks.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Capability Overrides
          type: object
        custom_tokenizer:
          anyOf:
            - type: string
            - type: 'null'
          description: A custom tokenizer to use for token counting.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Custom Tokenizer
        disable_stop_word:
          anyOf:
            - type: boolean
            - type: 'null'
          default: false
          description: Disable using of stop word.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Disable Stop Word
        disable_vision:
          anyOf:
            - type: boolean
            - type: 'null'
          description: >-
            If model is vision capable, this option allows to disable image
            processing (useful for cost reduction).
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Disable Vision
        drop_params:
          default: true
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Drop Params
          type: boolean
        enable_encrypted_reasoning:
          default: true
          description: >-
            If True, ask for ['reasoning.encrypted_content'] in Responses API
            include.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Enable Encrypted Reasoning
          type: boolean
        extended_thinking_budget:
          anyOf:
            - type: integer
            - type: 'null'
          default: 200000
          description: >-
            Legacy token budget for models confirmed to use manual Anthropic
            extended thinking. Ignored for adaptive-thinking models. Prefer
            reasoning_effort for new integrations.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Extended Thinking Budget
        extra_headers:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          description: Optional HTTP headers to forward to LiteLLM requests.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Extra Headers
        fallback_strategy:
          anyOf:
            - $ref: '#/components/schemas/FallbackStrategy'
            - type: 'null'
          description: >-
            Optional fallback strategy for trying alternate LLMs on transient
            failure. Construct with
            FallbackStrategy(fallback_llms=[...]).Excluded from serialization;
            must be reconfigured after load.
        force_string_serializer:
          anyOf:
            - type: boolean
            - type: 'null'
          description: >-
            Force using string content serializer when sending to LLM API. If
            None (default), auto-detect based on model. Useful for providers
            that do not support list content, like HuggingFace and Groq.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Force String Serializer
        inline_image_urls:
          anyOf:
            - type: boolean
            - type: 'null'
          description: >-
            If True, fetch any http(s) image URL in outgoing messages and inline
            it as a base64 ``data:`` URL before sending. If None (default),
            auto-detect based on model (some APIs such as Moonshot's public Kimi
            endpoint reject URL-formatted images and require base64). Set this
            explicitly when the model is reached through a proxy alias that
            hides the underlying provider (e.g.
            ``litellm_proxy/<custom-alias>``). Note: inlining only runs when
            ``vision_is_active()`` is True, so the alias must still be
            recognised as vision-capable by the SDK feature registry or proxy
            model metadata.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Inline Image Urls
        input_cost_per_token:
          anyOf:
            - minimum: 0
              type: number
            - type: 'null'
          description: The cost per input token. This will available in logs for user.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Input Cost Per Token
        litellm_extra_body:
          additionalProperties: true
          description: >-
            Additional key-value pairs to pass to litellm's extra_body
            parameter. This is useful for custom inference endpoints that need
            additional parameters for configuration, routing, or advanced
            features. NOTE: Not all LLM providers support extra_body parameters.
            Some providers (e.g., OpenAI) may reject requests with unrecognized
            options. This is commonly supported by: - LiteLLM proxy servers
            (routing metadata, tracing) - vLLM endpoints (return_token_ids,
            etc.) - Custom inference clusters Examples: - Proxy routing:
            {'trace_version': '1.0.0', 'tags': ['agent:my-agent']} - vLLM
            features: {'return_token_ids': True}
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Litellm Extra Body
          type: object
        log_completions:
          default: false
          description: Enable logging of completions.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Log Completions
          type: boolean
        log_completions_folder:
          default: logs/completions
          description: >-
            The folder to log LLM completions to. Required if log_completions is
            True.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Log Completions Folder
          type: string
        max_input_tokens:
          anyOf:
            - minimum: 1
              type: integer
            - type: 'null'
          description: >-
            The maximum number of input tokens. Note that this is currently
            unused, and the value at runtime is actually the total tokens in
            OpenAI (e.g. 128,000 tokens for GPT-4).
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Max Input Tokens
        max_message_chars:
          default: 30000
          description: Approx max chars in each event/content sent to the LLM.
          minimum: 1
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Max Message Chars
          type: integer
        max_output_tokens:
          anyOf:
            - minimum: 1
              type: integer
            - type: 'null'
          description: The maximum number of output tokens. This is sent to the LLM.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Max Output Tokens
        model:
          default: gpt-5.6
          description: Model name.
          openhands_settings:
            depends_on: []
            prominence: critical
          title: Model
          type: string
        model_canonical_name:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Optional canonical model name for feature registry lookups. The
            OpenHands SDK maintains a model feature registry that maps model
            names to capabilities (e.g., vision support, prompt caching,
            responses API support). When using proxied or aliased model
            identifiers, set this field to the canonical model name (e.g.,
            'openai/gpt-4o') to ensure correct capability detection. If not
            provided, the 'model' field will be used for capability lookups.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Model Canonical Name
        native_tool_calling:
          default: true
          description: Whether to use native tool calling.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Native Tool Calling
          type: boolean
        num_retries:
          default: 5
          minimum: 0
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Num Retries
          type: integer
        ollama_base_url:
          anyOf:
            - type: string
            - type: 'null'
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Ollama Base Url
        openrouter_app_name:
          default: OpenHands
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Openrouter App Name
          type: string
        openrouter_site_url:
          default: https://docs.all-hands.dev/
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Openrouter Site Url
          type: string
        output_cost_per_token:
          anyOf:
            - minimum: 0
              type: number
            - type: 'null'
          description: The cost per output token. This will available in logs for user.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Output Cost Per Token
        prompt_cache_retention:
          anyOf:
            - type: string
            - type: 'null'
          default: 24h
          description: >-
            Retention policy for prompt cache. Only sent for supported models
            (GPT-5+ and GPT-4.1, excluding Azure deployments); explicitly
            stripped for all others.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Prompt Cache Retention
        provider_connection_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Optional provider connection whose shared API key and base URL are
            resolved and applied each time this LLM profile is loaded
            (read-at-use). When set, the profile stores no inline api_key or
            base_url of its own.
          openhands_settings:
            depends_on: []
            prominence: major
          title: Provider Connection Id
        reasoning_effort:
          anyOf:
            - enum:
                - low
                - medium
                - high
                - xhigh
                - none
              type: string
            - type: 'null'
          default: high
          description: >-
            Provider-neutral reasoning effort. Common values include 'none',
            'minimal', 'low', 'medium', 'high', 'xhigh', and 'max'. The SDK
            accepts future provider values and lets LiteLLM translate them.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Reasoning Effort
        reasoning_summary:
          anyOf:
            - enum:
                - auto
                - concise
                - detailed
              type: string
            - type: 'null'
          description: >-
            The level of detail for reasoning summaries. This is a string that
            can be one of 'auto', 'concise', or 'detailed'. Requires verified
            OpenAI organization. Only sent when explicitly set.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Reasoning Summary
        retry_max_wait:
          default: 64
          minimum: 0
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Retry Max Wait
          type: integer
        retry_min_wait:
          default: 8
          minimum: 0
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Retry Min Wait
          type: integer
        retry_multiplier:
          default: 8
          minimum: 0
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Retry Multiplier
          type: number
        seed:
          anyOf:
            - type: integer
            - type: 'null'
          description: The seed to use for random number generation.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Seed
        stream:
          default: false
          description: >-
            Enable streaming responses from the LLM. When enabled, the provided
            `on_token` callback in .completions and .responses will be invoked
            for each chunk of tokens.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Stream
          type: boolean
        stream_idle_timeout:
          anyOf:
            - minimum: 0
              type: number
            - type: 'null'
          default: 300
          description: >-
            Maximum seconds between chunks in an asynchronous streaming
            response. Default is 300s (5 minutes); set to None to disable.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Stream Idle Timeout
        subscription_vendor:
          anyOf:
            - const: openai
              type: string
            - type: 'null'
          description: Subscription provider for subscription-backed LLM access.
          openhands_settings:
            depends_on:
              - auth_type
            label: Subscription provider
            prominence: critical
          title: Subscription Vendor
        temperature:
          anyOf:
            - minimum: 0
              type: number
            - type: 'null'
          description: >-
            Sampling temperature for response generation. Defaults to None (uses
            provider default temperature). Set to 0.0 for deterministic outputs,
            or higher values (0.7-1.0) for more creative responses.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Temperature
        timeout:
          anyOf:
            - minimum: 0
              type: integer
            - type: 'null'
          default: 300
          description: >-
            HTTP and hard per-attempt timeout in seconds. Default is 300s (5
            minutes). Set to None to disable the hard timeout.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Timeout
        top_k:
          anyOf:
            - minimum: 0
              type: number
            - type: 'null'
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Top K
        top_p:
          anyOf:
            - maximum: 1
              minimum: 0
              type: number
            - type: 'null'
          description: >-
            Nucleus sampling parameter. Defaults to None (uses provider
            default). Set to a value between 0 and 1 to control diversity of
            outputs.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Top P
        usage_id:
          default: default
          description: >-
            Unique usage identifier for the LLM. Used for registry lookups,
            telemetry, and spend tracking.
          openhands_settings:
            depends_on: []
            prominence: minor
          title: Usage Id
          type: string
      title: LLM
      type: object
    FallbackStrategy:
      description: |-
        Encapsulates fallback behavior for LLM calls.

        When the primary LLM fails with a transient error (after retries),
        this strategy tries alternate LLMs loaded from LLMProfileStore profiles.
        Fallback is per-call: each new request starts with the primary model.
      properties:
        fallback_llms:
          description: Ordered list of LLM profile names to try on transient failure.
          items:
            type: string
          title: Fallback Llms
          type: array
        profile_store_dir:
          anyOf:
            - type: string
            - format: path
              type: string
            - type: 'null'
          description: >-
            Path to directory containing profiles. If not specified, defaults to
            `.openhands/profiles`.
          title: Profile Store Dir
      required:
        - fallback_llms
      title: FallbackStrategy
      type: object
  securitySchemes:
    APIKeyHeader:
      in: header
      name: X-Session-API-Key
      type: apiKey

````

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