Per-request model token usage tracked to per-day JSONL files, with a stats page in Web settings: daily trend chart, per-model breakdown, and date/model filters.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:LaoYueHanNi/dsh-token-usage
GitHub-sourced plugins run build scripts on your machine at install time. Only install sources you trust, and pin a commit (github:owner/repo#sha).
README

简体中文 | English
A dsh usage plugin that displays model token usage right in the Web UI. After installation, open Settings (the gear icon in the sidebar) and you'll find the Token Usage page — summary cards, a daily total-token line chart and a per-model breakdown, all filterable by date range and model, exactly as shown in the screenshot above.
Repo: https://github.com/LaoYueHanNi/dsh-token-usage
Features
- Live hook: every successful model request is appended to per-day JSONL files (request id, model, input / output / cache-read / cache-write tokens, time, session id).
- Web stats page: filters (date range + model +
1d/7d/30dshortcuts), summary cards, daily trend chart, per-model table. - Cost figures & model pricing: per-request cost is computed live from per-model rates (¥ per million tokens) — a highlighted total-cost card, a cost column plus the per-model rates under each model name in the per-model table, and a warning strip for unpriced models (their cost counts as ¥0). The rate table is maintained by you in
pricing.jsoninside the data directory;/token-usage-pricingprints the active table anytime. - History backfill: the first startup syncs requests that happened before installation; the
/token-usage-synccommand re-runs the same idempotent backfill anytime.
Model pricing
Cost = each token bucket × its rate ÷ 1,000,000. Rates live in pricing.json in the data directory (no pricing configured means every model is unpriced):
{
"deepseek-chat": { "inputPerMillion": 2, "outputPerMillion": 8, "cacheReadPerMillion": 0.5 },
"deepseek-reasoner": { "inputPerMillion": 4, "outputPerMillion": 16, "cacheReadPerMillion": 1 }
}
- Keys are model ids (must match the recorded
modelexactly); values are ¥ per million tokens. inputPerMillionandoutputPerMillionare required;cacheReadPerMillion(cache hit) andcacheWritePerMillion(cache write) are optional and fall back to the input rate when absent.- A broken file or invalid entries leave the affected models unpriced without breaking the stats page; save and refresh (or re-run the command) to apply changes.
- Default location:
~/.dsh/token-usage/pricing.json(whereverpathpoints when configured).
Install
From GitHub (recommended)
dsh plugin --profile web add github:LaoYueHanNi/dsh-token-usage
The package declares
dsh.bundle, soaddwires the plugin into the profile's layer stack automatically — no config editing needed. The builtlib/ships in the repo (there is nopreparescript), so git installs work out of the box without any build allowlist. The first startup runs one history backfill, afterwards it records in real time.
From a local directory (development)
dsh plugin --profile web add link:D:/plugins/dsh-token-usage
link: installs a symlink: rebuild the plugin and restart dsh web to apply changes.
Update
dsh plugin --profile web update dsh-token-usage
Remove
dsh plugin --profile web remove dsh-token-usage
The plugin is removed from the profile and stops loading. Data files under $DSH_HOME/token-usage/ are kept — delete them manually if you no longer need them.
Development
Build the plugin once:
npm install
npm run build && npm run build:client
No
preparescript — by design. The compiledlib/output is committed to the repo. pnpm ≥ 10 refuses to run build scripts of git-hosted dependencies unless they are allowlisted (ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED), so apreparescript would break the zero-configgithub:install for every user. Shipping prebuilt output instead keepsdsh plugin add github:LaoYueHanNi/dsh-token-usageworking out of the box. After changing anything undersrc/, always rebuild and commit the updatedlib/, or installs will get stale output:
npm run build && npm run build:client
git add lib/
Temporary mount — effective for this launch only, no profile changes. cordis.yml points at the built lib/index.js:
dsh web --patch <plugin-dir>/cordis.yml
This mode only mounts the host half (data recording and commands work); the stats page needs the client bundle resolved by package name, so for UI development use the link: install above instead: run npm run build && npm run build:client (or npx tsdown --watch in the plugin directory), restart dsh web, and the browser plugin hot-reloads automatically.
Links
More in this category
zhu1090093659/dsh-web-ui★ 1766
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
ccch1mneyyy/dsh-TUI★ 829
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
omdsh-dev/DSH-better-sidebar★ 705
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
huiliyi37/dsh-tianshu-tui★ 131
A terminal UI (TUI) for DeepSeek Harness.
omdsh-dev/dsh-at-file★ 117
Codex-style `@file` mentions: search workspace files in the composer and attach their contents to prompts.
Nagi-ovo/dsh-visualize★ 79
In-conversation generative UI: the model renders interactive HTML cards into the chat stream, with streaming preview and sandboxed rendering.