Skip to documentation content

Models Configuration

This reference lists the fields of models.json. See Configure a compatible endpoint for examples and Configuration for the file location.

Add "$schema": "https://pi.dev/schemas/models.schema.json" to models.json for editor validation and completion.

Providers

Each key under providers is a provider ID. A built-in provider ID changes that provider. Any other ID adds a provider, which needs baseUrl and an api at provider or model level.

FieldTypeDefaultDescription
namestringDisplay name.
baseUrlstringAPI base URL. Also applies to the provider's built-in models.
apiKeystringLiteral key, "$NAME" environment interpolation, or "!command" output.
apistringAPI for the provider's models, such as "openai-completions", "openai-responses", "anthropic-messages", or "google-generative-ai".
oauth"radius"OAuth login flow. Requires baseUrl.
headersobjectRequest headers. Values resolve like apiKey.
compatobjectProvider and model compatibility overrides.
authHeaderbooleanfalseWhether to send the resolved API key as Authorization: Bearer.
modelsobject[]
modelOverridesobject

Models

Each models entry adds a model to the provider. An entry whose id matches an existing model replaces it.

FieldTypeDefaultDescription
idstringRequired. Model ID sent to the API.
namestringDisplay name, also matched by --model patterns.
apistringOverrides the provider api.
baseUrlstringOverrides the provider baseUrl.
reasoningbooleanfalseWhether the model supports thinking.
thinkingLevelMapobjectProvider value sent for each thinking level. A string is sent to the provider; null hides the level. Levels left out use the provider's default value for off through high; xhigh and max are opt-in and only offered when mapped to a string.
input("text" | "image")[]["text"]
inputLimitsobject
costobject
cost.inputnumberRequired. Input cost in USD per million tokens.
cost.outputnumberRequired. Output cost in USD per million tokens.
cost.cacheReadnumberRequired. Cache-read cost in USD per million tokens.
cost.cacheWritenumberRequired. Cache-write cost in USD per million tokens.
cost.imageOutputnumberImage output cost in USD per million tokens, for models that generate images. Image output tokens use this rate and the rest of output (text and reasoning) uses output. Unset means image tokens cost output.
cost.tiersobject[]Request-wide pricing tiers. The highest matching input threshold applies to the full request.
cost.tiers[].inputTokensAbovenumberRequired. Use this tier when total request input exceeds this token count.
cost.tiers[].inputnumberRequired. Input cost in USD per million tokens.
cost.tiers[].outputnumberRequired. Output cost in USD per million tokens.
cost.tiers[].cacheReadnumberRequired. Cache-read cost in USD per million tokens.
cost.tiers[].cacheWritenumberRequired. Cache-write cost in USD per million tokens.
promptCacheobjectBest-effort prompt cache lifetime in seconds for the short and long retention tiers. Pi warms only tiers with a known lifetime.
contextWindownumber128000Context window in tokens.
maxTokensnumber16384Maximum output tokens.
samplingParamsobjectFields merged into every request body. Applies only to OpenAI-compatible APIs.
samplingParamsByThinkingLevelobjectsamplingParams per thinking level, merged over samplingParams.
headersobjectRequest headers. Values resolve like apiKey.
compatobjectProvider and model compatibility overrides.

Model overrides

Each modelOverrides key is the ID of a built-in or extension model. Unknown IDs are ignored. Object fields, such as cost, merge with the model's value field by field; other fields replace it.

FieldTypeDefaultDescription
namestringDisplay name, also matched by --model patterns.
reasoningbooleanWhether the model supports thinking.
thinkingLevelMapobjectProvider value sent for each thinking level. A string is sent to the provider; null hides the level. Levels left out use the provider's default value for off through high; xhigh and max are opt-in and only offered when mapped to a string.
input("text" | "image")[]
inputLimitsobject
costobject
cost.inputnumberInput cost in USD per million tokens.
cost.outputnumberOutput cost in USD per million tokens.
cost.cacheReadnumberCache-read cost in USD per million tokens.
cost.cacheWritenumberCache-write cost in USD per million tokens.
cost.imageOutputnumberImage output cost in USD per million tokens, for models that generate images. Image output tokens use this rate and the rest of output (text and reasoning) uses output. Unset means image tokens cost output.
cost.tiersobject[]Request-wide pricing tiers. The highest matching input threshold applies to the full request.
cost.tiers[].inputTokensAbovenumberRequired. Use this tier when total request input exceeds this token count.
cost.tiers[].inputnumberRequired. Input cost in USD per million tokens.
cost.tiers[].outputnumberRequired. Output cost in USD per million tokens.
cost.tiers[].cacheReadnumberRequired. Cache-read cost in USD per million tokens.
cost.tiers[].cacheWritenumberRequired. Cache-write cost in USD per million tokens.
promptCacheobjectBest-effort prompt cache lifetime in seconds for the short and long retention tiers. Pi warms only tiers with a known lifetime.
contextWindownumberContext window in tokens.
maxTokensnumberMaximum output tokens.
samplingParamsobjectFields merged into every request body. Applies only to OpenAI-compatible APIs.
samplingParamsByThinkingLevelobjectsamplingParams per thinking level, merged over samplingParams.
headersobjectRequest headers. Values resolve like apiKey.
compatobjectProvider and model compatibility overrides.

Input limits

See Describe model input and caching.

FieldTypeDefaultDescription
maxRequestBytesintegerMaximum serialized provider request size in bytes.
imagesobject
images.resizeobjectCache-safe resize profile applied before a new image enters conversation history.
images.resize.maxWidthinteger
images.resize.maxHeightinteger
images.resize.maxBytesintegerMaximum base64-encoded payload size in bytes.
images.resize.jpegQualityinteger
images.maxPerMessageintegerMaximum images accepted in one provider message.
images.maxPerRequestintegerMaximum images accepted across one provider request.

Compatibility

compat describes verified differences from an API's standard request and response behavior. Model values override provider values per field. The fields that apply depend on the model's api.

openai-completions

FieldTypeDefaultDescription
supportsStorebooleanWhether the provider supports the store field. Default: auto-detected from URL.
supportsDeveloperRolebooleanWhether to send system messages of reasoning models (the system prompt and mid-conversation system messages) with the developer role instead of system. Default: true only for api.openai.com.
supportsReasoningEffortbooleanWhether the provider supports reasoning_effort. Default: auto-detected from URL.
supportsUsageInStreamingbooleantrueWhether the provider supports stream_options.include_usage for token usage in streaming responses.
supportsFinishReasonbooleantrueWhether streamed responses include finish_reason. When false, pi infers stop or toolUse when the stream ends.
maxTokensField"max_completion_tokens" | "max_tokens"Which field to use for max tokens. Default: auto-detected from URL.
requiresToolResultNamebooleanWhether tool results require the name field. Default: auto-detected from URL.
requiresAssistantAfterToolResultbooleanWhether a user message after tool results requires an assistant message in between. Default: auto-detected from URL.
requiresNonNullAssistantContentbooleanWhether replayed assistant messages with no text (e.g. tool-call-only messages) must send "" instead of null content. Default: false.
requiresToolsWithToolHistorybooleanWhether requests without tools must send "tools": [] when the conversation contains tool calls or tool results. Needed by some proxies in front of Anthropic, such as older LiteLLM versions. Default: false, the field is omitted.
requiresThinkingAsTextbooleanWhether thinking blocks must be converted to text blocks with <thinking> delimiters. Default: auto-detected from URL.
requiresReasoningContentOnAssistantMessagesbooleanWhether all replayed assistant messages must include an empty reasoning_content field when reasoning is enabled. Default: auto-detected from URL.
thinkingFormat"openai" | "openrouter" | "deepseek" | "ant-ling" | "together" | "baseten" | "zai" | "qwen" | "chat-template" | "qwen-chat-template" | "string-thinking"Format for reasoning or thinking parameters. When omitted, Pi auto-detects the format from the provider URL. "openai" uses reasoning_effort, "openrouter" uses reasoning.effort, "deepseek" (deprecated alias: "ant-ling") uses thinking.type plus reasoning_effort when supported, "together" uses reasoning.enabled plus reasoning_effort when supported, "baseten" uses configurable chat_template_args plus reasoning_effort when supported, "zai" uses thinking.type, "qwen" uses top-level enable_thinking, "qwen-chat-template" uses chat_template_kwargs.enable_thinking and preserve_thinking, "chat-template" uses configurable chat_template_kwargs, and "string-thinking" uses top-level thinking.
chatTemplateKwargsobjectKwargs sent as chat_template_kwargs when thinkingFormat is "chat-template". Use $var with "thinking.enabled", "thinking.effort", or "thinking.budget" for pi-controlled values.
chatTemplateArgsobjectArguments sent as chat_template_args when thinkingFormat is "baseten". Use $var with "thinking.enabled", "thinking.effort", or "thinking.budget" for pi-controlled values.
openRouterRoutingobjectOpenRouter provider routing preferences. Controls which upstream providers OpenRouter routes requests to. Sent as the provider field in the OpenRouter API request body. See https://openrouter.ai/docs/guides/routing/provider-selection.
vercelGatewayRoutingobjectVercel AI Gateway routing preferences. Controls which upstream providers the gateway routes requests to. See https://vercel.com/docs/ai-gateway/models-and-providers/provider-options.
zaiToolStreambooleanfalseWhether z.ai supports top-level tool_stream for streaming tool call deltas.
thinkingTokenBudgetField"thinking_token_budget" | "thinking_budget" | "thinking_budget_tokens"Top-level request field used to cap reasoning tokens from thinkingBudgets. Reasoning and the answer share max_tokens on these endpoints. "thinking_token_budget" is vLLM, "thinking_budget" is Qwen, DashScope, or SGLang, and "thinking_budget_tokens" is llama.cpp. Off by default and not set on the generated catalog.
supportsThinkingTokenBudgetbooleanfalseAlias for thinkingTokenBudgetField: "thinking_token_budget" (vLLM). Prefer thinkingTokenBudgetField.
supportsOpenAIGrammarToolsbooleanfalseWhether the provider supports OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. The generated catalog enables this for capable models.
supportsMidConvoSystemMessagesbooleanfalseWhether the exact model accepts system or developer messages after the conversation has started. When false, later system messages are folded into the leading system message. The generated catalog enables this for verified models.
supportsMidConvoToolAdditionsbooleanfalseWhether system messages can introduce additional tools mid-conversation. Requires supportsMidConvoSystemMessages. The generated catalog enables this for capable models.
supportsStrictModebooleanfalseWhether the provider supports the strict field in tool definitions. Generated capable models enable it explicitly.
cacheControlFormat"anthropic"Cache control convention for prompt caching. Anthropic applies cache_control markers to the system prompt, last tool definition, and last user, assistant, or tool-result text content.
sendSessionAffinityHeadersbooleanWhether to send session-affinity data from options.sessionId. Default: true for OpenRouter endpoints, false otherwise.
sessionAffinityFormat"openai" | "openai-nosession" | "openrouter"Session-affinity header format. openai sends session_id, x-client-request-id, and x-session-affinity; openai-nosession sends x-client-request-id and x-session-affinity; openrouter sends x-session-id. Does not affect prompt_cache_key. Default: auto-detected.
promptCacheKeyMode"auto" | "enabled" | "disabled"Controls the prompt_cache_key request field. auto sends it to api.openai.com, or with long cache retention when supportsLongCacheRetention is true; enabled sends it whenever caching is active, for compatible proxies; disabled never sends it. Default: auto.
supportsLongCacheRetentionbooleanWhether the provider supports long prompt cache retention (prompt_cache_retention: "24h" or Anthropic-style cache_control.ttl: "1h", depending on format). Default: auto-detected from provider and URL.
vllmPrioritynumbervLLM scheduler priority sent as the top-level priority request field. Lower values are handled earlier and the server default is 0. Only meaningful with --scheduling-policy priority. Off by default and not set on the generated catalog.

openai-responses

Also applies to azure-openai-responses and openai-codex-responses.

FieldTypeDefaultDescription
supportsDeveloperRolebooleantrueWhether the provider supports the developer role instead of system.
supportsMidConvoSystemMessagesbooleanfalseWhether the exact model accepts developer or system messages after the conversation has started. When false, later system messages are folded into the leading system message. The generated catalog enables this for verified models.
sessionAffinityFormat"openai" | "openai-nosession" | "openrouter"Session-affinity header format. openai sends session-id and x-client-request-id; openai-nosession sends x-client-request-id; openrouter sends x-session-id. Does not affect prompt_cache_key. Default: auto-detected.
promptCacheKeyMode"auto" | "enabled" | "disabled"Controls the prompt_cache_key request field. auto and enabled send it whenever caching is active; disabled never sends it, for compatible proxies that reject it. Default: auto.
supportsLongCacheRetentionbooleantrueWhether the provider supports long prompt cache retention. This uses prompt_cache_options.ttl: "30m" on GPT-5.6+ and prompt_cache_retention: "24h" on earlier models.
supportsStrictModebooleanWhether the provider supports strict JSON-schema function tools. Defaults are API-specific; generated OpenAI models enable it explicitly.
supportsOpenAIGrammarToolsbooleanfalseWhether to emit OpenAI custom tools with Lark or regex grammar formats. When false, grammar-constrained tools fall back to normal function tools. The generated catalog enables this for capable models.
supportsAdditionalToolsbooleanfalseWhether the model supports message-anchored additional_tools input items.
supportsToolSearchbooleanfalseWhether the model supports client-executed tool search for transcript-anchored additions.
supportsExplicitPromptCacheModebooleanfalseWhether the model accepts prompt_cache_options. Older OpenAI models reject the parameter.
supportsMidConvoEffortbooleanfalseWhether thinking level changes are sent as configuration_update input items instead of changing reasoning.effort, so a change keeps the prompt cache. Used by the openai-responses and openai-codex-responses APIs, and ignored with Sign in with ChatGPT on the openai provider.
supportsMaxOutputTokensbooleantrueWhether the provider accepts max_output_tokens. Some Codex-protocol gateways reject it.

anthropic-messages

FieldTypeDefaultDescription
supportsEagerToolInputStreamingbooleantrueWhether the provider accepts per-tool eager_input_streaming. When false, the Anthropic provider omits tools[].eager_input_streaming and sends the legacy fine-grained-tool-streaming-2025-05-14 beta header for tool-enabled requests.
supportsLongCacheRetentionbooleantrueWhether the provider supports Anthropic long cache retention through cache_control.ttl.
sendSessionAffinityHeadersbooleanWhether to send x-session-affinity from options.sessionId when caching is enabled. Required for providers like Fireworks that use session affinity for prompt cache routing; requests to the same replica maximize cache hits. Default: true for OpenRouter endpoints, false otherwise.
sessionAffinityFormat"openrouter"Session-affinity format. openrouter sends x-session-id; when unset, sends x-session-affinity.
supportsCacheControlOnToolsbooleantrueWhether the provider supports Anthropic-style cache_control markers on tool definitions. When false, cache_control is omitted from tool parameters. Some Anthropic-compatible providers, such as Fireworks, do not support this field on tools and may reject or ignore it.
supportsTemperaturebooleantrueWhether the model accepts the Anthropic temperature request field. Claude Opus 4.7+ rejects non-default values.
forceAdaptiveThinkingbooleanfalseWhether to force adaptive thinking (thinking.type: adaptive plus output_config.effort) regardless of model ID. Built-in models that require adaptive thinking set this in generated metadata. Custom Anthropic-compatible providers can set this to true for any model whose upstream requires the adaptive format. Set false to opt out on overridden built-in models.
allowEmptySignaturebooleanfalseWhether to replay empty thinking signatures instead of converting thinking to text.
supportsStrictToolsbooleanfalseWhether the provider supports Anthropic strict tool schemas. Generated Anthropic models enable it explicitly.
supportsMidConvoEffortbooleanfalseWhether the exact model transport supports effort-only system messages and thinking binding controls.
supportsMidConvoSystemMessagesbooleanfalseWhether the exact model accepts system-role messages inside the conversation. When false, later system messages are folded into the top-level system prompt.
supportsMidConvoToolChangesbooleanfalseWhether the exact model accepts mid-conversation tool_addition and tool_removal blocks. Requires supportsMidConvoSystemMessages.
supportsMessageThreadsbooleanWhether the endpoint supports Anthropic message threads, which let a request with a session id send only the new messages and continue from the previous reply. Default: true for a baseUrl on api.anthropic.com, false otherwise. Set true for gateways that forward the thread request field.
allowedFallbackModelsobject[]Models Anthropic accepts for server-side refusal fallback, with local pricing metadata for returned fallback responses. When absent or empty, callers must omit fallbacks; Anthropic rejects the field for models with no permitted fallback targets.

bedrock-converse-stream

FieldTypeDefaultDescription
supportsStrictModebooleanfalseWhether the model supports Bedrock strict tool schemas.
supportsReasoningReplaybooleantrueWhether the model accepts reasoning blocks from earlier assistant messages. When false, earlier reasoning is not sent back. The generated catalog disables this for Kimi K3 models, which fail on Converse when it is sent.

mistral-conversations

FieldTypeDefaultDescription
supportsMidConvoSystemMessagesbooleanfalseWhether the exact model accepts system messages after the conversation has started. When false, later system messages are folded into the leading system message.
supportsStrictModebooleanfalseWhether the model supports strict (schema-constrained) function tools.

google-generative-ai

Also applies to google-vertex.

FieldTypeDefaultDescription
supportsStrictModebooleanWhether the model enforces strict tools through Gemini's VALIDATED function-calling mode. Default: true for model IDs containing gemini-3 or a later version, such as gemini-3-pro or vendor-gemini-4-argon, false otherwise. Set true for Gemini 3+ models served under IDs without the version.

typesafe-system-one

Also applies to cloudflare-workers-ai-system-one.

FieldTypeDefaultDescription
imageInput"assets" | "images" | "state-image-urls"How the service takes classifier images. "assets" sends TypeSafe's assets map (PNG and JPEG) and references the images from the state, as TypeSafe and Jev on Workers AI expect. "images" sends Clef's images list of data URLs (PNG, JPEG, and WebP, at most four), as Clef on Workers AI expects. "state-image-urls" places image_url parts before the state, as OpenRouter expects; OpenRouter drops assets without an error. Auto-detected from the provider, baseUrl, and model ID. Classifier models read it from the provider-level compat; models and modelOverrides entries apply to chat models only.
sendImageOptInHeaderbooleanWhether requests with images send the TypeSafe-Danger-Zone-Images: true header, which TypeSafe's own API requires for its experimental image input. Defaults to true for the typesafe-system-one API unless the model is detected as OpenRouter.