hermes - ✅(Solved) Fix Model switcher ignores current provider — ambiguous name resolves to OpenRouter instead of active provider [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#19858Fetched 2026-05-05 06:04:40
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Participants
Timeline (top)
labeled ×4cross-referenced ×2

When switching models by name (e.g., saying "sonnet" or "switch to sonnet"), Hermes resolves the name across all configured providers instead of preferring the currently active provider. This causes an unintended provider switch that silently breaks if the new provider has no API key.

Root Cause

When switching models by name (e.g., saying "sonnet" or "switch to sonnet"), Hermes resolves the name across all configured providers instead of preferring the currently active provider. This causes an unintended provider switch that silently breaks if the new provider has no API key.

Fix Action

Workaround

Edit ~/.hermes/config.yaml directly:

model: anthropic/claude-sonnet-4-6
provider: anthropic

PR fix notes

PR #19904: fix(gateway): prefer configured provider for model aliases

Description (problem / solution / changelog)

Summary

  • make gateway /model read legacy root-level provider/base_url when model is a string
  • align gateway provider fallback with the interactive CLI so ambiguous aliases resolve against the configured provider
  • add regression coverage for /model sonnet with string model + root Anthropic provider config

Fixes #19858

Validation

  • python3 -m py_compile gateway/run.py tests/gateway/test_model_command_custom_providers.py
  • $HOME/.hermes/hermes-agent/venv/bin/python -m pytest tests/gateway/test_model_command_custom_providers.py -q -n 4 → 2 passed

Note

  • scripts/run_tests.sh tests/gateway/test_model_command_custom_providers.py -q could not start locally because the shared venv lacks pip while the wrapper attempted to install pytest-split.

Changed files

  • gateway/run.py (modified, +43/-5)
  • tests/gateway/test_model_command_custom_providers.py (modified, +54/-0)

PR #19950: fix: prefer active provider for anthropic sonnet switches

Description (problem / solution / changelog)

Summary

Fixes #19858 by preferring the active provider when a requested model can be normalized into one of that provider's native model IDs.

Before this change, ambiguous Claude Sonnet inputs such as claude-sonnet-4.6 or anthropic/claude-sonnet-4.6 could fall through to generic provider detection and get remapped to an aggregator catalog entry instead of staying on the already-active Anthropic provider.

What changed

  • normalize the requested model against the current provider before cross-provider detection
  • if the normalized ID already belongs to the current provider catalog, keep the provider unchanged and reuse the native ID
  • add regression coverage for both:
    • anthropic/claude-sonnet-4.6 while already on anthropic
    • claude-sonnet-4.6 while already on anthropic

Validation

  • scripts/run_tests.sh tests/hermes_cli/test_models.py tests/hermes_cli/test_model_switch_variant_tags.py
  • direct reproduction check:
    • detect_provider_for_model('anthropic/claude-sonnet-4.6', 'anthropic')
    • detect_provider_for_model('claude-sonnet-4.6', 'anthropic')
    • both now resolve to ('anthropic', 'claude-sonnet-4-6')

Notes

This keeps the existing fallback behavior for true cross-provider switches, but stops same-provider Claude inputs from being hijacked by later OpenRouter-style detection.

Changed files

  • hermes_cli/models.py (modified, +19/-4)
  • tests/hermes_cli/test_models.py (modified, +20/-0)

Code Example

model: anthropic/claude-sonnet-4-6
provider: anthropic
RAW_BUFFERClick to expand / collapse

Summary

When switching models by name (e.g., saying "sonnet" or "switch to sonnet"), Hermes resolves the name across all configured providers instead of preferring the currently active provider. This causes an unintended provider switch that silently breaks if the new provider has no API key.

Steps to reproduce

  1. Configure Hermes with provider: anthropic and a Claude OAuth token (CLAUDE_CODE_OAUTH_TOKEN) — no OpenRouter key set
  2. Ask Hermes to switch to "sonnet" (via chat or /model)
  3. Hermes resolves anthropic/claude-sonnet-4.6 from OpenRouter's catalog (note: dots in version = OpenRouter naming convention)
  4. Provider switches from anthropicOpenRouter
  5. Next request fails — no OPENROUTER_API_KEY in env

Expected behavior

The model switcher should prefer candidates from the current provider when resolving an ambiguous name. Only fall back to other providers if no match exists on the current one.

OpenRouter and Anthropic native use different naming conventions for the same models:

  • OpenRouter: anthropic/claude-sonnet-4.6 (dots)
  • Anthropic native: anthropic/claude-sonnet-4-6 (hyphens)

If I'm on provider: anthropic and say "sonnet", I expect to get anthropic/claude-sonnet-4-6 — not silently hop to OpenRouter.

Workaround

Edit ~/.hermes/config.yaml directly:

model: anthropic/claude-sonnet-4-6
provider: anthropic

Environment

  • Hermes v0.12.0
  • Provider: anthropic (Claude OAuth token)
  • Platform: macOS (tart VM)
  • Gateway: BlueBubbles

extent analysis

TL;DR

Prefer the current provider when resolving model names to prevent unintended provider switches.

Guidance

  • Verify that the provider configuration is set to the expected value (anthropic in this case) before switching models.
  • Check the naming conventions used by each provider (e.g., OpenRouter uses dots, while Anthropic native uses hyphens) to ensure consistent model naming.
  • Consider modifying the model resolution logic to prioritize candidates from the current provider.
  • Test the model switcher with different provider configurations to ensure the expected behavior.

Example

No code snippet is provided as the issue is more related to configuration and logic rather than code.

Notes

The issue is specific to Hermes v0.12.0 and may not apply to other versions. The workaround provided in the issue body can be used as a temporary solution.

Recommendation

Apply workaround: edit the ~/.hermes/config.yaml file to specify the exact model and provider, as shown in the issue body, to avoid unintended provider switches. This is a safe and straightforward solution that addresses the immediate problem.

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…

FAQ

Expected behavior

The model switcher should prefer candidates from the current provider when resolving an ambiguous name. Only fall back to other providers if no match exists on the current one.

OpenRouter and Anthropic native use different naming conventions for the same models:

  • OpenRouter: anthropic/claude-sonnet-4.6 (dots)
  • Anthropic native: anthropic/claude-sonnet-4-6 (hyphens)

If I'm on provider: anthropic and say "sonnet", I expect to get anthropic/claude-sonnet-4-6 — not silently hop to OpenRouter.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix Model switcher ignores current provider — ambiguous name resolves to OpenRouter instead of active provider [2 pull requests, 1 participants]