Bug: "Fetch available models" returns stale bundled catalog for built-in providers (e.g. OpenRouter) instead of querying the live endpoint #4469
calvinmoltbot
started this conversation in
General
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.
Summary
On the web Models settings page, clicking "Fetch available models" on a built-in catalog provider's card (e.g. OpenRouter) never queries the provider's live
/modelsendpoint.discoverModels()short-circuits to the bundled static catalog whenever the request names an installed pi-ai provider, so the button effectively returns a stale snapshot instead of discovering what the provider currently advertises.For OpenRouter specifically, the bundled snapshot (
@earendil-works/pi-ai's generatedopenrouter.json) contains 276 models, while OpenRouter's liveGET https://openrouter.ai/api/v1/modelscurrently advertises 418. Models added upstream after the snapshot was generated are impossible to discover through the UI and must be entered by hand.Environment
0.1.1-rc.2@deepseek-ai/dsh-llm-pi-ai0.1.1-rc.2@earendil-works/pi-ai0.82.1Repro steps
stealth/ox-alpha,google/gemini-3.7-flash— are absent.Expected behavior
"Fetch available models" interrogates the provider's live endpoint (
<baseUrl>/models) and returns what it currently advertises, falling back to the bundled catalog only when no base URL is known (or optionally, when the live request fails).Actual behavior
discoverModels()returns early before any network call:The UI probe for a built-in card always carries
providerand nobaseURL(unless the user overrides it), so every fetch resolves from the static snapshot and the network path is unreachable for exactly the providers that ship a catalog.Suggested fix
When the named provider's installed catalog also ships a
baseUrl, prefer the live listing; keep the bundled list as a fallback when there is no base URL at all:Optionally, catch a failed live fetch and degrade to the bundled snapshot rather than erroring, so offline use still gets the stale list.
I verified locally against this build that preferring the catalog
baseUrlmakes the OpenRouter card return the live 418-model listing, including models missing from the snapshot. Note only the host-side change is needed:catalogProvider(...)is already in scope indsh-llm-pi-ai, and the stored-key closure already resolves the right credential per route.Workaround
Manually add the missing model ids on the provider card, or patch
discoverModelsas above in the installeddsh-llm-pi-aipackage (noting a local patch is overwritten by reinstall/upgrade).All reactions