From f0811a01659c8d28a93fb02cc1fa7c485edd13f1 Mon Sep 17 00:00:00 2001 From: Rupesh Poojary Date: Sun, 25 Oct 2026 14:14:10 +0530 Subject: [PATCH] refactor(cost_calculator): make base_model_pricing_provider public for cross-module use Importing the underscore-prefixed helper from litellm_logging added one reportPrivateUsage and breached the basedpyright ceiling. --- litellm/cost_calculator.py | 4 ++-- litellm/litellm_core_utils/litellm_logging.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py index 550bbfcde98..d22582a93cb 100644 --- a/litellm/cost_calculator.py +++ b/litellm/cost_calculator.py @@ -916,7 +916,7 @@ def _declares_rates(model_info: ModelInfo | None) -> bool: return model_info is not None and cost_map_key_prices_anything(model_info["key"]) -def _base_model_pricing_provider(base_model: str, custom_llm_provider: str | None) -> str | None: +def base_model_pricing_provider(base_model: str, custom_llm_provider: str | None) -> str | None: """The provider to price an explicit base_model under, when the deployment's own provider has no rates for it (e.g. chatgpt/ subscription rows) but the base model's own row does""" if custom_llm_provider is None or _declares_rates(_cost_map_model_info(base_model, custom_llm_provider)): @@ -1622,7 +1622,7 @@ def completion_cost( _configured_search_cost_per_query(litellm_logging_obj) if custom_pricing else None ) base_model_provider: Final = ( - _base_model_pricing_provider( + base_model_pricing_provider( base_model, _get_provider_for_cost_calc( model=model, diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index 53bdf671b32..1c94a28e46e 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -51,7 +51,7 @@ from litellm.constants import ( from litellm.cost_calculator import ( RealtimeAPITokenUsageProcessor, ResponsesWebSocketTokenUsageProcessor, - _base_model_pricing_provider, + base_model_pricing_provider, get_usage_object, pricing_entry_for_cost_calc, select_model_name_for_cost_calc, @@ -6700,7 +6700,7 @@ class StandardLoggingPayloadSetup: # rejects the match on provider mismatch and this diagnostic field stays None even though spend is # computed correctly. pricing_provider: Final = ( - _base_model_pricing_provider(base_model, custom_llm_provider) + base_model_pricing_provider(base_model, custom_llm_provider) if base_model is not None and custom_pricing is not True else None )