DeepSeek Harness (DSH) is designed around the idea that “everything is a plugin.” In multi-session or batch-use scenarios, tracking whole-machine Token consumption often requires manually aggregating logs from multiple directories. The zoyluoblue/deepseek-harness-token plugin folds the session logs from all dsh home directories and provides a centralized Token view.

This is a DeepSeek Harness (DSH) plugin for reporting whole-machine Token usage statistics. It aggregates the session logs from each dsh home directory (~/.dsh and ~/.dsh_desktop/<version>). In the settings page, it displays totals, a GitHub-style contribution heatmap, streak records, peak hours, and per-model breakdowns (input / cache read / cache write / output). It registers zero model-facing tools and does not append session events, so mounting it does not increase conversational cost.

Installation and Enablement

Before installing, ensure that Node.js ^22.19 || >=24 and pnpm are installed on the system (dsh plugin is a thin pnpm frontend).

dsh plugin --profile web add @zoytown/dsh-token

After installation, open Settings in DSH and go to the Token page to view the statistics.

If the current environment does not have a global dsh command, you can also install it using one of the following methods:

npx -y @deepseek-ai/dsh plugin --profile web add @zoytown/dsh-token
# 或者
pnpm dsh plugin --profile web add @zoytown/dsh-token

Configuration

The plugin’s configuration keys are located in the profile’s cordis.patch.yml file under the key dsh-token:

Key Default Meaning
extraSessionRoots [] Additional dsh home directories to scan. ~/.dsh and ~/.dsh_desktop/<version> are already covered by default. If a home directory accessed via $DSH_HOME does not take effect, list it here.
includeCompaction true Whether to include the Tokens consumed by generating compaction summaries (the tokenUsage projection in dsh itself cannot see this part). Set to false to make it align 1:1 with the projected data.
refreshIntervalMs 30000 Frequency, in milliseconds, for rescanning new session logs.
indexChunkYieldMs 16 Interval, in milliseconds, for cooperative yielding during scanning.

Features and Limitations

Data Source and Access Method

The plugin reads local files only, operates in read-only mode, does not write to sessions, and does not contact network services. It responds only to loopback callers.

Supported Shell and Data Paths

The plugin only supports dsh web. The Electron desktop Shell cannot load this plugin due to limitations in native module resolution, so installing it in the desktop Shell’s DSH_HOME is not supported. However, session logs recorded by the desktop Shell under ~/.dsh_desktop/<version>/ can still be read by the Web Shell.

Excluded Features

  • Cost estimation: The plugin does not store price tables and does not provide currency estimates. Account balance is within the scope of @zoytown/dsh-billing.
  • Model tools: The plugin does not register any model-facing tools.

Statistical Definitions

The footer at the bottom of the page discloses billing coverage, retried steps, sessions that are still being written to, and skipped logs.

  • Total tokens: Includes cache reads. This is the sum of four mutually exclusive provider buckets.
  • Sessions: Excludes sub-agent sessions, but includes their Token counts.
  • Messages: Refers to non-empty assistant messages, not log entries. Streaming responses can generate a large number of delta events, which may cause entry counts to differ by two or three orders of magnitude.
  • Daily/hourly: Uses the local calendar (Intl API). Streaks are calculated using a noon anchor to avoid the impact of daylight saving time transitions.
  • Retried steps: If a provider request is retried within a step, the log retains only the final usage report. As a result, retried steps may underestimate consumption.