feat: add Models dashboard tab with rich per-model analytics

- New /models page in left nav (after Analytics)
- New /api/analytics/models endpoint with per-model token/cost/session
  breakdown, cache read/reasoning tokens, tool calls, avg tokens/session,
  and capabilities from models.dev (vision/tools/reasoning/context window)
- Model cards with stacked token distribution bar, capability badges,
  provider badges, cost info, and relative time
- Summary stats bar (models used, total tokens, est. cost, sessions)
- Period selector (7d/30d/90d) with refresh
- i18n support (en + zh)
This commit is contained in:
Alex Yates
2026-04-29 20:34:22 -07:00
committed by Teknium
parent 289cc47631
commit e6b05eaf63
7 changed files with 579 additions and 0 deletions

View File

@@ -74,6 +74,7 @@ export const en: Translations = {
documentation: "Documentation",
keys: "Keys",
logs: "Logs",
models: "Models",
sessions: "Sessions",
skills: "Skills",
},
@@ -172,6 +173,18 @@ export const en: Translations = {
inOut: "{input} in / {output} out",
},
models: {
modelsUsed: "Models Used",
estimatedCost: "Est. Cost",
tokens: "tokens",
sessions: "sessions",
avgPerSession: "avg/session",
apiCalls: "API calls",
toolCalls: "tool calls",
noModelsData: "No model usage data for this period",
startSession: "Start a session to see model data here",
},
logs: {
title: "Logs",
autoRefresh: "Auto-refresh",

View File

@@ -74,6 +74,7 @@ export interface Translations {
documentation: string;
keys: string;
logs: string;
models: string;
sessions: string;
skills: string;
};
@@ -174,6 +175,19 @@ export interface Translations {
inOut: string;
};
// ── Models page ──
models: {
modelsUsed: string;
estimatedCost: string;
tokens: string;
sessions: string;
avgPerSession: string;
apiCalls: string;
toolCalls: string;
noModelsData: string;
startSession: string;
};
// ── Logs page ──
logs: {
title: string;

View File

@@ -73,6 +73,7 @@ export const zh: Translations = {
documentation: "文档",
keys: "密钥",
logs: "日志",
models: "模型",
sessions: "会话",
skills: "技能",
},
@@ -170,6 +171,18 @@ export const zh: Translations = {
inOut: "输入 {input} / 输出 {output}",
},
models: {
modelsUsed: "使用模型数",
estimatedCost: "预估费用",
tokens: "Token",
sessions: "会话",
avgPerSession: "平均/会话",
apiCalls: "API 调用",
toolCalls: "工具调用",
noModelsData: "该时间段暂无模型使用数据",
startSession: "开始会话后将在此显示模型数据",
},
logs: {
title: "日志",
autoRefresh: "自动刷新",