Introduction¶
In the development workflow of DeepSeek-Harness (DSH), monitoring Token consumption and billing by model or time period is a common requirement. dsh-token-tracker is a web plugin for processing this data. It aggregates provider Token usage from persistent session logs and provides peak/off-peak pricing. It displays totals in the DSH GUI and offers a standalone overview page and a JSON API.
Plugin Overview¶
This is a DSH client plugin maintained by XiaHouSheng (MIT License). The plugin runs inside the DSH host, listens to session events, aggregates Token data, and displays it in the Web interface.
Core Features¶
- Data Aggregation and Display: Aggregates provider Token usage from session logs.
- Time-Based Pricing: Supports peak/off-peak pricing.
- GUI Overlay Elements: Displays a Token badge and period label in the DSH GUI header, and provides a Tracker button, composer dock line, turn-end tail, and
conversation.viewToken label. - Standalone Page and API: Provides a standalone overview page and JSON API.
Installation and Enablement¶
Before installing this plugin, DeepSeek-Harness (dsh) must be installed first, because it is a peer dependency. The plugin itself is an installable dsh plugin package, with prebuilt content in the lib/ directory.
- Install the plugin:
Run the following command to install the plugin package:
dsh plugin --profile web add https://github.com/XiaHouSheng/dsh-token-tracker.git
- Start DSH:
Start the service to activate the plugin layer:
dsh --profile web
Typical Usage¶
-
Configure pricing:
Place atoken-pricing.jsonfile in the workspace root or session cwd to override the default prices. The system reads this file and bills based on cached/uncached, input/output, and peak/off-peak periods. -
Access pages:
* Standalone overview page: Visithttp://127.0.0.1:<port>/dsh-token-tracker.
* JSON API: Visithttp://127.0.0.1:<port>/dsh-token-tracker/api.
Notes¶
- The plugin runs inside the DSH host and uses its runtime environment.
- Rebuilding from source requires Node.js >= 20 and pnpm, but installing the plugin itself does not require these dependencies.
- The plugin is an installable dsh plugin package, with prebuilt content in the
lib/directory.
Summary¶
This plugin provides DSH users with visualized Token monitoring and billing capabilities. For more details, see the GitHub repository.