Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
6bdac6f
feat(proxy): add model leaderboard analytics
ishaan-berri Sep 28, 2026
b1e9192
feat: add model insights task and range constants
ishaan-berri Sep 29, 2026
4f39c7d
feat: record task type from task tags in model usage rollup
ishaan-berri Sep 29, 2026
558a3fc
feat: serve 365 days of model insights by UTC date
ishaan-berri Sep 29, 2026
08ebc0c
test: cover task tag resolution in model usage rollup
ishaan-berri Sep 29, 2026
b9ba2d9
test: update model insights range limit test to 365 days
ishaan-berri Sep 29, 2026
631286b
chore: regenerate dashboard api types for model insights
ishaan-berri Sep 29, 2026
a9d7b87
feat: add model insights aggregation helpers
ishaan-berri Sep 29, 2026
c18ed82
test: cover model insights aggregation helpers
ishaan-berri Sep 29, 2026
8079554
feat: redesign model leaderboard with stacked bars, treemap and ranking
ishaan-berri Sep 29, 2026
a0a0baa
test: update model leaderboard view test
ishaan-berri Sep 29, 2026
ebcedb6
feat: mark model leaderboard as beta in sidebar
ishaan-berri Sep 29, 2026
ebbac03
chore: sync schema.prisma copies from root
github-actions[bot] Sep 29, 2026
7102e8b
fix: only treat task: prefixed tags as model insight tasks
ishaan-berri Sep 29, 2026
d7d3b90
feat: add metric type for model insights ranking
ishaan-berri Sep 29, 2026
6c5d38d
fix: rank model insights by selected metric and scope detail queries …
ishaan-berri Sep 29, 2026
faf8bc8
test: plain tags are not model insight tasks
ishaan-berri Sep 29, 2026
c2411be
test: cover metric ranking, deployment scoping and rollup round trip
ishaan-berri Sep 29, 2026
e648296
fix: build model insights weeks and halves from the requested date range
ishaan-berri Sep 29, 2026
d5fa1c8
test: cover empty weeks and range-based change comparison
ishaan-berri Sep 29, 2026
d7bd5a6
fix: refetch by metric, show load errors and ignore stale responses
ishaan-berri Sep 29, 2026
4848d64
test: cover metric refetch and error state
ishaan-berri Sep 29, 2026
b87e4ae
feat: define model insight tasks in a JSON file
ishaan-berri Sep 29, 2026
f37f5d6
feat: return task labels and categories from model insights
ishaan-berri Sep 29, 2026
641a5b2
feat: load model insight tasks from JSON
ishaan-berri Sep 29, 2026
b515b41
refactor: validate rollup task tags against the JSON task list
ishaan-berri Sep 29, 2026
48aff5f
feat: serve the task list with model insights
ishaan-berri Sep 29, 2026
8add5af
refactor: drop hardcoded task list from constants
ishaan-berri Sep 29, 2026
8fe05c5
build: ship model insight tasks JSON in the wheel
ishaan-berri Sep 29, 2026
8153733
test: cover model insight task JSON
ishaan-berri Sep 29, 2026
7e1b592
refactor: take task labels and categories from the API
ishaan-berri Sep 29, 2026
cbbe04a
test: pass task info to task tile builder
ishaan-berri Sep 29, 2026
f1c5eec
refactor: color treemap by API-provided category
ishaan-berri Sep 29, 2026
ee3bff1
test: include tasks in model leaderboard fixture
ishaan-berri Sep 29, 2026
f26cc48
fix: make daily model usage migration idempotent
ishaan-berri Sep 29, 2026
337b1b0
feat: bound the model insights task query size
ishaan-berri Sep 29, 2026
aed0bdf
fix: compute task breakdown independent of the chart metric
ishaan-berri Sep 29, 2026
c569893
test: task breakdown is stable across chart metrics
ishaan-berri Sep 29, 2026
f89746e
chore: regenerate lazy openapi snapshot for model insights
ishaan-berri Sep 29, 2026
1ee8fbf
chore: regenerate dashboard api types for model insights
ishaan-berri Sep 29, 2026
9226ad0
fix: keep previous ranking dimmed while a new metric loads
ishaan-berri Sep 29, 2026
bb290ed
test: cover stale metric state in model leaderboard
ishaan-berri Sep 29, 2026
3cb62e3
refactor: drop task row cap constant
ishaan-berri Sep 29, 2026
f933406
fix: return the full task breakdown instead of a truncated one
ishaan-berri Sep 29, 2026
8223bab
test: task query is not truncated
ishaan-berri Sep 29, 2026
c006b28
feat: add task summary types for model insights
ishaan-berri Sep 29, 2026
742b3e3
feat: summarise tasks server-side on a separate model insights endpoint
ishaan-berri Sep 29, 2026
a82ae63
test: cover the model insights tasks endpoint
ishaan-berri Sep 29, 2026
511e773
chore: regenerate lazy openapi snapshot for model insights tasks
ishaan-berri Sep 29, 2026
0eedc5f
chore: regenerate dashboard api types for model insights tasks
ishaan-berri Sep 29, 2026
24d7f02
refactor: drop client-side task aggregation
ishaan-berri Sep 29, 2026
ac4f5fa
test: remove client-side task aggregation tests
ishaan-berri Sep 29, 2026
c5e4341
feat: load task breakdown separately from the chart metric
ishaan-berri Sep 29, 2026
e795e50
test: task breakdown is not refetched on chart metric change
ishaan-berri Sep 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE TABLE IF NOT EXISTS "LiteLLM_DailyModelUsage" (
"date" TEXT NOT NULL,
"model_group" TEXT NOT NULL,
"model" TEXT NOT NULL,
"custom_llm_provider" TEXT NOT NULL,
"task_type" TEXT NOT NULL,
"spend" DOUBLE PRECISION NOT NULL DEFAULT 0.0,
"prompt_tokens" BIGINT NOT NULL DEFAULT 0,
"completion_tokens" BIGINT NOT NULL DEFAULT 0,
"request_count" BIGINT NOT NULL DEFAULT 0,
"successful_requests" BIGINT NOT NULL DEFAULT 0,
"failed_requests" BIGINT NOT NULL DEFAULT 0,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "LiteLLM_DailyModelUsage_pkey" PRIMARY KEY ("date", "model_group", "model", "custom_llm_provider", "task_type")
);

CREATE INDEX IF NOT EXISTS "LiteLLM_DailyModelUsage_date_idx" ON "LiteLLM_DailyModelUsage"("date");
CREATE INDEX IF NOT EXISTS "LiteLLM_DailyModelUsage_model_group_idx" ON "LiteLLM_DailyModelUsage"("model_group");
20 changes: 20 additions & 0 deletions litellm-proxy-extras/litellm_proxy_extras/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,26 @@ model LiteLLM_DailyToolSpend {
@@id([date, tool_name])
}

model LiteLLM_DailyModelUsage {
date String
model_group String
model String
custom_llm_provider String
task_type String
spend Float @default(0.0)
prompt_tokens BigInt @default(0)
completion_tokens BigInt @default(0)
request_count BigInt @default(0)
successful_requests BigInt @default(0)
failed_requests BigInt @default(0)
created_at DateTime @default(now())
updated_at DateTime @updatedAt

@@id([date, model_group, model, custom_llm_provider, task_type])
@@index([date])
@@index([model_group])
}

// Gateway request counts recorded at the ASGI edge by
// BillableRequestMetricsMiddleware. This is the source of truth for SGR
// (successful gateway requests): it counts what the proxy actually answered,
Expand Down
4 changes: 4 additions & 0 deletions litellm/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,10 @@
os.getenv("SCHEDULED_JOB_SHUTDOWN_CANCEL_TIMEOUT_SECONDS", "5")
)
TOOL_SPEND_TOP_TOOLS: Final = 100
MODEL_INSIGHTS_TOP_MODELS: Final = 10
MODEL_INSIGHTS_MAX_RANGE_DAYS: Final = 365
MODEL_INSIGHTS_DEFAULT_TASK: Final = "uncategorized"
MODEL_INSIGHTS_TASK_TAG_PREFIX: Final = "task:"
SPEND_LOG_PARTITION_INTERVAL: Final = os.getenv("SPEND_LOG_PARTITION_INTERVAL", "day")
SPEND_LOG_PARTITION_PRECREATE_AHEAD: Final = int(os.getenv("SPEND_LOG_PARTITION_PRECREATE_AHEAD", 7))
SPEND_LOG_WRITE_BATCH_MAX_BYTES: Final = max(1, int(os.getenv("SPEND_LOG_WRITE_BATCH_MAX_BYTES", 2_000_000)))
Expand Down
5 changes: 5 additions & 0 deletions litellm/proxy/_lazy_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ def matches(self, path: str) -> bool:
module_path="litellm.proxy.management_endpoints.tool_management_endpoints",
path_prefixes=("/v1/tool", "/tool"),
),
LazyFeature(
name="model_insights",
module_path="litellm.proxy.management_endpoints.model_insights_endpoints",
path_prefixes=("/model-insights",),
),
LazyFeature(
name="search_tools",
module_path="litellm.proxy.search_endpoints.search_tool_management",
Expand Down
Loading
Loading