Repository navigation
fix(cost_calculator): honor base_model's own provider in cost-logging metadata too - #48013
Open
rupeshpoojary9 wants to merge 2 commits into
Open
rupeshpoojary9 wants to merge 2 commits into
rupeshpoojary9 wants to merge 2 commits into
Conversation
… metadata too completion_cost() already resolves the correct provider for billing when base_model points at a priced row under a different provider than the deployment's transport (e.g. a chatgpt/ subscription deployment priced via an openai/ or zai/ base_model, fixed in BerriAI#46318). The diagnostic model_map_information field built in litellm_logging.py never got the same correction: it calls get_model_info() with the raw transport provider, which _check_provider_match rejects, so model_map_value stays None even though spend is now computed correctly. Reuses the same _base_model_pricing_provider helper for this lookup too. Fixes BerriAI#47908 (the remaining part after BerriAI#46318)
|
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…r cross-module use Importing the underscore-prefixed helper from litellm_logging added one reportPrivateUsage and breached the basedpyright ceiling.
This branch has not been deployed
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.
Fixes the remaining part of #47908, after #46318.
#46318 fixed
completion_cost()to honorbase_model's own registered provider when the deployment's transport provider has no rates for it, so spend computes correctly. The diagnosticmodel_map_informationfield built inlitellm_logging.py(StandardLoggingPayloadSetup.get_model_cost_information) never got the same fix: it still callsget_model_info()with the raw transportcustom_llm_provider, which_check_provider_matchrejects, somodel_map_valuestaysNoneeven though the spend amount next to it is now correct. Confirmed directly:Reuses the same
_base_model_pricing_providerhelper #46318 added, applied to this lookup too.Added a regression test with a registered test-only model under a distinct provider, mirroring the existing tests for this function. Ran the full
test_litellm_logging.pyandtest_cost_calculator.pysuites (viauv sync --frozen --all-groups --all-extras): 1232 passed, 1 pre-existing unrelated failure (test_base_model_keeps_deployment_provider_row_that_declares_rates, fails identically on unmodifiedmain, confirmed before and after this change). Lint and format clean on both touched files.