{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ModelsJson",
  "description": "`ModelsConfigSchema`.",
  "type": "object",
  "properties": {
    "$schema": {
      "type": [
        "string"
      ]
    },
    "providers": {
      "description": "Insertion-ordered (upstream `Map` preserves key insertion order in\n`getProviderIds`).",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/ModelsJsonProvider"
      }
    }
  },
  "required": [
    "providers"
  ],
  "$defs": {
    "ModelsJsonProvider": {
      "description": "`ProviderConfigSchema`.",
      "type": "object",
      "properties": {
        "name": {
          "type": [
            "string"
          ],
          "minLength": 1
        },
        "baseUrl": {
          "type": [
            "string"
          ],
          "minLength": 1
        },
        "apiKey": {
          "type": [
            "string"
          ],
          "minLength": 1
        },
        "api": {
          "type": [
            "string"
          ],
          "minLength": 1
        },
        "oauth": {
          "anyOf": [
            {
              "$ref": "#/$defs/ModelsJsonOAuth"
            }
          ]
        },
        "headers": {
          "type": [
            "object"
          ],
          "additionalProperties": {
            "type": "string"
          }
        },
        "compat": {
          "anyOf": [
            {
              "$ref": "#/$defs/ModelCompat"
            }
          ]
        },
        "authHeader": {
          "type": [
            "boolean"
          ]
        },
        "models": {
          "type": [
            "array"
          ],
          "items": {
            "$ref": "#/$defs/ModelsJsonModel"
          }
        },
        "modelOverrides": {
          "description": "Insertion-ordered (upstream `Record<string, ModelOverrideSchema>` keeps\nkey insertion order).",
          "type": [
            "object"
          ],
          "additionalProperties": {
            "$ref": "#/$defs/ModelsJsonModelOverride"
          }
        }
      }
    },
    "ModelsJsonOAuth": {
      "type": "string",
      "enum": [
        "radius"
      ]
    },
    "ModelCompat": {
      "description": "Merged compat settings for OpenAI-completions / OpenAI-responses /\nAnthropic-messages / Bedrock / System One APIs (see file header note for\nwhy this is one flat struct). All fields optional; absent fields are\nomitted on the wire, matching upstream objects.",
      "type": "object",
      "properties": {
        "supportsStore": {
          "description": "Whether the provider supports the `store` field.",
          "type": [
            "boolean"
          ]
        },
        "supportsDeveloperRole": {
          "description": "Whether the provider supports the `developer` role (vs `system`).\nAlso in OpenAIResponsesCompat.",
          "type": [
            "boolean"
          ]
        },
        "supportsReasoningEffort": {
          "description": "Whether the provider supports `reasoning_effort`.",
          "type": [
            "boolean"
          ]
        },
        "supportsUsageInStreaming": {
          "description": "Whether the provider supports `stream_options: { include_usage: true }`.",
          "type": [
            "boolean"
          ]
        },
        "supportsFinishReason": {
          "description": "Whether streamed responses include `finish_reason`. When false, pi\ninfers `stop` or `toolUse` when the stream ends. Default: true.",
          "type": [
            "boolean"
          ]
        },
        "maxTokensField": {
          "description": "Which field to use for max tokens.",
          "anyOf": [
            {
              "$ref": "#/$defs/MaxTokensField"
            }
          ]
        },
        "requiresToolResultName": {
          "description": "Whether tool results require the `name` field.",
          "type": [
            "boolean"
          ]
        },
        "requiresAssistantAfterToolResult": {
          "description": "Whether a user message after tool results requires an assistant message\nin between.",
          "type": [
            "boolean"
          ]
        },
        "requiresThinkingAsText": {
          "description": "Whether thinking blocks must be converted to text blocks with\n`<thinking>` delimiters.",
          "type": [
            "boolean"
          ]
        },
        "requiresReasoningContentOnAssistantMessages": {
          "description": "Whether all replayed assistant messages must include an empty\n`reasoning_content` field when reasoning is enabled.",
          "type": [
            "boolean"
          ]
        },
        "thinkingFormat": {
          "description": "Format for the reasoning/thinking parameter.",
          "anyOf": [
            {
              "$ref": "#/$defs/ThinkingFormat"
            }
          ]
        },
        "chatTemplateKwargs": {
          "description": "Kwargs sent as `chat_template_kwargs` when `thinking_format` is\n`chat-template`.",
          "type": [
            "object"
          ],
          "additionalProperties": {
            "$ref": "#/$defs/ChatTemplateKwargValue"
          }
        },
        "chatTemplateArgs": {
          "description": "Arguments sent as `chat_template_args` when `thinking_format` is\n`baseten` (the Baseten thinking branch itself is T26 scope; the field\nis threaded through here so models.json entries round-trip).",
          "type": [
            "object"
          ],
          "additionalProperties": {
            "$ref": "#/$defs/ChatTemplateKwargValue"
          }
        },
        "openRouterRouting": {
          "description": "OpenRouter routing preferences, sent as the `provider` request field.",
          "anyOf": [
            {
              "$ref": "#/$defs/OpenRouterRouting"
            }
          ]
        },
        "vercelGatewayRouting": {
          "description": "Vercel AI Gateway routing preferences.",
          "anyOf": [
            {
              "$ref": "#/$defs/VercelGatewayRouting"
            }
          ]
        },
        "zaiToolStream": {
          "description": "Whether z.ai supports top-level `tool_stream: true`.",
          "type": [
            "boolean"
          ]
        },
        "supportsThinkingTokenBudget": {
          "description": "Whether the provider supports top-level `thinking_token_budget` to cap\nreasoning tokens (vLLM). Reasoning and the answer share `max_tokens`\non these endpoints, so without a budget a reasoning-heavy turn can\nconsume the whole response and emit no answer. Default: false.",
          "type": [
            "boolean"
          ]
        },
        "thinkingTokenBudgetField": {
          "description": "b23741269 (#8275): the top-level request field carrying the thinking\nbudget — `thinking_token_budget` (vLLM) / `thinking_budget`\n(Qwen-SGLang) / `thinking_budget_tokens` (llama.cpp).\n`supports_thinking_token_budget` is the `thinking_token_budget`\nalias (field wins when both are set).",
          "anyOf": [
            {
              "$ref": "#/$defs/ThinkingTokenBudgetField"
            }
          ]
        },
        "vllmPriority": {
          "description": "256f63024 (#9004): vLLM scheduler priority, sent as the top-level\n`priority` request field when set.",
          "type": [
            "number"
          ],
          "format": "double"
        },
        "supportsMaxOutputTokens": {
          "description": "b8b873b98 (#8941): whether the Responses `max_output_tokens` field is\naccepted. Default: true; some Codex-protocol gateways reject it.",
          "type": [
            "boolean"
          ]
        },
        "supportsOpenAIGrammarTools": {
          "description": "Whether the provider supports OpenAI custom tools with Lark/regex\ngrammar formats. Also in OpenAIResponsesCompat.",
          "type": [
            "boolean"
          ]
        },
        "supportsStrictMode": {
          "description": "Whether the provider supports the `strict` field in tool definitions.\nAlso in OpenAIResponsesCompat (strict JSON-schema function tools) and\nBedrockCompat (Bedrock strict tool schemas).",
          "type": [
            "boolean"
          ]
        },
        "cacheControlFormat": {
          "description": "Cache control convention for prompt caching.",
          "anyOf": [
            {
              "$ref": "#/$defs/CacheControlFormat"
            }
          ]
        },
        "sendSessionAffinityHeaders": {
          "description": "Whether to send session-affinity data from `options.session_id`.\nDefault: true for OpenRouter endpoints, false otherwise (#9102).\nAlso in AnthropicMessagesCompat.",
          "type": [
            "boolean"
          ]
        },
        "sessionAffinityFormat": {
          "description": "Session-affinity header format. Also in OpenAIResponsesCompat; the\nAnthropic Messages adapter consumes it too (#9102: `openrouter`\nselects `x-session-id`, unset keeps `x-session-affinity`).",
          "anyOf": [
            {
              "$ref": "#/$defs/SessionAffinityFormat"
            }
          ]
        },
        "supportsLongCacheRetention": {
          "description": "Whether the provider supports long prompt cache retention. Also in\nOpenAIResponsesCompat and AnthropicMessagesCompat.",
          "type": [
            "boolean"
          ]
        },
        "supportsAdditionalTools": {
          "description": "Whether the model supports message-anchored `additional_tools` input\nitems. Default: false.",
          "type": [
            "boolean"
          ]
        },
        "supportsToolSearch": {
          "description": "Whether the model supports client-executed tool search for deferred tools.",
          "type": [
            "boolean"
          ]
        },
        "supportsExplicitPromptCacheMode": {
          "description": "Whether the model accepts `prompt_cache_options` (OpenAI GPT-5.6+\nexplicit prompt caching).",
          "type": [
            "boolean"
          ]
        },
        "supportsEagerToolInputStreaming": {
          "description": "Whether the provider accepts per-tool `eager_input_streaming`.",
          "type": [
            "boolean"
          ]
        },
        "supportsCacheControlOnTools": {
          "description": "Whether the provider supports Anthropic-style `cache_control` markers\non tool definitions.",
          "type": [
            "boolean"
          ]
        },
        "supportsTemperature": {
          "description": "Whether the model accepts the Anthropic `temperature` request field.",
          "type": [
            "boolean"
          ]
        },
        "forceAdaptiveThinking": {
          "description": "Whether to force adaptive thinking (`thinking.type: \"adaptive\"` plus\n`output_config.effort`) regardless of the model id.",
          "type": [
            "boolean"
          ]
        },
        "allowEmptySignature": {
          "description": "Whether to replay empty thinking signatures as `signature: \"\"` instead\nof converting thinking to text.",
          "type": [
            "boolean"
          ]
        },
        "supportsStrictTools": {
          "description": "Whether the provider supports Anthropic strict tool schemas.",
          "type": [
            "boolean"
          ]
        },
        "supportsMidConvoEffort": {
          "description": "Whether the exact model transport supports effort-only system messages\nand thinking binding controls (types.ts:716, 4e69b0c28). Default:\nfalse; catalog gating rules are V14-09 scope.",
          "type": [
            "boolean"
          ]
        },
        "allowedFallbackModels": {
          "description": "Models Anthropic accepts in `fallbacks` for server-side refusal\nfallback, with local pricing metadata for returned fallback\nresponses (types.ts:718-723, eb1f87fa9). When absent or empty the\n`fallbacks` request field must be omitted — Anthropic rejects it for\nmodels with no permitted fallback targets.",
          "type": [
            "array"
          ],
          "items": {
            "$ref": "#/$defs/AnthropicAllowedFallbackModel"
          }
        },
        "supportsMidConvoSystemMessages": {
          "description": "Whether the model accepts system messages / Kimi-style tool-bearing\nsystem messages after the conversation started (#9548, 9e05370b2 —\nreplaces the earlier `supportsToolReferences` catalog face, which\nleft the type surface with the deferred-tool mechanism). Declared\nin OpenAI-completions/responses and Anthropic-messages compat;\ncatalog bake rules are V15-03 data sync, wire semantics V15-06.",
          "type": [
            "boolean"
          ]
        },
        "supportsMidConvoToolAdditions": {
          "description": "Whether tool additions can ride system messages mid-conversation\n(Kimi K3 family: Moonshot, Fireworks, OpenCode; not GitHub Copilot).",
          "type": [
            "boolean"
          ]
        },
        "supportsMidConvoToolChanges": {
          "description": "Whether the transport accepts `tool_addition`/`tool_removal` blocks\n(first-party Anthropic only; proxies reject them).",
          "type": [
            "boolean"
          ]
        },
        "imageInput": {
          "description": "How a System One service accepts classifier images.",
          "anyOf": [
            {
              "$ref": "#/$defs/SystemOneImageInput"
            }
          ]
        },
        "sendImageOptInHeader": {
          "description": "Whether image requests send `TypeSafe-Danger-Zone-Images: true`.",
          "type": [
            "boolean"
          ]
        }
      }
    },
    "MaxTokensField": {
      "description": "`OpenAICompletionsCompat.maxTokensField`.",
      "type": "string",
      "enum": [
        "max_completion_tokens",
        "max_tokens"
      ]
    },
    "ThinkingFormat": {
      "description": "`OpenAICompletionsCompat.thinkingFormat` (11 values).",
      "oneOf": [
        {
          "description": "Uses `reasoning_effort`. Default.",
          "type": "string",
          "const": "openai"
        },
        {
          "description": "Uses `reasoning: { effort }`.",
          "type": "string",
          "const": "openrouter"
        },
        {
          "description": "Uses `thinking: { type }` plus `reasoning_effort` when supported.",
          "type": "string",
          "const": "deepseek"
        },
        {
          "description": "Uses `reasoning: { enabled }` plus `reasoning_effort` when supported.",
          "type": "string",
          "const": "together"
        },
        {
          "description": "Uses `thinking: { type }`.",
          "type": "string",
          "const": "zai"
        },
        {
          "description": "Uses top-level `enable_thinking: boolean`.",
          "type": "string",
          "const": "qwen"
        },
        {
          "description": "Uses configurable `chat_template_kwargs`.",
          "type": "string",
          "const": "chat-template"
        },
        {
          "description": "Uses `chat_template_kwargs.enable_thinking` and `preserve_thinking`.",
          "type": "string",
          "const": "qwen-chat-template"
        },
        {
          "description": "Uses top-level `thinking: string`.",
          "type": "string",
          "const": "string-thinking"
        },
        {
          "description": "Uses `chat_template_args` (Baseten-specific) plus optional\n`reasoning_effort` when the model supports it.\nPort of `openai-completions.ts:779` @ `c1019d920` / `4181f66`.",
          "type": "string",
          "const": "baseten"
        },
        {
          "description": "Uses `reasoning: { effort }` only when the mapped effort is non-null.",
          "type": "string",
          "const": "ant-ling"
        }
      ]
    },
    "ChatTemplateKwargValue": {
      "description": "`ChatTemplateKwargValue`.",
      "anyOf": [
        {
          "description": "`{ $var: \"thinking.enabled\" | \"thinking.effort\", omitWhenOff?: boolean }`",
          "$ref": "#/$defs/ChatTemplateKwargVar"
        },
        {
          "description": "Plain `string | number | boolean | null`."
        }
      ]
    },
    "ChatTemplateKwargVar": {
      "type": "object",
      "properties": {
        "$var": {
          "$ref": "#/$defs/ChatTemplateKwargVarKind"
        },
        "omitWhenOff": {
          "type": [
            "boolean"
          ]
        }
      },
      "required": [
        "$var"
      ]
    },
    "ChatTemplateKwargVarKind": {
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "thinking.enabled",
            "thinking.effort"
          ]
        },
        {
          "description": "b23741269 (#8275): the clamped thinking budget (same value the\ntop-level budget field would carry).",
          "type": "string",
          "const": "thinking.budget"
        }
      ]
    },
    "OpenRouterRouting": {
      "description": "`OpenRouterRouting` — controls which upstream providers OpenRouter routes\nrequests to. Sent as the `provider` field in the OpenRouter API request\nbody. Field names are snake_case upstream (unlike the rest of the model\ncatalog), so no rename rule is applied here.",
      "type": "object",
      "properties": {
        "allow_fallbacks": {
          "description": "Whether to allow backup providers to serve requests. Default: true.",
          "type": [
            "boolean"
          ]
        },
        "require_parameters": {
          "description": "Filter to providers supporting all parameters in the request.",
          "type": [
            "boolean"
          ]
        },
        "data_collection": {
          "description": "Data collection setting.",
          "anyOf": [
            {
              "$ref": "#/$defs/DataCollection"
            }
          ]
        },
        "zdr": {
          "description": "Restrict to ZDR (Zero Data Retention) endpoints.",
          "type": [
            "boolean"
          ]
        },
        "enforce_distillable_text": {
          "description": "Restrict to models that allow text distillation.",
          "type": [
            "boolean"
          ]
        },
        "order": {
          "description": "Ordered list of provider names/slugs to try in sequence.",
          "type": [
            "array"
          ],
          "items": {
            "type": "string"
          }
        },
        "only": {
          "description": "Provider names/slugs to exclusively allow.",
          "type": [
            "array"
          ],
          "items": {
            "type": "string"
          }
        },
        "ignore": {
          "description": "Provider names/slugs to skip.",
          "type": [
            "array"
          ],
          "items": {
            "type": "string"
          }
        },
        "quantizations": {
          "description": "Quantization levels to filter by.",
          "type": [
            "array"
          ],
          "items": {
            "type": "string"
          }
        },
        "sort": {
          "description": "Sorting strategy.",
          "anyOf": [
            {
              "$ref": "#/$defs/OpenRouterSort"
            }
          ]
        },
        "max_price": {
          "description": "Maximum price per million tokens (USD).",
          "anyOf": [
            {
              "$ref": "#/$defs/OpenRouterMaxPrice"
            }
          ]
        },
        "preferred_min_throughput": {
          "description": "Preferred minimum throughput (tokens/second).",
          "anyOf": [
            {
              "$ref": "#/$defs/OpenRouterThroughput"
            }
          ]
        },
        "preferred_max_latency": {
          "description": "Preferred maximum latency (seconds).",
          "anyOf": [
            {
              "$ref": "#/$defs/OpenRouterLatency"
            }
          ]
        }
      }
    },
    "DataCollection": {
      "description": "`OpenRouterRouting.data_collection`.",
      "type": "string",
      "enum": [
        "deny",
        "allow"
      ]
    },
    "OpenRouterSort": {
      "description": "`OpenRouterRouting.sort` — string or object form.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/OpenRouterSortSpec"
        }
      ]
    },
    "OpenRouterSortSpec": {
      "type": "object",
      "properties": {
        "by": {
          "description": "The sorting metric: \"price\", \"throughput\", \"latency\".",
          "type": [
            "string"
          ]
        },
        "partition": {
          "description": "Partitioning strategy: \"model\" (default) or \"none\".",
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "OpenRouterMaxPrice": {
      "description": "`OpenRouterRouting.max_price` — prices per million tokens (USD).",
      "type": "object",
      "properties": {
        "prompt": {
          "anyOf": [
            {
              "$ref": "#/$defs/NumberOrString"
            }
          ]
        },
        "completion": {
          "anyOf": [
            {
              "$ref": "#/$defs/NumberOrString"
            }
          ]
        },
        "image": {
          "anyOf": [
            {
              "$ref": "#/$defs/NumberOrString"
            }
          ]
        },
        "audio": {
          "anyOf": [
            {
              "$ref": "#/$defs/NumberOrString"
            }
          ]
        },
        "request": {
          "anyOf": [
            {
              "$ref": "#/$defs/NumberOrString"
            }
          ]
        }
      }
    },
    "NumberOrString": {
      "description": "JSON `number | string` union (used by diagnostic error codes and OpenRouter\nrouting prices).",
      "anyOf": [
        {
          "type": "number",
          "format": "double"
        },
        {
          "type": "string"
        }
      ]
    },
    "OpenRouterThroughput": {
      "description": "`OpenRouterRouting.preferred_min_throughput` — number or percentile object.",
      "anyOf": [
        {
          "type": "number",
          "format": "double"
        },
        {
          "$ref": "#/$defs/OpenRouterPercentiles"
        }
      ]
    },
    "OpenRouterPercentiles": {
      "type": "object",
      "properties": {
        "p50": {
          "type": [
            "number"
          ],
          "format": "double"
        },
        "p75": {
          "type": [
            "number"
          ],
          "format": "double"
        },
        "p90": {
          "type": [
            "number"
          ],
          "format": "double"
        },
        "p99": {
          "type": [
            "number"
          ],
          "format": "double"
        }
      }
    },
    "OpenRouterLatency": {
      "description": "`OpenRouterRouting.preferred_max_latency` — number or percentile object.",
      "anyOf": [
        {
          "type": "number",
          "format": "double"
        },
        {
          "$ref": "#/$defs/OpenRouterPercentiles"
        }
      ]
    },
    "VercelGatewayRouting": {
      "description": "`VercelGatewayRouting` — routing preferences for Vercel AI Gateway.",
      "type": "object",
      "properties": {
        "only": {
          "description": "Provider slugs to exclusively use (e.g. [\"bedrock\", \"anthropic\"]).",
          "type": [
            "array"
          ],
          "items": {
            "type": "string"
          }
        },
        "order": {
          "description": "Provider slugs to try in order.",
          "type": [
            "array"
          ],
          "items": {
            "type": "string"
          }
        }
      }
    },
    "ThinkingTokenBudgetField": {
      "description": "`OpenAICompletionsCompat.thinkingTokenBudgetField` (b23741269/#8275):\nthe top-level request field carrying the thinking budget.",
      "type": "string",
      "enum": [
        "thinking_token_budget",
        "thinking_budget",
        "thinking_budget_tokens"
      ]
    },
    "CacheControlFormat": {
      "description": "`OpenAICompletionsCompat.cacheControlFormat`.",
      "oneOf": [
        {
          "description": "Anthropic-style `cache_control` markers on the system prompt, last tool\ndefinition, and last user/assistant/tool-result text content.",
          "type": "string",
          "const": "anthropic"
        }
      ]
    },
    "SessionAffinityFormat": {
      "description": "`SessionAffinityFormat = \"openai\" | \"openai-nosession\" | \"openrouter\"`.",
      "type": "string",
      "enum": [
        "openai",
        "openai-nosession",
        "openrouter"
      ]
    },
    "AnthropicAllowedFallbackModel": {
      "description": "`AnthropicAllowedFallbackModel` (types.ts:307-311): one server-side\nrefusal-fallback target with its local pricing.",
      "type": "object",
      "properties": {
        "provider": {
          "type": "string",
          "minLength": 1
        },
        "model": {
          "type": "string",
          "minLength": 1
        },
        "cost": {
          "$ref": "#/$defs/ModelCost"
        }
      },
      "required": [
        "provider",
        "model",
        "cost"
      ]
    },
    "ModelCost": {
      "description": "`ModelCost extends ModelCostRates`.",
      "type": "object",
      "properties": {
        "input": {
          "type": "number",
          "format": "double"
        },
        "output": {
          "type": "number",
          "format": "double"
        },
        "cacheRead": {
          "type": "number",
          "format": "double"
        },
        "cacheWrite": {
          "type": "number",
          "format": "double"
        },
        "tiers": {
          "description": "Request-wide pricing tiers. The highest matching input threshold\napplies to the full request.",
          "type": [
            "array"
          ],
          "items": {
            "$ref": "#/$defs/ModelCostTier"
          }
        }
      },
      "required": [
        "input",
        "output",
        "cacheRead",
        "cacheWrite"
      ]
    },
    "ModelCostTier": {
      "description": "`ModelCostTier extends ModelCostRates`.",
      "type": "object",
      "properties": {
        "input": {
          "type": "number",
          "format": "double"
        },
        "output": {
          "type": "number",
          "format": "double"
        },
        "cacheRead": {
          "type": "number",
          "format": "double"
        },
        "cacheWrite": {
          "type": "number",
          "format": "double"
        },
        "inputTokensAbove": {
          "description": "Use this tier for requests whose total input usage exceeds this token count.",
          "type": "integer",
          "format": "uint64",
          "minimum": 0
        }
      },
      "required": [
        "input",
        "output",
        "cacheRead",
        "cacheWrite",
        "inputTokensAbove"
      ]
    },
    "SystemOneImageInput": {
      "description": "`SystemOneCompat.imageInput`: the wire representation used for classifier\nimages (7f225f25d).",
      "type": "string",
      "enum": [
        "assets",
        "images",
        "state-image-urls"
      ]
    },
    "ModelsJsonModel": {
      "description": "`ModelDefinitionSchema`.",
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "name": {
          "type": [
            "string"
          ],
          "minLength": 1
        },
        "api": {
          "type": [
            "string"
          ],
          "minLength": 1
        },
        "baseUrl": {
          "type": [
            "string"
          ],
          "minLength": 1
        },
        "reasoning": {
          "type": [
            "boolean"
          ]
        },
        "thinkingLevelMap": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "high": {
              "type": [
                "string",
                "null"
              ]
            },
            "low": {
              "type": [
                "string",
                "null"
              ]
            },
            "max": {
              "type": [
                "string",
                "null"
              ]
            },
            "medium": {
              "type": [
                "string",
                "null"
              ]
            },
            "minimal": {
              "type": [
                "string",
                "null"
              ]
            },
            "off": {
              "type": [
                "string",
                "null"
              ]
            },
            "xhigh": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "additionalProperties": false
        },
        "input": {
          "type": [
            "array"
          ],
          "items": {
            "$ref": "#/$defs/InputModality"
          }
        },
        "inputLimits": {
          "description": "`ModelDefinitionSchema.inputLimits` (#9631): carried verbatim onto\nthe runtime model (`modelFromJson`, provider-composer.ts:163).",
          "anyOf": [
            {
              "$ref": "#/$defs/ModelInputLimits"
            }
          ]
        },
        "cost": {
          "anyOf": [
            {
              "$ref": "#/$defs/ModelCost"
            }
          ]
        },
        "promptCache": {
          "description": "`ModelDefinitionSchema.promptCache` (#9668): unset disables cache\nwarming for the model.",
          "anyOf": [
            {
              "$ref": "#/$defs/ModelsJsonPromptCache"
            }
          ]
        },
        "contextWindow": {
          "type": [
            "number"
          ],
          "format": "double",
          "exclusiveMinimum": 0.0
        },
        "maxTokens": {
          "type": [
            "number"
          ],
          "format": "double",
          "exclusiveMinimum": 0.0
        },
        "samplingParams": {
          "description": "25a2c8dcf (#7568): default sampling parameters for this model.",
          "type": [
            "object"
          ],
          "additionalProperties": true
        },
        "samplingParamsByThinkingLevel": {
          "description": "`ModelDefinitionSchema.samplingParamsByThinkingLevel` (v1.0.2,\n#9776; R2.3.1): carried verbatim onto the runtime model.",
          "type": [
            "object"
          ],
          "properties": {
            "high": {
              "type": "object",
              "additionalProperties": true
            },
            "low": {
              "type": "object",
              "additionalProperties": true
            },
            "max": {
              "type": "object",
              "additionalProperties": true
            },
            "medium": {
              "type": "object",
              "additionalProperties": true
            },
            "minimal": {
              "type": "object",
              "additionalProperties": true
            },
            "off": {
              "type": "object",
              "additionalProperties": true
            },
            "xhigh": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "additionalProperties": false
        },
        "headers": {
          "type": [
            "object"
          ],
          "additionalProperties": {
            "type": "string"
          }
        },
        "compat": {
          "anyOf": [
            {
              "$ref": "#/$defs/ModelCompat"
            }
          ]
        }
      },
      "required": [
        "id"
      ]
    },
    "InputModality": {
      "description": "`Model.input` entry: `\"text\" | \"image\"`.",
      "type": "string",
      "enum": [
        "text",
        "image"
      ]
    },
    "ModelInputLimits": {
      "description": "`ModelInputLimits` (types.ts:974-978): provider input limits and\ncache-safe preprocessing metadata (#9631). Parsing is additive — unknown\nfields are ignored and a missing `inputLimits` yields `None` (models keep\ntheir historical behavior; zero-regression red line).",
      "type": "object",
      "properties": {
        "maxRequestBytes": {
          "description": "Maximum serialized provider request size in bytes.",
          "type": [
            "integer"
          ],
          "format": "uint64",
          "minimum": 1
        },
        "images": {
          "anyOf": [
            {
              "$ref": "#/$defs/ModelImageInputLimits"
            }
          ]
        }
      }
    },
    "ModelImageInputLimits": {
      "description": "`ModelImageInputLimits` (types.ts:966-972).",
      "type": "object",
      "properties": {
        "resize": {
          "description": "Cache-safe resize profile applied before a new image enters history.",
          "anyOf": [
            {
              "$ref": "#/$defs/ModelImageResizeOptions"
            }
          ]
        },
        "maxPerMessage": {
          "description": "Maximum images accepted in one provider message.",
          "type": [
            "integer"
          ],
          "format": "uint32",
          "minimum": 1
        },
        "maxPerRequest": {
          "description": "Maximum images accepted across one provider request.",
          "type": [
            "integer"
          ],
          "format": "uint32",
          "minimum": 1
        }
      }
    },
    "ModelImageResizeOptions": {
      "description": "`ModelImageResizeOptions` (types.ts:958-964, #9631 / f5c946480):\ncache-safe resize profile applied before a new image enters conversation\nhistory. Every key is optional — unset keys keep the caller's defaults\n(rpi's historical global limits in `rpi::tools::image_process`).",
      "type": "object",
      "properties": {
        "maxWidth": {
          "type": [
            "integer"
          ],
          "format": "uint32",
          "minimum": 1
        },
        "maxHeight": {
          "type": [
            "integer"
          ],
          "format": "uint32",
          "minimum": 1
        },
        "maxBytes": {
          "description": "Maximum base64-encoded payload size in bytes.",
          "type": [
            "integer"
          ],
          "format": "uint64",
          "minimum": 1
        },
        "jpegQuality": {
          "type": [
            "integer"
          ],
          "format": "uint32",
          "minimum": 1,
          "maximum": 100
        }
      }
    },
    "ModelsJsonPromptCache": {
      "description": "`ModelPromptCacheSchema` (#9668, c596d09d9; model-config.ts:139-142):\nbest-effort prompt cache lifetime in seconds per retention tier.",
      "type": "object",
      "properties": {
        "short": {
          "type": [
            "integer"
          ],
          "format": "uint32",
          "minimum": 0,
          "exclusiveMinimum": 0.0
        },
        "long": {
          "type": [
            "integer"
          ],
          "format": "uint32",
          "minimum": 0,
          "exclusiveMinimum": 0.0
        }
      }
    },
    "ModelsJsonModelOverride": {
      "description": "`ModelOverrideSchema`.",
      "type": "object",
      "properties": {
        "name": {
          "type": [
            "string"
          ],
          "minLength": 1
        },
        "reasoning": {
          "type": [
            "boolean"
          ]
        },
        "thinkingLevelMap": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "high": {
              "type": [
                "string",
                "null"
              ]
            },
            "low": {
              "type": [
                "string",
                "null"
              ]
            },
            "max": {
              "type": [
                "string",
                "null"
              ]
            },
            "medium": {
              "type": [
                "string",
                "null"
              ]
            },
            "minimal": {
              "type": [
                "string",
                "null"
              ]
            },
            "off": {
              "type": [
                "string",
                "null"
              ]
            },
            "xhigh": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "additionalProperties": false
        },
        "input": {
          "type": [
            "array"
          ],
          "items": {
            "$ref": "#/$defs/InputModality"
          }
        },
        "inputLimits": {
          "description": "`ModelOverrideSchema.inputLimits` (#9631): merged over the catalog\nvalue (`mergeInputLimits`, provider-composer.ts:110-130). Same wire\nshape as the catalog type (model-config.ts:143-158).",
          "anyOf": [
            {
              "$ref": "#/$defs/ModelInputLimits"
            }
          ]
        },
        "cost": {
          "anyOf": [
            {
              "$ref": "#/$defs/ModelsJsonModelOverrideCost"
            }
          ]
        },
        "promptCache": {
          "description": "`ModelOverrideSchema.promptCache` (#9668): merged per tier with the\ncatalog value.",
          "anyOf": [
            {
              "$ref": "#/$defs/ModelsJsonPromptCache"
            }
          ]
        },
        "contextWindow": {
          "type": [
            "number"
          ],
          "format": "double",
          "exclusiveMinimum": 0.0
        },
        "maxTokens": {
          "type": [
            "number"
          ],
          "format": "double",
          "exclusiveMinimum": 0.0
        },
        "samplingParams": {
          "description": "25a2c8dcf (#7568): default sampling parameters for this model.",
          "type": [
            "object"
          ],
          "additionalProperties": true
        },
        "samplingParamsByThinkingLevel": {
          "description": "`ModelOverrideSchema.samplingParamsByThinkingLevel` (v1.0.2, #9776;\nR2.3.1): merged per level and per key over the catalog value.",
          "type": [
            "object"
          ],
          "properties": {
            "high": {
              "type": "object",
              "additionalProperties": true
            },
            "low": {
              "type": "object",
              "additionalProperties": true
            },
            "max": {
              "type": "object",
              "additionalProperties": true
            },
            "medium": {
              "type": "object",
              "additionalProperties": true
            },
            "minimal": {
              "type": "object",
              "additionalProperties": true
            },
            "off": {
              "type": "object",
              "additionalProperties": true
            },
            "xhigh": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "additionalProperties": false
        },
        "headers": {
          "type": [
            "object"
          ],
          "additionalProperties": {
            "type": "string"
          }
        },
        "compat": {
          "anyOf": [
            {
              "$ref": "#/$defs/ModelCompat"
            }
          ]
        }
      }
    },
    "ModelsJsonModelOverrideCost": {
      "description": "`ModelOverrideSchema.cost` — every rate optional (partial override).",
      "type": "object",
      "properties": {
        "input": {
          "type": [
            "number"
          ],
          "format": "double"
        },
        "output": {
          "type": [
            "number"
          ],
          "format": "double"
        },
        "cacheRead": {
          "type": [
            "number"
          ],
          "format": "double"
        },
        "cacheWrite": {
          "type": [
            "number"
          ],
          "format": "double"
        },
        "tiers": {
          "type": [
            "array"
          ],
          "items": {
            "$ref": "#/$defs/ModelCostTier"
          }
        }
      }
    }
  },
  "$id": "https://revpi.dev/schemas/models.schema.json",
  "$comment": "Generated from the rpi typed configuration models by scripts/sync-config-schemas.py. Do not edit it manually; run the script to regenerate."
}
