Skip to content

fix: include custom_providers in /model command listings and resolution#6807

Closed
rahimsais wants to merge 1 commit into
NousResearch:mainfrom
rahimsais:fix/custom-providers-in-model-command
Closed

fix: include custom_providers in /model command listings and resolution#6807
rahimsais wants to merge 1 commit into
NousResearch:mainfrom
rahimsais:fix/custom-providers-in-model-command

Conversation

@rahimsais

@rahimsais rahimsais commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Problem

Custom providers defined in config.yaml under custom_providers: were invisible to the /model command in both gateway (Telegram, Discord, etc.) and CLI. Explicit switching via --provider failed with "Unknown provider".

Root Cause

gateway/run.py, cli.py, and model_switch.py only read the providers: dict from config, ignoring custom_providers: entirely. The resolution chain in providers.py also had no step for custom providers.

Changes

hermes_cli/providers.py

  • Add resolve_custom_provider() to match custom providers by name or slug (custom:<display-name>)
  • Extend resolve_provider_full() to check custom_providers after user_providers in the resolution chain

hermes_cli/model_switch.py

  • Propagate custom_providers through switch_model(), list_authenticated_providers(), and get_authenticated_provider_slugs()
  • Add custom provider section to provider listings with proper slug, name, and default model
  • Fix provider label display for custom providers (show display name instead of slug)

gateway/run.py

  • Read custom_providers from config.yaml
  • Pass to all model-switch function calls

cli.py

  • Hoist config loading to read both providers and custom_providers
  • Pass both to listing and switch calls

Tests

4 new regression tests:

  • test_list_authenticated_providers_includes_custom_providers — verifies custom providers appear in listings
  • test_switch_model_explicit_custom_provider_resolution — verifies explicit --provider custom:slug resolves
  • test_switch_model_custom_provider_label — verifies display name used in result
  • test_handle_model_command_lists_saved_custom_provider — verifies gateway command handler includes custom providers

All 71 tests pass (67 existing + 4 new).

Example Config

custom_providers:
  - name: Local (127.0.0.1:4141)
    base_url: http://127.0.0.1:4141/v1
    model: lacal7b

Now shows up as custom:local-(127.0.0.1:4141) in /model listings and is switchable.

Custom providers defined in config.yaml under  were
completely invisible to the /model command in both gateway (Telegram,
Discord, etc.) and CLI. The provider listing skipped them and explicit
switching via --provider failed with "Unknown provider".

Root cause: gateway/run.py, cli.py, and model_switch.py only read the
 dict from config, ignoring  entirely.

Changes:
- providers.py: add resolve_custom_provider() and extend
  resolve_provider_full() to check custom_providers after user_providers
- model_switch.py: propagate custom_providers through switch_model(),
  list_authenticated_providers(), and get_authenticated_provider_slugs();
  add custom provider section to provider listings
- gateway/run.py: read custom_providers from config, pass to all
  model-switch calls
- cli.py: hoist config loading, pass custom_providers to listing and
  switch calls

Tests: 4 new regression tests covering listing, resolution, and gateway
command handler. All 71 tests pass.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #7088. Your commit was cherry-picked onto current main with your authorship preserved in git log. Follow-up fixes added: extracted shared slug helper, fixed a resolution bug where the first custom provider would match any display-name input, and hardened the gateway test. Thanks for the contribution @rahimsais!

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.

3 participants