feat: add Models dashboard tab with rich per-model analytics#17745
Merged
Conversation
- 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)
…or split - SQL: add `model != ''` to both queries in /api/analytics/models so sessions with empty-string model (pre-existing data integrity, confirmed in production DB: ~107 sessions) no longer render as blank-header cards. - ModelsPage: drop the arbitrary slashIdx < 20 length gate in shortModelName / modelProvider. The gate was fragile for longer vendor prefixes (e.g. `deepseek-ai/...`). Strip on the first / unconditionally. Rename modelProvider -> modelVendor to avoid confusion with the billing provider column. - scripts/release.py: add AUTHOR_MAP entry for yatesjalex.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvage of #17733 from @yatesjalex onto current main, plus two follow-up fixes.
What this ships
A new "Models" tab in the web dashboard with per-model analytics cards:
token distribution bar (cache / reasoning / input / output), capability
badges (tools / vision / reasoning + family), context window + max
output from models.dev, cost, sessions, API calls, tool calls,
time-since-last-use. Backed by a new
/api/analytics/modelsendpoint.Follow-up fixes on top of @yatesjalex's commit
WHERE model IS NOT NULLbut pre-existing sessions withmodel = ''(data integrity quirk, ~100+ rows in practice) passedthat check and rendered as blank-header cards on the page. Added
AND model != ''on both the per-model and totals queries.slashIdx < 20heuristic inshortModelName/modelProviderand split on the first/unconditionally. Thelength gate was guessing; a real slash always separates vendor from
model regardless of prefix length. Renamed
modelProvider→modelVendorto disambiguate from the billing-provider column thatalready exists on
ModelCard.yatesjalextoscripts/release.pyAUTHOR_MAP.Validation
web/cleanly (tsc + vite).~/.hermes/hermes_state.db./modelsshowed 23 models / 3374 sessions / 1 blank-headercard at rank Nous Portal subscription integration #25 (112 ghost sessions with empty model string).
curl … | jqconfirms zero empty-string rows in both
models[]and totals.header correctly.
Closes #17733.
Credit to @yatesjalex — his commit is preserved via rebase-merge.