fix(auth): preserve 'custom' provider instead of silently remapping to '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 commit is contained in:
Teknium 2026-03-24 06:41:11 -07:00 committed by GitHub
parent 4313b8aff6
commit 2f1c4fb01f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 92 additions and 4 deletions

View file

@ -690,8 +690,10 @@ def resolve_provider(
}
normalized = _PROVIDER_ALIASES.get(normalized, normalized)
if normalized in {"openrouter", "custom"}:
if normalized == "openrouter":
return "openrouter"
if normalized == "custom":
return "custom"
if normalized in PROVIDER_REGISTRY:
return normalized
if normalized != "auto":