fix(custom-providers): preserve multi-model entries and group by provider name#9275
Merged
Conversation
get_compatible_custom_providers() deduplicates by (name, base_url) which collapses multiple models under the same provider into a single entry. For example, 7 Ollama Cloud entries with different models become 1. Adding model to the tuple preserves all entries.
…per provider The /model picker currently renders one row per ``custom_providers`` entry. When several entries share the same provider name (e.g. four ``ollama-cloud`` entries for ``qwen3-coder``, ``glm-5.1``, ``kimi-k2``, ``minimax-m2.7``), users see four separate "Ollama Cloud" rows in the picker, which is confusing UX — there is only one Ollama Cloud provider, so there should be one row containing four models. This PR groups ``custom_providers`` entries that share the same provider name into a single picker row while keeping entries with distinct names as separate rows. So: * Four entries named ``Ollama Cloud`` → one "Ollama Cloud" row with four models inside. * One entry named ``Ollama Cloud`` and one named ``Moonshot`` → two separate rows, one model each. Implementation -------------- Replaces the single-pass loop in ``list_authenticated_providers()`` with a two-pass approach: 1. First pass: build an ``OrderedDict`` keyed by ``custom_provider_slug(name)``, accumulating ``models`` per group while preserving discovery order. 2. Second pass: iterate the groups and append one result row per group, skipping any slug that already appeared in an earlier provider source (the existing ``seen_slugs`` guard). Insertion order is preserved via ``OrderedDict``, so providers and their models still appear in the order the user listed them in ``custom_providers``. No new dependencies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
This was referenced Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Salvages PRs #9233 and #8011 by @akhater (Tony365's feature request).
When a user configures multiple
custom_providersentries sharing the same provider name (e.g. 4 Ollama Cloud entries for different models), two bugs prevented them from appearing correctly in the/modelpicker:Bug 1 (data layer):
get_compatible_custom_providers()deduplicates by(name, base_url), collapsing entries with different models into one. Fix: includemodelin the dedup key.Bug 2 (display layer):
list_authenticated_providers()creates one row per entry, and theseen_slugsguard drops all entries after the first for each slug. Fix: two-pass grouping via OrderedDict — first collect all models per provider slug, then emit one grouped row per provider.Before
After
Changes
hermes_cli/config.py— Add model to dedup tuple in_append_if_new()(+2/-1)hermes_cli/model_switch.py— Two-pass grouping in section 4 oflist_authenticated_providers()(+25/-10)Test plan
Closes #8011, closes #9233.