diff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prisma index 6a9b72728..f31fa130a 100644 --- a/litellm/proxy/schema.prisma +++ b/litellm/proxy/schema.prisma @@ -7,10 +7,42 @@ generator client { provider = "prisma-client-py" } +// Budget / Rate Limits for an org +model LiteLLM_BudgetTable { + budget_id String @id @default(uuid()) + max_budget Float? + max_parallel_requests Int? + tpm_limit BigInt? + rpm_limit BigInt? + model_max_budget Json @default("{}") + budget_duration String? + budget_reset_at DateTime? + created_at DateTime @default(now()) @map("created_at") + created_by String + updated_at DateTime @default(now()) @updatedAt @map("updated_at") + updated_by String +} + +model LiteLLM_OrganizationTable { + organization_id String @id @default(uuid()) + organization_alias String? + budget_id String + metadata Json @default("{}") + models String[] + spend Float @default(0.0) + model_spend Json @default("{}") + created_at DateTime @default(now()) @map("created_at") + created_by String + updated_at DateTime @default(now()) @updatedAt @map("updated_at") + updated_by String + litellm_budget_table LiteLLM_BudgetTable @relation(fields: [budget_id], references: [budget_id]) +} + // Assign prod keys to groups, not individuals model LiteLLM_TeamTable { - team_id String @unique + team_id String @id @default(uuid()) team_alias String? + organization_id String? admins String[] members String[] members_with_roles Json @default("{}") @@ -27,11 +59,12 @@ model LiteLLM_TeamTable { updated_at DateTime @default(now()) @updatedAt @map("updated_at") model_spend Json @default("{}") model_max_budget Json @default("{}") + litellm_organization_table LiteLLM_OrganizationTable @relation(fields: [organization_id], references: [organization_id]) } // Track spend, rate limit, budget Users model LiteLLM_UserTable { - user_id String @unique + user_id String @id team_id String? teams String[] @default([]) user_role String? @@ -51,7 +84,7 @@ model LiteLLM_UserTable { // Generate Tokens for Proxy model LiteLLM_VerificationToken { - token String @unique + token String @id key_name String? key_alias String? spend Float @default(0.0) @@ -82,7 +115,7 @@ model LiteLLM_Config { // View spend, model, api_key per request model LiteLLM_SpendLogs { - request_id String @unique + request_id String @id call_type String api_key String @default ("") spend Float @default(0.0) @@ -98,11 +131,12 @@ model LiteLLM_SpendLogs { cache_key String @default("") request_tags Json @default("[]") team_id String? - end_user String? + end_user String? } + // Beta - allow team members to request access to a model model LiteLLM_UserNotifications { - request_id String @unique + request_id String @id user_id String models String[] justification String diff --git a/schema.prisma b/schema.prisma index d08295e10..f31fa130a 100644 --- a/schema.prisma +++ b/schema.prisma @@ -7,10 +7,42 @@ generator client { provider = "prisma-client-py" } +// Budget / Rate Limits for an org +model LiteLLM_BudgetTable { + budget_id String @id @default(uuid()) + max_budget Float? + max_parallel_requests Int? + tpm_limit BigInt? + rpm_limit BigInt? + model_max_budget Json @default("{}") + budget_duration String? + budget_reset_at DateTime? + created_at DateTime @default(now()) @map("created_at") + created_by String + updated_at DateTime @default(now()) @updatedAt @map("updated_at") + updated_by String +} + +model LiteLLM_OrganizationTable { + organization_id String @id @default(uuid()) + organization_alias String? + budget_id String + metadata Json @default("{}") + models String[] + spend Float @default(0.0) + model_spend Json @default("{}") + created_at DateTime @default(now()) @map("created_at") + created_by String + updated_at DateTime @default(now()) @updatedAt @map("updated_at") + updated_by String + litellm_budget_table LiteLLM_BudgetTable @relation(fields: [budget_id], references: [budget_id]) +} + // Assign prod keys to groups, not individuals model LiteLLM_TeamTable { - team_id String @unique + team_id String @id @default(uuid()) team_alias String? + organization_id String? admins String[] members String[] members_with_roles Json @default("{}") @@ -27,11 +59,12 @@ model LiteLLM_TeamTable { updated_at DateTime @default(now()) @updatedAt @map("updated_at") model_spend Json @default("{}") model_max_budget Json @default("{}") + litellm_organization_table LiteLLM_OrganizationTable @relation(fields: [organization_id], references: [organization_id]) } // Track spend, rate limit, budget Users model LiteLLM_UserTable { - user_id String @unique + user_id String @id team_id String? teams String[] @default([]) user_role String? @@ -51,7 +84,7 @@ model LiteLLM_UserTable { // Generate Tokens for Proxy model LiteLLM_VerificationToken { - token String @unique + token String @id key_name String? key_alias String? spend Float @default(0.0) @@ -82,7 +115,7 @@ model LiteLLM_Config { // View spend, model, api_key per request model LiteLLM_SpendLogs { - request_id String @unique + request_id String @id call_type String api_key String @default ("") spend Float @default(0.0) @@ -103,7 +136,7 @@ model LiteLLM_SpendLogs { // Beta - allow team members to request access to a model model LiteLLM_UserNotifications { - request_id String @unique + request_id String @id user_id String models String[] justification String