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: resolve conflicts with verification e2e

Harshit Jainf77fbefc22e8
diff --cc docs/my-website/sidebars.js
index 3ea109d7139,579b5699101..6e9d65fac00
--- a/docs/my-website/sidebars.js
+++ b/docs/my-website/sidebars.js
@@@ -196,7 -400,7 +400,8 @@@ const sidebars =
items: [
"proxy/users",
"proxy/team_budgets",
+ "project_management",
+ "proxy/ui_team_soft_budget_alerts",
"proxy/tag_budgets",
"proxy/customers",
"proxy/dynamic_rate_limit",
@@@ -513,17 -765,53 +766,53 @@@
"providers/bedrock_rerank",
"providers/bedrock_agentcore",
"providers/bedrock_agents",
+ "providers/bedrock_writer",
"providers/bedrock_batches",
+ "providers/bedrock_realtime_with_audio",
+ "providers/aws_polly",
- "providers/bedrock_vector_store",
- ]
- },
- "providers/litellm_proxy",
- "providers/abliteration",
- "providers/ai21",
- "providers/aiml",
+ "providers/bedrock_vector_store",
+ ]
+ },
- "providers/milvus_vector_stores",
+ "providers/litellm_proxy",
- "providers/meta_llama",
- "providers/mistral",
++ "providers/abliteration",
++ "providers/ai21",
++ "providers/aiml",
+ "providers/aleph_alpha",
+ "providers/amazon_nova",
+ "providers/anyscale",
+ "providers/apertis",
+ "providers/baseten",
+ "providers/bytez",
+ "providers/cerebras",
+ "providers/chutes",
+ "providers/clarifai",
+ "providers/cloudflare_workers",
"providers/codestral",
"providers/cohere",
- "providers/anyscale",
+ "providers/cometapi",
+ "providers/compactifai",
+ "providers/custom_llm_server",
+ "providers/dashscope",
+ "providers/databricks",
+ "providers/datarobot",
+ "providers/deepgram",
+ "providers/deepinfra",
+ "providers/deepseek",
+ "providers/docker_model_runner",
+ "providers/elevenlabs",
+ "providers/fal_ai",
+ "providers/featherless_ai",
+ "providers/fireworks_ai",
+ "providers/friendliai",
+ "providers/galadriel",
+ "providers/github",
+ "providers/github_copilot",
+ "providers/gmi",
+ "providers/chatgpt",
+ "providers/gradient_ai",
+ "providers/groq",
+ "providers/helicone",
+ "providers/heroku",
{
type: "category",
label: "HuggingFace",
diff --cc litellm-proxy-extras/litellm_proxy_extras/schema.prisma
index 45b866ad2e9,2a0faee2808..8fe3596f75d
--- a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma
+++ b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma
@@@ -116,36 -135,55 +136,130 @@@ model LiteLLM_TeamTable
litellm_organization_table LiteLLM_OrganizationTable? @relation(fields: [organization_id], references: [organization_id])
litellm_model_table LiteLLM_ModelTable? @relation(fields: [model_id], references: [id])
object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
+ projects LiteLLM_ProjectTable[]
+}
+
+// Projects sit between teams and keys for use-case management
+model LiteLLM_ProjectTable {
+ project_id String @id @default(uuid())
+ project_alias String?
+ description String?
+ team_id String?
+ budget_id String?
+ metadata Json @default("{}")
+ models String[]
+ spend Float @default(0.0)
+ model_spend Json @default("{}")
+ model_rpm_limit Json @default("{}")
+ model_tpm_limit Json @default("{}")
+ blocked Boolean @default(false)
+ object_permission_id String?
+ created_at DateTime @default(now()) @map("created_at")
+ created_by String
+ updated_at DateTime @default(now()) @updatedAt @map("updated_at")
+ updated_by String
+
+ // Relations
+ litellm_team_table LiteLLM_TeamTable? @relation(fields: [team_id], references: [team_id])
+ litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
+ keys LiteLLM_VerificationToken[]
+ object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
+}
+
++// Audit table for deleted teams - preserves spend and team information for historical tracking
++model LiteLLM_DeletedTeamTable {
++ id String @id @default(uuid())
++ team_id String // Original team_id
++ team_alias String?
++ organization_id String?
++ object_permission_id String?
++ admins String[]
++ members String[]
++ members_with_roles Json @default("{}")
++ metadata Json @default("{}")
++ max_budget Float?
++ soft_budget Float?
++ spend Float @default(0.0)
++ models String[]
++ max_parallel_requests Int?
++ tpm_limit BigInt?
++ rpm_limit BigInt?
++ budget_duration String?
++ budget_reset_at DateTime?
++ blocked Boolean @default(false)
++ model_spend Json @default("{}")
++ model_max_budget Json @default("{}")
++ router_settings Json? @default("{}")
++ team_member_permissions String[] @default([])
++ access_group_ids String[] @default([])
++ policies String[] @default([])
++ model_id Int? // id for LiteLLM_ModelTable -> stores team-level model aliases
++ allow_team_guardrail_config Boolean @default(false)
++
++ // Original timestamps from team creation/updates
++ created_at DateTime? @map("created_at")
++ updated_at DateTime? @map("updated_at")
++
++ // Deletion metadata
++ deleted_at DateTime @default(now()) @map("deleted_at")
++ deleted_by String? @map("deleted_by") // User who deleted the team
++ deleted_by_api_key String? @map("deleted_by_api_key") // API key hash that performed the deletion
++ litellm_changed_by String? @map("litellm_changed_by") // From litellm-changed-by header if provided
++
++ @@index([team_id])
++ @@index([deleted_at])
++ @@index([organization_id])
++ @@index([team_alias])
++ @@index([created_at])
+ }
+
+ // Audit table for deleted teams - preserves spend and team information for historical tracking
+ model LiteLLM_DeletedTeamTable {
+ id String @id @default(uuid())
+ team_id String // Original team_id
+ team_alias String?
+ organization_id String?
+ object_permission_id String?
+ admins String[]
+ members String[]
+ members_with_roles Json @default("{}")
+ metadata Json @default("{}")
+ max_budget Float?
+ soft_budget Float?
+ spend Float @default(0.0)
+ models String[]
+ max_parallel_requests Int?
+ tpm_limit BigInt?
+ rpm_limit BigInt?
+ budget_duration String?
+ budget_reset_at DateTime?
+ blocked Boolean @default(false)
+ model_spend Json @default("{}")
+ model_max_budget Json @default("{}")
+ router_settings Json? @default("{}")
+ team_member_permissions String[] @default([])
+ access_group_ids String[] @default([])
+ policies String[] @default([])
+ model_id Int? // id for LiteLLM_ModelTable -> stores team-level model aliases
+ allow_team_guardrail_config Boolean @default(false)
+
+ // Original timestamps from team creation/updates
+ created_at DateTime? @map("created_at")
+ updated_at DateTime? @map("updated_at")
+
+ // Deletion metadata
+ deleted_at DateTime @default(now()) @map("deleted_at")
+ deleted_by String? @map("deleted_by") // User who deleted the team
+ deleted_by_api_key String? @map("deleted_by_api_key") // API key hash that performed the deletion
+ litellm_changed_by String? @map("litellm_changed_by") // From litellm-changed-by header if provided
+
+ @@index([team_id])
+ @@index([deleted_at])
+ @@index([organization_id])
+ @@index([team_alias])
+ @@index([created_at])
+ }
+
// Track spend, rate limit, budget Users
model LiteLLM_UserTable {
user_id String @id
@@@ -188,8 -227,9 +303,10 @@@ model LiteLLM_ObjectPermissionTable
mcp_access_groups String[] @default([])
mcp_tool_permissions Json? // Tool-level permissions for MCP servers. Format: {"server_id": ["tool_name_1", "tool_name_2"]}
vector_stores String[] @default([])
+ agents String[] @default([])
+ agent_access_groups String[] @default([])
teams LiteLLM_TeamTable[]
+ projects LiteLLM_ProjectTable[]
verification_tokens LiteLLM_VerificationToken[]
organizations LiteLLM_OrganizationTable[]
users LiteLLM_UserTable[]
@@@ -235,9 -280,9 +357,10 @@@ model LiteLLM_VerificationToken
models String[]
aliases Json @default("{}")
config Json @default("{}")
+ router_settings Json? @default("{}")
user_id String?
team_id String?
+ project_id String?
permissions Json @default("{}")
max_parallel_requests Int?
metadata Json @default("{}")
@@@ -265,8 -312,75 +390,76 @@@
key_rotation_at DateTime? // When this key should next be rotated
litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
litellm_organization_table LiteLLM_OrganizationTable? @relation(fields: [organization_id], references: [organization_id])
+ litellm_project_table LiteLLM_ProjectTable? @relation(fields: [project_id], references: [project_id])
object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
+
+ // SELECT COUNT(*) FROM (SELECT "public"."LiteLLM_VerificationToken"."token" FROM "public"."LiteLLM_VerificationToken" WHERE ("public"."LiteLLM_VerificationToken"."user_id" = $1 AND ("public"."LiteLLM_VerificationToken"."team_id" IS NULL OR "public"."LiteLLM_VerificationToken"."team_id" <> $2)) OFFSET $3 ) AS "sub"
+ // SELECT ... FROM "public"."LiteLLM_VerificationToken" WHERE "public"."LiteLLM_VerificationToken"."user_id" = $1 OFFSET $2
+ @@index([user_id, team_id])
+
+ // SELECT ... FROM "public"."LiteLLM_VerificationToken" WHERE "public"."LiteLLM_VerificationToken"."team_id" = $1 OFFSET $2
+ @@index([team_id])
+
+ // SELECT ... FROM "public"."LiteLLM_VerificationToken" WHERE (("public"."LiteLLM_VerificationToken"."expires" IS NULL OR "public"."LiteLLM_VerificationToken"."expires" > $1) AND "public"."LiteLLM_VerificationToken"."budget_reset_at" < $2) OFFSET $3
+ @@index([budget_reset_at, expires])
+ }
+
+ // Audit table for deleted keys - preserves spend and key information for historical tracking
+ model LiteLLM_DeletedVerificationToken {
+ id String @id @default(uuid())
+ token String // Original token (hashed)
+ key_name String?
+ key_alias String?
+ soft_budget_cooldown Boolean @default(false)
+ spend Float @default(0.0)
+ expires DateTime?
+ models String[]
+ aliases Json @default("{}")
+ config Json @default("{}")
+ user_id String?
+ team_id String?
+ permissions Json @default("{}")
+ max_parallel_requests Int?
+ metadata Json @default("{}")
+ blocked Boolean?
+ tpm_limit BigInt?
+ rpm_limit BigInt?
+ max_budget Float?
+ budget_duration String?
+ budget_reset_at DateTime?
+ allowed_cache_controls String[] @default([])
+ allowed_routes String[] @default([])
+ policies String[] @default([])
+ access_group_ids String[] @default([])
+ model_spend Json @default("{}")
+ model_max_budget Json @default("{}")
+ router_settings Json? @default("{}")
+ budget_id String?
+ organization_id String?
+ object_permission_id String?
+ created_at DateTime? // Original creation timestamp
+ created_by String? // Original creator
+ updated_at DateTime? // Last update timestamp before deletion
+ updated_by String? // Last user who updated before deletion
+ rotation_count Int? @default(0)
+ auto_rotate Boolean? @default(false)
+ rotation_interval String?
+ last_rotation_at DateTime?
+ key_rotation_at DateTime?
+
+ // Deletion metadata
+ deleted_at DateTime @default(now()) @map("deleted_at")
+ deleted_by String? @map("deleted_by") // User who deleted the key
+ deleted_by_api_key String? @map("deleted_by_api_key") // API key hash that performed the deletion
+ litellm_changed_by String? @map("litellm_changed_by") // From litellm-changed-by header if provided
+
+ @@index([token])
+ @@index([deleted_at])
+ @@index([user_id])
+ @@index([team_id])
+ @@index([organization_id])
+ @@index([key_alias])
+ @@index([created_at])
}
model LiteLLM_EndUserTable {
diff --cc litellm/proxy/management_endpoints/common_utils.py
index b050886d44b,d6f6d1337a3..205d7074970
--- a/litellm/proxy/management_endpoints/common_utils.py
+++ b/litellm/proxy/management_endpoints/common_utils.py
@@@ -1,11 -1,14 +1,15 @@@
- from typing import Any, Dict, Optional, Union
+ from typing import Any, Dict, Optional, Union, TYPE_CHECKING
+ from litellm._logging import verbose_proxy_logger
+ from litellm.caching import DualCache
from litellm.proxy._types import (
KeyRequestBase,
+ LiteLLM_ManagementEndpoint_MetadataFields,
LiteLLM_ManagementEndpoint_MetadataFields_Premium,
LiteLLM_OrganizationTable,
+ LiteLLM_ProjectTable,
LiteLLM_TeamTable,
+ LiteLLM_UserTable,
LitellmUserRoles,
UserAPIKeyAuth,
)
diff --cc litellm/proxy/proxy_server.py
index ca7fedcf4ef,fd86c5e1d21..fbbf26c9cd7
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@@ -295,9 -382,7 +382,10 @@@ from litellm.proxy.management_endpoints
from litellm.proxy.management_endpoints.organization_endpoints import (
router as organization_router,
)
+from litellm.proxy.management_endpoints.project_endpoints import (
+ router as project_router,
+)
+ from litellm.proxy.management_endpoints.policy_endpoints import router as policy_router
from litellm.proxy.management_endpoints.router_settings_endpoints import (
router as router_settings_router,
)
diff --cc litellm/proxy/schema.prisma
index 45b866ad2e9,b3caa46147b..73b3ea5f816
--- a/litellm/proxy/schema.prisma
+++ b/litellm/proxy/schema.prisma
@@@ -116,36 -134,54 +135,82 @@@ model LiteLLM_TeamTable
litellm_organization_table LiteLLM_OrganizationTable? @relation(fields: [organization_id], references: [organization_id])
litellm_model_table LiteLLM_ModelTable? @relation(fields: [model_id], references: [id])
object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
+ projects LiteLLM_ProjectTable[]
+}
+
+// Projects sit between teams and keys for use-case management
+model LiteLLM_ProjectTable {
+ project_id String @id @default(uuid())
+ project_alias String?
+ description String?
+ team_id String?
+ budget_id String?
+ metadata Json @default("{}")
+ models String[]
+ spend Float @default(0.0)
+ model_spend Json @default("{}")
+ model_rpm_limit Json @default("{}")
+ model_tpm_limit Json @default("{}")
+ blocked Boolean @default(false)
+ object_permission_id String?
+ created_at DateTime @default(now()) @map("created_at")
+ created_by String
+ updated_at DateTime @default(now()) @updatedAt @map("updated_at")
+ updated_by String
+
+ // Relations
+ litellm_team_table LiteLLM_TeamTable? @relation(fields: [team_id], references: [team_id])
+ litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
+ keys LiteLLM_VerificationToken[]
+ object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
}
+ // Audit table for deleted teams - preserves spend and team information for historical tracking
+ model LiteLLM_DeletedTeamTable {
+ id String @id @default(uuid())
+ team_id String // Original team_id
+ team_alias String?
+ organization_id String?
+ object_permission_id String?
+ admins String[]
+ members String[]
+ members_with_roles Json @default("{}")
+ metadata Json @default("{}")
+ max_budget Float?
+ soft_budget Float?
+ spend Float @default(0.0)
+ models String[]
+ max_parallel_requests Int?
+ tpm_limit BigInt?
+ rpm_limit BigInt?
+ budget_duration String?
+ budget_reset_at DateTime?
+ blocked Boolean @default(false)
+ model_spend Json @default("{}")
+ model_max_budget Json @default("{}")
+ router_settings Json? @default("{}")
+ team_member_permissions String[] @default([])
+ access_group_ids String[] @default([])
+ policies String[] @default([])
+ model_id Int? // id for LiteLLM_ModelTable -> stores team-level model aliases
+
+ // Original timestamps from team creation/updates
+ created_at DateTime? @map("created_at")
+ updated_at DateTime? @map("updated_at")
+
+ // Deletion metadata
+ deleted_at DateTime @default(now()) @map("deleted_at")
+ deleted_by String? @map("deleted_by") // User who deleted the team
+ deleted_by_api_key String? @map("deleted_by_api_key") // API key hash that performed the deletion
+ litellm_changed_by String? @map("litellm_changed_by") // From litellm-changed-by header if provided
+
+ @@index([team_id])
+ @@index([deleted_at])
+ @@index([organization_id])
+ @@index([team_alias])
+ @@index([created_at])
+ }
+
// Track spend, rate limit, budget Users
model LiteLLM_UserTable {
user_id String @id
@@@ -188,8 -225,9 +254,10 @@@ model LiteLLM_ObjectPermissionTable
mcp_access_groups String[] @default([])
mcp_tool_permissions Json? // Tool-level permissions for MCP servers. Format: {"server_id": ["tool_name_1", "tool_name_2"]}
vector_stores String[] @default([])
+ agents String[] @default([])
+ agent_access_groups String[] @default([])
teams LiteLLM_TeamTable[]
+ projects LiteLLM_ProjectTable[]
verification_tokens LiteLLM_VerificationToken[]
organizations LiteLLM_OrganizationTable[]
users LiteLLM_UserTable[]
@@@ -235,9 -278,9 +308,10 @@@ model LiteLLM_VerificationToken
models String[]
aliases Json @default("{}")
config Json @default("{}")
+ router_settings Json? @default("{}")
user_id String?
team_id String?
+ project_id String?
permissions Json @default("{}")
max_parallel_requests Int?
metadata Json @default("{}")
@@@ -265,8 -310,75 +341,76 @@@
key_rotation_at DateTime? // When this key should next be rotated
litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
litellm_organization_table LiteLLM_OrganizationTable? @relation(fields: [organization_id], references: [organization_id])
+ litellm_project_table LiteLLM_ProjectTable? @relation(fields: [project_id], references: [project_id])
object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
+
+ // SELECT COUNT(*) FROM (SELECT "public"."LiteLLM_VerificationToken"."token" FROM "public"."LiteLLM_VerificationToken" WHERE ("public"."LiteLLM_VerificationToken"."user_id" = $1 AND ("public"."LiteLLM_VerificationToken"."team_id" IS NULL OR "public"."LiteLLM_VerificationToken"."team_id" <> $2)) OFFSET $3 ) AS "sub"
+ // SELECT ... FROM "public"."LiteLLM_VerificationToken" WHERE "public"."LiteLLM_VerificationToken"."user_id" = $1 OFFSET $2
+ @@index([user_id, team_id])
+
+ // SELECT ... FROM "public"."LiteLLM_VerificationToken" WHERE "public"."LiteLLM_VerificationToken"."team_id" = $1 OFFSET $2
+ @@index([team_id])
+
+ // SELECT ... FROM "public"."LiteLLM_VerificationToken" WHERE (("public"."LiteLLM_VerificationToken"."expires" IS NULL OR "public"."LiteLLM_VerificationToken"."expires" > $1) AND "public"."LiteLLM_VerificationToken"."budget_reset_at" < $2) OFFSET $3
+ @@index([budget_reset_at, expires])
+ }
+
+ // Audit table for deleted keys - preserves spend and key information for historical tracking
+ model LiteLLM_DeletedVerificationToken {
+ id String @id @default(uuid())
+ token String // Original token (hashed)
+ key_name String?
+ key_alias String?
+ soft_budget_cooldown Boolean @default(false)
+ spend Float @default(0.0)
+ expires DateTime?
+ models String[]
+ aliases Json @default("{}")
+ config Json @default("{}")
+ user_id String?
+ team_id String?
+ permissions Json @default("{}")
+ max_parallel_requests Int?
+ metadata Json @default("{}")
+ blocked Boolean?
+ tpm_limit BigInt?
+ rpm_limit BigInt?
+ max_budget Float?
+ budget_duration String?
+ budget_reset_at DateTime?
+ allowed_cache_controls String[] @default([])
+ allowed_routes String[] @default([])
+ policies String[] @default([])
+ access_group_ids String[] @default([])
+ model_spend Json @default("{}")
+ model_max_budget Json @default("{}")
+ router_settings Json? @default("{}")
+ budget_id String?
+ organization_id String?
+ object_permission_id String?
+ created_at DateTime? // Original creation timestamp
+ created_by String? // Original creator
+ updated_at DateTime? // Last update timestamp before deletion
+ updated_by String? // Last user who updated before deletion
+ rotation_count Int? @default(0)
+ auto_rotate Boolean? @default(false)
+ rotation_interval String?
+ last_rotation_at DateTime?
+ key_rotation_at DateTime?
+
+ // Deletion metadata
+ deleted_at DateTime @default(now()) @map("deleted_at")
+ deleted_by String? @map("deleted_by") // User who deleted the key
+ deleted_by_api_key String? @map("deleted_by_api_key") // API key hash that performed the deletion
+ litellm_changed_by String? @map("litellm_changed_by") // From litellm-changed-by header if provided
+
+ @@index([token])
+ @@index([deleted_at])
+ @@index([user_id])
+ @@index([team_id])
+ @@index([organization_id])
+ @@index([key_alias])
+ @@index([created_at])
}
model LiteLLM_EndUserTable {
diff --cc schema.prisma
index 45b866ad2e9,2a11d0028fb..7f972650fdf
--- a/schema.prisma
+++ b/schema.prisma
@@@ -116,36 -135,55 +136,83 @@@ model LiteLLM_TeamTable
litellm_organization_table LiteLLM_OrganizationTable? @relation(fields: [organization_id], references: [organization_id])
litellm_model_table LiteLLM_ModelTable? @relation(fields: [model_id], references: [id])
object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
+ projects LiteLLM_ProjectTable[]
+}
+
+// Projects sit between teams and keys for use-case management
+model LiteLLM_ProjectTable {
+ project_id String @id @default(uuid())
+ project_alias String?
+ description String?
+ team_id String?
+ budget_id String?
+ metadata Json @default("{}")
+ models String[]
+ spend Float @default(0.0)
+ model_spend Json @default("{}")
+ model_rpm_limit Json @default("{}")
+ model_tpm_limit Json @default("{}")
+ blocked Boolean @default(false)
+ object_permission_id String?
+ created_at DateTime @default(now()) @map("created_at")
+ created_by String
+ updated_at DateTime @default(now()) @updatedAt @map("updated_at")
+ updated_by String
+
+ // Relations
+ litellm_team_table LiteLLM_TeamTable? @relation(fields: [team_id], references: [team_id])
+ litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
+ keys LiteLLM_VerificationToken[]
+ object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
}
+ // Audit table for deleted teams - preserves spend and team information for historical tracking
+ model LiteLLM_DeletedTeamTable {
+ id String @id @default(uuid())
+ team_id String // Original team_id
+ team_alias String?
+ organization_id String?
+ object_permission_id String?
+ admins String[]
+ members String[]
+ members_with_roles Json @default("{}")
+ metadata Json @default("{}")
+ max_budget Float?
+ soft_budget Float?
+ spend Float @default(0.0)
+ models String[]
+ max_parallel_requests Int?
+ tpm_limit BigInt?
+ rpm_limit BigInt?
+ budget_duration String?
+ budget_reset_at DateTime?
+ blocked Boolean @default(false)
+ model_spend Json @default("{}")
+ model_max_budget Json @default("{}")
+ router_settings Json? @default("{}")
+ team_member_permissions String[] @default([])
+ access_group_ids String[] @default([])
+ policies String[] @default([])
+ model_id Int? // id for LiteLLM_ModelTable -> stores team-level model aliases
+ allow_team_guardrail_config Boolean @default(false)
+
+ // Original timestamps from team creation/updates
+ created_at DateTime? @map("created_at")
+ updated_at DateTime? @map("updated_at")
+
+ // Deletion metadata
+ deleted_at DateTime @default(now()) @map("deleted_at")
+ deleted_by String? @map("deleted_by") // User who deleted the team
+ deleted_by_api_key String? @map("deleted_by_api_key") // API key hash that performed the deletion
+ litellm_changed_by String? @map("litellm_changed_by") // From litellm-changed-by header if provided
+
+ @@index([team_id])
+ @@index([deleted_at])
+ @@index([organization_id])
+ @@index([team_alias])
+ @@index([created_at])
+ }
+
// Track spend, rate limit, budget Users
model LiteLLM_UserTable {
user_id String @id
@@@ -188,8 -227,9 +256,10 @@@ model LiteLLM_ObjectPermissionTable
mcp_access_groups String[] @default([])
mcp_tool_permissions Json? // Tool-level permissions for MCP servers. Format: {"server_id": ["tool_name_1", "tool_name_2"]}
vector_stores String[] @default([])
+ agents String[] @default([])
+ agent_access_groups String[] @default([])
teams LiteLLM_TeamTable[]
+ projects LiteLLM_ProjectTable[]
verification_tokens LiteLLM_VerificationToken[]
organizations LiteLLM_OrganizationTable[]
users LiteLLM_UserTable[]
@@@ -235,9 -280,9 +310,10 @@@ model LiteLLM_VerificationToken
models String[]
aliases Json @default("{}")
config Json @default("{}")
+ router_settings Json? @default("{}")
user_id String?
team_id String?
+ project_id String?
permissions Json @default("{}")
max_parallel_requests Int?
metadata Json @default("{}")
@@@ -265,8 -312,74 +343,75 @@@
key_rotation_at DateTime? // When this key should next be rotated
litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
litellm_organization_table LiteLLM_OrganizationTable? @relation(fields: [organization_id], references: [organization_id])
+ litellm_project_table LiteLLM_ProjectTable? @relation(fields: [project_id], references: [project_id])
object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
+
+ // SELECT COUNT(*) FROM (SELECT "public"."LiteLLM_VerificationToken"."token" FROM "public"."LiteLLM_VerificationToken" WHERE ("public"."LiteLLM_VerificationToken"."user_id" = $1 AND ("public"."LiteLLM_VerificationToken"."team_id" IS NULL OR "public"."LiteLLM_VerificationToken"."team_id" <> $2)) OFFSET $3 ) AS "sub"
+ // SELECT ... FROM "public"."LiteLLM_VerificationToken" WHERE "public"."LiteLLM_VerificationToken"."user_id" = $1 OFFSET $2
+ @@index([user_id, team_id])
+
+ // SELECT ... FROM "public"."LiteLLM_VerificationToken" WHERE "public"."LiteLLM_VerificationToken"."team_id" = $1 OFFSET $2
+ @@index([team_id])
+
+ // SELECT ... FROM "public"."LiteLLM_VerificationToken" WHERE (("public"."LiteLLM_VerificationToken"."expires" IS NULL OR "public"."LiteLLM_VerificationToken"."expires" > $1) AND "public"."LiteLLM_VerificationToken"."budget_reset_at" < $2) OFFSET $3
+ @@index([budget_reset_at, expires])
+ }
+
+ // Audit table for deleted keys - preserves spend and key information for historical tracking
+ model LiteLLM_DeletedVerificationToken {
+ id String @id @default(uuid())
+ token String // Original token (hashed)
+ key_name String?
+ key_alias String?
+ soft_budget_cooldown Boolean @default(false)
+ spend Float @default(0.0)
+ expires DateTime?
+ models String[]
+ aliases Json @default("{}")
+ config Json @default("{}")
+ user_id String?
+ team_id String?
+ permissions Json @default("{}")
+ max_parallel_requests Int?
+ metadata Json @default("{}")
+ blocked Boolean?
+ tpm_limit BigInt?
+ rpm_limit BigInt?
+ max_budget Float?
+ budget_duration String?
+ budget_reset_at DateTime?
+ allowed_cache_controls String[] @default([])
+ allowed_routes String[] @default([])
+ policies String[] @default([])
+ access_group_ids String[] @default([])
+ model_spend Json @default("{}")
+ model_max_budget Json @default("{}")
+ router_settings Json? @default("{}")
+ budget_id String?
+ organization_id String?
+ object_permission_id String?
+ created_at DateTime? // Original creation timestamp
+ created_by String? // Original creator
+ updated_at DateTime? // Last update timestamp before deletion
+ updated_by String? // Last user who updated before deletion
+ rotation_count Int? @default(0)
+ auto_rotate Boolean? @default(false)
+ rotation_interval String?
+ last_rotation_at DateTime?
+ key_rotation_at DateTime?
+ // Deletion metadata
+ deleted_at DateTime @default(now()) @map("deleted_at")
+ deleted_by String? @map("deleted_by") // User who deleted the key
+ deleted_by_api_key String? @map("deleted_by_api_key") // API key hash that performed the deletion
+ litellm_changed_by String? @map("litellm_changed_by") // From litellm-changed-by header if provided
+
+ @@index([token])
+ @@index([deleted_at])
+ @@index([user_id])
+ @@index([team_id])
+ @@index([organization_id])
+ @@index([key_alias])
+ @@index([created_at])
}
model LiteLLM_EndUserTable {