diff --git a/litellm/proxy/_lazy_openapi_snapshot.json b/litellm/proxy/_lazy_openapi_snapshot.json index 7fe02c6d8bc..026a02d6b1d 100644 --- a/litellm/proxy/_lazy_openapi_snapshot.json +++ b/litellm/proxy/_lazy_openapi_snapshot.json @@ -11349,6 +11349,40 @@ "title": "UpdateGuardrailRequest", "type": "object" }, + "UsageChartPoint": { + "properties": { + "blocked": { + "title": "Blocked", + "type": "integer" + }, + "date": { + "title": "Date", + "type": "string" + }, + "passed": { + "title": "Passed", + "type": "integer" + }, + "score": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Score" + } + }, + "required": [ + "date", + "passed", + "blocked" + ], + "title": "UsageChartPoint", + "type": "object" + }, "UsageDetailResponse": { "properties": { "avgLatency": { @@ -11410,8 +11444,7 @@ }, "time_series": { "items": { - "additionalProperties": true, - "type": "object" + "$ref": "#/components/schemas/UsageChartPoint" }, "title": "Time Series", "type": "array" @@ -11423,6 +11456,40 @@ "type": { "title": "Type", "type": "string" + }, + "usage_units": { + "additionalProperties": { + "type": "integer" + }, + "title": "Usage Units", + "type": "object" + }, + "usage_units_by_key": { + "additionalProperties": { + "additionalProperties": { + "type": "integer" + }, + "type": "object" + }, + "title": "Usage Units By Key", + "type": "object" + }, + "usage_units_by_team": { + "additionalProperties": { + "additionalProperties": { + "type": "integer" + }, + "type": "object" + }, + "title": "Usage Units By Team", + "type": "object" + }, + "usage_units_daily": { + "items": { + "$ref": "#/components/schemas/UsageUnitsDailyPoint" + }, + "title": "Usage Units Daily", + "type": "array" } }, "required": [ @@ -11437,7 +11504,11 @@ "status", "trend", "description", - "time_series" + "time_series", + "usage_units", + "usage_units_daily", + "usage_units_by_team", + "usage_units_by_key" ], "title": "UsageDetailResponse", "type": "object" @@ -11572,8 +11643,7 @@ "properties": { "chart": { "items": { - "additionalProperties": true, - "type": "object" + "$ref": "#/components/schemas/UsageChartPoint" }, "title": "Chart", "type": "array" @@ -11596,6 +11666,13 @@ "totalRequests": { "title": "Totalrequests", "type": "integer" + }, + "totalUsageUnits": { + "additionalProperties": { + "type": "integer" + }, + "title": "Totalusageunits", + "type": "object" } }, "required": [ @@ -11603,7 +11680,8 @@ "chart", "totalRequests", "totalBlocked", - "passRate" + "passRate", + "totalUsageUnits" ], "title": "UsageOverviewResponse", "type": "object" @@ -11663,6 +11741,13 @@ "type": { "title": "Type", "type": "string" + }, + "usageUnits": { + "additionalProperties": { + "type": "integer" + }, + "title": "Usageunits", + "type": "object" } }, "required": [ @@ -11675,11 +11760,33 @@ "avgScore", "avgLatency", "status", - "trend" + "trend", + "usageUnits" ], "title": "UsageOverviewRow", "type": "object" }, + "UsageUnitsDailyPoint": { + "properties": { + "date": { + "title": "Date", + "type": "string" + }, + "units": { + "additionalProperties": { + "type": "integer" + }, + "title": "Units", + "type": "object" + } + }, + "required": [ + "date", + "units" + ], + "title": "UsageUnitsDailyPoint", + "type": "object" + }, "ValidationError": { "properties": { "loc": { @@ -21477,6 +21584,13 @@ "totalRequests": { "title": "Totalrequests", "type": "integer" + }, + "totalUsageUnits": { + "additionalProperties": { + "type": "integer" + }, + "title": "Totalusageunits", + "type": "object" } }, "required": [ @@ -21484,7 +21598,8 @@ "chart", "totalRequests", "totalBlocked", - "passRate" + "passRate", + "totalUsageUnits" ], "title": "UsageOverviewResponse", "type": "object" @@ -21544,6 +21659,13 @@ "type": { "title": "Type", "type": "string" + }, + "usageUnits": { + "additionalProperties": { + "type": "integer" + }, + "title": "Usageunits", + "type": "object" } }, "required": [ @@ -21556,7 +21678,8 @@ "avgScore", "avgLatency", "status", - "trend" + "trend", + "usageUnits" ], "title": "UsageOverviewRow", "type": "object" diff --git a/litellm/repositories/__init__.py b/litellm/repositories/__init__.py index e2e7f1fac73..881f7a66cea 100644 --- a/litellm/repositories/__init__.py +++ b/litellm/repositories/__init__.py @@ -28,6 +28,7 @@ from litellm.repositories.table_repositories import ( ClaudeCodePluginRepository, ConfigOverridesRepository, DailyGuardrailMetricsRepository, + DailyGuardrailUsageUnitsRepository, DailyPolicyMetricsRepository, DailyTagSpendRepository, DailyToolSpendRepository, @@ -101,6 +102,7 @@ __all__ = [ "ConfigRepository", "CredentialsRepository", "DailyGuardrailMetricsRepository", + "DailyGuardrailUsageUnitsRepository", "DailyPolicyMetricsRepository", "DailyTagSpendRepository", "DailyToolSpendRepository", diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.ts index 2bc21735248..318f02750ce 100644 --- a/ui/litellm-dashboard/src/lib/http/schema.d.ts +++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts @@ -35089,13 +35089,29 @@ export interface components { /** Status */ status: string; /** Time Series */ - time_series: { - [key: string]: unknown; - }[]; + time_series: components["schemas"]["UsageChartPoint"][]; /** Trend */ trend: string; /** Type */ type: string; + /** Usage Units */ + usage_units: { + [key: string]: number; + }; + /** Usage Units By Key */ + usage_units_by_key: { + [key: string]: { + [key: string]: number; + }; + }; + /** Usage Units By Team */ + usage_units_by_team: { + [key: string]: { + [key: string]: number; + }; + }; + /** Usage Units Daily */ + usage_units_daily: components["schemas"]["UsageUnitsDailyPoint"][]; }; /** UsageLogEntry */ UsageLogEntry: { @@ -35132,9 +35148,7 @@ export interface components { /** UsageOverviewResponse */ UsageOverviewResponse: { /** Chart */ - chart: { - [key: string]: unknown; - }[]; + chart: components["schemas"]["UsageChartPoint"][]; /** Passrate */ passRate: number; /** Rows */ @@ -35143,6 +35157,10 @@ export interface components { totalBlocked: number; /** Totalrequests */ totalRequests: number; + /** Totalusageunits */ + totalUsageUnits: { + [key: string]: number; + }; }; /** UsageOverviewRow */ UsageOverviewRow: { @@ -35166,6 +35184,19 @@ export interface components { trend: string; /** Type */ type: string; + /** Usageunits */ + usageUnits: { + [key: string]: number; + }; + }; + /** UsageUnitsDailyPoint */ + UsageUnitsDailyPoint: { + /** Date */ + date: string; + /** Units */ + units: { + [key: string]: number; + }; }; /** * UserAPIKeyAuth