LaoYueHanNi/dsh-token-usage

dsh-token-usage tracks every successful model request and shows a full usage dashboard in the DSH Web UI under Settings. Dashboard: summary cards with cost, daily trend chart (hover for day total), per-model breakdown table, and per-model pricing dialogs. Each record logs request ID, model, input/output/cache-read/cache-write tokens, timestamp, and session ID to per-day JSONL files. Cost is computed individually per record using the analyzer's full rule chain (context tiers, peak windows, time rules).

Other ★ 6 updated 2026-09-20 ✅ runtime-tested
View on GitHub ↗

Install

dsh plugin --profile web add dsh-token-usage

npm package dsh-token-usage 2.2.0 (registry-verified 2026-08-24). Adds a Token Usage stats page under Settings in the DSH Web UI. No extra configuration needed; model pricing data is fetched automatically at startup from the cloud model-price-table feed. A pricing.json file can override individual model rates. History backfill runs on first startup (idempotent).

Compatibility

DeepSeek Harness web profile (Web UI required for the stats page). Pricing is per-record (individual rule-chain resolution per request timestamp). Per-day JSONL log files stored locally. Supports DeepSeek official model rates and custom overrides via pricing.json.

Details

Recent updates

2.2.0: live hook on every model request; per-day JSONL storage; web stats page with date-range and model filters; per-model cost figures and pricing dialogs (tier/peak aware); auto-fetch of cloud model-price-table at startup; pricing.json manual overrides; first-startup history backfill (idempotent).

FAQ

How is the token cost computed per request?
Every record is priced individually through the analyzer's rule chain at its own timestamp: the covering time rule first (its context tiers, its peak slots), then the model-root's tiers and base rates. Tier matching uses the request's input-side tokens (input + cacheRead + cacheWrite). A price update re-prices the whole history instantly without rebuilding data files.
Where does model pricing data come from?
At every dsh restart, the plugin mirrors the cloud model-price-table feed automatically. Additionally, a local pricing.json file can override any model's rates — manual entries always win (they replace that model's cloud rules wholesale).
Does it track usage before installation?
Yes — first startup runs a backfill that syncs model requests that happened before installation. The backfill is idempotent, so it is safe to run multiple times.

Alternatives

Ychris12138/dsh-usage-stats · lanlandeli/dsh-usage-stats · omdsh-dev-dsh-cost-meter

More plugins in Other

Browse more in Other

Guides for Other plugins