litellm-proxy-extras 0.4.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- litellm_proxy_extras/__init__.py +0 -0
- litellm_proxy_extras/_logging.py +12 -0
- litellm_proxy_extras/migrations/20250326162113_baseline/migration.sql +360 -0
- litellm_proxy_extras/migrations/20250326171002_add_daily_user_table/migration.sql +33 -0
- litellm_proxy_extras/migrations/20250327180120_add_api_requests_to_daily_user_table/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250329084805_new_cron_job_table/migration.sql +14 -0
- litellm_proxy_extras/migrations/20250331215456_track_success_and_failed_requests_daily_agg_table/migration.sql +4 -0
- litellm_proxy_extras/migrations/20250411215431_add_managed_file_table/migration.sql +18 -0
- litellm_proxy_extras/migrations/20250412081753_team_member_permissions/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250415151647_add_cache_read_write_tokens_daily_spend_transactions/migration.sql +4 -0
- litellm_proxy_extras/migrations/20250415191926_add_daily_team_table/migration.sql +36 -0
- litellm_proxy_extras/migrations/20250416115320_add_tag_table_to_db/migration.sql +45 -0
- litellm_proxy_extras/migrations/20250416151339_drop_tag_uniqueness_requirement/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250416185146_add_allowed_routes_litellm_verification_token/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250425182129_add_session_id/migration.sql +4 -0
- litellm_proxy_extras/migrations/20250430193429_add_managed_vector_stores/migration.sql +14 -0
- litellm_proxy_extras/migrations/20250507161526_add_mcp_table_to_db/migration.sql +17 -0
- litellm_proxy_extras/migrations/20250507161527_add_health_check_fields_to_mcp_servers/migration.sql +4 -0
- litellm_proxy_extras/migrations/20250507184818_add_mcp_key_team_permission_mgmt/migration.sql +32 -0
- litellm_proxy_extras/migrations/20250508072103_add_status_to_spendlogs/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250509141545_use_big_int_for_daily_spend_tables/migration.sql +27 -0
- litellm_proxy_extras/migrations/20250510142544_add_session_id_index_spend_logs/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250514142245_add_guardrails_table/migration.sql +15 -0
- litellm_proxy_extras/migrations/20250522223020_managed_object_table/migration.sql +32 -0
- litellm_proxy_extras/migrations/20250526154401_allow_null_entity_id/migration.sql +9 -0
- litellm_proxy_extras/migrations/20250528185438_add_vector_stores_to_object_permissions/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250603210143_cascade_budget_changes/migration.sql +6 -0
- litellm_proxy_extras/migrations/20250618225828_add_health_check_table/migration.sql +28 -0
- litellm_proxy_extras/migrations/20250625145206_cascade_budget_and_loosen_managed_file_json/migration.sql +9 -0
- litellm_proxy_extras/migrations/20250625213625_add_status_to_managed_object_table/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250707212517_add_mcp_info_column_mcp_servers/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250707230009_add_mcp_namespaced_tool_name/migration.sql +42 -0
- litellm_proxy_extras/migrations/20250711220620_add_stdio_mcp/migration.sql +10 -0
- litellm_proxy_extras/migrations/20250718125714_add_litellm_params_to_vector_stores/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250802162330_prompt_table/migration.sql +15 -0
- litellm_proxy_extras/migrations/20250806095134_rename_alias_to_server_name_mcp_table/migration.sql +10 -0
- litellm_proxy_extras/migrations/20250918083359_drop_spec_version_column_from_mcp_table/migration.sql +8 -0
- litellm_proxy_extras/migrations/20250926194702_unnamed_migration/migration.sql +7 -0
- litellm_proxy_extras/migrations/20251003165142_add_allowed_tools_to_mcp/migration.sql +3 -0
- litellm_proxy_extras/migrations/20251003190954_extra_headers_to_mcp_table/migration.sql +3 -0
- litellm_proxy_extras/migrations/20251006143948_add_mcp_tool_permissions/migration.sql +3 -0
- litellm_proxy_extras/migrations/20251011084309_add_tag_table/migration.sql +18 -0
- litellm_proxy_extras/migrations/20251023141814_add_search_tool_table/migration.sql +15 -0
- litellm_proxy_extras/migrations/20251031181430_add_cache_config_table/migration.sql +20 -0
- litellm_proxy_extras/migrations/20251101131415_add_managed_vector_store_index_table/migration.sql +17 -0
- litellm_proxy_extras/migrations/20251103072422_add_static_headers/migration.sql +2 -0
- litellm_proxy_extras/migrations/20251104220043_add_credentials_to_mcp_servers/migration.sql +2 -0
- litellm_proxy_extras/migrations/migration_lock.toml +1 -0
- litellm_proxy_extras/schema.prisma +612 -0
- litellm_proxy_extras/utils.py +369 -0
- litellm_proxy_extras-0.4.3.dist-info/METADATA +44 -0
- litellm_proxy_extras-0.4.3.dist-info/RECORD +54 -0
- litellm_proxy_extras-0.4.3.dist-info/WHEEL +4 -0
- litellm_proxy_extras-0.4.3.dist-info/licenses/LICENSE +26 -0
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
datasource client {
|
|
2
|
+
provider = "postgresql"
|
|
3
|
+
url = env("DATABASE_URL")
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
generator client {
|
|
7
|
+
provider = "prisma-client-py"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Budget / Rate Limits for an org
|
|
11
|
+
model LiteLLM_BudgetTable {
|
|
12
|
+
budget_id String @id @default(uuid())
|
|
13
|
+
max_budget Float?
|
|
14
|
+
soft_budget Float?
|
|
15
|
+
max_parallel_requests Int?
|
|
16
|
+
tpm_limit BigInt?
|
|
17
|
+
rpm_limit BigInt?
|
|
18
|
+
model_max_budget Json?
|
|
19
|
+
budget_duration String?
|
|
20
|
+
budget_reset_at DateTime?
|
|
21
|
+
created_at DateTime @default(now()) @map("created_at")
|
|
22
|
+
created_by String
|
|
23
|
+
updated_at DateTime @default(now()) @updatedAt @map("updated_at")
|
|
24
|
+
updated_by String
|
|
25
|
+
organization LiteLLM_OrganizationTable[] // multiple orgs can have the same budget
|
|
26
|
+
keys LiteLLM_VerificationToken[] // multiple keys can have the same budget
|
|
27
|
+
end_users LiteLLM_EndUserTable[] // multiple end-users can have the same budget
|
|
28
|
+
tags LiteLLM_TagTable[] // multiple tags can have the same budget
|
|
29
|
+
team_membership LiteLLM_TeamMembership[] // budgets of Users within a Team
|
|
30
|
+
organization_membership LiteLLM_OrganizationMembership[] // budgets of Users within a Organization
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Models on proxy
|
|
34
|
+
model LiteLLM_CredentialsTable {
|
|
35
|
+
credential_id String @id @default(uuid())
|
|
36
|
+
credential_name String @unique
|
|
37
|
+
credential_values Json
|
|
38
|
+
credential_info Json?
|
|
39
|
+
created_at DateTime @default(now()) @map("created_at")
|
|
40
|
+
created_by String
|
|
41
|
+
updated_at DateTime @default(now()) @updatedAt @map("updated_at")
|
|
42
|
+
updated_by String
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Models on proxy
|
|
46
|
+
model LiteLLM_ProxyModelTable {
|
|
47
|
+
model_id String @id @default(uuid())
|
|
48
|
+
model_name String
|
|
49
|
+
litellm_params Json
|
|
50
|
+
model_info Json?
|
|
51
|
+
created_at DateTime @default(now()) @map("created_at")
|
|
52
|
+
created_by String
|
|
53
|
+
updated_at DateTime @default(now()) @updatedAt @map("updated_at")
|
|
54
|
+
updated_by String
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
model LiteLLM_OrganizationTable {
|
|
58
|
+
organization_id String @id @default(uuid())
|
|
59
|
+
organization_alias String
|
|
60
|
+
budget_id String
|
|
61
|
+
metadata Json @default("{}")
|
|
62
|
+
models String[]
|
|
63
|
+
spend Float @default(0.0)
|
|
64
|
+
model_spend Json @default("{}")
|
|
65
|
+
object_permission_id String?
|
|
66
|
+
created_at DateTime @default(now()) @map("created_at")
|
|
67
|
+
created_by String
|
|
68
|
+
updated_at DateTime @default(now()) @updatedAt @map("updated_at")
|
|
69
|
+
updated_by String
|
|
70
|
+
litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
|
|
71
|
+
teams LiteLLM_TeamTable[]
|
|
72
|
+
users LiteLLM_UserTable[]
|
|
73
|
+
keys LiteLLM_VerificationToken[]
|
|
74
|
+
members LiteLLM_OrganizationMembership[] @relation("OrganizationToMembership")
|
|
75
|
+
object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Model info for teams, just has model aliases for now.
|
|
79
|
+
model LiteLLM_ModelTable {
|
|
80
|
+
id Int @id @default(autoincrement())
|
|
81
|
+
model_aliases Json? @map("aliases")
|
|
82
|
+
created_at DateTime @default(now()) @map("created_at")
|
|
83
|
+
created_by String
|
|
84
|
+
updated_at DateTime @default(now()) @updatedAt @map("updated_at")
|
|
85
|
+
updated_by String
|
|
86
|
+
team LiteLLM_TeamTable?
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
// Assign prod keys to groups, not individuals
|
|
91
|
+
model LiteLLM_TeamTable {
|
|
92
|
+
team_id String @id @default(uuid())
|
|
93
|
+
team_alias String?
|
|
94
|
+
organization_id String?
|
|
95
|
+
object_permission_id String?
|
|
96
|
+
admins String[]
|
|
97
|
+
members String[]
|
|
98
|
+
members_with_roles Json @default("{}")
|
|
99
|
+
metadata Json @default("{}")
|
|
100
|
+
max_budget Float?
|
|
101
|
+
spend Float @default(0.0)
|
|
102
|
+
models String[]
|
|
103
|
+
max_parallel_requests Int?
|
|
104
|
+
tpm_limit BigInt?
|
|
105
|
+
rpm_limit BigInt?
|
|
106
|
+
budget_duration String?
|
|
107
|
+
budget_reset_at DateTime?
|
|
108
|
+
blocked Boolean @default(false)
|
|
109
|
+
created_at DateTime @default(now()) @map("created_at")
|
|
110
|
+
updated_at DateTime @default(now()) @updatedAt @map("updated_at")
|
|
111
|
+
model_spend Json @default("{}")
|
|
112
|
+
model_max_budget Json @default("{}")
|
|
113
|
+
team_member_permissions String[] @default([])
|
|
114
|
+
model_id Int? @unique // id for LiteLLM_ModelTable -> stores team-level model aliases
|
|
115
|
+
litellm_organization_table LiteLLM_OrganizationTable? @relation(fields: [organization_id], references: [organization_id])
|
|
116
|
+
litellm_model_table LiteLLM_ModelTable? @relation(fields: [model_id], references: [id])
|
|
117
|
+
object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Track spend, rate limit, budget Users
|
|
121
|
+
model LiteLLM_UserTable {
|
|
122
|
+
user_id String @id
|
|
123
|
+
user_alias String?
|
|
124
|
+
team_id String?
|
|
125
|
+
sso_user_id String? @unique
|
|
126
|
+
organization_id String?
|
|
127
|
+
object_permission_id String?
|
|
128
|
+
password String?
|
|
129
|
+
teams String[] @default([])
|
|
130
|
+
user_role String?
|
|
131
|
+
max_budget Float?
|
|
132
|
+
spend Float @default(0.0)
|
|
133
|
+
user_email String?
|
|
134
|
+
models String[]
|
|
135
|
+
metadata Json @default("{}")
|
|
136
|
+
max_parallel_requests Int?
|
|
137
|
+
tpm_limit BigInt?
|
|
138
|
+
rpm_limit BigInt?
|
|
139
|
+
budget_duration String?
|
|
140
|
+
budget_reset_at DateTime?
|
|
141
|
+
allowed_cache_controls String[] @default([])
|
|
142
|
+
model_spend Json @default("{}")
|
|
143
|
+
model_max_budget Json @default("{}")
|
|
144
|
+
created_at DateTime? @default(now()) @map("created_at")
|
|
145
|
+
updated_at DateTime? @default(now()) @updatedAt @map("updated_at")
|
|
146
|
+
|
|
147
|
+
// relations
|
|
148
|
+
litellm_organization_table LiteLLM_OrganizationTable? @relation(fields: [organization_id], references: [organization_id])
|
|
149
|
+
organization_memberships LiteLLM_OrganizationMembership[]
|
|
150
|
+
invitations_created LiteLLM_InvitationLink[] @relation("CreatedBy")
|
|
151
|
+
invitations_updated LiteLLM_InvitationLink[] @relation("UpdatedBy")
|
|
152
|
+
invitations_user LiteLLM_InvitationLink[] @relation("UserId")
|
|
153
|
+
object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
model LiteLLM_ObjectPermissionTable {
|
|
157
|
+
object_permission_id String @id @default(uuid())
|
|
158
|
+
mcp_servers String[] @default([])
|
|
159
|
+
mcp_access_groups String[] @default([])
|
|
160
|
+
mcp_tool_permissions Json? // Tool-level permissions for MCP servers. Format: {"server_id": ["tool_name_1", "tool_name_2"]}
|
|
161
|
+
vector_stores String[] @default([])
|
|
162
|
+
teams LiteLLM_TeamTable[]
|
|
163
|
+
verification_tokens LiteLLM_VerificationToken[]
|
|
164
|
+
organizations LiteLLM_OrganizationTable[]
|
|
165
|
+
users LiteLLM_UserTable[]
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Holds the MCP server configuration
|
|
169
|
+
model LiteLLM_MCPServerTable {
|
|
170
|
+
server_id String @id @default(uuid())
|
|
171
|
+
server_name String?
|
|
172
|
+
alias String?
|
|
173
|
+
description String?
|
|
174
|
+
url String?
|
|
175
|
+
transport String @default("sse")
|
|
176
|
+
auth_type String?
|
|
177
|
+
credentials Json? @default("{}")
|
|
178
|
+
created_at DateTime? @default(now()) @map("created_at")
|
|
179
|
+
created_by String?
|
|
180
|
+
updated_at DateTime? @default(now()) @updatedAt @map("updated_at")
|
|
181
|
+
updated_by String?
|
|
182
|
+
mcp_info Json? @default("{}")
|
|
183
|
+
mcp_access_groups String[]
|
|
184
|
+
allowed_tools String[] @default([])
|
|
185
|
+
extra_headers String[] @default([])
|
|
186
|
+
static_headers Json? @default("{}")
|
|
187
|
+
// Health check status
|
|
188
|
+
status String? @default("unknown")
|
|
189
|
+
last_health_check DateTime?
|
|
190
|
+
health_check_error String?
|
|
191
|
+
// Stdio-specific fields
|
|
192
|
+
command String?
|
|
193
|
+
args String[] @default([])
|
|
194
|
+
env Json? @default("{}")
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Generate Tokens for Proxy
|
|
198
|
+
model LiteLLM_VerificationToken {
|
|
199
|
+
token String @id
|
|
200
|
+
key_name String?
|
|
201
|
+
key_alias String?
|
|
202
|
+
soft_budget_cooldown Boolean @default(false) // key-level state on if budget alerts need to be cooled down
|
|
203
|
+
spend Float @default(0.0)
|
|
204
|
+
expires DateTime?
|
|
205
|
+
models String[]
|
|
206
|
+
aliases Json @default("{}")
|
|
207
|
+
config Json @default("{}")
|
|
208
|
+
user_id String?
|
|
209
|
+
team_id String?
|
|
210
|
+
permissions Json @default("{}")
|
|
211
|
+
max_parallel_requests Int?
|
|
212
|
+
metadata Json @default("{}")
|
|
213
|
+
blocked Boolean?
|
|
214
|
+
tpm_limit BigInt?
|
|
215
|
+
rpm_limit BigInt?
|
|
216
|
+
max_budget Float?
|
|
217
|
+
budget_duration String?
|
|
218
|
+
budget_reset_at DateTime?
|
|
219
|
+
allowed_cache_controls String[] @default([])
|
|
220
|
+
allowed_routes String[] @default([])
|
|
221
|
+
model_spend Json @default("{}")
|
|
222
|
+
model_max_budget Json @default("{}")
|
|
223
|
+
budget_id String?
|
|
224
|
+
organization_id String?
|
|
225
|
+
object_permission_id String?
|
|
226
|
+
created_at DateTime? @default(now()) @map("created_at")
|
|
227
|
+
created_by String?
|
|
228
|
+
updated_at DateTime? @default(now()) @updatedAt @map("updated_at")
|
|
229
|
+
updated_by String?
|
|
230
|
+
rotation_count Int? @default(0) // Number of times key has been rotated
|
|
231
|
+
auto_rotate Boolean? @default(false) // Whether this key should be auto-rotated
|
|
232
|
+
rotation_interval String? // How often to rotate (e.g., "30d", "90d")
|
|
233
|
+
last_rotation_at DateTime? // When this key was last rotated
|
|
234
|
+
key_rotation_at DateTime? // When this key should next be rotated
|
|
235
|
+
litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
|
|
236
|
+
litellm_organization_table LiteLLM_OrganizationTable? @relation(fields: [organization_id], references: [organization_id])
|
|
237
|
+
object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id])
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
model LiteLLM_EndUserTable {
|
|
241
|
+
user_id String @id
|
|
242
|
+
alias String? // admin-facing alias
|
|
243
|
+
spend Float @default(0.0)
|
|
244
|
+
allowed_model_region String? // require all user requests to use models in this specific region
|
|
245
|
+
default_model String? // use along with 'allowed_model_region'. if no available model in region, default to this model.
|
|
246
|
+
budget_id String?
|
|
247
|
+
litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
|
|
248
|
+
blocked Boolean @default(false)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Track tags with budgets and spend
|
|
252
|
+
model LiteLLM_TagTable {
|
|
253
|
+
tag_name String @id
|
|
254
|
+
description String?
|
|
255
|
+
models String[]
|
|
256
|
+
model_info Json? // maps model_id to model_name
|
|
257
|
+
spend Float @default(0.0)
|
|
258
|
+
budget_id String?
|
|
259
|
+
litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
|
|
260
|
+
created_at DateTime @default(now()) @map("created_at")
|
|
261
|
+
created_by String?
|
|
262
|
+
updated_at DateTime @default(now()) @updatedAt @map("updated_at")
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// store proxy config.yaml
|
|
266
|
+
model LiteLLM_Config {
|
|
267
|
+
param_name String @id
|
|
268
|
+
param_value Json?
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// View spend, model, api_key per request
|
|
272
|
+
model LiteLLM_SpendLogs {
|
|
273
|
+
request_id String @id
|
|
274
|
+
call_type String
|
|
275
|
+
api_key String @default ("") // Hashed API Token. Not the actual Virtual Key. Equivalent to 'token' column in LiteLLM_VerificationToken
|
|
276
|
+
spend Float @default(0.0)
|
|
277
|
+
total_tokens Int @default(0)
|
|
278
|
+
prompt_tokens Int @default(0)
|
|
279
|
+
completion_tokens Int @default(0)
|
|
280
|
+
startTime DateTime // Assuming start_time is a DateTime field
|
|
281
|
+
endTime DateTime // Assuming end_time is a DateTime field
|
|
282
|
+
completionStartTime DateTime? // Assuming completionStartTime is a DateTime field
|
|
283
|
+
model String @default("")
|
|
284
|
+
model_id String? @default("") // the model id stored in proxy model db
|
|
285
|
+
model_group String? @default("") // public model_name / model_group
|
|
286
|
+
custom_llm_provider String? @default("") // litellm used custom_llm_provider
|
|
287
|
+
api_base String? @default("")
|
|
288
|
+
user String? @default("")
|
|
289
|
+
metadata Json? @default("{}")
|
|
290
|
+
cache_hit String? @default("")
|
|
291
|
+
cache_key String? @default("")
|
|
292
|
+
request_tags Json? @default("[]")
|
|
293
|
+
team_id String?
|
|
294
|
+
end_user String?
|
|
295
|
+
requester_ip_address String?
|
|
296
|
+
messages Json? @default("{}")
|
|
297
|
+
response Json? @default("{}")
|
|
298
|
+
session_id String?
|
|
299
|
+
status String?
|
|
300
|
+
mcp_namespaced_tool_name String?
|
|
301
|
+
proxy_server_request Json? @default("{}")
|
|
302
|
+
@@index([startTime])
|
|
303
|
+
@@index([end_user])
|
|
304
|
+
@@index([session_id])
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// View spend, model, api_key per request
|
|
308
|
+
model LiteLLM_ErrorLogs {
|
|
309
|
+
request_id String @id @default(uuid())
|
|
310
|
+
startTime DateTime // Assuming start_time is a DateTime field
|
|
311
|
+
endTime DateTime // Assuming end_time is a DateTime field
|
|
312
|
+
api_base String @default("")
|
|
313
|
+
model_group String @default("") // public model_name / model_group
|
|
314
|
+
litellm_model_name String @default("") // model passed to litellm
|
|
315
|
+
model_id String @default("") // ID of model in ProxyModelTable
|
|
316
|
+
request_kwargs Json @default("{}")
|
|
317
|
+
exception_type String @default("")
|
|
318
|
+
exception_string String @default("")
|
|
319
|
+
status_code String @default("")
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Beta - allow team members to request access to a model
|
|
323
|
+
model LiteLLM_UserNotifications {
|
|
324
|
+
request_id String @id
|
|
325
|
+
user_id String
|
|
326
|
+
models String[]
|
|
327
|
+
justification String
|
|
328
|
+
status String // approved, disapproved, pending
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
model LiteLLM_TeamMembership {
|
|
332
|
+
// Use this table to track the Internal User's Spend within a Team + Set Budgets, rpm limits for the user within the team
|
|
333
|
+
user_id String
|
|
334
|
+
team_id String
|
|
335
|
+
spend Float @default(0.0)
|
|
336
|
+
budget_id String?
|
|
337
|
+
litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
|
|
338
|
+
@@id([user_id, team_id])
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
model LiteLLM_OrganizationMembership {
|
|
342
|
+
// Use this table to track Internal User and Organization membership. Helps tracking a users role within an Organization
|
|
343
|
+
user_id String
|
|
344
|
+
organization_id String
|
|
345
|
+
user_role String?
|
|
346
|
+
spend Float? @default(0.0)
|
|
347
|
+
budget_id String?
|
|
348
|
+
created_at DateTime? @default(now()) @map("created_at")
|
|
349
|
+
updated_at DateTime? @default(now()) @updatedAt @map("updated_at")
|
|
350
|
+
|
|
351
|
+
// relations
|
|
352
|
+
user LiteLLM_UserTable @relation(fields: [user_id], references: [user_id])
|
|
353
|
+
organization LiteLLM_OrganizationTable @relation("OrganizationToMembership", fields: [organization_id], references: [organization_id])
|
|
354
|
+
litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id])
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
@@id([user_id, organization_id])
|
|
359
|
+
@@unique([user_id, organization_id])
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
model LiteLLM_InvitationLink {
|
|
363
|
+
// use this table to track invite links sent by admin for people to join the proxy
|
|
364
|
+
id String @id @default(uuid())
|
|
365
|
+
user_id String
|
|
366
|
+
is_accepted Boolean @default(false)
|
|
367
|
+
accepted_at DateTime? // when link is claimed (user successfully onboards via link)
|
|
368
|
+
expires_at DateTime // till when is link valid
|
|
369
|
+
created_at DateTime // when did admin create the link
|
|
370
|
+
created_by String // who created the link
|
|
371
|
+
updated_at DateTime // when was invite status updated
|
|
372
|
+
updated_by String // who updated the status (admin/user who accepted invite)
|
|
373
|
+
|
|
374
|
+
// Relations
|
|
375
|
+
liteLLM_user_table_user LiteLLM_UserTable @relation("UserId", fields: [user_id], references: [user_id])
|
|
376
|
+
liteLLM_user_table_created LiteLLM_UserTable @relation("CreatedBy", fields: [created_by], references: [user_id])
|
|
377
|
+
liteLLM_user_table_updated LiteLLM_UserTable @relation("UpdatedBy", fields: [updated_by], references: [user_id])
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
model LiteLLM_AuditLog {
|
|
382
|
+
id String @id @default(uuid())
|
|
383
|
+
updated_at DateTime @default(now())
|
|
384
|
+
changed_by String @default("") // user or system that performed the action
|
|
385
|
+
changed_by_api_key String @default("") // api key hash that performed the action
|
|
386
|
+
action String // create, update, delete
|
|
387
|
+
table_name String // on of LitellmTableNames.TEAM_TABLE_NAME, LitellmTableNames.USER_TABLE_NAME, LitellmTableNames.PROXY_MODEL_TABLE_NAME,
|
|
388
|
+
object_id String // id of the object being audited. This can be the key id, team id, user id, model id
|
|
389
|
+
before_value Json? // value of the row
|
|
390
|
+
updated_values Json? // value of the row after change
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// Track daily user spend metrics per model and key
|
|
394
|
+
model LiteLLM_DailyUserSpend {
|
|
395
|
+
id String @id @default(uuid())
|
|
396
|
+
user_id String?
|
|
397
|
+
date String
|
|
398
|
+
api_key String
|
|
399
|
+
model String?
|
|
400
|
+
model_group String?
|
|
401
|
+
custom_llm_provider String?
|
|
402
|
+
mcp_namespaced_tool_name String?
|
|
403
|
+
prompt_tokens BigInt @default(0)
|
|
404
|
+
completion_tokens BigInt @default(0)
|
|
405
|
+
cache_read_input_tokens BigInt @default(0)
|
|
406
|
+
cache_creation_input_tokens BigInt @default(0)
|
|
407
|
+
spend Float @default(0.0)
|
|
408
|
+
api_requests BigInt @default(0)
|
|
409
|
+
successful_requests BigInt @default(0)
|
|
410
|
+
failed_requests BigInt @default(0)
|
|
411
|
+
created_at DateTime @default(now())
|
|
412
|
+
updated_at DateTime @updatedAt
|
|
413
|
+
|
|
414
|
+
@@unique([user_id, date, api_key, model, custom_llm_provider, mcp_namespaced_tool_name])
|
|
415
|
+
@@index([date])
|
|
416
|
+
@@index([user_id])
|
|
417
|
+
@@index([api_key])
|
|
418
|
+
@@index([model])
|
|
419
|
+
@@index([mcp_namespaced_tool_name])
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Track daily team spend metrics per model and key
|
|
423
|
+
model LiteLLM_DailyTeamSpend {
|
|
424
|
+
id String @id @default(uuid())
|
|
425
|
+
team_id String?
|
|
426
|
+
date String
|
|
427
|
+
api_key String
|
|
428
|
+
model String?
|
|
429
|
+
model_group String?
|
|
430
|
+
custom_llm_provider String?
|
|
431
|
+
mcp_namespaced_tool_name String?
|
|
432
|
+
prompt_tokens BigInt @default(0)
|
|
433
|
+
completion_tokens BigInt @default(0)
|
|
434
|
+
cache_read_input_tokens BigInt @default(0)
|
|
435
|
+
cache_creation_input_tokens BigInt @default(0)
|
|
436
|
+
spend Float @default(0.0)
|
|
437
|
+
api_requests BigInt @default(0)
|
|
438
|
+
successful_requests BigInt @default(0)
|
|
439
|
+
failed_requests BigInt @default(0)
|
|
440
|
+
created_at DateTime @default(now())
|
|
441
|
+
updated_at DateTime @updatedAt
|
|
442
|
+
|
|
443
|
+
@@unique([team_id, date, api_key, model, custom_llm_provider, mcp_namespaced_tool_name])
|
|
444
|
+
@@index([date])
|
|
445
|
+
@@index([team_id])
|
|
446
|
+
@@index([api_key])
|
|
447
|
+
@@index([model])
|
|
448
|
+
@@index([mcp_namespaced_tool_name])
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Track daily team spend metrics per model and key
|
|
452
|
+
model LiteLLM_DailyTagSpend {
|
|
453
|
+
id String @id @default(uuid())
|
|
454
|
+
tag String?
|
|
455
|
+
date String
|
|
456
|
+
api_key String
|
|
457
|
+
model String?
|
|
458
|
+
model_group String?
|
|
459
|
+
custom_llm_provider String?
|
|
460
|
+
mcp_namespaced_tool_name String?
|
|
461
|
+
prompt_tokens BigInt @default(0)
|
|
462
|
+
completion_tokens BigInt @default(0)
|
|
463
|
+
cache_read_input_tokens BigInt @default(0)
|
|
464
|
+
cache_creation_input_tokens BigInt @default(0)
|
|
465
|
+
spend Float @default(0.0)
|
|
466
|
+
api_requests BigInt @default(0)
|
|
467
|
+
successful_requests BigInt @default(0)
|
|
468
|
+
failed_requests BigInt @default(0)
|
|
469
|
+
created_at DateTime @default(now())
|
|
470
|
+
updated_at DateTime @updatedAt
|
|
471
|
+
|
|
472
|
+
@@unique([tag, date, api_key, model, custom_llm_provider, mcp_namespaced_tool_name])
|
|
473
|
+
@@index([date])
|
|
474
|
+
@@index([tag])
|
|
475
|
+
@@index([api_key])
|
|
476
|
+
@@index([model])
|
|
477
|
+
@@index([mcp_namespaced_tool_name])
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
// Track the status of cron jobs running. Only allow one pod to run the job at a time
|
|
482
|
+
model LiteLLM_CronJob {
|
|
483
|
+
cronjob_id String @id @default(cuid()) // Unique ID for the record
|
|
484
|
+
pod_id String // Unique identifier for the pod acting as the leader
|
|
485
|
+
status JobStatus @default(INACTIVE) // Status of the cron job (active or inactive)
|
|
486
|
+
last_updated DateTime @default(now()) // Timestamp for the last update of the cron job record
|
|
487
|
+
ttl DateTime // Time when the leader's lease expires
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
enum JobStatus {
|
|
491
|
+
ACTIVE
|
|
492
|
+
INACTIVE
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
model LiteLLM_ManagedFileTable {
|
|
496
|
+
id String @id @default(uuid())
|
|
497
|
+
unified_file_id String @unique // The base64 encoded unified file ID
|
|
498
|
+
file_object Json? // Stores the OpenAIFileObject
|
|
499
|
+
model_mappings Json
|
|
500
|
+
flat_model_file_ids String[] @default([]) // Flat list of model file id's - for faster querying of model id -> unified file id
|
|
501
|
+
created_at DateTime @default(now())
|
|
502
|
+
created_by String?
|
|
503
|
+
updated_at DateTime @updatedAt
|
|
504
|
+
updated_by String?
|
|
505
|
+
|
|
506
|
+
@@index([unified_file_id])
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
model LiteLLM_ManagedObjectTable { // for batches or finetuning jobs which use the
|
|
510
|
+
id String @id @default(uuid())
|
|
511
|
+
unified_object_id String @unique // The base64 encoded unified file ID
|
|
512
|
+
model_object_id String @unique // the id returned by the backend API provider
|
|
513
|
+
file_object Json // Stores the OpenAIFileObject
|
|
514
|
+
file_purpose String // either 'batch' or 'fine-tune'
|
|
515
|
+
status String? // check if batch cost has been tracked
|
|
516
|
+
created_at DateTime @default(now())
|
|
517
|
+
created_by String?
|
|
518
|
+
updated_at DateTime @updatedAt
|
|
519
|
+
updated_by String?
|
|
520
|
+
|
|
521
|
+
@@index([unified_object_id])
|
|
522
|
+
@@index([model_object_id])
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
model LiteLLM_ManagedVectorStoresTable {
|
|
526
|
+
vector_store_id String @id
|
|
527
|
+
custom_llm_provider String
|
|
528
|
+
vector_store_name String?
|
|
529
|
+
vector_store_description String?
|
|
530
|
+
vector_store_metadata Json?
|
|
531
|
+
created_at DateTime @default(now())
|
|
532
|
+
updated_at DateTime @updatedAt
|
|
533
|
+
litellm_credential_name String?
|
|
534
|
+
litellm_params Json?
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// Guardrails table for storing guardrail configurations
|
|
538
|
+
model LiteLLM_GuardrailsTable {
|
|
539
|
+
guardrail_id String @id @default(uuid())
|
|
540
|
+
guardrail_name String @unique
|
|
541
|
+
litellm_params Json
|
|
542
|
+
guardrail_info Json?
|
|
543
|
+
created_at DateTime @default(now())
|
|
544
|
+
updated_at DateTime @updatedAt
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// Prompt table for storing prompt configurations
|
|
548
|
+
model LiteLLM_PromptTable {
|
|
549
|
+
id String @id @default(uuid())
|
|
550
|
+
prompt_id String @unique
|
|
551
|
+
litellm_params Json
|
|
552
|
+
prompt_info Json?
|
|
553
|
+
created_at DateTime @default(now())
|
|
554
|
+
updated_at DateTime @updatedAt
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
model LiteLLM_HealthCheckTable {
|
|
558
|
+
health_check_id String @id @default(uuid())
|
|
559
|
+
model_name String
|
|
560
|
+
model_id String?
|
|
561
|
+
status String
|
|
562
|
+
healthy_count Int @default(0)
|
|
563
|
+
unhealthy_count Int @default(0)
|
|
564
|
+
error_message String?
|
|
565
|
+
response_time_ms Float?
|
|
566
|
+
details Json?
|
|
567
|
+
checked_by String?
|
|
568
|
+
checked_at DateTime @default(now())
|
|
569
|
+
created_at DateTime @default(now())
|
|
570
|
+
updated_at DateTime @updatedAt
|
|
571
|
+
|
|
572
|
+
@@index([model_name])
|
|
573
|
+
@@index([checked_at])
|
|
574
|
+
@@index([status])
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// Search Tools table for storing search tool configurations
|
|
578
|
+
model LiteLLM_SearchToolsTable {
|
|
579
|
+
search_tool_id String @id @default(uuid())
|
|
580
|
+
search_tool_name String @unique
|
|
581
|
+
litellm_params Json
|
|
582
|
+
search_tool_info Json?
|
|
583
|
+
created_at DateTime @default(now())
|
|
584
|
+
updated_at DateTime @updatedAt
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// SSO configuration table
|
|
588
|
+
model LiteLLM_SSOConfig {
|
|
589
|
+
id String @id @default("sso_config")
|
|
590
|
+
sso_settings Json
|
|
591
|
+
created_at DateTime @default(now())
|
|
592
|
+
updated_at DateTime @updatedAt
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
model LiteLLM_ManagedVectorStoreIndexTable {
|
|
596
|
+
id String @id @default(uuid())
|
|
597
|
+
index_name String @unique
|
|
598
|
+
litellm_params Json
|
|
599
|
+
index_info Json?
|
|
600
|
+
created_at DateTime @default(now())
|
|
601
|
+
created_by String?
|
|
602
|
+
updated_at DateTime @updatedAt
|
|
603
|
+
updated_by String?
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
// Cache configuration table
|
|
607
|
+
model LiteLLM_CacheConfig {
|
|
608
|
+
id String @id @default("cache_config")
|
|
609
|
+
cache_settings Json
|
|
610
|
+
created_at DateTime @default(now())
|
|
611
|
+
updated_at DateTime @updatedAt
|
|
612
|
+
}
|