From cce118e091b6f206249cb159f572da635eb18926 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 25 Oct 2024 07:19:29 +0400 Subject: [PATCH 1/3] track created, updated at virtual keys --- litellm/proxy/schema.prisma | 2 ++ schema.prisma | 2 ++ 2 files changed, 4 insertions(+) diff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prisma index e7e54335147..64045999c95 100644 --- a/litellm/proxy/schema.prisma +++ b/litellm/proxy/schema.prisma @@ -154,6 +154,8 @@ model LiteLLM_VerificationToken { model_spend Json @default("{}") model_max_budget Json @default("{}") budget_id String? + created_at DateTime? @default(now()) @map("created_at") + updated_at DateTime? @default(now()) @updatedAt @map("updated_at") litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id]) } diff --git a/schema.prisma b/schema.prisma index e7e54335147..64045999c95 100644 --- a/schema.prisma +++ b/schema.prisma @@ -154,6 +154,8 @@ model LiteLLM_VerificationToken { model_spend Json @default("{}") model_max_budget Json @default("{}") budget_id String? + created_at DateTime? @default(now()) @map("created_at") + updated_at DateTime? @default(now()) @updatedAt @map("updated_at") litellm_budget_table LiteLLM_BudgetTable? @relation(fields: [budget_id], references: [budget_id]) } From 8cd8d47f47d1b070ca79033cc3c174265517b89e Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 25 Oct 2024 07:21:15 +0400 Subject: [PATCH 2/3] add created_at, updated_at for verification token --- litellm/proxy/_types.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 629e002b56f..b0463a890cd 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -1371,6 +1371,8 @@ class LiteLLM_VerificationToken(LiteLLMBase): blocked: Optional[bool] = None litellm_budget_table: Optional[dict] = None org_id: Optional[str] = None # org id for a given key + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None model_config = ConfigDict(protected_namespaces=()) From 2d2a2c35d8667c65e78837653918af38059a57c2 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 25 Oct 2024 09:23:08 +0400 Subject: [PATCH 3/3] ui show created at date --- .../src/components/view_key_table.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/litellm-dashboard/src/components/view_key_table.tsx b/ui/litellm-dashboard/src/components/view_key_table.tsx index 0595e31fd63..474a308e9f0 100644 --- a/ui/litellm-dashboard/src/components/view_key_table.tsx +++ b/ui/litellm-dashboard/src/components/view_key_table.tsx @@ -802,6 +802,7 @@ const ViewKeyTable: React.FC = ({ Key Alias Secret Key + Created Expires Spend (USD) Budget (USD) @@ -843,10 +844,19 @@ const ViewKeyTable: React.FC = ({ {item.key_name} + + {item.created_at != null ? ( +
+

{new Date(item.created_at).toLocaleDateString()}

+
+ ) : ( +

Not available

+ )} +
{item.expires != null ? (
-

{new Date(item.expires).toLocaleString()}

+

{new Date(item.expires).toLocaleDateString()}

) : (

Never