fix(models): use curated list for Nous in provider_model_ids()

provider_model_ids('nous') was calling fetch_nous_models() which
returns the FULL live Nous API catalog (382 models including image
generators, rerankers, and non-agentic models). This caused the
/model picker fallback to dump hundreds of models into the list,
making it unusable.

PR #10146 fixed the /model picker to prefer the curated list first,
but the fallback still called provider_model_ids() which returned
382 models. On WSL2 environments where stale .pyc caches prevented
the #10146 fix from taking effect, users saw the full catalog.

Fix: Return the curated _PROVIDER_MODELS['nous'] list (29 models)
directly, matching the pattern used by hermes model, the gateway
picker, and the OpenRouter flow (which also uses curated lists
cross-referenced against the live API rather than raw live data).

Before: provider_model_ids('nous') → 382 models (live API)
After:  provider_model_ids('nous') → 29 models (curated)
This commit is contained in:
Teknium 2026-04-15 03:49:16 -07:00
parent 1c4d3216d3
commit 34d2a332ef
No known key found for this signature in database

View file

@ -1237,16 +1237,12 @@ def provider_model_ids(provider: Optional[str], *, force_refresh: bool = False)
if normalized == "copilot-acp":
return list(_PROVIDER_MODELS.get("copilot", []))
if normalized == "nous":
# Try live Nous Portal /models endpoint
try:
from hermes_cli.auth import fetch_nous_models, resolve_nous_runtime_credentials
creds = resolve_nous_runtime_credentials()
if creds:
live = fetch_nous_models(api_key=creds.get("api_key", ""), inference_base_url=creds.get("base_url", ""))
if live:
return live
except Exception:
pass
# Use curated list — the live /models endpoint returns 300+ models
# (including non-agentic ones like image generators and rerankers).
# The curated list matches the `hermes model` and gateway pickers.
curated = _PROVIDER_MODELS.get("nous", [])
if curated:
return list(curated)
if normalized == "anthropic":
live = _fetch_anthropic_models()
if live: