Feat: Add Token Usage Dashboard/Analytics #330
No reviewers
Labels
No labels
area:chat
area:core
area:llm
area:routes
area:tools
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sleepy/odysseus!330
Loading…
Reference in a new issue
No description provided.
Delete branch "zapulam/feature/add_usage_dashboard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hey Felix,
I added a token usage dashboard, by day and by model, figured this would be pretty useful for those curious on token consumption. Added it as a new button on the side nav under the "Theme" button which opens a new modal. I seeded some older messages to make it usable. Spend would also be cool to track for non-hosting folks, just gets a bit weird to get the actual cost nailed down with cached tokens (different providers do it a bit differently I think), but its doable.
https://github.com/user-attachments/assets/f8e81adb-8c1e-48d2-a3a0-cbd3d69a07cc
https://github.com/user-attachments/assets/7cffea5c-9400-436b-bedf-cf77f30a08f6
https://github.com/user-attachments/assets/352ce4eb-9984-4bd0-afed-faa22efed668
Changed Areas
routes/usage_routes.py/api/usage/tokensaggregation for daily token/message usage.static/js/usage.jsstatic/css/usage.cssstatic/index.html/static/app.jstests/test_usage_routes.pyTesting
Automated checks run:
python -m pytest tests/test_usage_routes.py -q5 passedcore/database.py.node --check static/js/usage.jsManual UI checks performed:
This is really cool, I would suggest if we could also have a way for seeing usage by model, like we could filter it, and also see like the top 3 4 most used models, that sounds like the perfect extension to this.
@TanmayDoesAI Good idea! I'll add that in
Edit: Updated PR with Model tab for individual model metrics and filter by model on the daily page
Merged via squash. Usage dashboard with daily + model charts, lazy-loaded CSS, dead code removed, admin-only user scoping enforced. All review feedback addressed.