Skip to content

fix(cost): backport #47497 to lts/1.108.x - #51412

Merged
kerry-berri merged 1 commit into
BerriAI:lts/1.108.xfrom
ramundomario:litellm_backport_47497_lts_1_108_x
Nov 16, 2026
Merged

kerry-berri merged 1 commit into
BerriAI:lts/1.108.xfrom
ramundomario:litellm_backport_47497_lts_1_108_x

Conversation

@ramundomario

@ramundomario ramundomario commented Nov 12, 2026 •

Copy link
Copy Markdown

TLDR

Problem this solves:

  • on lts/1.108.x, a deployment whose base_model only 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 model
  • explicit_pricing is true whenever base_model is set, so _priced_candidates_before_unpriced_rules is skipped and the unpriced candidate wins

How it solves it:

User 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 through openai/* / gemini/* is logged with spend = 0, while tokens are still counted.

  1. admin creates openai/* with base_model: "*" (stored in the DB)
  2. a client calls gpt-4o-mini through the wildcard
  3. the spend log and litellm_spend_metric_total record $0

After: the priced response model is tried before the unpriced base_model candidate, so the same request is billed at the gpt-4o-mini rate, 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

  • I have added meaningful tests (backported from fix(cost): price base_model deployments past rule-only cost map entries #47497)
  • The handful of test files covering my change pass locally: uv run --extra proxy pytest tests/unit/test_cost_calculator.py -q passes on this branch
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Screenshots / Proof of Fix

Reproduced on 1.106.6 and 1.108.6: a wildcard openai/* deployment with model_info = {"base_model": "*"} records spend = 0 for every request; the same deployment without base_model is priced correctly. Removing base_model from the DB rows restores spend, which is consistent with this ladder change.

@CLAassistant

CLAassistant commented Nov 12, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

…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
ramundomario force-pushed the litellm_backport_47497_lts_1_108_x branch from 517b833 to a5b3369 Compare November 12, 2026 16:52
@ramundomario
ramundomario marked this pull request as ready for review November 12, 2026 16:53
@ramundomario
ramundomario requested a review from a team November 12, 2026 16:53
@veria-ai

veria-ai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

No security issues were found in this pull request.

Reviews

@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kerry-berri
kerry-berri merged commit 3d3b887 into BerriAI:lts/1.108.x Nov 16, 2026
59 of 63 checks passed
@ramundomario
ramundomario deleted the litellm_backport_47497_lts_1_108_x branch November 16, 2026 16:56
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.

3 participants