hermes - ✅(Solved) Fix [Bug]: Telegram model picker does not list models from providers.custom.models dict [2 pull requests, 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#11499Fetched 2026-04-18 06:00:42
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×2

Root Cause

list_authenticated_providers() in hermes_cli/model_switch.py handled older custom-provider shapes (default_model, list-style models) but did not fully support the newer config shape that uses:

  • base_url
  • model
  • models as a dict keyed by model name

There was also no deduplication between the direct providers.custom view and the compatibility-layer custom_providers view, which could surface duplicate provider rows.

Fix Action

Fix / Workaround

I already have a local patch and regression tests for this and can open a PR linked to this issue.

PR fix notes

PR #11505: fix(cli): support custom provider model dictionaries in model picker

Description (problem / solution / changelog)

What does this PR do?

Fixes the shared model picker provider listing logic so custom providers configured with the newer providers.<name> shape are displayed correctly.

Previously, a custom provider using base_url, model, and models as a dict could appear with only its default model, and in some cases the picker could show duplicate provider rows such as custom (0) and custom (1).

This change updates list_authenticated_providers() to support the newer config shape and deduplicate equivalent provider entries without collapsing distinct providers that only share the same display name.

Related Issue

Fixes #11499

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✅ Tests (adding or improving test coverage)

Changes Made

  • Updated hermes_cli/model_switch.py to:
    • accept base_url as a custom provider API URL source
    • accept model as a default model source
    • expand models when provided as a dict by using its keys as model names
    • deduplicate equivalent provider entries across providers.<name> and compatibility-layer custom_providers
    • keep distinct custom providers when they share a display name but use different URLs
  • Added regression tests in tests/hermes_cli/test_user_providers_model_switch.py for:
    • newer providers.<name> config shape support
    • duplicate custom provider suppression
    • preserving distinct providers with the same display name when their endpoints differ

How to Test

  1. Configure a custom provider with the newer shape:

    providers:
      custom:
        base_url: http://example.com/v1
        model: gpt-5.4
        models:
          gpt-5.4: {}
          grok-4.20-beta: {}
          minimax-m2.7: {}
  2. Start the Telegram gateway and open the /model picker.

  3. Verify the picker shows a single custom provider entry for the same endpoint.

  4. Verify the picker lists all configured models instead of only the default model.

  5. Run:

    source venv/bin/activate
    pytest tests/hermes_cli/test_user_providers_model_switch.py tests/gateway/test_model_command_custom_providers.py -q

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Debian 13 (trixie)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

Relevant regression tests pass:

13 passed in 2.11s

Changed files

  • hermes_cli/model_switch.py (modified, +51/-10)
  • tests/hermes_cli/test_user_providers_model_switch.py (modified, +121/-0)

PR #11534: fix(model): support providers.*.models dict in Telegram /model picker

Description (problem / solution / changelog)

## Summary

  • fix list_authenticated_providers() to support the new providers.<name> shape using base_url, model, and models as a dict
  • include model names from models dict keys so Telegram /model picker shows the full configured model set
  • dedupe user-provider slugs before merging legacy custom_providers, preventing duplicate rows like custom (0) / custom (1)

Test plan

  • Run targeted regression tests in tests/hermes_cli/test_user_providers_model_switch.py
  • Added regression tests for new-shape dict models and providers/custom_providers slug overlap

Closes #11499.

Changed files

  • hermes_cli/model_switch.py (modified, +15/-4)
  • tests/hermes_cli/test_user_providers_model_switch.py (modified, +63/-0)

Code Example

providers:
  custom:
    base_url: http://example.com/v1
    model: gpt-5.4
    models:
      gpt-5.4: {}
      grok-4.20-beta: {}
      minimax-m2.7: {}
RAW_BUFFERClick to expand / collapse

Bug Description

When Hermes is configured with a custom OpenAI-compatible provider using the newer providers.<name> shape (base_url, model, and models as a dict), the Telegram /model picker does not show the full model list for that provider.

In our case, the picker only surfaced the default model and could also show duplicate provider entries such as custom (0) and custom (1) instead of a single provider with the full model list.

Steps to Reproduce

  1. Configure a custom provider in ~/.hermes/config.yaml using the newer shape:
providers:
  custom:
    base_url: http://example.com/v1
    model: gpt-5.4
    models:
      gpt-5.4: {}
      grok-4.20-beta: {}
      minimax-m2.7: {}
  1. Start the Telegram gateway.
  2. Open the /model picker.
  3. Inspect the provider list and the models shown for custom.

Expected Behavior

  • The picker should show a single custom provider entry.
  • The picker should list all models defined in providers.custom.models.
  • The default model should be included, but not duplicated.

Actual Behavior

  • The picker only showed the default model from model.
  • In some cases it also showed duplicate provider entries such as custom (0) and custom (1).

Affected Component

  • Gateway (Telegram)
  • Configuration (config.yaml, custom providers)
  • CLI/model switch shared provider listing logic

Operating System

Debian 13 (trixie)

Python Version

3.11.x

Hermes Version

Current main as of 2026-04-17

Root Cause Analysis

list_authenticated_providers() in hermes_cli/model_switch.py handled older custom-provider shapes (default_model, list-style models) but did not fully support the newer config shape that uses:

  • base_url
  • model
  • models as a dict keyed by model name

There was also no deduplication between the direct providers.custom view and the compatibility-layer custom_providers view, which could surface duplicate provider rows.

Proposed Fix

Update list_authenticated_providers() to:

  1. accept base_url as the provider API URL source,
  2. accept model as the default model source,
  3. expand models when it is a dict by using its keys as model names,
  4. deduplicate provider slugs so the same provider is not shown twice.

I already have a local patch and regression tests for this and can open a PR linked to this issue.

extent analysis

TL;DR

Update the list_authenticated_providers() function in hermes_cli/model_switch.py to support the newer custom provider configuration shape and deduplicate provider slugs.

Guidance

  • Review the list_authenticated_providers() function to ensure it correctly handles the newer custom provider configuration shape with base_url, model, and models as a dict.
  • Verify that the function expands the models dict into a list of model names and uses the base_url as the provider API URL source.
  • Check for deduplication of provider slugs to prevent duplicate provider entries.
  • Test the updated function with the provided custom provider configuration to ensure it shows the full model list and does not display duplicate provider entries.

Example

def list_authenticated_providers():
    # ...
    for provider in providers.values():
        if isinstance(provider, dict) and 'base_url' in provider and 'models' in provider:
            # Expand models dict into a list of model names
            models = list(provider['models'].keys())
            # Use base_url as the provider API URL source
            base_url = provider['base_url']
            # Deduplicate provider slugs
            provider_slug = provider.get('slug') or provider.get('name')
            # ...

Notes

The proposed fix assumes that the list_authenticated_providers() function is the root cause of the issue. However, further testing and verification may be necessary to ensure that the updated function resolves the problem.

Recommendation

Apply the proposed fix by updating the list_authenticated_providers() function to support the newer custom provider configuration shape and deduplicate provider slugs, as this is the most direct solution to the issue.

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