
LaoYueHanNi/dsh-token-usage
51Last commit Aug 15, 2026
dsh-token-usage DSH plugin
After installation, open Settings and find the Token Usage page with summary cards, daily chart, per-model breakdown, and pricing dialogs. It records token usage per request via a live hook and supports history backfill. Pricing is computed from per-model rates, with auto-fetched cloud prices and manual overrides.
How to install the dsh-token-usage DSH plugin
dsh plugin --profile web add github:LaoYueHanNi/dsh-token-usageCopying does not run this command. Review the repository and version before installing the dsh-token-usage DSH plugin.
dsh-token-usage DSH plugin data source
dsh-token-usage DSH plugin snapshot date: Aug 16, 2026
discovered
What the dsh-token-usage DSH plugin can do
- Live hook: records every successful model request to per-day JSONL files (request id, model, tokens, time, session id).
- Web stats page: date range and model filters, 1d/7d/30d shortcuts, summary cards, daily trend chart, per-model table with cost column.
- Cost computation: per-request cost calculated from per-model rates, total cost card, warning strip for unpriced models.
- History backfill: first startup syncs requests that happened before installation.
- Model pricing dialog: shows full rate table per model, including context tiers, peak windows, and time rules.
Where the dsh-token-usage DSH plugin fits
- Monitor API token consumption and costs across models in real time.
- Analyze daily token usage trends to optimize model selection or budget.
- View per-model breakdown of token usage and cost for allocation or billing.
- Set manual pricing overrides for models not covered by the cloud feed.
- Backfill historical token usage data after plugin installation.
Who the dsh-token-usage DSH plugin is for
- DSH users who want to track API token consumption and costs.
- Developers or teams managing multiple models and needing to optimize spending.
dsh-token-usage DSH plugin limitations
- Only works with the web profile of DSH (install command specifies --profile web).
- Pricing depends on cloud feed availability; without it, models may be unpriced and cost counted as ¥0.
- Data files are stored locally under ~/.dsh/token-usage/ and require manual cleanup if no longer needed.
dsh-token-usage DSH plugin: from the repository README
Quoted from the LaoYueHanNi/dsh-token-usage README, the upstream source of the dsh-token-usage DSH plugin. Copyright remains with the original authors.
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 (with cost), a daily total-token line chart, a per-model breakdown, and per-model pricing dialogs, all filterable by date range and model, exactly as shown in the screenshot above. [dsh]: https://github.com/cordiverse/dsh 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`/`30d` shortcuts), summary cards, daily trend chart (hover a day for its total), 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 in the per-model table, and a warning strip for unpriced models (their cost counts as ¥0). Every priced model's name carries a small **rates button** that opens a dialog with that model's full price table: **each row
Read the full READMEThe repository declares no license. Check with the authors before using it.
dsh-token-usage DSH plugin questions
How do I install this plugin?
Run `dsh plugin --profile web add github:LaoYueHanNi/dsh-token-usage` in your terminal. The package declares `dsh.bundle`, so it wires into the profile automatically. No config editing needed.
How do I update the plugin?
Use `dsh plugin --profile web update dsh-token-usage`. This will pull the latest version from GitHub and apply it to your web profile.
Where is the token usage data stored?
Data files are stored under `~/.dsh/token-usage/` by default. You can configure the path via `path` in the plugin settings. The data includes JSONL files for each day and the pricing files.
How can I set custom pricing for a model?
Edit the `pricing.json` file in the data directory. Add an entry for the model with `inputPerMillion` and `outputPerMillion` (and optionally `cacheReadPerMillion` and `cacheWritePerMillion`). Save and refresh the stats page to apply changes.
How do I remove the plugin completely?
Run `dsh plugin --profile web remove dsh-token-usage`. This removes the plugin from the profile. Data files under `~/.dsh/token-usage/` are kept; delete them manually if you no longer need them.