From 1bc243893b1fe647e0e189d51aa150eb37ddfd1e Mon Sep 17 00:00:00 2001 From: mateo Date: Sun, 13 Sep 2026 08:36:03 +0000 Subject: [PATCH] refactor: keep the model info pricing helper out of the cleanup Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../management_endpoints/model_management_endpoints.py | 6 ++---- litellm/types/utils.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/management_endpoints/model_management_endpoints.py b/litellm/proxy/management_endpoints/model_management_endpoints.py index 8155119cf7b..2234e825090 100644 --- a/litellm/proxy/management_endpoints/model_management_endpoints.py +++ b/litellm/proxy/management_endpoints/model_management_endpoints.py @@ -2094,10 +2094,8 @@ async def add_new_model( enforced=bool(general_settings.get(ENFORCE_RPM_TPM_ON_MODEL_ADD_SETTING, False)), ) - model_params.model_info = ( - ModelInfo.model_validate( # rebind-ok: downstream team-model handling mutates this same object - dict(without_server_derived_pricing(model_params.model_info.model_dump(exclude_none=True))) - ) + model_params.model_info = ModelInfo( # rebind-ok: downstream team-model handling mutates this same object + **without_server_derived_pricing(model_params.model_info.model_dump(exclude_none=True)) ) model_response: prisma_models.LiteLLM_ProxyModelTable | LiteLLM_ProxyModelTable | None = None diff --git a/litellm/types/utils.py b/litellm/types/utils.py index 84231423562..00c55b35182 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -3667,7 +3667,7 @@ def is_server_derived_pricing_key(key: str) -> bool: return key in SERVER_DERIVED_PRICING_FIELDS or ABOVE_THRESHOLD_COST_KEY_PATTERN.search(key) is not None -def without_server_derived_pricing(model_info: Mapping[str, object]) -> Mapping[str, object]: +def without_server_derived_pricing(model_info: Mapping[str, Any]) -> Mapping[str, Any]: """Drop the pricing ``/model/info`` derives for display, keeping everything else. ``/model/info`` fills a deployment's missing pricing in from the cost map so the