bug: custom price override for models

This commit is contained in:
shivam 2026-02-07 15:53:21 -08:00
parent dd5c14baf8
commit 2aeb1b8773

View file

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