Introduction¶
DeepSeek Harness (DSH) is a plugin-based intelligent agent development framework. During development and debugging, developers need to understand the current session’s model API call frequency and Token consumption. The official Web interface currently does not provide a direct usage statistics view, and manually checking logs is cumbersome.
The dsh-usage-info plugin fills this gap. It does not rely on external services and directly generates statistical reports locally based on DSH session logs.
Feature Positioning¶
This is a localized usage statistics plugin maintained by shenzhantu. It adds a “Usage Info” navigation item under “Settings -> Plugins” in the DSH Web interface to display today’s and this month’s API call status.
The core value lies in answering two questions:
1. How many model API calls were made today / this month in total?
2. For each model (vendor/model), how many requests were made and how many Tokens were used?
Core Features¶
- Local statistics and snapshots: Pure local JSON persistence with no database dependency. The page API directly returns an in-memory snapshot, loads quickly, and does not require waiting for historical scans.
- Automatic reconstruction and incremental synchronization: After the service starts, it automatically performs a full reconstruction of historical statistics from local session logs, then only performs incremental synchronization; data is not lost after restart.
- Grouping and sorting: Groups by vendor/model to count requests and Tokens. Models from the same vendor are grouped together, and models within a vendor are sorted A-Z.
- Detailed data dimensions: Supports switching between today/this month views. Includes Tokens input (distinguishing cache hit/miss) and Tokens output statistics.
- Privacy and security: Raw data only reads DSH local session logs; it does not modify or upload any session content. The page API only accepts GET and verifies that requests come from the local loopback address.
Installation and Enabling¶
Before installation, ensure that the web profile of DSH is installed (version @deepseek-ai/dsh >= 0.1.0-rc.6).
Use the official installation command to add the plugin:
dsh plugin --profile web add "github:<your GitHub username>/dsh-usage-info"
After adding, restart dsh web and refresh the browser to take effect.
Usage¶
- Restart
dsh web. - Open the Web interface and go to Settings.
- Click Usage Info under Plugins in the left navigation.
- Switch to the This Month or Today view at the top of the page.
Statistical Definitions¶
The plugin collects statistics by parsing DSH session events:
- Request count:
assistant/message: counts as 1 requestcompaction/summary: counts as 1 requestsession/title-llm-request: counts as 1 request (DSH does not persist usage for this event, so Tokens are 0)
- Token calculation:
- Tokens input (cache hit): from
cacheReadTokens - Tokens input (cache miss):
inputTokens + cacheWriteTokens - Tokens output:
outputTokens
- Tokens input (cache hit): from
Data and Privacy¶
- Storage location: Statistics results are cached in
~/.dsh/storages/dsh-usage-info.json. If you delete this file, it will be automatically reconstructed on the next start. - Data source: All data comes from DSH local session logs.
- Network requests: It does not calculate prices, query official balance/billing, or make any upstream network requests.
Applicable Scenarios¶
Suitable for developers who need to monitor local model invocation costs, verify API call logic, and check cache hit rates.
Conclusion¶
dsh-usage-info provides a lightweight, privacy-friendly way to track DSH usage. All calculations are completed locally and do not involve uploading sensitive data.