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
[Fix] Skip all-team-models sentinel in team change validation
yuneng-jiangc637c93a6ab4
diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.pyindex db1a089ff7b..715a395e67e 100644--- a/litellm/proxy/management_endpoints/key_management_endpoints.py+++ b/litellm/proxy/management_endpoints/key_management_endpoints.py@@ -2301,23 +2301,16 @@ async def validate_key_team_change(# Check if the team has access to the key's modelsif len(key.models) > 0:for model in key.models:+ # Skip special sentinel values — "all-team-models" means+ # "use whatever the team allows", so it's always valid.+ if model == SpecialModelNames.all_team_models.value:+ continueawait can_team_access_model(model=model,team_object=team,llm_router=llm_router,)- # Check if the key's user_id is a member of the team- member_object = _get_user_in_team(- team_table=cast(LiteLLM_TeamTableCachedObj, team), user_id=key.user_id- )- if key.user_id is not None:- if not member_object:- raise HTTPException(- status_code=403,- detail=f"User={key.user_id} is not a member of the team={team.team_id}. Check team members via `/team/info`.",- )-# Check if the key's tpm/rpm limit is less than the team's tpm/rpm limitif key.tpm_limit is not None:if team.tpm_limit and key.tpm_limit > team.tpm_limit:@@ -2331,6 +2324,17 @@ async def validate_key_team_change(detail=f"Key={key.token} has a rpm_limit={key.rpm_limit} which is greater than the team's rpm_limit={team.rpm_limit}.",)+ # Check if the key's user_id is a member of the team+ member_object = _get_user_in_team(+ team_table=cast(LiteLLM_TeamTableCachedObj, team), user_id=key.user_id+ )+ if key.user_id is not None:+ if not member_object:+ raise HTTPException(+ status_code=403,+ detail=f"User={key.user_id} is not a member of the team={team.team_id}. Check team members via `/team/info`.",+ )+# Check if the person initiating the change is a Proxy Admin or Team Adminif change_initiated_by.user_role == LitellmUserRoles.PROXY_ADMIN.value:return