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.

  1. Install
    dsh plugin --profile web add @lengduan/dsh-usage-stats
  1. Upgrade
    dsh plugin --profile web update @lengduan/dsh-usage-stats
  1. Disable (preserve ledger)
    Override in dsh web’s cordis.patch.yml:
    - id: usage-stats
      disabled: true
  1. Remove (preserve ledger)
    dsh plugin --profile web remove @lengduan/dsh-usage-stats

Usage

  1. Install and restart dsh web.
  2. Open any session with an existing conversation.
  3. Switch to the Usage Statistics tab at the top of the session view.
  4. By default, it shows data for Today · All scope.
  5. Filter data by time range (today/this week, etc.) and scope (all/conversation/internal).
  6. Click a provider row to expand/collapse and view its model breakdown.
  7. 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/api will return a 403 error.
  • Uninstall behavior: Uninstallation does not delete the local ledger. To clear history, manually delete the $DSH_HOME/storages/usage-stats/ directory.