Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: add None check for litellm_params (#16754)

Alexsander Hamir6b7035e32f32
diff --git a/litellm/router_strategy/lowest_tpm_rpm.py b/litellm/router_strategy/lowest_tpm_rpm.py
index e2bb0d77c4b..1bd065a3e42 100644
--- a/litellm/router_strategy/lowest_tpm_rpm.py
+++ b/litellm/router_strategy/lowest_tpm_rpm.py
@@ -33,6 +33,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:
@@ -92,11 +94,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
)