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]

add types for internal user settings

Ishaan Jaff401630833f02
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py
index a75a2f1583b..b18a1932ade 100644
--- a/litellm/proxy/_types.py
+++ b/litellm/proxy/_types.py
@@ -2611,35 +2611,35 @@ class TransformRequestBody(BaseModel):
request_body: dict
-class DefaultInternalUserParams(LiteLLMPydanticObjectBase):
- """
- Default parameters to apply when a new user signs in via SSO
- """
-
- user_role: Optional[
- Literal[
- LitellmUserRoles.INTERNAL_USER,
- LitellmUserRoles.INTERNAL_USER_VIEW_ONLY,
- LitellmUserRoles.PROXY_ADMIN,
- LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY,
- ]
- ] = LitellmUserRoles.INTERNAL_USER
- max_budget: Optional[float] = None
- budget_duration: Optional[str] = None
- models: Optional[List[str]] = None
-
-
class UpperboundKeyGenerateParams(LiteLLMPydanticObjectBase):
"""
Upperbound limits for /key/generate requests when self-serve flow is enabled
"""
- max_budget: Optional[float] = None
- budget_duration: Optional[str] = None
- duration: Optional[str] = None
- max_parallel_requests: Optional[int] = None
- tpm_limit: Optional[int] = None
- rpm_limit: Optional[int] = None
+ max_budget: Optional[float] = Field(
+ default=None,
+ description="Maximum budget (in USD) that can be set for any generated key",
+ )
+ budget_duration: Optional[str] = Field(
+ default=None,
+ description="Maximum budget duration that can be set (e.g. '30d', '1mo')",
+ )
+ duration: Optional[str] = Field(
+ default=None,
+ description="Maximum key lifetime duration that can be set (e.g. '30d', '1mo')",
+ )
+ max_parallel_requests: Optional[int] = Field(
+ default=None,
+ description="Maximum parallel requests limit that can be set for any generated key",
+ )
+ tpm_limit: Optional[int] = Field(
+ default=None,
+ description="Maximum tokens per minute limit that can be set for any generated key",
+ )
+ rpm_limit: Optional[int] = Field(
+ default=None,
+ description="Maximum requests per minute limit that can be set for any generated key",
+ )
class TeamKeyGenerationSettings(LiteLLMPydanticObjectBase):
@@ -2647,7 +2647,10 @@ class TeamKeyGenerationSettings(LiteLLMPydanticObjectBase):
Settings for team-based key generation
"""
- allowed_team_member_roles: Optional[List[Literal["admin", "user"]]] = ["admin"]
+ allowed_team_member_roles: Optional[List[Literal["admin", "user"]]] = Field(
+ default=["admin"],
+ description="Team member roles that are allowed to generate keys for their team",
+ )
class PersonalKeyGenerationSettings(LiteLLMPydanticObjectBase):
@@ -2655,7 +2658,10 @@ class PersonalKeyGenerationSettings(LiteLLMPydanticObjectBase):
Settings for personal key generation (maps to 'Default Team' on UI)
"""
- allowed_user_roles: Optional[List[str]] = [LitellmUserRoles.PROXY_ADMIN]
+ allowed_user_roles: Optional[List[str]] = Field(
+ default=[LitellmUserRoles.PROXY_ADMIN],
+ description="User roles that are allowed to generate personal keys (for the 'Default Team')",
+ )
class KeyGenerationSettings(LiteLLMPydanticObjectBase):
@@ -2663,8 +2669,43 @@ class KeyGenerationSettings(LiteLLMPydanticObjectBase):
Settings that restrict who can generate keys
"""
- team_key_generation: Optional[TeamKeyGenerationSettings] = None
- personal_key_generation: Optional[PersonalKeyGenerationSettings] = None
+ team_key_generation: Optional[TeamKeyGenerationSettings] = Field(
+ default=None,
+ description="Settings that control which team members can generate keys for their team",
+ )
+ personal_key_generation: Optional[PersonalKeyGenerationSettings] = Field(
+ default=None,
+ description="Settings that control which users can generate personal keys",
+ )
+
+
+class DefaultInternalUserParams(LiteLLMPydanticObjectBase):
+ """
+ Default parameters to apply when a new user signs in via SSO
+ """
+
+ user_role: Optional[
+ Literal[
+ LitellmUserRoles.INTERNAL_USER,
+ LitellmUserRoles.INTERNAL_USER_VIEW_ONLY,
+ LitellmUserRoles.PROXY_ADMIN,
+ LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY,
+ ]
+ ] = Field(
+ default=LitellmUserRoles.INTERNAL_USER,
+ description="Default role assigned to new users signing in via SSO",
+ )
+ max_budget: Optional[float] = Field(
+ default=None,
+ description="Default maximum budget (in USD) for new users signing in via SSO",
+ )
+ budget_duration: Optional[str] = Field(
+ default=None,
+ description="Default budget duration for new users (e.g. '30d', '1mo')",
+ )
+ models: Optional[List[str]] = Field(
+ default=None, description="Default list of models that new users can access"
+ )
class UISSOSettings(LiteLLMPydanticObjectBase):
@@ -2672,8 +2713,22 @@ class UISSOSettings(LiteLLMPydanticObjectBase):
Configuration for SSO integration with the LiteLLM proxy UI
"""
- max_internal_user_budget: Optional[float] = None
- internal_user_budget_duration: Optional[str] = None
- default_internal_user_params: Optional[DefaultInternalUserParams] = None
- upperbound_key_generate_params: Optional[UpperboundKeyGenerateParams] = None
- key_generation_settings: Optional[KeyGenerationSettings] = None
+ max_internal_user_budget: Optional[float] = Field(
+ default=None,
+ description="Global maximum budget (in USD) for all internal users",
+ )
+ internal_user_budget_duration: Optional[str] = Field(
+ default=None,
+ description="Global budget duration for internal users (e.g. '30d', '1mo')",
+ )
+ default_internal_user_params: Optional[DefaultInternalUserParams] = Field(
+ default=None,
+ description="Default parameters applied to new users signing in via SSO",
+ )
+ upperbound_key_generate_params: Optional[UpperboundKeyGenerateParams] = Field(
+ default=None,
+ description="Maximum limits for key generation when self-serve flow is enabled",
+ )
+ key_generation_settings: Optional[KeyGenerationSettings] = Field(
+ default=None, description="Settings that control which users can generate keys"
+ )