Spaces:
Paused
Paused
| datasource client { | |
| provider = "postgresql" | |
| url = env("DATABASE_URL") | |
| } | |
| generator client { | |
| provider = "prisma-client-py" | |
| } | |
| // Budget / Rate Limits for an org | |
| model LiteLLM_BudgetTable { | |
| budget_id String | |
| max_budget Float? | |
| soft_budget Float? | |
| max_parallel_requests Int? | |
| tpm_limit BigInt? | |
| rpm_limit BigInt? | |
| model_max_budget Json? | |
| budget_duration String? | |
| budget_reset_at DateTime? | |
| created_at DateTime | |
| created_by String | |
| updated_at DateTime | |
| updated_by String | |
| organization LiteLLM_OrganizationTable[] // multiple orgs can have the same budget | |
| keys LiteLLM_VerificationToken[] // multiple keys can have the same budget | |
| end_users LiteLLM_EndUserTable[] // multiple end-users can have the same budget | |
| team_membership LiteLLM_TeamMembership[] // budgets of Users within a Team | |
| organization_membership LiteLLM_OrganizationMembership[] // budgets of Users within a Organization | |
| } | |
| // Models on proxy | |
| model LiteLLM_CredentialsTable { | |
| credential_id String | |
| credential_name String | |
| credential_values Json | |
| credential_info Json? | |
| created_at DateTime | |
| created_by String | |
| updated_at DateTime | |
| updated_by String | |
| } | |
| // Models on proxy | |
| model LiteLLM_ProxyModelTable { | |
| model_id String | |
| model_name String | |
| litellm_params Json | |
| model_info Json? | |
| created_at DateTime | |
| created_by String | |
| updated_at DateTime | |
| updated_by String | |
| } | |
| model LiteLLM_OrganizationTable { | |
| organization_id String | |
| organization_alias String | |
| budget_id String | |
| metadata Json | |
| models String[] | |
| spend Float | |
| model_spend Json | |
| object_permission_id String? | |
| created_at DateTime | |
| created_by String | |
| updated_at DateTime | |
| updated_by String | |
| litellm_budget_table LiteLLM_BudgetTable? | |
| teams LiteLLM_TeamTable[] | |
| users LiteLLM_UserTable[] | |
| keys LiteLLM_VerificationToken[] | |
| members LiteLLM_OrganizationMembership[] | |
| object_permission LiteLLM_ObjectPermissionTable? | |
| } | |
| // Model info for teams, just has model aliases for now. | |
| model LiteLLM_ModelTable { | |
| id Int | |
| model_aliases Json? | |
| created_at DateTime | |
| created_by String | |
| updated_at DateTime | |
| updated_by String | |
| team LiteLLM_TeamTable? | |
| } | |
| // Assign prod keys to groups, not individuals | |
| model LiteLLM_TeamTable { | |
| team_id String | |
| team_alias String? | |
| organization_id String? | |
| object_permission_id String? | |
| admins String[] | |
| members String[] | |
| members_with_roles Json | |
| metadata Json | |
| max_budget Float? | |
| spend Float | |
| models String[] | |
| max_parallel_requests Int? | |
| tpm_limit BigInt? | |
| rpm_limit BigInt? | |
| budget_duration String? | |
| budget_reset_at DateTime? | |
| blocked Boolean | |
| created_at DateTime | |
| updated_at DateTime | |
| model_spend Json | |
| model_max_budget Json | |
| team_member_permissions String[] | |
| model_id Int? // id for LiteLLM_ModelTable -> stores team-level model aliases | |
| litellm_organization_table LiteLLM_OrganizationTable? | |
| litellm_model_table LiteLLM_ModelTable? | |
| object_permission LiteLLM_ObjectPermissionTable? | |
| } | |
| // Track spend, rate limit, budget Users | |
| model LiteLLM_UserTable { | |
| user_id String | |
| user_alias String? | |
| team_id String? | |
| sso_user_id String? | |
| organization_id String? | |
| object_permission_id String? | |
| password String? | |
| teams String[] | |
| user_role String? | |
| max_budget Float? | |
| spend Float | |
| user_email String? | |
| models String[] | |
| metadata Json | |
| max_parallel_requests Int? | |
| tpm_limit BigInt? | |
| rpm_limit BigInt? | |
| budget_duration String? | |
| budget_reset_at DateTime? | |
| allowed_cache_controls String[] | |
| model_spend Json | |
| model_max_budget Json | |
| created_at DateTime? | |
| updated_at DateTime? | |
| // relations | |
| litellm_organization_table LiteLLM_OrganizationTable? | |
| organization_memberships LiteLLM_OrganizationMembership[] | |
| invitations_created LiteLLM_InvitationLink[] | |
| invitations_updated LiteLLM_InvitationLink[] | |
| invitations_user LiteLLM_InvitationLink[] | |
| object_permission LiteLLM_ObjectPermissionTable? | |
| } | |
| model LiteLLM_ObjectPermissionTable { | |
| object_permission_id String | |
| mcp_servers String[] | |
| vector_stores String[] | |
| teams LiteLLM_TeamTable[] | |
| verification_tokens LiteLLM_VerificationToken[] | |
| organizations LiteLLM_OrganizationTable[] | |
| users LiteLLM_UserTable[] | |
| } | |
| // Holds the MCP server configuration | |
| model LiteLLM_MCPServerTable { | |
| server_id String | |
| alias String? | |
| description String? | |
| url String | |
| transport String | |
| spec_version String | |
| auth_type String? | |
| created_at DateTime? | |
| created_by String? | |
| updated_at DateTime? | |
| updated_by String? | |
| } | |
| // Generate Tokens for Proxy | |
| model LiteLLM_VerificationToken { | |
| token String | |
| key_name String? | |
| key_alias String? | |
| soft_budget_cooldown Boolean // key-level state on if budget alerts need to be cooled down | |
| spend Float | |
| expires DateTime? | |
| models String[] | |
| aliases Json | |
| config Json | |
| user_id String? | |
| team_id String? | |
| permissions Json | |
| max_parallel_requests Int? | |
| metadata Json | |
| blocked Boolean? | |
| tpm_limit BigInt? | |
| rpm_limit BigInt? | |
| max_budget Float? | |
| budget_duration String? | |
| budget_reset_at DateTime? | |
| allowed_cache_controls String[] | |
| allowed_routes String[] | |
| model_spend Json | |
| model_max_budget Json | |
| budget_id String? | |
| organization_id String? | |
| object_permission_id String? | |
| created_at DateTime? | |
| created_by String? | |
| updated_at DateTime? | |
| updated_by String? | |
| litellm_budget_table LiteLLM_BudgetTable? | |
| litellm_organization_table LiteLLM_OrganizationTable? | |
| object_permission LiteLLM_ObjectPermissionTable? | |
| } | |
| model LiteLLM_EndUserTable { | |
| user_id String | |
| alias String? // admin-facing alias | |
| spend Float | |
| allowed_model_region String? // require all user requests to use models in this specific region | |
| default_model String? // use along with 'allowed_model_region'. if no available model in region, default to this model. | |
| budget_id String? | |
| litellm_budget_table LiteLLM_BudgetTable? | |
| blocked Boolean | |
| } | |
| // store proxy config.yaml | |
| model LiteLLM_Config { | |
| param_name String | |
| param_value Json? | |
| } | |
| // View spend, model, api_key per request | |
| model LiteLLM_SpendLogs { | |
| request_id String | |
| call_type String | |
| api_key String ("") // Hashed API Token. Not the actual Virtual Key. Equivalent to 'token' column in LiteLLM_VerificationToken | |
| spend Float | |
| total_tokens Int | |
| prompt_tokens Int | |
| completion_tokens Int | |
| startTime DateTime // Assuming start_time is a DateTime field | |
| endTime DateTime // Assuming end_time is a DateTime field | |
| completionStartTime DateTime? // Assuming completionStartTime is a DateTime field | |
| model String | |
| model_id String? // the model id stored in proxy model db | |
| model_group String? // public model_name / model_group | |
| custom_llm_provider String? // litellm used custom_llm_provider | |
| api_base String? | |
| user String? | |
| metadata Json? | |
| cache_hit String? | |
| cache_key String? | |
| request_tags Json? | |
| team_id String? | |
| end_user String? | |
| requester_ip_address String? | |
| messages Json? | |
| response Json? | |
| session_id String? | |
| status String? | |
| proxy_server_request Json? | |
| @ | |
| @ | |
| @ | |
| } | |
| // View spend, model, api_key per request | |
| model LiteLLM_ErrorLogs { | |
| request_id String | |
| startTime DateTime // Assuming start_time is a DateTime field | |
| endTime DateTime // Assuming end_time is a DateTime field | |
| api_base String | |
| model_group String // public model_name / model_group | |
| litellm_model_name String // model passed to litellm | |
| model_id String // ID of model in ProxyModelTable | |
| request_kwargs Json | |
| exception_type String | |
| exception_string String | |
| status_code String | |
| } | |
| // Beta - allow team members to request access to a model | |
| model LiteLLM_UserNotifications { | |
| request_id String | |
| user_id String | |
| models String[] | |
| justification String | |
| status String // approved, disapproved, pending | |
| } | |
| model LiteLLM_TeamMembership { | |
| // Use this table to track the Internal User's Spend within a Team + Set Budgets, rpm limits for the user within the team | |
| user_id String | |
| team_id String | |
| spend Float | |
| budget_id String? | |
| litellm_budget_table LiteLLM_BudgetTable? | |
| @ | |
| } | |
| model LiteLLM_OrganizationMembership { | |
| // Use this table to track Internal User and Organization membership. Helps tracking a users role within an Organization | |
| user_id String | |
| organization_id String | |
| user_role String? | |
| spend Float? | |
| budget_id String? | |
| created_at DateTime? | |
| updated_at DateTime? | |
| // relations | |
| user LiteLLM_UserTable | |
| organization LiteLLM_OrganizationTable | |
| litellm_budget_table LiteLLM_BudgetTable? | |
| @ | |
| @ | |
| } | |
| model LiteLLM_InvitationLink { | |
| // use this table to track invite links sent by admin for people to join the proxy | |
| id String | |
| user_id String | |
| is_accepted Boolean | |
| accepted_at DateTime? // when link is claimed (user successfully onboards via link) | |
| expires_at DateTime // till when is link valid | |
| created_at DateTime // when did admin create the link | |
| created_by String // who created the link | |
| updated_at DateTime // when was invite status updated | |
| updated_by String // who updated the status (admin/user who accepted invite) | |
| // Relations | |
| liteLLM_user_table_user LiteLLM_UserTable | |
| liteLLM_user_table_created LiteLLM_UserTable | |
| liteLLM_user_table_updated LiteLLM_UserTable | |
| } | |
| model LiteLLM_AuditLog { | |
| id String | |
| updated_at DateTime | |
| changed_by String // user or system that performed the action | |
| changed_by_api_key String // api key hash that performed the action | |
| action String // create, update, delete | |
| table_name String // on of LitellmTableNames.TEAM_TABLE_NAME, LitellmTableNames.USER_TABLE_NAME, LitellmTableNames.PROXY_MODEL_TABLE_NAME, | |
| object_id String // id of the object being audited. This can be the key id, team id, user id, model id | |
| before_value Json? // value of the row | |
| updated_values Json? // value of the row after change | |
| } | |
| // Track daily user spend metrics per model and key | |
| model LiteLLM_DailyUserSpend { | |
| id String | |
| user_id String? | |
| date String | |
| api_key String | |
| model String | |
| model_group String? | |
| custom_llm_provider String? | |
| prompt_tokens BigInt | |
| completion_tokens BigInt | |
| cache_read_input_tokens BigInt | |
| cache_creation_input_tokens BigInt | |
| spend Float | |
| api_requests BigInt | |
| successful_requests BigInt | |
| failed_requests BigInt | |
| created_at DateTime | |
| updated_at DateTime | |
| @ | |
| @ | |
| @ | |
| @ | |
| @ | |
| } | |
| // Track daily team spend metrics per model and key | |
| model LiteLLM_DailyTeamSpend { | |
| id String | |
| team_id String? | |
| date String | |
| api_key String | |
| model String | |
| model_group String? | |
| custom_llm_provider String? | |
| prompt_tokens BigInt | |
| completion_tokens BigInt | |
| cache_read_input_tokens BigInt | |
| cache_creation_input_tokens BigInt | |
| spend Float | |
| api_requests BigInt | |
| successful_requests BigInt | |
| failed_requests BigInt | |
| created_at DateTime | |
| updated_at DateTime | |
| @ | |
| @ | |
| @ | |
| @ | |
| @ | |
| } | |
| // Track daily team spend metrics per model and key | |
| model LiteLLM_DailyTagSpend { | |
| id String | |
| tag String? | |
| date String | |
| api_key String | |
| model String | |
| model_group String? | |
| custom_llm_provider String? | |
| prompt_tokens BigInt | |
| completion_tokens BigInt | |
| cache_read_input_tokens BigInt | |
| cache_creation_input_tokens BigInt | |
| spend Float | |
| api_requests BigInt | |
| successful_requests BigInt | |
| failed_requests BigInt | |
| created_at DateTime | |
| updated_at DateTime | |
| @ | |
| @ | |
| @ | |
| @ | |
| @ | |
| } | |
| // Track the status of cron jobs running. Only allow one pod to run the job at a time | |
| model LiteLLM_CronJob { | |
| cronjob_id String // Unique ID for the record | |
| pod_id String // Unique identifier for the pod acting as the leader | |
| status JobStatus // Status of the cron job (active or inactive) | |
| last_updated DateTime // Timestamp for the last update of the cron job record | |
| ttl DateTime // Time when the leader's lease expires | |
| } | |
| enum JobStatus { | |
| ACTIVE | |
| INACTIVE | |
| } | |
| model LiteLLM_ManagedFileTable { | |
| id String | |
| unified_file_id String // The base64 encoded unified file ID | |
| file_object Json // Stores the OpenAIFileObject | |
| model_mappings Json | |
| flat_model_file_ids String[] // Flat list of model file id's - for faster querying of model id -> unified file id | |
| created_at DateTime | |
| created_by String? | |
| updated_at DateTime | |
| updated_by String? | |
| @ | |
| } | |
| model LiteLLM_ManagedObjectTable { // for batches or finetuning jobs which use the | |
| id String | |
| unified_object_id String // The base64 encoded unified file ID | |
| model_object_id String // the id returned by the backend API provider | |
| file_object Json // Stores the OpenAIFileObject | |
| file_purpose String // either 'batch' or 'fine-tune' | |
| created_at DateTime | |
| created_by String? | |
| updated_at DateTime | |
| updated_by String? | |
| @ | |
| @ | |
| } | |
| model LiteLLM_ManagedVectorStoresTable { | |
| vector_store_id String | |
| custom_llm_provider String | |
| vector_store_name String? | |
| vector_store_description String? | |
| vector_store_metadata Json? | |
| created_at DateTime | |
| updated_at DateTime | |
| litellm_credential_name String? | |
| } | |
| // Guardrails table for storing guardrail configurations | |
| model LiteLLM_GuardrailsTable { | |
| guardrail_id String | |
| guardrail_name String | |
| litellm_params Json | |
| guardrail_info Json? | |
| created_at DateTime | |
| updated_at DateTime | |
| } |