Skip to content

[Feature]: Admin usage & analytics dashboard (token consumption) #463

Description

@bjrump

Problem Statement

Per-message token usage is persisted (packages/db/src/tables/chats.ts:82–86input_tokens, output_tokens, total_tokens, plus modelId in message metadata) but never aggregated or shown anywhere. System Admins have no view of consumption per user / per AI Model / over time.

Proposed Solution

  • API: aggregation endpoint(s) summing tokens grouped by user, AI Model, and day (consider a cached/materialized table if message volume is high). Gate to System Admin.
  • Frontend: a new "Usage & Analytics" Settings Section in the System Admin Category; charts via recharts (already a dependency). Show totals, per-model split, and a time series.

Acceptance Criteria

  • A System-Admin-only Settings Section shows token usage over a selectable time range.
  • Breakdown by AI Model and by user is available.
  • Non-admins never see the Section (Category hidden when no rights, per existing settings rules).
  • de + en strings.

Scope / Notes

Frontend + backend. Depends conceptually on nothing, but can additionally surface 👍/👎 feedback rates once the message-feedback issue lands.

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions