feat(webui): list every model with full usage on the Models tab

The Models tab ranks by requests by default and asks the server for
per-model detail. A table under the chart lists requests, tokens in,
tokens out and cost for each model. A model with no recorded cost that
is marked free shows a "free" badge instead of $0. The CSV export
includes every column and the free flag. admin_assets_gen.go is
regenerated.

Claude-Session: https://claude.ai/code/session_01V5jYJNxpDFdJkyyExpADrv
This commit is contained in:
2026-09-23 13:40:08 +01:00
parent 3e05a79c0b
commit 782ea43b02
12 changed files with 471 additions and 35 deletions
+9 -1
View File
@@ -16,7 +16,15 @@ import type { HistoryWindow } from '@/types/api'
/** The five defaults every per-tab param omits from the built hash when the field is already at its default value (buildHash's own "caller decides what's default" contract, lib/hash-state.ts). */
const DEFAULT_WINDOW: HistoryWindow = 'hour'
const DEFAULT_CHART_TAB: ChartTab = 'requests'
const DEFAULT_METRIC: ModelMetric = 'cost'
/**
* DEFAULT_METRIC mirrors stores/history.ts's own initial `modelMetric`
* state (free-models-plan.md: 'req', not 'cost' — a cost-default ranking
* hides every free model). An omitted `metric` hash param, or one this
* build does not recognize (parseChartsParams' own independent-field
* validation, lib/hash-state.ts), falls back to this value here; an
* explicit `metric=cost` in the hash still parses and applies normally.
*/
const DEFAULT_METRIC: ModelMetric = 'req'
const DEFAULT_SCOPE = 'total'
const DEFAULT_MODEL_FILTER = ''