Repository navigation
fix(cost): backport #47497 to lts/1.108.x - #51412
Merged
kerry-berri merged 1 commit intoNov 16, 2026
Merged
kerry-berri merged 1 commit into
kerry-berri merged 1 commit into
Conversation
3 of 5 tasks
…es (BerriAI#47497) * fix(cost): price base_model deployments past rule-only cost map entries and warn when base_model has no rates * fix(router): warn on unpriced base_model from add_deployment too and honour model_info prices * refactor(cost): drop the unpriced base_model startup warning, keep the one-line ladder fix --------- Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> (cherry picked from commit 8d2bf42) Co-authored-by: Kerry Lu <klu@berri.ai>
ramundomario
force-pushed
the
litellm_backport_47497_lts_1_108_x
branch
from
November 12, 2026 16:52
517b833 to
a5b3369
Compare
ramundomario
marked this pull request as ready for review
November 12, 2026 16:53
Contributor
PR overviewNo security issues were found in this pull request. Reviews
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
kerry-berri
approved these changes
Nov 16, 2026
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.
TLDR
Problem this solves:
lts/1.108.x, a deployment whosebase_modelonly matches a price-free capability rule (or no priced entry at all, e.g."*") stops the cost ladder at $0, even when the response names a priced modelexplicit_pricingis true wheneverbase_modelis set, so_priced_candidates_before_unpriced_rulesis skipped and the unpriced candidate winsHow it solves it:
custom_pricing is True), not just becausebase_modelis setUser Flow
Before: wildcard deployments stored in the DB with
model_info.base_model = "*", a value with no price of its own. On 1.98.x those requests were priced from the response model; since 1.106.x (and still on 1.108.6 LTS) every request throughopenai/*/gemini/*is logged withspend = 0, while tokens are still counted.openai/*withbase_model: "*"(stored in the DB)gpt-4o-minithrough the wildcardlitellm_spend_metric_totalrecord $0After: the priced response model is tried before the unpriced
base_modelcandidate, so the same request is billed at thegpt-4o-minirate, as on 1.98.x and on main since 1.109.0.Relevant issues
Backport of #47497 to lts/1.108.x (requested on the PR here)
Pre-Submission checklist
uv run --extra proxy pytest tests/unit/test_cost_calculator.py -qpasses on this branchScreenshots / Proof of Fix
Reproduced on 1.106.6 and 1.108.6: a wildcard
openai/*deployment withmodel_info = {"base_model": "*"}recordsspend = 0for every request; the same deployment withoutbase_modelis priced correctly. Removingbase_modelfrom the DB rows restores spend, which is consistent with this ladder change.