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(jwt_auth): grant only /v1/messages routes to JWT teams by default, not all anthropic_routes
mateo-berric2f0014a632f
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex 53b6e51aaef..1608811b5a1 100644--- a/litellm/proxy/_types.py+++ b/litellm/proxy/_types.py@@ -4254,7 +4254,13 @@ class LiteLLM_JWTAuth(LiteLLMPydanticObjectBase):team_id_upsert: bool = Falseteam_ids_jwt_field: Optional[str] = Noneupsert_sso_user_to_team: bool = False- team_allowed_routes: List[str] = ["openai_routes", "anthropic_routes", "info_routes", "mcp_routes"]+ team_allowed_routes: List[str] = [+ "openai_routes",+ "info_routes",+ "mcp_routes",+ "/v1/messages",+ "/v1/messages/count_tokens",+ ]team_id_default: Optional[str] = Field(default=None,description="If no team_id given, default permissions/spend-tracking to this team.s",diff --git a/tests/test_litellm/proxy/auth/test_handle_jwt.py b/tests/test_litellm/proxy/auth/test_handle_jwt.pyindex 35aaa0f1254..3840c90d691 100644--- a/tests/test_litellm/proxy/auth/test_handle_jwt.py+++ b/tests/test_litellm/proxy/auth/test_handle_jwt.py@@ -1299,6 +1299,28 @@ async def test_find_team_with_model_access_v1_messages_default_routes(monkeypatcassert team_obj.team_id == "coding-team"+ "route,expected",+ [+ ("/v1/messages", True),+ ("/v1/messages/count_tokens", True),+ ("/v1/skills", False),+ ("/v1/skills/skill_abc123", False),+ ],+)+def test_default_team_allowed_routes_cover_messages_but_not_skills(route, expected):+ from litellm.proxy.auth.auth_checks import allowed_routes_check++ assert (+ allowed_routes_check(+ user_role=LitellmUserRoles.TEAM,+ user_route=route,+ litellm_proxy_roles=LiteLLM_JWTAuth(),+ )+ is expected+ )++@pytest.mark.asyncioasync def test_auth_builder_returns_team_membership_object():"""