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.
This commit is contained in:
Rupesh Poojary 2026-10-25 14:14:10 +05:30
parent d066f502da
commit f0811a0165
2 changed files with 4 additions and 4 deletions

View file

@ -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,

View file

@ -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
)