Preface¶
In the development workflow of DeepSeek Harness (DSH), monitoring token consumption, evaluating cache hit rates, and analyzing usage distribution across different models are fundamental requirements for cost control and performance optimization. Typically, this involves manually parsing logs or relying on scattered counters, lacking a unified and intuitive dashboard. The dsh-plugin-usage-stats plugin addresses this by directly reading adapter usage data to provide a full-page usage statistics report within the Web interface.
Plugin Introduction¶
Maintained by fakeNihilist, this plugin’s core responsibility is to answer the question: “How many tokens were used in these sessions?” It does not register tools, inject prompts, or modify requests. It is completely invisible to the model and does not affect prompts or KV caching. Upon installation, a “Usage Stats” (用量统计) entry is added to the left sidebar of the Web GUI, displaying a full-page dashboard in the main area.
Core Features¶
The dashboard contains only two interactive controls: a full-page “Refresh” button and a set of time range toggles for “7 Days / 30 Days / All”. Switching the range only changes the view window; all views share the same data payload and statistical scope.
- Overview Cards: Display today’s tokens, accumulated tokens (broken down into input, output, and cache read), and cache hit rate. Also includes today’s cache rate, and today’s/accumulated request counts.
- Token Activity: Displays a one-year daily heatmap using a GitHub-style blue four-level color scale. Hovering over any cell reveals all metrics for that day.
- Daily Token Trends: A stacked bar chart showing input and output, with a light yellow cache hit rate bar overlaid in the background (right axis, 0–100%).
- Model Usage: A donut chart on the left and a legend on the right (model name, percentage, token count). Hovering over a sector or legend item reveals the percentage, call count, and cache rate.
- Breakdown Table by Model: Grouped by provider, showing model, call count, uncached input, output, cache read, cache rate, and total. The table header is sticky, and the content is scrollable.
Data Characteristics:
* No Settings: Ready out of the box with no configuration files or parameters to adjust.
* No Inference: All figures are taken directly from the usage reported by the adapter. No inference, character-count conversion, or zero-padding is performed.
* Hover Readouts: Token values on heatmap cells and trend bars are abbreviated to K/M/B units (e.g., 698.9M), while call counts and cache rates remain as full numbers.
Installation and Activation¶
Install the plugin via the DSH package manager:
dsh plugin add https://github.com/fakeNihilist/dsh-plugin-usage-stats
After installation, restart the Host process to load the new code, then refresh the Web interface to see the “Usage Stats” entry in the left sidebar.
Typical Usage¶
- Open the Web GUI and click “Usage Stats” in the left sidebar.
- Click the “Refresh” button in the main area to update data.
- Use the “7 Days / 30 Days / All” buttons at the top to switch time ranges; views will update synchronously.
- Hover over heatmap cells, trend bars, or donut sectors to view detailed values (heatmaps and trends use independent windows/tooltips).
Applicable Scenarios and Notes¶
This plugin is suitable for developers who need granular monitoring of token consumption, evaluation of cache strategy effectiveness, and model cost allocation.
Notes:
* Timezone: Statistics use the host’s local timezone; the offset is fixed at process startup.
* Sub-sessions: Usage from sub-agent sessions is included in the total.
* Cache Writes: Currently, cacheWriteTokens is always 0 on the DeepSeek adapter, so this column is not listed in the breakdown table.
* Workspaces: Grouped by the session’s cwd; sessions without a cwd are grouped by session ID.
* Parameter Meaning: The days parameter is a lower bound, not an upper bound; “All” equals the span of the corpus itself (not all data since database creation).
* Heatmap: Bars are not drawn for dates without billable input.
* Theme Compatibility: Borders and explanatory text under the light theme are derived by the plugin itself.
Ecosystem Background¶
The DSH philosophy is “Everything is a plugin.” There is no affiliation between the community catalog and DeepSeek officials.