DeepSeek Harness (DSH) adopts a plugin-based architecture that allows developers to extend its functionality. dsh-shanhai-stats is a usage statistics plugin that extracts data from DSH session logs and provides overall summaries, daily trends, a GitHub-style heatmap, and details grouped by model or provider.
Installation and Activation¶
Install it using the official plugin command:
dsh plugin --profile web add github:cn-zhangpeng/dsh-shanhai-stats
After installation, view it in DSH Settings → Usage Statistics.
Core Features¶
Data Source and Definitions¶
The plugin’s data comes from assistant/message events in DSH session logs, including the usage and message.source.provider/model fields. The plugin does not calculate tokens by itself; it only aggregates and displays data. Its data definitions are consistent with DSH:
* inputTokens: non-cached input.
* cacheReadTokens: cached input reads.
* cacheWriteTokens: cache writes.
* outputTokens: already includes reasoningTokens.
Time Dimensions and Historical Backfill¶
- Time dimensions: provides overall
totals, per-workspace (perWorkspace), and per-model (perModel) aggregation dimensions, and values never reset to zero. - Daily details: retains a 53-week sliding window.
- Historical backfill: when the plugin is activated, it scans all local workspace sessions. Subsequent updates are folded incrementally from real-time events, and missing data is backfilled using
seqresume points and gap detection. - Subagents: supports subagent sessions, which are counted naturally alongside their events.
View Display¶
The plugin provides four sections:
1. Total Summary Badges: displays total tokens spent, cache hit rate, total usage count, total request count, model usage, and consecutive usage days. By default, the page opens in the “Today” view.
2. Daily Trend Line Chart: displays daily token trends for input, cache hits, cache writes, and output. Supports switching between Today / 1-day / 7-day / 30-day views.
3. GitHub-style Heatmap: displays daily activity levels over the past year; hover to view details.
4. Usage Details Table: supports switching between “By Provider” and “By Model” tabs to view token usage, message counts, and cache hit status for each provider or model.
Usage Instructions¶
- By default, the page opens in the “Today” view. You can switch to 1-day / 7-day / 30-day views or a custom range using the dropdown menu.
- In the Usage Details Table, click the “By Provider” or “By Model” tab to switch.
Notes¶
- First activation scans local historical sessions; after scanning is complete, the numbers will no longer change frequently.
- A
perModelaggregation dimension byprovider × modelhas been added. - The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license before installation.
Ecosystem Context¶
This plugin is a resource in the community catalog and has no official affiliation with DeepSeek or High-Flyer.