xhigh effort support.AWS_REGION (#5527 by @AJM10565).thinking: { type: "disabled" } compatibility parameter (#5330).maxTokens as max_tokens (#5331).thinking: { type: "disabled" } compatibility parameter (#5531).maxTokens metadata to 128,000, correcting an upstream value that duplicated the 272,000 input sub-limit as the output limit (#5559).compat.supportsDeveloperRole: false for reasoning models (#5456).compat.openRouterRouting even when baseUrl does not point directly at OpenRouter (#5347).minimax and minimax-cn direct providers, and removed the hardcoded context-window override that was masking models.dev values (#5313).options.apiKey; top-level stream*/complete* helpers still resolve built-in environment auth.StreamOptions.headers, excluding reserved AWS signing headers (#5178 by @stephanmck).system instead of unsupported developer messages (#5159).thinking objects instead of invalid string values, and fixed OpenCode Zen Grok Build thinking requests to omit unsupported reasoning_effort (#5169).xhigh reasoning metadata to preserve OpenRouter's native effort instead of sending DeepSeek's max effort (#4801).allowEmptySignature compatibility flag (#4464).thinking: "none" (#5078).mimo-v2-flash variants (#5075).session-id instead of proxy-incompatible session_id (#4967).openai-codex/gpt-5.3-codex-spark generated metadata to use its 128k context window (#4969).maximum allowed input length errors (#4943).maxRetries, SDK retries default to 0, and quota/billing 429s are not retried behind Pi's retry handling (#4991 by @mitsuhiko).OAuthLoginCallbacks to require onDeviceCode and onSelect, so OAuth providers can rely on pi supplying device-code and selection UI callbacks (#4788 by @vegarsti).compat.forceAdaptiveThinking model metadata and moving built-in adaptive-thinking selection out of provider id substring checks (#4797 by @mbazso).@smithy/node-http-handler dependency (#4842).streamSimple() requests to stop sending model-derived default output token caps, avoiding context-window reservation failures on servers such as vLLM while preserving explicit maxTokens and required Anthropic max_tokens handling (#4675).reasoning_content for thinking-mode multi-turn requests (#4678).ANTHROPIC_AUTH_TOKEN environment values, avoiding invalid bearer credentials for providers such as Xiaomi MiMo (#4342).errorMessage, so transient 5xx and 429 errors are correctly matched by the agent-level auto-retry classifier (#4232).openai-completions API, restoring multi-turn thinking/tool-call sessions (#4505).reasoning fields back to reasoning_content for OpenCode Go only (#4251).streamSimple() defaults for models whose advertised output limit is effectively their full context window to avoid impossible default requests (#4614).TOGETHER_API_KEY authentication (#3624 by @Nutlope).GH_TOKEN and GITHUB_TOKEN environment variables, requiring OAuth login or COPILOT_GITHUB_TOKEN instead (#4485).openai-completions streams to surface an error when the stream ends before any terminal finish_reason, so truncated responses can retry instead of being accepted as success (#4345).NO_PROXY exclusions while using HTTP(S)-only proxy agents.proxy-from-env from external node_modules (#4513).reasoning.effort: "none" when thinking is off.off as unsupported in thinkingLevelMap, so the openai-completions provider omits the reasoning param instead of defaulting to {reasoning:{effort:"none"}} (which puts Mercury 2 in instant mode, disabling tool calls).retry-after-ms and retry-after headers before falling back to exponential backoff.exceeds the model's maximum context length of ... tokens wording (#4563).streamSimple() defaults to respect model output limits above 32000 tokens instead of clamping provider requests to 32000 (#4539).response.reasoning_text.delta events (#4191 by @yaanfpv).kimi-for-coding (#4218).xiaomi provider endpoint from Token Plan AMS (https://token-plan-ams.xiaomimimo.com/anthropic) to API billing (https://api.xiaomimimo.com/anthropic). XIAOMI_API_KEY now refers to the API billing key from platform.xiaomimimo.com. Users still on Token Plan must move to the appropriate xiaomi-token-plan-* provider and set the corresponding env var (#4112 by @Phoen1xCode).xiaomi-token-plan-cn (XIAOMI_TOKEN_PLAN_CN_API_KEY), xiaomi-token-plan-ams (XIAOMI_TOKEN_PLAN_AMS_API_KEY), and xiaomi-token-plan-sgp (XIAOMI_TOKEN_PLAN_SGP_API_KEY) (#4112 by @Phoen1xCode).registerSessionResourceCleanup() and cleanupSessionResources() so providers can register cleanup hooks for session-scoped resources.xhigh for Claude Opus 4.7.Replaced OpenAICompletionsCompat.reasoningEffortMap with top-level Model.thinkingLevelMap for model-specific thinking controls (#3208). Migration: move mappings from model.compat.reasoningEffortMap to model.thinkingLevelMap. See packages/ai/README.md#custom-models and packages/coding-agent/docs/models.md#thinking-level-map. Map values keep the same provider-specific string semantics, and null marks a pi thinking level unsupported. Example:
// Before
compat: { reasoningEffortMap: { high: "high", xhigh: "max" } }
// After
thinkingLevelMap: { minimal: null, low: null, medium: null, high: "high", xhigh: "max" }
Removed supportsXhigh(). Migration: use getSupportedThinkingLevels(model).includes("xhigh") or clampThinkingLevel(model, requestedLevel) instead (#3208).
XIAOMI_API_KEY authentication (#4005 by @Phoen1xCode).Model.thinkingLevelMap, getSupportedThinkingLevels(), and clampThinkingLevel() so model metadata can describe supported thinking levels and provider-specific level values (#3208).streamSimple() to honor the configured transport instead of always using SSE, and made auto the default transport with cached WebSocket context when available (#4083).websocket-cached transport support for OpenAI Codex Responses used with ChatGPT subscription auth. This keeps the same WebSocket open for a session and, after the first request, sends only new conversation items instead of resending the full chat history when possible.CLOUDFLARE_API_KEY/CLOUDFLARE_ACCOUNT_ID/CLOUDFLARE_GATEWAY_ID authentication (#3856 by @mchenco).MOONSHOT_API_KEY authentication.AssistantMessage.responseModel on the openai-completions path: surfaces the concrete chunk.model when it differs from the requested id (e.g. OpenRouter auto -> anthropic/...) (#3968 by @purrgrammer).skip_thought_signature_validator sentinel for unsigned tool calls (#4032).@anthropic-ai/sdk to ^0.91.1 to clear GHSA-p7fg-763f-g4gf audit findings (#3992).xhigh thinking support so requests preserve xhigh and map it to DeepSeek's max reasoning effort (#3944).message_stop to be treated as errors instead of successful partial responses (#3936).prompt_cache_hit_tokens in OpenAI-compatible usage responses (#3880).CLOUDFLARE_API_KEY/CLOUDFLARE_ACCOUNT_ID authentication, and OpenAI-compatible streaming support (#3851 by @mchenco).User-Agent model headers so attribution can be controlled by callers.low when no verbosity is specified./proc/self/environ when Bun's sandbox leaves process.env empty (#3801 by @mdsjip).done terminators (#3708).tools: [] on OpenAI-compatible, Anthropic, OpenAI Responses, OpenAI Codex Responses, and Azure OpenAI Responses requests when no tools are active (e.g. pi --no-tools). DashScope/Aliyun Qwen (OpenAI-compatible) rejects empty tools arrays with "[] is too short - 'tools'" (HTTP 400); the field is now omitted unless the conversation has tool history (the existing LiteLLM/Anthropic-proxy workaround) (#3650 by @HQidea).supportsXhigh() to recognize DeepSeek V4 Pro, preserving xhigh reasoning requests so they map to DeepSeek's max effort (#3662)reasoning_content on assistant messages when needed, preventing OpenRouter DeepSeek V4 sessions from failing after responses without reasoning deltas (#3668)timeout/maxRetries, avoiding SDK validation errors such as timeout must be an integer when provider controls are not set (#3627)DEEPSEEK_API_KEY authentication.thinkingFormat: "deepseek" (sends thinking: { type } + reasoning_effort), a reasoningEffortMap, and requiresReasoningContentOnAssistantMessages compat that injects empty reasoning_content on all replayed assistant messages when reasoning is enabled (#3636)timeoutMs and maxRetries in stream options and forward them through OpenAI/Azure/Anthropic request options, preventing unconfigurable SDK timeout/retry defaults on long-running local inference requests (#3627)findEnvKeys() so callers can identify configured provider API-key environment variables without exposing credential values while preserving getEnvApiKey() as the credential-value API.google-vertex to forward custom model.baseUrl values to @google/genai, enabling Vertex proxy and gateway endpoints (#3619)completion_tokens (#3581)compat.supportsLongCacheRetention, allowing Anthropic Messages and OpenAI-compatible proxies to explicitly disable long-retention fields while enabling long retention by default when requested (#3543)openai-responses compatibility by adding compat.sendSessionIdHeader: false, allowing strict OpenAI-compatible proxies to omit the underscore-containing session_id header while still sending other session-affinity headers (#3579)anthropic-messages tool streaming compatibility by adding compat.supportsEagerToolInputStreaming, allowing Anthropic-compatible providers to omit per-tool eager_input_streaming and use the legacy fine-grained tool streaming beta header instead (#3575)supportsXhigh() to recognize openai-codex gpt-5.5, preserving xhigh reasoning requests instead of clamping them to high.openai-completions streamed tool-call assembly to coalesce deltas by stable tool index when OpenAI-compatible gateways mutate tool call IDs mid-stream, preventing malformed Kimi K2.6/OpenCode tool streams from splitting one call into multiple bogus tool calls (#3576)packages/ai E2E coverage to use currently supported OpenAI Responses and OpenAI Codex models, and updated the Bedrock adaptive-thinking payload expectation to match the current display: "summarized" shape.kimi-coding model generation to attach User-Agent: KimiCLI/1.5 to all generated Kimi models, overriding the Anthropic SDK default UA so direct Kimi Coding requests use the provider's expected client identity (#3586)low and apply the model's 2.5x priority service-tier pricing multiplier (#3618 by @markusylisiurunen)@sinclair/typebox 0.34.x plus AJV to typebox 1.x plus TypeBox's built-in validator and value-conversion APIs. Tool argument validation now runs in eval-restricted JavaScript runtimes such as Cloudflare Workers and other environments that disallow eval / new Function, instead of being silently skipped. Migration: install and import from typebox instead of @sinclair/typebox, and retest any coercion-sensitive tool paths that serialize schemas to plain JSON because those now go through the new TypeBox-based validation and coercion path rather than AJV (#3112)google-gemini-cli built-in model discovery to include gemini-3.1-flash-lite-preview, so Cloud Code Assist model lists expose it without requiring manual --model fallback selection (#3545)transformMessages() to synthesize missing trailing tool results for transcripts that end with unresolved assistant tool calls during direct low-level history replay (#3555)FIREWORKS_API_KEY auth (#3519)fine-grained-tool-streaming beta header with per-tool eager_input_streaming, and updating stale test model references (#3175)AWS_REGION / AWS_PROFILE, restoring us.* and eu.* inference profile support after v0.68.0 while preserving custom VPC/proxy endpoint overrides (#3481, #3485, #3486, #3487, #3488)PI_OAUTH_CALLBACK_HOST support for built-in Anthropic, Gemini CLI, Google Antigravity, and OpenAI Codex OAuth flows, allowing local callback servers to bind to a custom interface instead of hardcoded 127.0.0.1 (#3409 by @Michaelliv)inferenceConfig.maxTokens when model token limits are unknown and to omit temperature when unset, letting Bedrock use model defaults and avoid unnecessary TPM quota reservation (#3400 by @wirjo)openai-completions compat.requiresThinkingAsText assistant replay to preserve text-part serialization and avoid same-model crashes when prior assistant messages contain both thinking and text (#3387)$schema, $defs, and definitions before sending OpenAPI parameters, avoiding provider validation failures for tool-enabled requests (#3412 by @vladlearns)sessionId and cacheRetention to OpenAI prompt caching fields, sending prompt_cache_key when caching is enabled and prompt_cache_retention: "24h" for direct api.openai.com requests with long retention (#3426)session_id, x-client-request-id, and x-session-affinity session-affinity headers from sessionId via compat.sendSessionAffinityHeaders, enabling cache-affinity routing for backends such as Fireworks (#3430)model.baseUrl through as the SDK endpoint, restoring support for custom Bedrock endpoints such as VPC or proxy routes (#3402 by @wirjo)cache_control markers to the system prompt, last tool definition, and last user/assistant text content via compat.cacheControlFormat, and enabled that compat for OpenCode/OpenCode Go Qwen 3.5/3.6 Plus models so prompt caching works there too (#3392)thinking.display for GovCloud targets, avoiding duplicate Authorization headers and GovCloud Converse validation errors (#3359)AWS_BEARER_TOKEN_BEDROCK, enabling API-key style access without SigV4 credentials (#3125 by @wirjo)display: "summarized" field when reasoning is enabled.reasoning_effort instead of prompt_mode, restoring default thinking support for mistral-small-2603 and mistral-small-latest (#3338)qwen-chat-template OpenAI-compatible requests to set chat_template_kwargs.preserve_thinking: true, preserving prior Qwen thinking across turns so multi-turn tool calls keep their arguments instead of degrading to empty {} payloads (#3325)onResponse to StreamOptions so callers can inspect provider HTTP status and headers after each response arrives and before the response stream is consumed (#3128)thinkingDisplay ("summarized" | "omitted") to AnthropicOptions and BedrockOptions, wiring it through to the Anthropic/Bedrock thinking config. Defaults to "summarized" so Claude Opus 4.7 and Mythos Preview keep returning thinking text; set it to "omitted" to skip thinking streaming for faster time-to-first-text-token.api.openai.com base URLs (OpenAI-compatible proxies such as litellm, theclawbay) by sending the session_id and x-client-request-id cache-affinity headers unconditionally when a sessionId is provided, matching the official Codex CLI behavior (#3264 by @vegarsti)xhigh reasoning to provider-supported effort values (#3286 by @markusylisiurunen)claude-opus-4-7 model for Anthropic, OpenRouter.cache_control breakpoint on the last tool definition, so tool schemas can be cached independently from transcript updates while preserving existing cache retention behavior (#3260)k2p5 to kimi-for-coding from models.dev data and removed the old static fallback model list (#3242)google-vertex API key resolution to treat gcp-vertex-credentials as an Application Default Credentials marker instead of a literal API key, so marker-based setups correctly fall back to ADC (#3221 by @deepkilo)prompt_cache_key, session_id, and x-client-request-id values when sessionId is provided, improving prompt cache affinity for append-only sessions (#3018 by @steipete)partialJson scratch buffers leaking into persisted OpenAI Responses tool calls, which could corrupt follow-up payloads on resumed conversations.OpenRouterRouting field support, including fallbacks, parameter requirements, data collection, ZDR, ignore lists, quantizations, provider sorting, max price, and preferred throughput and latency constraints (#2904 by @zmberber)1.21.9 (#2901 by @aadishv)thinkingLevel and map Pi reasoning levels to the model's supported thinking levels (#2903 by @aadishv)serviceTier values, restoring service-tier selection for Codex sessions (#2996 by @markusylisiurunen)readline import to use node:readline prefix for Deno compatibility (#2885 by @milosv-vtool)prompt_tokens_details.cache_write_tokens and normalize OpenRouter cached_tokens to previous-request cache hits only, preventing cache read/write double counting in usage and cost calculation (#2802)request_too_large errors, so callers can trigger compaction and retry instead of getting stuck on repeated oversized-image requests (#2734)toolcall_delta when function call arguments arrive only in response.function_call_arguments.done, and to emit only the missing suffix when .done extends earlier streamed arguments (#2745)registerFauxProvider(), fauxAssistantMessage(), fauxText(), fauxThinking(), and fauxToolCall().gemini-3.1-pro-preview-customtools model support for the google-vertex provider (#2610 by @gordonhwc)prompt too long; exceeded max context length ..., so callers can trigger compaction and retry instead of surfacing the raw overflow error (#2626)minimax and minimax-cn model IDs, keeping only MiniMax-M2.7 and MiniMax-M2.7-highspeed. Update pinned model IDs to one of those supported direct MiniMax models, or use another provider route that still exposes the older IDs (#2596 by @liyuan97)reasoning field entirely when no reasoning effort is requested, avoiding 400 errors from Copilot gpt-5-mini rejecting reasoning: { effort: "none" } during internal summary calls (#2567)cachedContentTokenCount (#2588 by @sparkleMing)requestMetadata option to BedrockOptions for AWS cost allocation tagging; key-value pairs are forwarded to the Bedrock Converse API requestMetadata field and appear in AWS Cost Explorer split cost allocation data (#2511 by @wjonaskr)BedrockOptions type from the package root entry point, consistent with other provider option types.function_call.id values into bounded fc_<hash> IDs instead of preserving backend-specific normalized shapes that OpenAI Codex rejects.thinking: { type: "disabled" } for reasoning-capable models when thinking is explicitly off, and added payload and env-gated end-to-end coverage for the Anthropic provider (#2022)none effort instead of relying on provider defaults (#2490)MiniMax-M2.1-highspeed entries for the minimax and minimax-cn providers and normalize MiniMax Anthropic-compatible context limits to the provider's supported model set (#2445 by @1500256797)gpt-5.4-mini model support for the openai-codex provider with Codex pricing metadata and unit coverage (#2334 by @justram)validateToolArguments() to fall back gracefully when AJV schema compilation is blocked in restricted runtimes such as Cloudflare Workers, allowing tool execution to proceed without schema validation (#2395)google-vertex API key resolution to ignore placeholder auth markers like <authenticated> and fall back to ADC instead of sending them as literal API keys (#2335)reasoning.effort payload instead of OpenAI's reasoning_effort, restoring thinking level support for OpenRouter models (#2298 by @PriNova)AWS_BEDROCK_FORCE_CACHE=1 when the profile ARN does not expose the underlying Claude model name (#2346 by @haoqixu)network_error responses to surface as errors so callers can retry them instead of treating them as successful assistant messages (#2313)client injection support to AnthropicOptions, allowing callers to provide a pre-built Anthropic-compatible client instead of constructing one internally.@mariozechner/pi-ai no longer eagerly loads provider SDKs, significantly reducing base startup cost without changing dependency installation footprint (#2297)responseId support on AssistantMessage for providers that expose upstream response or message identifiers, including Anthropic, OpenAI, Google, Gemini CLI, and Mistral, and added end-to-end coverage for supported OAuth and API key providers (#2245)scope from refresh-token requests (#2169)qwen-chat-template compat mode that uses Qwen's native chat template format (#2020)finish_reason: "end" from Ollama/LM Studio by mapping it to "stop" instead of throwing (#2142)GOOGLE_CLOUD_API_KEY environment variable support for the google-vertex provider as an alternative to Application Default Credentials (#1976 by @gordonhwc)choice.usage instead of the standard chunk.usage (e.g., Moonshot/Kimi) (#2017)function_call_output items for OpenAI Responses API providers, causing image data to be silently dropped in tool results (#2104)openai-completions provider, causing errors with some OpenAI-compatible backends (#2008 by @geraldoaax)response.failed handler to include status code, error code, and message instead of a generic failure (#1956 by @drewburr)model_context_window_exceeded errors surfaced through OpenAI-compatible stop reason handling (#1937)beforeProviderRequest, allowing callers to inspect or replace provider payloads before sending.claude-sonnet-4-6 model for the google-antigravity provider (#1859).1.18.4 (#1859).-thinking suffix, so models like claude-sonnet-4-6 receive the header correctly (#1859).gpt-5.4 model support for openai, openai-codex, azure-openai-responses, and opencode providers, with GPT-5.4 treated as xhigh-capable and capped to a 272000 context window in built-in metadata.gpt-5.3-codex fallback model availability for github-copilot until upstream model catalogs include it (#1853).phase metadata (commentary, final_answer) across turns by encoding id and phase in textSignature for session persistence and replay, with backward compatibility for legacy plain signatures (#1819).autopush-cloudcode-pa.sandbox endpoint to the fallback list, and removed extra fingerprint headers (X-Goog-Api-Client, Client-Metadata) from Antigravity requests (#1830).@mariozechner/pi-ai/oauth package exports to point directly at built dist files, avoiding broken TypeScript resolution through unpublished wrapper targets (#1856).skip_thought_signature_validator sentinel instead of converting function calls to text, preserving structured tool call context across multi-turn conversations (#1829).@mariozechner/pi-ai/oauth instead of @mariozechner/pi-ai (#1814)gemini-3.1-flash-lite-preview fallback model entry for the google provider so it remains selectable until upstream model catalogs include it (#1785, thanks @n-WN).opencode-go model catalog entries and OPENCODE_API_KEY environment variable support (#1757).google and google-vertex providers so gemini-3.1-* models use Gemini 3 level-based thinking config instead of budget fallback (#1785, thanks @n-WN).ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING failures by replacing Function-based dynamic imports with module dynamic imports in browser-safe provider loading paths (#1814).AWS_PROFILE by honoring region from the selected profile when present (#1800).resetOAuthProviders() for registry reset flows.thinking instead of enable_thinking), causing thinking to always be enabled and wasting tokens/latency (#1674 by @okuyam2y)redacted_thinking blocks being silently dropped during Anthropic streaming. They are now captured as ThinkingContent with redacted: true, passed back to the API in multi-turn conversations, and handled in cross-model message transformation (#1665 by @tctev)interleaved-thinking-2025-05-14 beta header being sent for adaptive thinking models (Opus 4.6, Sonnet 4.6) where the header is deprecated or redundant (#1665 by @tctev)(external, cli) user-agent flag causing 401 errors on Anthropic setup-token endpoint (#1677 by @LazerLance777)choices array by adding optional chaining (#1671)gemini-3.1-pro-preview model support to the google-gemini-cli provider (#1599 by @audichuang)xhigh effort values to supported levels (#1548 by @tctev)claude-sonnet-4-6 fallback model entry to generated model definitions.transport to StreamOptions with values "sse", "websocket", and "auto" (currently supported by openai-codex-responses).openai-codex-responses).transport is explicitly set.sessionId and expire after 5 minutes of inactivity.minimax, minimax-cn, openrouter, and vercel-ai-gateway providers, plus minimax-m2.5-free for opencode.metadata field to StreamOptions for passing provider-specific metadata (e.g. Anthropic user_id for abuse tracking/rate limiting) (#1384 by @7Sageer)gpt-5.3-codex-spark model definition for OpenAI and OpenAI Codex providers (128k context, text-only, research preview). Not yet functional, may become available in the next few hours or days.parametersJsonSchema for Google provider tool declarations to support full JSON Schema (anyOf, oneOf, const, etc.) (#1398 by @jarib)claude-opus-4-6-thinking back to claude-opus-4-5-thinking (model doesn't exist on Antigravity endpoint)auto model alias for automatic model routing (#1361 by @yogasanas)AWS_BEDROCK_SKIP_AUTH and AWS_BEDROCK_FORCE_HTTP1 environment variables for connecting to unauthenticated Bedrock proxies (#1320 by @virtuald)store: false by default to avoid server-side history logging (#1308)Type, Static, and TSchema from @mariozechner/pi-ai to match documentation and avoid duplicate TypeBox type identity issues in pnpm setups (#1338)AWS_BEDROCK_SKIP_AUTH environment detection to avoid process access in non-Node.js environmentssupportsXhigh() to treat Anthropic Messages Opus 4.6 models as xhigh-capable so streamSimple can map xhigh to adaptive effort max:0 suffix) and cache pricing for us.* and eu.* variantseu.anthropic.claude-opus-4-6-v1 inference profile to model cataloglow, medium, high, max)effort option to AnthropicOptions for controlling adaptive thinking depththinkingEnabled now automatically uses adaptive thinking for Opus 4.6+ models and budget-based thinking for older modelsstreamSimple/completeSimple automatically map ThinkingLevel to effort levels for Opus 4.6@anthropic-ai/sdk to 0.73.0@aws-sdk/client-bedrock-runtime to 3.983.0@google/genai to 1.40.0fast-xml-parser override (no longer needed)cache_control not being applied to string-format user messages in Anthropic providercacheRetention option not being passed through in buildBaseOptions (#1154)HTTP_PROXY, HTTPS_PROXY env vars) (#1132)strict tool fields for providers that reject them (#1172)PI_AI_ANTIGRAVITY_VERSION environment variable to override the Antigravity User-Agent version when Google updates their version requirements (#1129)cacheRetention stream option with provider-specific mappings for prompt cache controls, defaulting to short retention (#1134)maxRetryDelayMs option to StreamOptions to cap server-requested retry delays. When a provider (e.g., Google Gemini CLI) requests a delay longer than this value, the request fails immediately with an informative error instead of waiting silently. Default: 60000ms (60 seconds). Set to 0 to disable the cap. (#1123)enable_thinking. (#940 by @4h9fbZ)vercelGatewayRouting option in model config (#1051 by @ben-vargas)PI_CACHE_RETENTION environment variable to control cache TTL for Anthropic (5m vs 1h) and OpenAI (in-memory vs 24h). Set to long for extended retention. Only applies to direct API calls (api.anthropic.com, api.openai.com). (#967)toolChoice handling to correctly set type: "function" wrapper (#998 by @williamtwomey)sensitive stop_reason returned by API (#978)deepseek.com URLs and disabling unsupported developer role (#1048)message_delta events (#1045)openRouterRouting compat field (#859 by @v01dpr1mr0s3)azure-openai-responses provider support for Azure OpenAI Responses API. (#890 by @markusylisiurunen)createAssistantMessageEventStream() factory function for use in extensions.resetApiProviders() to clear and re-register built-in API providers.streamSimple mapping.env-api-keys.ts and re-exported it from the package entrypoint.model.api instead of hardcoded API typesarguments.done events on OpenAI-compatible endpoints (#917 by @williballenthin)headers option to StreamOptions for custom HTTP headers in API requests. Supported by all providers except Amazon Bedrock (which uses AWS SDK auth). Headers are merged with provider defaults and model.headers, with options.headers taking precedence.originator option to loginOpenAICodex() for custom OAuth client identificationid field for function_calls from different models to avoid triggering OpenAI's reasoning/function_call pairing validation (#886)AWS_CONTAINER_CREDENTIALS_RELATIVE_URI, AWS_CONTAINER_CREDENTIALS_FULL_URI, AWS_WEB_IDENTITY_TOKEN_FILE (#848)strictResponsesPairing compat option (no longer needed after the transform-messages fix)OpenAIResponsesCompat interface with strictResponsesPairing option for Azure OpenAI Responses API, which requires strict reasoning/message pairing in history replay (#768 by @prateekmedia)OpenAICompat into OpenAICompletionsCompat and OpenAIResponsesCompat for type-safe API-specific compat settingsstopReason: "error", its tool calls are now excluded from pending tool tracking, preventing synthetic tool results from being generated for calls that will be dropped by provider-specific converters. (#812)model.provider in addition to URL, allowing custom base URLs (e.g., proxies) to work correctly with provider-specific settings (#774)transformMessages/v1 endpoint to use system role instead of developer role, fixing 400 Incorrect role information error for models using openai-completions API (#755 by @melihmucuk)minimax-cn) provider support (#725 by @tallshort)gpt-5.2-codex models for GitHub Copilot and OpenCode Zen providers (#734 by @aadishv)parseStreamingJson from main package for tsx dev mode compatibilityAI_GATEWAY_API_KEY env support (#689 by @timolins)thinking: { type: "enabled" } instead of OpenAI's reasoning_effort. Added thinkingFormat compat flag to handle this. (#688)serviceTier option for OpenAI Responses requests (#672 by @markusylisiurunen)cache_control breakpoints on the last assistant or user message. (#584 by @nathyong)baseUrl is unset), header-based retry delay parsing (Retry-After, x-ratelimit-reset, x-ratelimit-reset-after), stable sessionId derivation from first user message for cache affinity, empty SSE stream retry with backoff, and anthropic-beta header for Claude thinking models (#670 by @kim0)isThinkingPart() now only checks thought === true, not thoughtSignature. Per Google docs, thoughtSignature is for context replay and can appear on any part type. Also removed id field from functionCall/functionResponse (rejected by Vertex AI and Cloud Code Assist), and added textSignature round-trip for multi-turn reasoning context. (#631 by @theBucky)GOOGLE_APPLICATION_CREDENTIALS env var support for Vertex AI credential detection (standard for CI/production).supportsUsageInStreaming compatibility flag for OpenAI-compatible providers that reject stream_options: { include_usage: true }. Defaults to true. Set to false in model config for providers like gatewayz.ai. (#596 by @XesGaDeus)os.homedir() calls at module load time; now resolved lazily when needed.GOOGLE_CLOUD_PROJECT / GOOGLE_CLOUD_PROJECT_ID env vars for paid tiers, and handles VPC-SC affected users (#582 by @cmf)OPENCODE_API_KEY env var to use.AbortError in retry catch block, cancel SSE reader when abort signal fires (#568 by @tmustier)role: "user", set requestType: "agent", and use antigravity userAgent. Added bridge prompt to override Antigravity behavior (identity, paths, web dev guidelines) with Pi defaults. (#571 by @ben-vargas)<thinking> tags) when switching models. Previously, <thinking> tags caused models to mimic the pattern and output literal tags. Also fixed empty thinking blocks causing API errors. (#561)thinkingBudgets option in SimpleStreamOptions for customizing token budgets per thinking level on token-based providers (#529 by @melihmucuk)gpt-5, gpt-5-mini, gpt-5-nano, codex-mini-latest, gpt-5-codex, gpt-5.1-codex, gpt-5.1-chat-latest). Use canonical model IDs: gpt-5.1, gpt-5.1-codex-max, gpt-5.1-codex-mini, gpt-5.2, gpt-5.2-codex. (#536 by @ghoulr)context_length_exceeded error codes.CacheMetadata, getCodexInstructions, getModelFamily, ModelFamily, buildCodexPiBridge, buildCodexSystemPrompt, CodexSystemPrompt (#510 by @mitsuhiko)sessionId option in StreamOptions for providers that support session-based caching. OpenAI Codex provider uses this to set prompt_cache_key and routing headers.reasoning.encrypted_content even when custom include options are passed (#484 by @kim0)gpt-5.2-codex-high). Use the base model ID and set thinking level separately. The Codex provider clamps reasoning effort to what each model supports internally. (initial implementation by @ben-vargas in #472)reasoning field entirely when thinking is off, letting the backend use its default instead of forcing a value. (#472)openai-codex-responses streaming provider with SSE parsing, tool-call handling, usage/cost tracking, and PKCE OAuth flow (#451 by @kim0)getEnvApiKey(): Returns "<authenticated>" when Application Default Credentials are configured (~/.config/gcloud/application_default_credentials.json exists) and both GOOGLE_CLOUD_PROJECT (or GCLOUD_PROJECT) and GOOGLE_CLOUD_LOCATION are set. This allows streamSimple() to work with Vertex AI without explicit apiKey option. The ADC credentials file existence check is cached per-process to avoid repeated filesystem access.getEnvApiKey() returned a dummy value for google-vertex, causing models to show up even when Google Cloud ADC was not configured.gcloud auth application-default login, set GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION, and access Gemini models via Vertex AI. (#300 by @default-anton)agentLoop, agentLoopContinue, AgentContext, AgentEvent, AgentTool, AgentToolResult, etc.) has moved to @mariozechner/pi-agent-core. Import from that package instead of @mariozechner/pi-ai.GoogleThinkingLevel type: Exported type that mirrors Google's ThinkingLevel enum values ("THINKING_LEVEL_UNSPECIFIED" | "MINIMAL" | "LOW" | "MEDIUM" | "HIGH"). Allows configuring Gemini thinking levels without importing from @google/genai.ANTHROPIC_OAUTH_TOKEN env var: Now checked before ANTHROPIC_API_KEY in getEnvApiKey(), allowing OAuth tokens to take precedence.event-stream.js export: AssistantMessageEventStream utility now exported from package index.crypto.subtle) instead of Node.js crypto module. This improves browser compatibility while still working in Node.js 20+.generate-models.ts now sorts providers and models alphabetically for consistent output across runs. (#332 by @mrexodia)reasoning_content and reasoning fields, causing each chunk to be processed twice. Now only the first non-empty reasoning field is used.openai-completions API with correct base URL (https://api.z.ai/api/coding/paas/v4) instead of incorrect Anthropic API mapping. (#344, #358 by @default-anton)loadOAuthCredentials, saveOAuthCredentials, setOAuthStorage, etc.) removed. Callers are responsible for storing credentials.loginAnthropic, loginGitHubCopilot, loginGeminiCli, loginAntigravity now return OAuthCredentials instead of saving to disk.(provider, credentials) and returns new OAuthCredentials instead of saving.(provider, credentials) and returns { newCredentials, apiKey } or null.type: "oauth" discriminator. Callers add discriminator when storing.getEnvApiKey. Only checks environment variables for known providers.</thinking> tags in responses. Unsigned thinking blocks (from aborted streams) are now converted to plain text without <thinking> tags. The TUI still displays them as thinking blocks. (#302 by @nicobailon)supportsXhigh() function to check if a model supports xhigh reasoning level. Also clamps xhigh to high for OpenAI models that don't support it. (#236 by @theBucky)Gemini multimodal tool results: Fixed images in tool results causing flaky/broken responses with Gemini models. For Gemini 3, images are now nested inside functionResponse.parts per the docs. For older models (which don't support multimodal function responses), images are sent in a separate user message.
Queued message steering: When getQueuedMessages is provided, the agent loop now checks for queued user messages after each tool call and skips remaining tool calls in the current assistant message when a queued message arrives (emitting error tool results).
Double API version path in Google provider URL: Fixed Gemini API calls returning 404 after baseUrl support was added. The SDK was appending its default apiVersion to baseUrl which already included the version path. (#251 by @shellfyred)
Anthropic SDK retries disabled: Re-enabled SDK-level retries (default 2) for transient HTTP failures. (#252)
Gemini 3 Flash thinking support: Extended thinking level support for Gemini 3 Flash models (MINIMAL, LOW, MEDIUM, HIGH) to match Pro models' capabilities. (#212 by @markusylisiurunen)
GitHub Copilot thinking models: Added thinking support for additional Copilot models (o3-mini, o1-mini, o1-preview). (#234 by @aadishv)
Gemini tool result format: Fixed tool result format for Gemini 3 Flash Preview which strictly requires { output: value } for success and { error: value } for errors. Previous format using { result, isError } was rejected by newer Gemini models. Also improved type safety by removing as any casts. (#213, #220)
Google baseUrl configuration: Google provider now respects baseUrl configuration for custom endpoints or API proxies. (#216, #221 by @theBucky)
GitHub Copilot vision requests: Added Copilot-Vision-Request header when sending images to GitHub Copilot models. (#222)
GitHub Copilot X-Initiator header: Fixed X-Initiator logic to check last message role instead of any message in history. This ensures proper billing when users send follow-up messages. (#209)
Image limits test suite: Added comprehensive tests for provider-specific image limitations (max images, max size, max dimensions). Discovered actual limits: Anthropic (100 images, 5MB, 8000px), OpenAI (500 images, ≥25MB), Gemini (~2500 images, ≥40MB), Mistral (8 images, ~15MB), OpenRouter (~40 images context-limited, ~15MB). (#120)
Tool result streaming: Added tool_execution_update event and optional onUpdate callback to AgentTool.execute() for streaming tool output during execution. Tools can now emit partial results (e.g., bash stdout) that are forwarded to subscribers. (#44)
X-Initiator header for GitHub Copilot: Added X-Initiator header handling for GitHub Copilot provider to ensure correct call accounting (agent calls are not deducted from quota). Sets initiator based on last message role. (#200 by @kim0)
tool_execution_end event now always contains AgentToolResult (no longer AgentToolResult | string). Errors are wrapped in the standard result format.reasoning option is not specified, thinking is now explicitly disabled for all providers. Previously, some providers like Gemini with "dynamic thinking" would use their default (thinking ON), causing unexpected token usage. This was the original intended behavior. (#180 by @markusylisiurunen)interleavedThinking option to AnthropicOptions. When enabled, Claude 4 models can think between tool calls and reason after receiving tool results. Enabled by default (no extra token cost, just unlocks the capability). Set interleavedThinking: false to disable.Dedicated to Peter's shoulder (@steipete)
github-copilot as a known provider with models sourced from models.dev. Includes Claude, GPT, Gemini, Grok, and other models available through GitHub Copilot. (#191 by @cau1k)GitHub Copilot gpt-5 models: Fixed API selection for gpt-5 models to use openai-responses instead of openai-completions (gpt-5 models are not accessible via completions endpoint)
GitHub Copilot cross-model context handoff: Fixed context handoff failing when switching between GitHub Copilot models using different APIs (e.g., gpt-5 to claude-sonnet-4). Tool call IDs from OpenAI Responses API were incompatible with other models. (#198)
Gemini 3 Pro thinking levels: Thinking level configuration now works correctly for Gemini 3 Pro models. Previously all levels mapped to -1 (minimal thinking). Now LOW/MEDIUM/HIGH properly control test-time computation. (#176 by @markusylisiurunen)
maxRetries: 0 on Anthropic client to allow application-level retry handling. The SDK's built-in retries were interfering with coding-agent's retry logic. (#157)MISTRAL_API_KEY environment variable to use.Fixed Mistral 400 errors after aborted assistant messages by skipping empty assistant messages (no content, no tool calls) (#165)
Removed synthetic assistant bridge message after tool results for Mistral (no longer required as of Dec 2025) (#165)
Fixed bug where ANTHROPIC_API_KEY environment variable was deleted globally after first OAuth token usage, causing subsequent prompts to fail (#164)
agentLoopContinue function: Continue an agent loop from existing context without adding a new user message. Validates that the last message is user or toolResult. Useful for retry after context overflow or resuming from manually-added tool results.agentLoop via executeToolCalls, allowing models to retry on validation errors. For manual tool execution, use validateToolCall(tools, toolCall) or validateToolArguments(tool, toolCall).Added validateToolCall(tools, toolCall) helper that finds the tool by name and validates arguments.
OpenAI compatibility overrides: Added compat field to Model for openai-completions API, allowing explicit configuration of provider quirks (supportsStore, supportsDeveloperRole, supportsReasoningEffort, maxTokensField). Falls back to URL-based detection if not set. Useful for LiteLLM, custom proxies, and other non-standard endpoints. (#133, thanks @fink-andreas for the initial idea and PR)
xhigh reasoning level: Added xhigh to ReasoningEffort type for OpenAI codex-max models. For non-OpenAI providers (Anthropic, Google), xhigh is automatically mapped to high. (#143)
totalTokens field to Usage type: All code that constructs Usage objects must now include the totalTokens field. This field represents the total tokens processed by the LLM (input + output + cache). For OpenAI and Google, this uses native API values (total_tokens, totalTokenCount). For Anthropic, it's computed as input + output + cacheRead + cacheWrite.gpt-5.1-codex-max model supportOpenAI Token Counting: Fixed usage.input to exclude cached tokens for OpenAI providers. Previously, input included cached tokens, causing double-counting when calculating total context size via input + cacheRead. Now input represents non-cached input tokens across all providers, making input + output + cacheRead + cacheWrite the correct formula for total context size.
Fixed Claude Opus 4.5 cache pricing (was 3x too expensive)
scripts/generate-models.ts until upstream fix is mergedInitial release with multi-provider LLM support.