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: increment model_per_project TPM counter in async_log_success_event

shivam46a04e26f1a6
diff --git a/litellm/proxy/hooks/parallel_request_limiter_v3.py b/litellm/proxy/hooks/parallel_request_limiter_v3.py
index 59704517229..3bdda0f7406 100644
--- a/litellm/proxy/hooks/parallel_request_limiter_v3.py
+++ b/litellm/proxy/hooks/parallel_request_limiter_v3.py
@@ -1577,6 +1577,9 @@ class _PROXY_MaxParallelRequestsHandler_v3(CustomLogger):
user_api_key_organization_id = standard_logging_metadata.get(
"user_api_key_org_id"
)
+ user_api_key_project_id = standard_logging_metadata.get(
+ "user_api_key_project_id"
+ )
user_api_key_end_user_id = kwargs.get(
"user"
) or standard_logging_metadata.get("user_api_key_end_user_id")
@@ -1694,6 +1697,16 @@ class _PROXY_MaxParallelRequestsHandler_v3(CustomLogger):
)
)
+ if model_group and user_api_key_project_id:
+ pipeline_operations.extend(
+ self._create_pipeline_operations(
+ key="model_per_project",
+ value=f"{user_api_key_project_id}:{model_group}",
+ rate_limit_type="tokens",
+ total_tokens=total_tokens,
+ )
+ )
+
# Agent TPM
agent_id = standard_logging_metadata.get("agent_id")
if agent_id: