Skip to content

fix(model-switch): keep same-endpoint custom providers with different names as separate picker rows - #67747

Closed
craigdfrench wants to merge 1 commit into
NousResearch:mainfrom
craigdfrench:feat/custom-provider-grouping-fix
Closed

fix(model-switch): keep same-endpoint custom providers with different names as separate picker rows#67747
craigdfrench wants to merge 1 commit into
NousResearch:mainfrom
craigdfrench:feat/custom-provider-grouping-fix

Conversation

@craigdfrench

Copy link
Copy Markdown
Contributor

Problem

Multiple custom_providers entries sharing the same base_url (e.g. an aggregating proxy fronting multiple upstream providers at one URL) collapsed into a single picker row under the first entry's name. Users who configured separate entries for distinct sub-providers behind one endpoint saw all their models merged into one row, defeating the purpose of splitting them.

Fix

Extends the group_key in list_authenticated_providers() with a display-name prefix dimension:

group_key = (api_url, credential_identity, api_mode, headers_identity, display_prefix.lower())

The display prefix is the text before an em-dash () or space-hyphen-space (-) in the entry name. This means:

  • Same-URL entries with different names (e.g. "My Proxy / cog-proxy", "My Proxy / nvidia") now get separate picker rows — each showing only its own model list.
  • Same-URL entries sharing a common prefix (e.g. "Ollama — GLM 5.1", "Ollama — Qwen 3") still collapse into one "Ollama" row — preserving the existing per-model-suffix grouping behavior.
  • Same-host entries with different key_env or api_mode stay separate (credential_identity / api_mode preserved — no regression).

Why this is a bug fix, not a feature

The current grouping logic assumes all entries sharing an endpoint are duplicates of the same provider. This is wrong for aggregating proxies — users intentionally configure multiple entries pointing at the same URL to represent distinct upstream providers, each with their own model subset. The picker silently merging them destroys that configuration.

Tests

  • test_shared_url_different_display_names_are_separate_rows — three entries sharing base_url+api_key+api_mode but different names → three rows.
  • test_shared_url_per_model_suffix_still_collapses — "Ollama — A"/"Ollama — B" still collapse into one "Ollama" row.
  • Fixed 3 pre-existing tests that were hitting a live local Ollama during model discovery (added fetch_api_models mock).

Usage

Set discover_models: false and an explicit models list on each sub-provider entry:

custom_providers:
  - name: My Proxy / sub-provider-1
    base_url: http://my-proxy.example.com/v1
    api_key: no-key-needed
    api_mode: chat_completions
    discover_models: false
    models:
      model-1a: {}
      model-1b: {}
  - name: My Proxy / sub-provider-2
    base_url: http://my-proxy.example.com/v1
    api_key: no-key-needed
    api_mode: chat_completions
    discover_models: false
    models:
      model-2a: {}

Each entry appears as its own row in the /model picker.

Supersedes the grouping fix portion of #28218.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 19, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #67925 — your commit was cherry-picked onto current main with your authorship preserved in git log. This was exactly the right shape: extending the existing identity tuple instead of replacing it kept the credential/mode/headers safeguards intact, and the suffix-fold tests made the behavioral contract explicit. One small follow-up on our side: your test-mock additions for the three Ollama-flaky tests were dropped in favor of #62421's probe_custom_providers=False (merged as #67921 just before this).

#67751 (excluded_providers) is next in the review queue now that this base has landed. Thanks!

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

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants