dsh-token-metrics: A Token Usage Statistics Page for DeepSeek Harness
hugoyee75-cmyk/dsh-token-metrics
A DSH plugin that logs every model call and adds a sidebar token-usage dashboard, broken down by model, provider, project and date, with cache hit rate and trend charts.
dsh-token-metrics is a DSH plugin that records every model call passing through DeepSeek Harness and presents a complete usage page in the sidebar. It answers questions that are otherwise invisible: where tokens actually go, whether cache hits pay off, and which model or project consumes the most. All data is read from DSH's own session logs, with no extra requests and nothing uploaded. The plugin offers eight summary metrics, breakdowns by model, provider and more, a switchable trend chart plus a share donut, and supports startup backfill of history and self-update.
How to Install
dsh plugin --profile web add github:hugoyee75-cmyk/dsh-token-metrics- Category
- Models & Reasoning
- Platform
- DSH Plugin
- Author
- hugoyee75-cmyk
- Distribution
- Plugin
dsh-token-metrics Key Features
dsh-token-metrics Repo Summary
What Does It Do?
Token Metrics is a DSH plugin for DeepSeek Harness that records every model call passing through the harness and renders a token usage page in the sidebar. It solves the problem of not knowing where tokens go, whether caching pays off, and which model or project burns the most usage, with all data read from DSH's own session logs and nothing sent or uploaded. Maintained by hugoyee75-cmyk under the MIT license, it is written in JavaScript with zero runtime dependencies and no build step.
Core Features
- Eight summary metrics: input, output, cacheRead, cacheWrite, reasoning, total, call count and cache hit rate, across today, the last 7 days and all time.
- Multi-dimensional breakdowns: switch detail tables by model, provider, project, source (main session / sub-agent / workflow), account and date, with projects grouped by session working directory.
- Charts: one main trend chart switchable across four views (total, hit rate, input composition, by model) plus a model share donut, with light and dark color sets that follow the theme.
- Merged model view: the donut and trend merge by model name across providers, while detail tables stay split by provider.
- Startup backfill and persistence: the first open scans existing session logs to reconstruct past usage with visible progress, and data survives restarts and accumulates across sessions.
- Self-update: the version number in the corner is itself a button that checks for updates, with a status light for up to date, update available or not checked, plus install and hot reload.
How to Use This Plugin?
After enabling it in DSH, a Token Usage icon appears in the sidebar; opening it shows the statistics page with time-range and model filters on top, the eight summary metrics in the middle, and the trend chart, donut and detail tables below. The first visit automatically backfills historical usage from existing session logs and displays scan progress. To tune behavior, override the plugin's config in your profile, for example flush debounce, snapshot cache duration, retention days, number of trend series, whether to show session details, or whether to count failed attempts; note that an override replaces the whole config block, so rewrite the other fields when changing a few. Buttons at the top of the page also let you flush to disk, check for updates, or rebuild all statistics from session logs.
How to Troubleshoot This Plugin?
If the interface language does not follow the DSH setting, the language field or subscription is usually at fault: the active language field is active, and the panel must subscribe to locale changes or already-open pages will not re-render. If numbers look off, check the counting rules first: failed request attempts are retry intermediates and are excluded by default to avoid double counting, while compaction and title generation are captured through stream events. If detail data is missing, trigger a full rebuild of statistics from the session logs.
This page is an independent rewrite of the plugin's official README — for authoritative documentation and the latest changes, refer to the source: hugoyee75-cmyk/dsh-token-metrics. The plugin is third-party code that runs on your machine once installed; inclusion does not imply endorsement — please review the source before installing.
DSH Plugin FAQ
