Introduction¶
In the DeepSeek Harness (DSH) web UI, the default session token usage is usually displayed as just a single line of plain text stats below the composer. For DSH plugin developers who need to frequently monitor the context window, cache hits, and generation speed, this single line of text is not intuitive enough: you have to piece together the complete information—how much context is left, how many cache-read/cache-write/uncached tokens are in the input, and the current decode throughput and average TTFT—by looking at each item individually.
dsh-token-usage is a community DSH plugin that replaces the default plain text stats line with clearer bar areas and a details panel. It is maintained by hashdiana, is licensed under MIT, and the current version is 0.1.0.
What is it¶
dsh-token-usage is a pure client-side DSH plugin used to display session Token usage in the DeepSeek Harness web UI. It is not an official component and does not rely on new server-side interfaces; instead, it reads existing persistent projection data in the browser and replaces the default stats cell.
The plugin is registered to the stats cell of conversation.composer.dock with a priority of -1, and therefore replaces the default plain text stats line. The host-side apply() of the plugin is empty, and the client-side part is responsible for the UI display.
Core Features¶
Context Usage Bar¶
The plugin displays Used / window tokens in the bar area and uses color to indicate the context usage status: green when usage is low, amber as it continues to rise, and red when approaching the window limit.
Separation of Input, Output, and Cache¶
The plugin splits the input tokens into cache-read, cache-write, and uncached, and displays the cache-hit rate. This allows you to directly see which tokens constitute the input part of the current session, rather than just seeing a total input count.
Throughput & TTFT¶
The bar area also displays tok/s and TTFT. Here, tok/s represents the decode throughput, and TTFT represents the average first-token latency.
Details Panel¶
Clicking the bar area opens the details panel. The panel shows the context composition, input split, throughput, TTFT, and the session’s turn, step, model, and tool time.
When the content of the details panel exceeds the visible area, fade and blur effects appear at the top and bottom edges, indicating that scrolling is possible; these edge effects disappear when scrolling reaches the end.
Theme & Language¶
The plugin’s styles use --dsw-* tokens to adapt to light/dark themes and provide support for both Chinese and English.
Data Reading¶
The plugin reads persistent projections such as tokenUsage, contextPressure, contextBreakdown, and sessionStats. If there is no data, the entire row is hidden and no empty placeholder is displayed.
Installation and Enablement¶
Install from GitHub¶
The following command installs hashdiana/dsh-token-usage via dsh plugin from GitHub, specifying the web profile:
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:hashdiana/dsh-token-usage
After installation, you need to restart the web profile for the plugin to take effect:
dsh web
Install from Local¶
If you already have the repository code locally, you can install it using the repository path. Replace <path-to-this-repo> with your local directory path:
npx -p @deepseek-ai/dsh dsh plugin --profile web add <path-to-this-repo>
You also need to execute:
dsh web
Typical Usage¶
View Token Usage¶
After installing and restarting, you can see the usage bar below the composer in the DeepSeek Harness web UI. You can directly view the context usage, input, output, cache-hit rate, tok/s, and TTFT.
Click the bar area to open the details panel and view more complete context composition, input split, throughput, TTFT, and session statistics.
Temporary Disable¶
If you only want to temporarily disable the plugin without uninstalling it, you can add a disable item in the patch file of the web profile. The path is:
$DSH_HOME/profiles/web/cordis.patch.yml
Add the following configuration:
- id: dsh-token-usage
disabled: true
Then restart:
dsh web
The default stats line will be restored. To re-enable it, delete the two lines of configuration above and restart dsh web again.
Development Build¶
If you want to modify or contribute to this plugin, you can execute the following in the repository directory:
pnpm install
After installing dependencies, run the type check:
pnpm typecheck
Build the plugin artifacts:
pnpm build
Run the tests:
pnpm test
Note: Git installation uses the pre-built lib/ and does not run the build script during installation. Therefore, when distributing from a Git repository or submitting code, you need to include the lib/ directory.
Scenarios and Notes¶
This plugin is suitable for the following types of users:
- Developers using the DeepSeek Harness web UI for long sessions and long-context development.
- People who need to monitor the composition of cache-read/cache-write/uncached and the cache-hit rate.
- DSH users who want to see
tok/sandTTFTdirectly in the UI. - Community users who want to replace the default plain text stats line to reduce the effort to read information.
Usage notes:
- DSH plugins are loaded in the current
dshprocess environment. It is recommended to check the source code, license, and dependencies before installing. - The license for this plugin is MIT.
- After installing, disabling, or re-enabling, you need to restart
dsh webfor it to take effect. - When installing via Git, the pre-built
lib/artifacts in the repository are used; if there is nolib/, the installation may not yield a usable plugin. - This plugin is a pure client-side plugin; the host-side
apply()is empty, mainly affecting the stats display in the web UI.
Conclusion¶
The value of dsh-token-usage lies in turning a single line of text squeezed below the composer into a glanceable Token usage bar: context usage, input/output/cache breakdown, throughput, and first-token latency can all be seen directly. Clicking also opens a details panel to view session statistics.
GitHub repository:
https://github.com/hashdiana/dsh-token-usage