Skip to content

fix(auth): preserve 'custom' provider instead of silently remapping to 'openrouter'#2571

Closed
teyrebaz33 wants to merge 1 commit into
NousResearch:mainfrom
teyrebaz33:fix/custom-provider-silently-remapped
Closed

fix(auth): preserve 'custom' provider instead of silently remapping to 'openrouter'#2571
teyrebaz33 wants to merge 1 commit into
NousResearch:mainfrom
teyrebaz33:fix/custom-provider-silently-remapped

Conversation

@teyrebaz33

Copy link
Copy Markdown
Contributor

Problem

resolve_provider('custom') silently returned 'openrouter' due to a combined set check:

if normalized in {"openrouter", "custom"}:
    return "openrouter"

This caused:

  • /model showing "via openrouter" when user set provider: custom
  • /status showing the wrong provider
  • No notice given to the user about the remapping

Fix

Split the set check so each provider returns its own name:

if normalized == "openrouter":
    return "openrouter"
if normalized == "custom":
    return "custom"

Also preserve provider: custom in the runtime dict returned by resolve_runtime_provider() so all display layers receive the correct name.

What is not changed

  • The OpenRouter code path continues to handle custom base_url requests correctly — _resolve_openrouter_runtime() is still called for custom, only the provider key in the returned dict changes
  • Local model support via custom + base_url in config.yaml is unaffected
  • resolve_provider('openrouter') behavior is unchanged

Tests

5 new tests in tests/test_runtime_provider_resolution.py:

  • test_resolve_provider_custom_returns_custom — verifies the core fix against the actual resolve_provider() function
  • test_resolve_provider_openrouter_unchanged — regression guard
  • test_resolve_runtime_provider_custom_preserves_provider_name — runtime dict has provider: custom
  • test_resolve_runtime_provider_custom_base_url_preserved — base_url passes through correctly
  • test_resolve_runtime_provider_openrouter_not_affected — openrouter regression guard

Fixes #2562

…o 'openrouter'

resolve_provider('custom') was returning 'openrouter' due to a combined
set check. This caused /model and /status to show 'via openrouter' even
when the user had explicitly configured provider: custom in config.yaml,
with no notice given to the user.

Fix: split the set check so 'custom' returns 'custom' and 'openrouter'
returns 'openrouter' independently. Also preserve the provider name in
the runtime dict returned by resolve_runtime_provider() so display
layers receive 'custom' instead of 'openrouter'.

The OpenRouter code path continues to handle custom base_url requests
correctly — only the provider name in the returned dict changes.

Fixes NousResearch#2562
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #2792 which fixes #2562 comprehensively (auth.py + runtime_provider.py + no-key-required fallback for local servers + tests). Your fix attempt is appreciated — thank you for the contribution!

@teknium1 teknium1 closed this Mar 24, 2026
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.

[Bug]: 'custom' provider gets switched to 'openrouter'

2 participants