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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
[Chore] Check team counts on license when creating new team (#11943)
Ishaan Jaff57121b4fcc98
diff --git a/litellm/proxy/auth/litellm_license.py b/litellm/proxy/auth/litellm_license.pyindex 7998ea9b4b1..0a67105ef59 100644--- a/litellm/proxy/auth/litellm_license.py+++ b/litellm/proxy/auth/litellm_license.py@@ -140,6 +140,18 @@ class LicenseCheck:):return Falsereturn total_users > self.airgapped_license_data["max_users"]++ def is_team_count_over_limit(self, team_count: int) -> bool:+ """+ Check if the license is over the limit+ """+ if self.airgapped_license_data is None:+ return False+ if "max_teams" not in self.airgapped_license_data or not isinstance(+ self.airgapped_license_data["max_teams"], int+ ):+ return False+ return team_count > self.airgapped_license_data["max_teams"]def verify_license_without_api_request(self, public_key, license_key):try:diff --git a/litellm/proxy/management_endpoints/team_endpoints.py b/litellm/proxy/management_endpoints/team_endpoints.pyindex 8d7e12a6f89..a44da618962 100644--- a/litellm/proxy/management_endpoints/team_endpoints.py+++ b/litellm/proxy/management_endpoints/team_endpoints.py@@ -295,6 +295,7 @@ async def new_team( # noqa: PLR0915"""try:from litellm.proxy.proxy_server import (+ _license_check,create_audit_log_for_update,litellm_proxy_admin_name,prisma_client,@@ -302,6 +303,15 @@ async def new_team( # noqa: PLR0915if prisma_client is None:raise HTTPException(status_code=500, detail={"error": "No db connected"})+++ # Check if license is over limit+ total_teams = await prisma_client.db.litellm_teamtable.count()+ if total_teams and _license_check.is_team_count_over_limit(team_count=total_teams):+ raise HTTPException(+ status_code=403,+ detail="License is over limit. Please contact [email protected] to upgrade your license.",+ )if data.team_id is None:data.team_id = str(uuid.uuid4())