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]

fix(proxy/_types.py): handle user_email=None

Krrish Dholakia2d1082f52012
diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml
index afb1b7b3aa7..cd49647464b 100644
--- a/litellm/proxy/_new_secret_config.yaml
+++ b/litellm/proxy/_new_secret_config.yaml
@@ -18,4 +18,9 @@ router_settings:
general_settings:
enable_jwt_auth: True
litellm_jwtauth:
- admin_jwt_scope: "ai.admin"
\ No newline at end of file
+ admin_jwt_scope: "ai.admin"
+ # team_id_jwt_field: "client_id" # 👈 CAN BE ANY FIELD
+ user_id_jwt_field: "sub" # 👈 CAN BE ANY FIELD
+ org_id_jwt_field: "org_id" # 👈 CAN BE ANY FIELD
+ end_user_id_jwt_field: "customer_id" # 👈 CAN BE ANY FIELD
+ user_id_upsert: True
\ No newline at end of file
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py
index 255e37186df..220a0d5ddbe 100644
--- a/litellm/proxy/_types.py
+++ b/litellm/proxy/_types.py
@@ -1631,7 +1631,7 @@ class LiteLLM_UserTable(LiteLLMPydanticObjectBase):
class LiteLLM_UserTableFiltered(BaseModel): # done to avoid exposing sensitive data
user_id: str
- user_email: str
+ user_email: Optional[str] = None
class LiteLLM_UserTableWithKeyCount(LiteLLM_UserTable):
diff --git a/litellm/proxy/management_endpoints/internal_user_endpoints.py b/litellm/proxy/management_endpoints/internal_user_endpoints.py
index 43d8273dee5..e9be169cdcb 100644
--- a/litellm/proxy/management_endpoints/internal_user_endpoints.py
+++ b/litellm/proxy/management_endpoints/internal_user_endpoints.py
@@ -1240,4 +1240,5 @@ async def ui_view_users(
return [LiteLLM_UserTableFiltered(**user.model_dump()) for user in users]
except Exception as e:
+ verbose_proxy_logger.exception(f"Error searching users: {str(e)}")
raise HTTPException(status_code=500, detail=f"Error searching users: {str(e)}")