fix(auth): preserve 'custom' provider name instead of silently remapping to 'openrouter'#2564
Closed
dieutx wants to merge 1 commit into
Closed
fix(auth): preserve 'custom' provider name instead of silently remapping to 'openrouter'#2564dieutx wants to merge 1 commit into
dieutx wants to merge 1 commit into
Conversation
3040014 to
7504093
Compare
Contributor
|
A more extensive fix for custom models support in #2580 |
Contributor
Author
|
Thanks! Checked #2580 — nice work on the /model display side. This PR is a different layer though — it's the auth.py resolve_provider() that silently swaps "custom" to "openrouter" under the hood. #2580 doesn't touch that file. They should work together fine — one fixes how custom providers show up, this one stops them from being renamed internally. |
Closed
1 task
…ing to 'openrouter' resolve_provider() mapped 'custom' to 'openrouter' on line 666, causing the /model command to display 'openrouter' and overwriting the user's config.yaml provider setting. This was confusing for users with local models who explicitly set provider: custom. - Return 'custom' from resolve_provider() when explicitly requested - Preserve 'custom' in the runtime provider dict so display and config stay consistent with what the user configured - The OpenRouter runtime code path still handles the actual HTTP calls (it already had custom base_url support) Adds 5 regression tests covering both resolve_provider() and the full resolve_runtime_provider() chain for custom providers. Closes NousResearch#2562
7504093 to
c2a2ea6
Compare
Contributor
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
When a user sets
provider: custominconfig.yaml,resolve_provider()silently converts it to"openrouter"(line 666 inauth.py). This causes:/modelshows "via openrouter" instead of "via custom"Root cause:
resolve_provider()treated"custom"and"openrouter"identically:Fix:
"custom"fromresolve_provider()when explicitly requested"custom"in the runtime provider dict returned byresolve_runtime_provider()base_urlsupport (line 235 inruntime_provider.py)Closes #2562
Changes
Test plan
resolve_provider("custom")returns"openrouter"resolve_provider("custom")returns"custom"resolve_runtime_provider(requested="custom")returnsprovider: "custom"with correctbase_urlresolve_provider("openrouter")still returns"openrouter"(no regression)resolve_provider(), 3 forresolve_runtime_provider()custom flowtest_runtime_provider_resolution.pypasspytest tests/ -x -q