Introduction¶
DeepSeek Harness does not retain usage views across sessions; once a session is deleted, historical consumption can no longer be queried. dsh-usage-stats is a local usage statistics plugin. It records the four token types for each model call into a SQLite ledger and buckets them by day × provider × model. It only tracks usage and does not calculate costs, making it suitable for developers who need to distinguish main conversation calls from internal calls (such as compression and summarization).
Core Features¶
- Local SQLite ledger: Data is stored in
$DSH_HOME/storages/usage-stats/. - Bucketed statistics: Buckets by day × provider × model and tracks input, output, cache hits, and cache reads/writes.
- Call distinction: Distinguishes main conversation calls from DSH internal calls (such as compression and summarization).
- Historical backfill: Supports backfilling historical session data from before the plugin was installed.
- Permission control: Allows local loopback access only; no access to credentials or conversation content.
Installation and Enablement¶
The plugin only supports the Web GUI profile (dsh web); restart the service after installation.
- Install
dsh plugin --profile web add @lengduan/dsh-usage-stats
- Upgrade
dsh plugin --profile web update @lengduan/dsh-usage-stats
- Disable (preserve ledger)
Override indsh web’scordis.patch.yml:
- id: usage-stats
disabled: true
- Remove (preserve ledger)
dsh plugin --profile web remove @lengduan/dsh-usage-stats
Usage¶
- Install and restart
dsh web. - Open any session with an existing conversation.
- Switch to the Usage Statistics tab at the top of the session view.
- By default, it shows data for Today · All scope.
- Filter data by time range (today/this week, etc.) and scope (all/conversation/internal).
- Click a provider row to expand/collapse and view its model breakdown.
- Click Refresh to refetch data.
Use Cases and Notes¶
- Applicable scenarios: For users who need to verify token consumption by day or by model and need to view main conversation calls and DSH internal calls separately.
- Unsupported: TUI/headless environments (there is no Web slot to attach to), cost calculation (this plugin only has token counts and does not multiply by unit price), and cross-machine aggregation (the ledger is a single-machine file).
- Remote access: Remote access depends on the paired gated channel provided by
@linxin666/dsh-remote-web-ui. If this plugin is not installed or not paired, direct LAN access to/usage/apiwill return a403error. - Uninstall behavior: Uninstallation does not delete the local ledger. To clear history, manually delete the
$DSH_HOME/storages/usage-stats/directory.