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(lowest_tpm_rpm_routing_v2.py): fix deployment update to use correct keys

Krrish Dholakiacfe94c86cc88
diff --git a/litellm/router_strategy/lowest_tpm_rpm_v2.py b/litellm/router_strategy/lowest_tpm_rpm_v2.py
index 125eac663bc..bc7cb46b07e 100644
--- a/litellm/router_strategy/lowest_tpm_rpm_v2.py
+++ b/litellm/router_strategy/lowest_tpm_rpm_v2.py
@@ -462,7 +462,7 @@ class LowestTPMLoggingHandler_v2(CustomLogger):
id = m.get("model_info", {}).get(
"id"
) # a deployment should always have an 'id'. this is set in router.py
- deployment_name = m.get("model_name")
+ deployment_name = m.get("litellm_params", {}).get("model")
tpm_key = "{}:{}:tpm:{}".format(id, deployment_name, current_minute)
rpm_key = "{}:{}:rpm:{}".format(id, deployment_name, current_minute)
@@ -581,8 +581,9 @@ class LowestTPMLoggingHandler_v2(CustomLogger):
id = m.get("model_info", {}).get(
"id"
) # a deployment should always have an 'id'. this is set in router.py
- tpm_key = "{}:tpm:{}".format(id, current_minute)
- rpm_key = "{}:rpm:{}".format(id, current_minute)
+ deployment_name = m.get("litellm_params", {}).get("model")
+ tpm_key = "{}:{}:tpm:{}".format(id, deployment_name, current_minute)
+ rpm_key = "{}:{}:rpm:{}".format(id, deployment_name, current_minute)
tpm_keys.append(tpm_key)
rpm_keys.append(rpm_key)