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 - access metadata (#7523)

Ishaan Jaff6e31bcf5a7e4
diff --git a/litellm/proxy/hooks/model_max_budget_limiter.py b/litellm/proxy/hooks/model_max_budget_limiter.py
index 3befca85163..ac02c915366 100644
--- a/litellm/proxy/hooks/model_max_budget_limiter.py
+++ b/litellm/proxy/hooks/model_max_budget_limiter.py
@@ -155,8 +155,8 @@ class _PROXY_VirtualKeyModelMaxBudgetLimiter(RouterBudgetLimiting):
if standard_logging_payload is None:
raise ValueError("standard_logging_payload is required")
- _litellm_params = kwargs.get("litellm_params", {})
- _metadata = _litellm_params.get("metadata", {})
+ _litellm_params: dict = kwargs.get("litellm_params", {}) or {}
+ _metadata: dict = _litellm_params.get("metadata", {}) or {}
user_api_key_model_max_budget: Optional[dict] = _metadata.get(
"user_api_key_model_max_budget", None
)