Skip to content

fix(#604): model picker shows all configured providers#1126

Closed
bergeouss wants to merge 1 commit intonesquena:masterfrom
bergeouss:fix/604-model-picker-all-providers
Closed

fix(#604): model picker shows all configured providers#1126
bergeouss wants to merge 1 commit intonesquena:masterfrom
bergeouss:fix/604-model-picker-all-providers

Conversation

@bergeouss
Copy link
Copy Markdown
Contributor

Summary

Partially addresses #604

Two fixes to ensure the model picker surfaces every provider a user has configured:

1. Env var detection for xAI and Mistral

Added XAI_API_KEYx-ai and MISTRAL_API_KEYmistralai to the env var scanning. Previously these providers were only detectable via hermes auth or credential pool, not via environment variables.

2. Config.yaml providers section scanning

Users who configure providers in config.yaml (e.g. providers.anthropic.api_key) without setting the corresponding env var will now see those providers in the model picker. Only providers with known model catalogs in _PROVIDER_MODELS are added — no phantom entries.

Changes

  • api/config.py: Added XAI_API_KEY/MISTRAL_API_KEY env var scanning + config.yaml providers section scanning for known providers
  • tests/test_issue604_all_providers_model_picker.py: 12 regression tests

Note

The full #604 feature (provider key management from WebUI settings) is a larger effort. This PR addresses the core detection gap.

Testing

12 passed

Two fixes to ensure the model picker surface every provider a user has
configured:

1. Added env var detection for XAI_API_KEY (→ x-ai) and MISTRAL_API_KEY
   (→ mistralai). Previously these providers were only detectable via
   hermes auth or credential pool, not via environment variables.

2. Added config.yaml providers section scanning. Users who configure
   providers in config.yaml (e.g. providers.anthropic.api_key) without
   setting the corresponding env var will now see those providers in the
   model picker. Only providers with known model catalogs are added.

- Added 12 regression tests
@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Triage Review ✅

Clean targeted fix for the provider detection gap in #604.

What it does:

  • Adds XAI_API_KEYx-ai and MISTRAL_API_KEYmistralai to both the env var key list scan and the explicit detected_providers.add() block — consistent with how every other provider is handled
  • Adds a new cfg.get("providers", {}) scan so users who set provider API keys directly in config.yaml (without a corresponding env var) are also detected — only adds providers present in _PROVIDER_MODELS, preventing phantom entries

Code review:

  • api/config.py diff is minimal and surgical (+15 lines) — no side effects risk
  • Both env var additions follow the existing pattern exactly (list scan + explicit add block)
  • The config.yaml scan correctly guards against non-dict values (isinstance(_cfg_providers, dict)) and only allows known providers — safe
  • 12 regression tests cover both code paths (env vars and config.yaml detection) plus provider catalog completeness checks

One note: XAI_API_KEY is added both to the list at line ~1413 and as an explicit if all_env.get("XAI_API_KEY") block below — this mirrors the pattern used by other providers (e.g. OPENCODE_ZEN_API_KEY), so it's correct; the list scan feeds the credential pool path, the explicit block covers the all_env path.

Ready to merge. Addresses the core detection gap from #604.

@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Absorbed and shipped in v0.50.223 (PR #1127). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants