fix: prefer exact OpenRouter model id over the :suffix-stripped base - #5587
Open
tonycoder-hub wants to merge 1 commit into
Open
Conversation
get_model_info collected the requested route and its ":suffix"-stripped base id into a set, so whichever id appeared first in the OpenRouter payload won. A ":free" variant could therefore resolve to the paid base model's context length and pricing. Try the exact id first and only fall back to the base id, which keeps routing suffixes like ":nitro" working. Co-authored-by: Tony Coder <407243179@qq.com>
|
|
2 tasks
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
OpenRouterModelManager.get_model_infotreated the requested route and its:suffix-stripped base as equal candidates, soopenrouter/deepseek/deepseek-r1:freecould pick the paid base record (wrong context length and non-zero cost).Try the exact id first; fall back to the base id only when the exact id is missing (needed for routing suffixes like
:nitro). Distinct from #4931 and #5550/#5518/#5425.Test plan
32768 == 8192) and passes afterpython -m pytest tests/basic/test_openrouter.py -v→ 4 passed