Introduction¶
When debugging sessions or agents within DSH’s Web UI, costs, balances, cache hits, and token usage are usually scattered in different locations. dsh-cost-balance places these statistics below the input box: by default, it is a centered small black bar that expands into a semi-transparent multi-line panel upon clicking. The DSH plugin system emphasizes “everything is a plugin,” and this plugin can be integrated as an entry point for statistics in the web profile.
The following introduces its positioning, features, installation methods, and considerations.
What is it¶
dsh-cost-balance is a DeepSeek Harness (DSH) Web UI plugin maintained by zoumutou under the MIT license.
It is registered in the conversation.composer.dock slot, taking over the shipped stats cell to display statistics below the input box.
The plugin consists of a client and a Host component: the client is responsible for the UI collapsing/expanding and reading data via a same-origin interface; the Host is responsible for registering routes, calculating costs, and retrieving balances.
Core Features¶
Display Content¶
By default, it is collapsed into a centered small black bar, similar to the iOS bottom bar. Clicking it expands a frosted glass panel to view:
- Turns / Steps
- LLM Time / Tool Calls
- Avg First Token / Throughput
- Cache Hits
- Token Input / Output
- Session Cost
- Account Balance
The balance is displayed as the real-time balance of the DeepSeek account, with automatic refresh every 60 seconds.
Data Source and Refresh¶
The client reads data via the same-origin GET /api/cost-balance endpoint, automatically refreshing every 60 seconds; it recalculates immediately when token usage changes.
The Host registers the /api/cost-balance route via webServer. The cost is calculated by multiplying the accumulated tokens of the session by the model’s unit price. The balance is obtained by parsing the DEEPSEEK_API_KEY via the credentials service and calling the official DeepSeek GET /user/balance endpoint; it has a 60-second cache and a 30-second suppression period after a failure.
The balance is sourced from the user’s own API Key account and does not require additional configuration. When not configured or the fetch fails, the panel displays:
Balance --
It includes built-in DeepSeek official pricing, covering cache hits, cache misses, and output prices for deepseek-v4-flash and deepseek-v4-pro.
The README mentions that DeepSeek switched to peak-valley billing starting at 2026-08-16 16:00 UTC, where off-peak rates are half of the peak rates.
Installation and Usage¶
NPM Release¶
First, execute the installation command to add the plugin to the web profile:
dsh plugin --profile web add dsh-cost-balance
This command pulls the published dsh-cost-balance (dsh.bundle) from the npm registry and adds it to the profile’s bundle layer.
Then, restart (or refresh) the DSH Web UI. Following these steps, a default collapsed small black bar will appear below the input box, which can be clicked to expand the statistics panel.
The uninstall command is as follows:
dsh plugin --profile web remove dsh-cost-balance
Source Code Installation¶
If you are developing or debugging locally, first clone the repository, then navigate into the directory, and finally add the current directory as a plugin to the web profile:
git clone https://github.com/zoumutou/dsh-cost-balance.git
cd dsh-cost-balance
dsh plugin --profile web add .
The current version in the repository’s package.json is 0.1.0.
When publishing a new version, first modify the version in package.json, then execute npm publish; the account requires a 2FA bypass token, see npm documentation.
Pricing Overrides¶
When DeepSeek’s billing rates adjust, you can override the prices configuration in the profile’s cordis.patch.yml without waiting for the plugin to update.
The override entry must retain the plugin ID and configure the target model price fields under config.prices:
- id: cost-balance
config:
prices:
deepseek-v4-flash:
# fill cacheHit / cacheMiss / output as needed
deepseek-v4-pro:
# fill cacheHit / cacheMiss / output as needed
Overrides are whole-line replacements, so be sure to retain id: cost-balance.
Use Cases and Considerations¶
Suitable for users who need to quickly view session costs, account balances, cache hits, and token usage within the DSH Web UI.
Precautions before use:
- The plugin runs with the permissions of the current DSH process. The Host will register routes and call interfaces; you should check the source code and MIT license before installing.
- The balance depends on
DEEPSEEK_API_KEY; when not configured or the fetch fails, it displaysBalance --. - Pricing overrides are whole-line replacements; be sure to retain
id: cost-balancewhen modifying the configuration.
Related Links¶
This plugin consolidates costs, balances, cache hits, and token usage below the input box, making it suitable as a lightweight statistics entry point for the DSH web profile.
GitHub:
- https://github.com/zoumutou/dsh-cost-balance
Directory Page Link:
- https://www.skillhub.cn/plugins/zoumutou/dsh-cost-balance
The directory page link is from an independent site and does not represent the official DeepSeek or Huanfang app store.