pi-mono/packages/ai/test
David Brailovsky ee409a85f6
feat(ai,coding-agent): list only the OpenRouter models a key may use (#10672)
On each OpenRouter refresh, combine the catalog (built-in models plus a newer pi.dev catalog) with GET /models/user for the user's key: keep only the listed chat models and take their context size, max output and prices from it. Image and classifier models are kept. The combined list is saved and replaces the OpenRouter catalog, including offline.

- ai: add personalizeOpenRouterCatalog and RefreshModelsContext.baseUrl, so the request follows a base URL configured in models.json (regional endpoints)
- ai: share OpenRouter price conversion with the generator; negative prices (router models such as openrouter/auto) become 0
- coding-agent: add withPersonalizedCatalog next to withRemoteCatalog
- docs: OpenRouter section in providers.md

fixes #10353
2026-10-12 10:17:40 +02:00
..
data feat(ai): Add image input tests for vision-capable models 2025-08-30 18:37:17 +02:00
abort.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
anthropic-adaptive-thinking-models.test.ts fix(ai): pin Kimi K3 Moonshot pricing and expect Haiku 5.5 adaptive thinking 2026-10-07 22:41:41 +02:00
anthropic-auth-token.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
anthropic-cache-write-1h-cost.test.ts fix(ai): price Vercel AI Gateway 1-hour cache writes correctly 2026-09-23 17:16:32 +02:00
anthropic-eager-tool-input-compat.test.ts fix(ai): send Anthropic tools non-strict when schema has rejected keywords 2026-09-30 15:20:17 +02:00
anthropic-eager-tool-input-e2e.test.ts fix(ai): type Anthropic probes by catalog providers 2026-07-14 12:29:38 +02:00
anthropic-empty-thinking-signature-compat.test.ts fix(ai,coding-agent): update Fireworks tests and default for removed models 2026-09-28 00:22:39 +02:00
anthropic-federation-sdk.test.ts feat(ai): Anthropic workload identity federation (#10242) 2026-09-30 20:58:37 +02:00
anthropic-federation.test.ts feat(ai): Anthropic workload identity federation (#10242) 2026-09-30 20:58:37 +02:00
anthropic-force-adaptive-thinking.test.ts kimi: add low,high to k3 and remove k2p7 references 2026-07-20 09:00:15 +00:00
anthropic-long-cache-retention-e2e.test.ts fix(ai): type Anthropic probes by catalog providers 2026-07-14 12:29:38 +02:00
anthropic-mid-conversation-effort.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
anthropic-oauth.test.ts fix(ai): fall back to a free port for Anthropic OAuth callback 2026-10-07 07:47:22 +00:00
anthropic-opus-4-8-smoke.test.ts fix(ai): revert selective pi-ai base entrypoints 2026-06-22 12:54:32 +02:00
anthropic-sse-parsing.test.ts feat(coding-agent,tui): System theme (#10067) 2026-09-26 13:33:47 +02:00
anthropic-strict-tool-schema.test.ts fix(ai): send Anthropic tools non-strict when schema has rejected keywords 2026-09-30 15:20:17 +02:00
anthropic-temperature-compat.test.ts fix(ai): revert selective pi-ai base entrypoints 2026-06-22 12:54:32 +02:00
anthropic-thinking-binding-e2e.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
anthropic-thinking-disable.test.ts fix(ai): update generated model catalogue 2026-06-30 22:12:48 +02:00
anthropic-tool-name-normalization.test.ts fix(ai): revert selective pi-ai base entrypoints 2026-06-22 12:54:32 +02:00
assistant-message-frame.test.ts fix(ai): preserve provider thinking level in frames 2026-09-03 14:26:49 +02:00
azure-openai-base-url.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
azure-openai-completions.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
azure-openai-responses-reasoning-replay.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
azure-openai-tool-choice.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
azure-utils.ts add Azure deployment name map and refresh generated models 2026-01-24 12:04:34 +01:00
baseten-models.test.ts fix: repair Baseten and coding-agent test checks 2026-09-03 11:40:37 +02:00
bedrock-cache-write-1h-cost.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
bedrock-convert-messages.test.ts feat(agent): add Pico storage foundation 2026-09-18 12:32:00 +02:00
bedrock-credentials.test.ts fix(ai): prefer configured Bedrock profile over ambient AWS keys (#7176) 2026-07-28 08:38:35 +02:00
bedrock-custom-headers.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
bedrock-endpoint-resolution.test.ts fix(ai): filter ambient auth markers in compat dispatch 2026-07-11 13:38:48 +02:00
bedrock-error-metadata.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
bedrock-models.test.ts feat(ai): support Claude Opus 5 on Bedrock (#7081) 2026-07-25 08:25:23 +02:00
bedrock-raw-stop-reason.test.ts feat: expose provider stream events to extensions (#9901) 2026-09-23 16:03:30 +02:00
bedrock-redacted-reasoning.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
bedrock-response-headers.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
bedrock-thinking-payload.test.ts fix(ai): send reasoning effort to OpenAI models on Bedrock Converse (#10142) 2026-10-06 18:06:46 +02:00
bedrock-utils.ts feat(ai): Add Amazon Bedrock provider (#494) 2026-01-13 00:32:59 +01:00
cache-retention.test.ts feat(ai,coding-agent): add alternative sign in for the openai provider 2026-09-29 17:16:15 +02:00
classifier-models.test.ts feat(ai,coding-agent): add OpenAI Decisions classifier and classifier images 2026-10-07 08:27:56 +02:00
cloudflare-ai-binding.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
cloudflare-stream.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
cloudflare-utils.ts fix(ai): finalize cloudflare gateway provider support 2026-05-01 00:56:05 +02:00
cloudflare-workers-ai-system-one.test.ts feat(ai): add Cloudflare Clef classifiers to Workers AI (#10316) 2026-10-02 16:52:58 +02:00
codex-websocket-cached-probe.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
compat-env.test.ts feat(ai): complete models runtime migration 2026-06-23 15:29:46 +02:00
compat-schema.test.ts feat(coding-agent): publish configuration schemas (#9880) 2026-10-08 10:01:17 +02:00
constrained-sampling.test.ts fix(ai): drop mismatched item ids when replaying grammar tool calls 2026-10-01 20:42:40 +02:00
context-estimate.test.ts fix(ai): estimate request context at 3.5 characters per token 2026-10-06 17:37:24 +02:00
context-overflow.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
cross-provider-handoff.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
empty.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
env-api-keys.test.ts fix(ai): support Anthropic bearer token env (#6148) 2026-07-24 15:13:22 +02:00
error-body.test.ts fix(ai): treat only plain objects as provider error bodies (#7205) 2026-07-31 09:38:54 +02:00
event-stream.test.ts feat: record response, tool execution, and durable task times 2026-10-06 19:28:54 +02:00
faux-provider.test.ts fix(ai): compare faux prompt-cache usage per message 2026-10-06 20:58:35 +02:00
fetch-option.test.ts feat(ai,coding-agent): unify image and classifier model infrastructure (#9948) 2026-09-23 17:41:19 +02:00
fireworks-model-generation.test.ts feat(ai,coding-agent): unify image and classifier model infrastructure (#9948) 2026-09-23 17:41:19 +02:00
fireworks-models.test.ts fix(ai,coding-agent): update Fireworks tests and default for removed models 2026-09-28 00:22:39 +02:00
generate-models-strict.test.ts fix(ai): add Qwen3.8 Flash to individual token plan 2026-09-03 12:34:53 +02:00
github-copilot-anthropic.test.ts feat(ai,coding-agent): add new Copilot models 2026-09-22 21:14:13 +02:00
github-copilot-oauth.test.ts fix(ai): keep Copilot tests aligned with current model catalog 2026-09-04 11:15:20 +02:00
google-raw-stop-reason.test.ts feat: expose provider stream events to extensions (#9901) 2026-09-23 16:03:30 +02:00
google-shared-convert-tools.test.ts feat(ai): support constrained sampling (#6341) 2026-07-23 23:48:40 +02:00
google-shared-gemini3-unsigned-tool-call.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
google-shared-image-tool-result-routing.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
google-shared-retry.test.ts fix(ai): retry transient provider errors in Google adapters (#7471) 2026-08-03 12:45:45 +02:00
google-shared-signed-empty-blocks.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
google-thinking-disable.test.ts fix(ai): revert selective pi-ai base entrypoints 2026-06-22 12:54:32 +02:00
google-thinking-level-map.test.ts fix(ai): avoid unsupported Gemini thinking levels 2026-09-17 10:08:36 +02:00
google-thinking-signature.test.ts feat(ai): move API implementations to src/api with lazy wrappers (phase 2) 2026-06-10 20:08:59 +02:00
google-vertex-api-key-resolution.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
image-model-data.test.ts feat(ai): serve Jev classifier through OpenRouter and Cloudflare Workers AI 2026-09-24 12:34:58 +02:00
image-tool-result.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
images-models.test.ts feat(tui,coding-agent): add color values and theme styling (#8398) 2026-09-24 14:42:22 +02:00
images.test.ts feat(ai,coding-agent): unify image and classifier model infrastructure (#9948) 2026-09-23 17:41:19 +02:00
interleaved-thinking.test.ts fix(ai): revert selective pi-ai base entrypoints 2026-06-22 12:54:32 +02:00
kimi-coding-oauth.test.ts fix(coding-agent): make model refresh cancellation caller-owned 2026-08-04 00:03:52 +02:00
lax-message-content.test.ts fix(ai,agent,coding-agent): normalize null message content at ingestion boundaries (#6343) 2026-07-06 20:47:08 +02:00
lazy-module-load.test.ts fix(ai): replace Mistral SDK with native transport 2026-08-08 09:32:49 +02:00
llama-cpp-classify.test.ts feat(ai): Discount jev (#10119) 2026-09-28 14:19:07 +02:00
max-thinking.test.ts feat(ai,coding-agent): add GPT-6.1 Sol and make it the Codex default 2026-09-29 19:43:27 +02:00
message-types.test.ts feat(agent): add Pico storage foundation 2026-09-18 12:32:00 +02:00
meta-oauth.test.ts feat(ai,coding-agent): add Meta provider with Muse subscription OAuth (#9096) 2026-09-20 11:13:43 +02:00
mistral-http-transport.test.ts fix(ai): apply Mistral request timeout only to response headers 2026-10-08 10:24:04 +02:00
mistral-raw-stop-reason.test.ts fix(ai): retry Mistral finish_reason error 2026-10-07 09:06:19 +00:00
mistral-reasoning-mode.test.ts fix(ai): send requested thinking level to Mistral reasoning models 2026-09-28 14:33:10 +02:00
mistral-tool-schema.test.ts feat(ai): support constrained sampling (#6341) 2026-07-23 23:48:40 +02:00
model-catalog-types.test.ts feat(ai,coding-agent): add new Copilot models 2026-09-22 21:14:13 +02:00
model-cost-tiers.test.ts fix(ai): keep prompt-length pricing tiers from all model catalogs 2026-10-07 21:54:18 +02:00
model-data-validation.test.ts feat(coding-agent): add Nix flake (#9137) 2026-10-02 18:30:51 +02:00
model-types.test.ts feat(ai,coding-agent): unify image and classifier model infrastructure (#9948) 2026-09-23 17:41:19 +02:00
models-entry.test.ts feat(ai,durable): add lightweight pi-ai/models entry and avoid TypeBox in durable 2026-09-29 21:24:17 +02:00
models-runtime.test.ts feat(ai,coding-agent): list only the OpenRouter models a key may use (#10672) 2026-10-12 10:17:40 +02:00
node-http-proxy.test.ts fix(ai): match subdomains and root domains in NO_PROXY (#8737) 2026-09-01 11:38:31 +02:00
oauth-auth.test.ts feat(ai,coding-agent): add alternative sign in for the openai provider 2026-09-29 17:16:15 +02:00
oauth-callback-server.test.ts fix(ai): use color Pi logo on OAuth pages 2026-10-01 15:10:11 +02:00
oauth-device-code.test.ts fix(coding-agent): make model refresh cancellation caller-owned 2026-08-04 00:03:52 +02:00
oauth.ts fix(coding-agent): make model refresh cancellation caller-owned 2026-08-04 00:03:52 +02:00
openai-chatgpt-oauth.test.ts feat(ai): let apps name themselves in OpenAI logins (#10433) 2026-10-06 09:27:40 +02:00
openai-codex-cache-affinity-e2e.test.ts fix(ai): revert selective pi-ai base entrypoints 2026-06-22 12:54:32 +02:00
openai-codex-oauth.test.ts feat(ai): let apps name themselves in OpenAI logins (#10433) 2026-10-06 09:27:40 +02:00
openai-codex-stream.test.ts fix(ai): let caller headers override Codex originator and User-Agent (#10429) 2026-10-06 10:01:19 +02:00
openai-completions-cache-control-format.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
openai-completions-empty-tools.test.ts fix(ai): update output limit assertions for token estimate 2026-10-06 15:58:16 +00:00
openai-completions-prompt-cache.test.ts fix(ai,coding-agent): update Fireworks tests and default for removed models 2026-09-28 00:22:39 +02:00
openai-completions-provider-stream-event.test.ts feat: expose provider stream events to extensions (#9901) 2026-09-23 16:03:30 +02:00
openai-completions-raw-stop-reason.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
openai-completions-reasoning-details.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
openai-completions-response-model.test.ts fix(ai): revert selective pi-ai base entrypoints 2026-06-22 12:54:32 +02:00
openai-completions-retry.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
openai-completions-thinking-as-text.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
openai-completions-thinking-token-budget.test.ts feat(ai): generalize openai-completions thinking token budget fields (#8275) 2026-08-18 16:35:35 +02:00
openai-completions-tool-choice.test.ts fix(ai): update tests for removed OpenCode Go Kimi K2.6 2026-09-28 12:01:02 +02:00
openai-completions-tool-result-images.test.ts fix(ai): omit empty text parts from multimodal user messages 2026-09-21 21:48:11 +02:00
openai-completions-vllm-priority.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
openai-decisions.test.ts feat(ai,coding-agent): add OpenAI Decisions classifier and classifier images 2026-10-07 08:27:56 +02:00
openai-responses-cache-affinity-e2e.test.ts fix(ai): revert selective pi-ai base entrypoints 2026-06-22 12:54:32 +02:00
openai-responses-chatgpt-sign-in.test.ts feat(ai,coding-agent): add alternative sign in for the openai provider 2026-09-29 17:16:15 +02:00
openai-responses-compat.test.ts feat(ai,coding-agent): add alternative sign in for the openai provider 2026-09-29 17:16:15 +02:00
openai-responses-empty-tool-result.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
openai-responses-foreign-toolcall-id.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
openai-responses-message-id.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
openai-responses-namespace.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
openai-responses-partial-json-cleanup.test.ts feat(ai): expose pending stop reason while streaming (#7151) 2026-07-27 11:56:15 +02:00
openai-responses-reasoning-replay-e2e.test.ts fix tests: use updated models 2026-07-24 18:52:56 +00:00
openai-responses-terminal-event.test.ts fix(ai): reject unfinished Responses tool calls instead of running them 2026-09-28 23:19:38 +02:00
openai-responses-tool-result-images.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
openai-responses-usage-limit.test.ts feat(ai,coding-agent): add alternative sign in for the openai provider 2026-09-29 17:16:15 +02:00
opencode-provider-headers.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
openrouter-cache-control-models.test.ts feat(ai): preserve Anthropic per-turn thinking effort 2026-09-02 21:39:29 +02:00
openrouter-cache-write-repro.test.ts fix(ai): revert selective pi-ai base entrypoints 2026-06-22 12:54:32 +02:00
openrouter-images.test.ts feat(ai,coding-agent): unify image and classifier model infrastructure (#9948) 2026-09-23 17:41:19 +02:00
openrouter-oauth.test.ts feat(ai,coding-agent): unify image and classifier model infrastructure (#9948) 2026-09-23 17:41:19 +02:00
openrouter-reasoning-options.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
openrouter-user-models.test.ts feat(ai,coding-agent): list only the OpenRouter models a key may use (#10672) 2026-10-12 10:17:40 +02:00
overflow.test.ts fix(ai): detect Z.AI CN endpoint context overflow errors 2026-09-30 10:51:10 +02:00
pi-messages.test.ts feat: expose provider stream events to extensions (#9901) 2026-09-23 16:03:30 +02:00
pre-generation-error.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
provider-error-body-passthrough.test.ts feat(ai,coding-agent): unify image and classifier model infrastructure (#9948) 2026-09-23 17:41:19 +02:00
provider-error-body-regression.test.ts Mid conversation system messages (#9548) 2026-09-16 15:54:07 +02:00
provider-retry.test.ts feat(ai,coding-agent): add OpenAI Decisions classifier and classifier images 2026-10-07 08:27:56 +02:00
providers.test.ts fix(ai,coding-agent): update Fireworks tests and default for removed models 2026-09-28 00:22:39 +02:00
qwen-token-plan-models.test.ts fix(ai): add Qwen3.8 Flash to individual token plan 2026-09-03 12:34:53 +02:00
radius-oauth.test.ts feat(ai,coding-agent): share OAuth callback server and sign-in page 2026-09-29 12:10:50 +02:00
radius-provider.test.ts fix(ai): replace bundled Radius catalog with gateway catalog 2026-10-06 19:46:54 +02:00
radius-thinking-replay-e2e.test.ts test(ai): e2e repro for radius dropping replayed Claude thinking 2026-10-11 16:35:08 +00:00
reasoning-options.test.ts generate-models: use reasoning options from models.dev (#6928) 2026-07-22 08:33:34 +02:00
responseid.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
retry.test.ts fix(ai): retry HTTP/2 pending stream cancellation 2026-10-05 13:49:46 +02:00
sampling-options.test.ts feat(ai): add per-thinking-level sampling parameters (#9776) 2026-10-04 01:29:01 +02:00
scratch.ts feat(coding-agent): replace model registry with model runtime 2026-07-14 17:48:45 +02:00
stream.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
supports-xhigh.test.ts fix(ai): use models.dev metadata for Claude 5.5 models 2026-10-08 11:20:26 +02:00
system-message-replay.test.ts fix(coding-agent): send forced system prompts without recording them 2026-09-17 20:02:23 +02:00
telemetry-options.test.ts feat(ai,coding-agent): unify image and classifier model infrastructure (#9948) 2026-09-23 17:41:19 +02:00
text.test.ts feat(ai): add shared contentText utility (#6840) 2026-07-20 01:50:36 +02:00
together-models.test.ts fix(ai): update Together DeepSeek V4 Pro model ID (#10336) 2026-10-02 10:18:11 +02:00
tokens.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
tool-call-id-normalization.test.ts fix(coding-agent): update repository links to "earendil-works/pi" (#9278) 2026-09-07 14:09:39 +02:00
tool-call-without-result.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
total-tokens.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
transcript-tool-changes.test.ts feat(ai): define Anthropic mid-conversation tools inline 2026-10-02 12:30:48 +02:00
transform-messages-copilot-openai-to-anthropic.test.ts feat(ai): move API implementations to src/api with lazy wrappers (phase 2) 2026-06-10 20:08:59 +02:00
typesafe-system-one.test.ts feat(ai,coding-agent): add OpenAI Decisions classifier and classifier images 2026-10-07 08:27:56 +02:00
unicode-surrogate.test.ts feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
uuid.test.ts feat(ai): support UUIDv7 follower timestamps 2026-08-12 11:11:30 +03:00
validation.test.ts feat(agent): add Pico storage foundation 2026-09-18 12:32:00 +02:00
xai-oauth.test.ts fix(coding-agent): make model refresh cancellation caller-owned 2026-08-04 00:03:52 +02:00
xai-responses.test.ts feat(ai,coding-agent): add Grok 4.7 support 2026-09-22 00:07:34 +02:00
xhigh.test.ts fix tests: use updated models 2026-07-24 18:52:56 +00:00
xiaomi-models.test.ts fix(ai,coding-agent): remove deprecated Xiaomi models 2026-08-17 14:43:48 +02:00
xiaomi-token-plan-ams-anthropic-empty-signature-smoke.test.ts fix(ai): revert selective pi-ai base entrypoints 2026-06-22 12:54:32 +02:00
zai-coding-plan-models.test.ts fix(ai): update tests for current model catalogs 2026-09-18 09:49:53 +02:00
zen.test.ts fix(ai): revert selective pi-ai base entrypoints 2026-06-22 12:54:32 +02:00