zhangzheng25/dsh-token-monitor
DeepSeek Harness plugin: token usage & conversation stats as a native settings page - today / 7d / 30d totals,
dsh-token-monitor puts a real-time 'Today usage' card at the bottom of the DeepSeek Harness sidebar (next to the settings icon): it shows today's total token count (e.g. '今日用量:8888万', refreshed every 30 seconds) and opens a full statistics window on click — today/7-day/30-day totals, a 30-day per-model stacked usage chart, per-model usage ranking, and session statistics — without occupying a settings page. Historical backfill is idempotent: startup, the 'backfill history' button, and the 30-second poll all rescan all sessions in the window into new buckets (atomic replace), so usage from before plugin installation is included and repeat runs never double-count.
Install
dsh plugin --profile web add github:zhangzheng25/dsh-token-monitorGitHub install per README (bilingual, English edition): dsh plugin --profile web add github:zhangzheng25/dsh-token-monitor, or from a local checkout dsh plugin --profile web add E:\path\to\dsh-token-monitor. dsh plugin forwards to pnpm inside the profile directory and reconciles dsh.profile.bundles; the package's dsh.bundle.patch inserts the plugin row into the host composition, and dsh.client.platform: "web" makes the web shell serve client/bundle.js. Restart DSH after install — the '今日用量' (Today usage) card appears at the bottom of the sidebar next to the settings icon.
Compatibility
DeepSeek Harness web profile. Sidebar 'Today usage' card (auto-refresh every 30 s; collapses to a bare number in narrow mode) + full statistics modal: today / 7d / 30d totals, 30-day per-model stacked usage chart (model with highest daily usage at the bar bottom, colors fixed by 30-day rank, weekday-Monday baseline labels, hover detail cards), model usage ranking (top 4 in 2×2 cards with provider share), and session counts (top-level conversations only, delegationDepth === 0). Data persisted to $DSH_HOME/plugins/token-monitor/data.json (181-day retention, per-day per-model buckets); session logs are the only data source with idempotent backfill (counts usage before plugin install); atomic bucket replacement prevents double counting.
Details
- Repo: zhangzheng25/dsh-token-monitor
- Category: Coding & Development
- Stars: 6
- Version: GitHub install github:zhangzheng25/dsh-token-monitor (README-documented)
- Last push: 2026-08-16
- First seen: 2026-08-14
Recent updates
The current English README (README.en.md) documents: features (one-click card, 30-day per-model chart, ranking, session stats, auto-refresh, persistence, history backfill), install, and the architecture (host side src/index.js with backfill/buildSessionStats/persist/webServer routes; client side client/bundle.js with sidebar.footer.action slot injection).
FAQ
- Does it count usage from before I installed it?
- Yes — history backfill uses session logs as the only data source and idempotently rescans all sessions in the window into new buckets (atomic replace), so pre-install usage is included; repeat runs never double-count.
- Where is the data stored?
- Data is written to $DSH_HOME/plugins/token-monitor/data.json with per-day per-model buckets and a 181-day retention window; it survives restarts.
- Are subagent sessions counted in session stats?
- No — session statistics count only top-level conversations (delegationDepth === 0); subagent-internal sessions are excluded.
Alternatives
qwert702/dsh-token-viewer · Max-Samson/dsh-usage-chart · lanlandeli/dsh-usage-stats