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: allow any authenticated user to call /user/available_roles
yuneng-jiang67884c279a01
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.pyindex e6b7b7d285d..b1d3fe4c3f8 100644--- a/litellm/proxy/_types.py+++ b/litellm/proxy/_types.py@@ -652,6 +652,7 @@ class LiteLLMRoutes(enum.Enum):"/model/update","/model/delete","/user/daily/activity",+ "/user/available_roles", # read-only role metadata; any authenticated user may read"/model/{model_id}/update","/prompt/list","/prompt/info",diff --git a/tests/test_litellm/proxy/auth/test_route_checks.py b/tests/test_litellm/proxy/auth/test_route_checks.pyindex f1e96f3e660..5477a20b626 100644--- a/tests/test_litellm/proxy/auth/test_route_checks.py+++ b/tests/test_litellm/proxy/auth/test_route_checks.py@@ -1190,3 +1190,41 @@ def test_non_admin_non_team_admin_cannot_access_config_update_but_can_attempt_rerequest_data={},)assert "Only proxy admin can be used to generate" in str(exc_info.value)+++ "user_role",+ [+ LitellmUserRoles.INTERNAL_USER.value,+ LitellmUserRoles.INTERNAL_USER_VIEW_ONLY.value,+ LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY.value,+ ],+)+def test_available_roles_accessible_to_non_admin_users(user_role):+ """+ /user/available_roles is read-only role metadata that any authenticated user+ (including org admins and team admins) needs when inviting users. It should+ pass the route check for all non-proxy-admin roles without requiring an+ organization_id in the request body.+ """+ user_obj = LiteLLM_UserTable(+ user_id="test_user",+ user_email="[email protected]",+ user_role=user_role,+ )+ valid_token = UserAPIKeyAuth(+ user_id="test_user",+ user_role=user_role,+ )+ request = MagicMock(spec=Request)+ request.query_params = {}++ # Should not raise — /user/available_roles is in self_managed_routes+ RouteChecks.non_proxy_admin_allowed_routes_check(+ user_obj=user_obj,+ _user_role=user_role,+ route="/user/available_roles",+ request=request,+ valid_token=valid_token,+ request_data={},+ )