mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
init project apis
This commit is contained in:
parent
a3c3f6ae74
commit
412f7e396a
1 changed files with 115 additions and 0 deletions
|
|
@ -842,6 +842,7 @@ class GenerateKeyRequest(KeyRequestBase):
|
|||
description="How often to rotate this key (e.g., '30d', '90d'). Required if auto_rotate=True",
|
||||
)
|
||||
organization_id: Optional[str] = None
|
||||
project_id: Optional[str] = None
|
||||
|
||||
|
||||
class GenerateKeyResponse(KeyRequestBase):
|
||||
|
|
@ -851,6 +852,7 @@ class GenerateKeyResponse(KeyRequestBase):
|
|||
user_id: Optional[str] = None
|
||||
token_id: Optional[str] = None
|
||||
organization_id: Optional[str] = None
|
||||
project_id: Optional[str] = None
|
||||
litellm_budget_table: Optional[Any] = None
|
||||
token: Optional[str] = None
|
||||
created_by: Optional[str] = None
|
||||
|
|
@ -2222,6 +2224,119 @@ class NewOrganizationResponse(LiteLLM_OrganizationTable):
|
|||
updated_at: datetime
|
||||
|
||||
|
||||
### PROJECT MANAGEMENT TYPES ###
|
||||
|
||||
|
||||
class ProjectBase(LiteLLMPydanticObjectBase):
|
||||
"""Base fields shared by project create/update requests"""
|
||||
|
||||
project_id: Optional[str] = None
|
||||
project_alias: Optional[str] = None
|
||||
team_id: Optional[str] = None
|
||||
metadata: Optional[dict] = None
|
||||
models: Optional[List[str]] = None
|
||||
blocked: bool = False
|
||||
|
||||
|
||||
class NewProjectRequest(LiteLLM_BudgetTable):
|
||||
"""Request model for POST /project/new"""
|
||||
|
||||
project_id: Optional[str] = None
|
||||
project_alias: Optional[str] = None
|
||||
team_id: str
|
||||
budget_id: Optional[str] = None
|
||||
metadata: Optional[dict] = None
|
||||
models: List[str] = []
|
||||
blocked: bool = False
|
||||
object_permission: Optional[LiteLLM_ObjectPermissionBase] = None
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def set_model_info(cls, values):
|
||||
for field in LiteLLM_ManagementEndpoint_MetadataFields:
|
||||
if values.get(field) is not None:
|
||||
if values.get("metadata") is None:
|
||||
values.update({"metadata": {}})
|
||||
values["metadata"][field] = values.get(field)
|
||||
values.pop(field)
|
||||
return values
|
||||
|
||||
|
||||
class UpdateProjectRequest(LiteLLM_BudgetTable):
|
||||
"""Request model for POST /project/update"""
|
||||
|
||||
project_id: str
|
||||
project_alias: Optional[str] = None
|
||||
team_id: Optional[str] = None
|
||||
metadata: Optional[dict] = None
|
||||
models: Optional[List[str]] = None
|
||||
blocked: Optional[bool] = None
|
||||
budget_id: Optional[str] = None
|
||||
object_permission: Optional[LiteLLM_ObjectPermissionBase] = None
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def set_model_info(cls, values):
|
||||
for field in LiteLLM_ManagementEndpoint_MetadataFields:
|
||||
if values.get(field) is not None:
|
||||
if values.get("metadata") is None:
|
||||
values.update({"metadata": {}})
|
||||
values["metadata"][field] = values.get(field)
|
||||
values.pop(field)
|
||||
return values
|
||||
|
||||
|
||||
class DeleteProjectRequest(LiteLLMPydanticObjectBase):
|
||||
"""Request model for DELETE /project/delete"""
|
||||
|
||||
project_ids: List[str]
|
||||
|
||||
|
||||
class LiteLLM_ProjectTable(LiteLLMPydanticObjectBase):
|
||||
"""Database model representation for project"""
|
||||
|
||||
project_id: str
|
||||
project_alias: Optional[str] = None
|
||||
team_id: Optional[str] = None
|
||||
budget_id: Optional[str] = None
|
||||
metadata: Optional[dict] = None
|
||||
models: List[str] = []
|
||||
spend: float = 0.0
|
||||
model_spend: Optional[dict] = None
|
||||
blocked: bool = False
|
||||
object_permission_id: Optional[str] = None
|
||||
created_by: str
|
||||
updated_by: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
litellm_budget_table: Optional[LiteLLM_BudgetTable] = None
|
||||
object_permission: Optional[LiteLLM_ObjectPermissionTable] = None
|
||||
|
||||
|
||||
class NewProjectResponse(LiteLLM_ProjectTable):
|
||||
"""Response model for POST /project/new"""
|
||||
|
||||
project_id: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class LiteLLM_ProjectTableCachedObj(LiteLLMPydanticObjectBase):
|
||||
"""Cached version for auth checks"""
|
||||
|
||||
project_id: str
|
||||
project_alias: Optional[str] = None
|
||||
team_id: Optional[str] = None
|
||||
budget_id: Optional[str] = None
|
||||
metadata: Optional[dict] = None
|
||||
models: List[str] = []
|
||||
spend: float = 0.0
|
||||
model_spend: Optional[dict] = None
|
||||
blocked: bool = False
|
||||
object_permission_id: Optional[str] = None
|
||||
litellm_budget_table: Optional[LiteLLM_BudgetTable] = None
|
||||
|
||||
|
||||
class LiteLLM_UserTableFiltered(BaseModel): # done to avoid exposing sensitive data
|
||||
user_id: str
|
||||
user_email: Optional[str] = None
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue