From b6692ef754497127a25aef0a9274a3ffe2d6c001 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Fri, 24 Apr 2026 18:56:02 -0700 Subject: [PATCH] schema: add LiteLLM_TeamMemberModelSpend table for atomic per-model spend tracking --- litellm-proxy-extras/litellm_proxy_extras/schema.prisma | 9 +++++++++ litellm/proxy/schema.prisma | 9 +++++++++ schema.prisma | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma index e83ef330c9b..2567d0d5c2e 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma +++ b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma @@ -623,6 +623,15 @@ model LiteLLM_TeamMembership { @@id([user_id, team_id]) } +model LiteLLM_TeamMemberModelSpend { + // Per-model spend tracking for team members — uses atomic increment, unlike JSON field approach + user_id String + team_id String + model String + spend Float @default(0.0) + @@id([user_id, team_id, model]) +} + model LiteLLM_OrganizationMembership { // Use this table to track Internal User and Organization membership. Helps tracking a users role within an Organization user_id String diff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prisma index e83ef330c9b..2567d0d5c2e 100644 --- a/litellm/proxy/schema.prisma +++ b/litellm/proxy/schema.prisma @@ -623,6 +623,15 @@ model LiteLLM_TeamMembership { @@id([user_id, team_id]) } +model LiteLLM_TeamMemberModelSpend { + // Per-model spend tracking for team members — uses atomic increment, unlike JSON field approach + user_id String + team_id String + model String + spend Float @default(0.0) + @@id([user_id, team_id, model]) +} + model LiteLLM_OrganizationMembership { // Use this table to track Internal User and Organization membership. Helps tracking a users role within an Organization user_id String diff --git a/schema.prisma b/schema.prisma index e83ef330c9b..2567d0d5c2e 100644 --- a/schema.prisma +++ b/schema.prisma @@ -623,6 +623,15 @@ model LiteLLM_TeamMembership { @@id([user_id, team_id]) } +model LiteLLM_TeamMemberModelSpend { + // Per-model spend tracking for team members — uses atomic increment, unlike JSON field approach + user_id String + team_id String + model String + spend Float @default(0.0) + @@id([user_id, team_id, model]) +} + model LiteLLM_OrganizationMembership { // Use this table to track Internal User and Organization membership. Helps tracking a users role within an Organization user_id String