fix(auth): preserve 'custom' provider instead of silently remapping to 'openrouter'#2792
Merged
fix(auth): preserve 'custom' provider instead of silently remapping to 'openrouter'#2792
Conversation
…o 'openrouter'
resolve_provider('custom') was silently returning 'openrouter', causing
users who set provider: custom in config.yaml to unknowingly route
through OpenRouter instead of their local/custom endpoint. The display
showed 'via openrouter' even when the user explicitly chose custom.
Changes:
- auth.py: Split the conditional so 'custom' returns 'custom' as-is
- runtime_provider.py: _resolve_named_custom_runtime now returns
provider='custom' instead of 'openrouter'
- runtime_provider.py: _resolve_openrouter_runtime returns
provider='custom' when that was explicitly requested
- Add 'no-key-required' placeholder for keyless local servers
- Update existing test + add 5 new tests covering the fix
Fixes #2562
This was referenced Mar 24, 2026
Closed
Closed
1 task
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
Fixes #2562.
resolve_provider('custom')was silently returning'openrouter', causing users who setprovider: customin config.yaml to unknowingly route through OpenRouter instead of their local/custom endpoint.This is Phase 1 of the
/modelcommand overhaul plan.What changed
hermes_cli/auth.py: Split the{"openrouter", "custom"}set check into two separate conditionals so'custom'returns'custom'as-ishermes_cli/runtime_provider.py:_resolve_named_custom_runtime()now returnsprovider='custom'instead of'openrouter'_resolve_openrouter_runtime()returnsprovider='custom'when that was explicitly requested'no-key-required'placeholder API key for local servers that don't need authentication (OpenAI SDK requires non-empty string)Why this is safe
All OpenRouter-specific logic in
run_agent.pychecks by URL ("openrouter" in base_url), not by provider name. Custom endpoints hitting non-OpenRouter URLs won't match any OpenRouter-specific behavior.Salvaged from
Closes #2562. Four external PRs attempted this fix (#2564, #2571, #2633, #2725) — all submitted the same auth.py change but none added the runtime_provider.py fixes or the no-key-required fallback for local servers. Credit to @davidmacmillan for the original report, @aifunmobi for the root cause analysis, and @teyrebaz33, @dusterbloom, @amethystani for their fix attempts.
Test plan
python -m pytest tests/test_runtime_provider_resolution.py -q— 36/36 pass