From cf22e9a92b92a8546ddcb700b5a75b99c256bb9b Mon Sep 17 00:00:00 2001 From: AlexsanderHamir Date: Mon, 17 Nov 2025 14:48:51 -0800 Subject: [PATCH] fix: add None check for litellm_params We currently cover the first case where the `litellm_params` may not be there, but not when it could be None --- litellm/router_strategy/lowest_tpm_rpm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/litellm/router_strategy/lowest_tpm_rpm.py b/litellm/router_strategy/lowest_tpm_rpm.py index 735ddb3f802..049c1112553 100644 --- a/litellm/router_strategy/lowest_tpm_rpm.py +++ b/litellm/router_strategy/lowest_tpm_rpm.py @@ -34,6 +34,8 @@ class LowestTPMLoggingHandler(CustomLogger): """ Update TPM/RPM usage on success """ + if "litellm_params" not in kwargs or kwargs["litellm_params"] is None: + return if kwargs["litellm_params"].get("metadata") is None: pass else: @@ -93,11 +95,11 @@ class LowestTPMLoggingHandler(CustomLogger): """ Update TPM/RPM usage on success """ + if "litellm_params" not in kwargs or kwargs["litellm_params"] is None: + return if kwargs["litellm_params"].get("metadata") is None: pass else: - if "litellm_params" not in kwargs: - return model_group = kwargs["litellm_params"]["metadata"].get( "model_group", None )