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]

Merge remote-tracking branch 'origin/main' into litellm_jwt_token_exchange_grant

mateo-berrid8c3a38a51fb
diff --cc tests/test_litellm/proxy/auth/test_auth_checks.py
index e4c03399b30,f480e096081..e0cb3966ae2
--- a/tests/test_litellm/proxy/auth/test_auth_checks.py
+++ b/tests/test_litellm/proxy/auth/test_auth_checks.py
@@@ -8390,19 -8451,13 +8451,30 @@@ async def test_access_group_model_fallb
reader.assert_awaited_once_with(where={"access_group_id": "group-a"})
+def test_jwt_team_role_reaches_the_gateway_token_endpoint_by_default():
+ """The RFC 8693 token exchange authorizes the IdP JWT against ``POST /token`` itself, and JWT
+ auth only binds a team from a multi-team claim when that team may call the route, so the
+ default team allowlist has to cover the gateway's token endpoint or the exchange would mint
+ teamless credentials for every ``team_ids_jwt_field`` deployment."""
+ from litellm.proxy._types import LiteLLM_JWTAuth
+ from litellm.proxy.auth.auth_checks import allowed_routes_check
+
+ assert allowed_routes_check(
+ user_role=LitellmUserRoles.TEAM, user_route="/token", litellm_proxy_roles=LiteLLM_JWTAuth()
+ )
+ assert not allowed_routes_check(
+ user_role=LitellmUserRoles.TEAM,
+ user_route="/token",
+ litellm_proxy_roles=LiteLLM_JWTAuth(team_allowed_routes=[]),
+ )
++
+ def test_route_skips_budget_checks_marks_only_spend_free_routes() -> None:
+ assert route_skips_budget_checks(route="/v1/models") is True
+ assert route_skips_budget_checks(route="/spend/logs") is True
+ assert route_skips_budget_checks(route="/health") is False
+ assert route_skips_budget_checks(route="/v1/chat/completions") is False
+
+
+ def test_request_skips_budget_checks_extends_route_rule_with_zero_cost_models() -> None:
+ assert request_skips_budget_checks(route="/v1/models", model=None, llm_router=None) is True
+ assert request_skips_budget_checks(route="/v1/chat/completions", model=None, llm_router=None) is False