From 2aeb1b87738c51d27c1c844f2b75422d51d59c45 Mon Sep 17 00:00:00 2001 From: shivam Date: Sat, 7 Feb 2026 15:53:21 -0800 Subject: [PATCH] bug: custom price override for models --- litellm/router.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/litellm/router.py b/litellm/router.py index 0f49cf90510..42058c79c17 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -5925,9 +5925,20 @@ class Router: deployment.litellm_params.custom_llm_provider + "/" + _model_name ) + # For the shared backend key, strip custom pricing fields so that + # one deployment's pricing overrides don't pollute another + # deployment sharing the same backend model name. + # Each deployment's full pricing is already stored under its + # unique model_id above. + _custom_pricing_fields = CustomPricingLiteLLMParams.model_fields.keys() + _shared_model_info = { + k: v + for k, v in _model_info.items() + if k not in _custom_pricing_fields + } litellm.register_model( model_cost={ - _model_name: _model_info, + _model_name: _shared_model_info, } )