pi-mono/packages/ai/scripts
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
..
ai-gateway-pricing.ts fix(ai): keep prompt-length pricing tiers from all model catalogs 2026-10-07 21:54:18 +02:00
check-model-data.ts fix(ai): validate generated model data before builds 2026-07-20 22:29:06 +02:00
generate-models.ts fix(ai): use models.dev metadata for Claude 5.5 models 2026-10-08 11:20:26 +02:00
generate-test-image.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
hydrate-model-catalog.ts feat(coding-agent): add Nix flake (#9137) 2026-10-02 18:30:51 +02:00
model-data.ts feat(coding-agent): add Nix flake (#9137) 2026-10-02 18:30:51 +02:00
models-dev-reasoning-options.ts generate-models: use reasoning options from models.dev (#6928) 2026-07-22 08:33:34 +02:00
openrouter-catalog.ts feat(ai,coding-agent): list only the OpenRouter models a key may use (#10672) 2026-10-12 10:17:40 +02:00
openrouter-reasoning-options.ts fix(ai): derive OpenRouter reasoning controls (#8614) 2026-08-25 12:11:21 +02:00