hermes - ✅(Solved) Fix custom_providers: /model picker ignores live /v1/models endpoint, shows stale static subset [1 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#19071Fetched 2026-05-04 05:18:18
View on GitHub
Comments
1
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

Error Message

if api_url and api_key and discover: try: from hermes_cli.models import fetch_api_models live_models = fetch_api_models(api_key, api_url) if live_models: models_list = live_models except Exception: pass

Root Cause

Section 3 of list_authenticated_providers() calls fetch_api_models() to do live discovery:

if api_url and api_key and discover:
    try:
        from hermes_cli.models import fetch_api_models
        live_models = fetch_api_models(api_key, api_url)
        if live_models:
            models_list = live_models
    except Exception:
        pass

Section 4 has no equivalent — it only reads the static models: dict from the config entry.

Fix Action

Fix

PR incoming with the same live discovery pattern added to the custom_providers (section 4) processing loop.

PR fix notes

PR #19072: fix(model_switch): live model discovery for custom_providers in /model picker

Description (problem / solution / changelog)

Closes #19071

Problem

custom_providers entries in config.yaml only showed the statically-configured models: dict in the /model picker, ignoring the live /v1/models endpoint. Gateways like Bifrost that expose hundreds of models were limited to whatever handful the user had explicitly listed.

Root cause

list_authenticated_providers() section 4 (custom_providers processing) only read the static models: dict. Section 3 (user providers: entries) already had live discovery via fetch_api_models() — this PR adds the same pattern to section 4.

Changes

  • hermes_cli/model_switch.py: Added live model discovery for custom_providers entries with api_key + base_url, matching section 3 behavior.
  • tests/hermes_cli/test_model_switch_custom_providers.py: Added test_custom_providers_uses_live_models_for_multi_model_endpoint to verify the live list replaces the static subset.

Testing

# All model_switch tests pass
pytest tests/hermes_cli/test_model_switch_custom_providers.py \
       tests/hermes_cli/test_custom_provider_model_switch.py \
       tests/hermes_cli/test_user_providers_model_switch.py \
       tests/hermes_cli/test_apply_model_switch_result_context.py \
       tests/hermes_cli/test_model_switch_context_display.py
# 68 passed

Changed files

  • hermes_cli/model_switch.py (modified, +14/-1)
  • tests/hermes_cli/test_model_switch_custom_providers.py (modified, +61/-0)

Code Example

if api_url and api_key and discover:
    try:
        from hermes_cli.models import fetch_api_models
        live_models = fetch_api_models(api_key, api_url)
        if live_models:
            models_list = live_models
    except Exception:
        pass
RAW_BUFFERClick to expand / collapse

Bug description

When using a custom provider entry pointed at a multi-model gateway (e.g., Bifrost, Ollama, LM Studio), the /model picker only shows models listed in the static models: dict in config.yaml. It never fetches the live /v1/models endpoint to discover all available models.

This is because list_authenticated_providers() in hermes_cli/model_switch.py does live model discovery for user providers: entries (section 3) but not for custom_providers entries (section 4).

Steps to reproduce

  1. Configure a custom_providers entry pointing at Bifrost with an api_key, base_url, and a small models: dict (e.g., 9 models).
  2. Run /model in Hermes.
  3. Only the 9 static models appear, even though the gateway exposes 581 models on /v1/models.

Root cause

Section 3 of list_authenticated_providers() calls fetch_api_models() to do live discovery:

if api_url and api_key and discover:
    try:
        from hermes_cli.models import fetch_api_models
        live_models = fetch_api_models(api_key, api_url)
        if live_models:
            models_list = live_models
    except Exception:
        pass

Section 4 has no equivalent — it only reads the static models: dict from the config entry.

Fix

PR incoming with the same live discovery pattern added to the custom_providers (section 4) processing loop.

extent analysis

TL;DR

To fix the issue, add live model discovery to the custom_providers processing loop in list_authenticated_providers() by calling fetch_api_models() for custom provider entries.

Guidance

  • Review the list_authenticated_providers() function in hermes_cli/model_switch.py to understand the difference in handling providers and custom_providers entries.
  • Add a call to fetch_api_models() in the custom_providers processing loop to enable live model discovery for custom providers.
  • Verify that the /model picker shows all available models after implementing the fix by running the command and checking the output.
  • Test the fix with different custom provider configurations to ensure it works as expected.

Example

# Example of how the fix might look in list_authenticated_providers()
for custom_provider in custom_providers:
    if custom_provider['api_url'] and custom_provider['api_key'] and discover:
        try:
            live_models = fetch_api_models(custom_provider['api_key'], custom_provider['api_url'])
            if live_models:
                models_list = live_models
        except Exception:
            pass

Notes

The provided code snippet is based on the assumption that the fetch_api_models() function is correctly implemented and works for custom providers. Additional testing and verification may be necessary to ensure the fix works as expected.

Recommendation

Apply the workaround by adding live model discovery to the custom_providers processing loop, as this will allow the /model picker to show all available models for custom providers.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING