New OpenRouter models don't show up until a new release #1394
kristianernst
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Area
AI providers and models, Coding agent and CLI
Problem
Prime Agent's OpenRouter model list comes from a generated snapshot (models.generated.ts), so a model released on OpenRouter today can't be used until maintainers regenerate the snapshot and ship a release.
This affects --model openrouter/..., the model picker, and saved defaults. Snapshot churn also affects existing sessions: if an upgrade's regenerated snapshot dropped or renamed a model an old session used, that session falls back to a different model with a warning.
Proposed direction
Fetch the live OpenRouter catalog (/api/v1/models) at the points that need it (catalog refresh, session restore, --model openrouter/... startup), with a short TTL, in-flight dedupe, and failure backoff, keeping the generated snapshot as the offline/failure fallback. For ids the snapshot already knows, its curated cost/limit/compat metadata stays authoritative; live data contributes membership and capabilities for new ids. Session restore consults the live catalog too, so sessions using live-only models survive restarts. Offline mode (PI_OFFLINE) skips the network entirely.
Alternatives considered
Do nothing: users can already add missing models by hand in models.json - that's manual, per-user.
Ship releases more often.
A user command that updates a local catalog: something like pi model refresh, alongside the existing pi model list — fetch the current OpenRouter catalog and save it to a small file in the agent's config directory, loaded at startup. Same parser and data source as the proposal, but it only runs when the user asks, and the result survives restarts and works offline.
Additional context
Transparency. I opened PR #1310 before CONTRIBUTING.md was part of the main branch.
Happy to treat it as a reference implementation and rework or close it depending on where maintainers want to take this.
All reactions