Preface¶
When running DeepSeek models in DSH Web, the cost is not a simple number: input, output, and cache hits all affect the price, and costs vary between peak and off-peak hours. If you only dig through logs after the fact to estimate costs, it is easy to miss items and difficult to export.
dsh-token-billing is a DSH plugin that brings real-time cost, price sources, historical ledger, statistics, and export into a single configuration entry point. DSH’s plugin ecosystem is organized around the principle of “everything is a plugin”; this plugin is a third-party extension with no official affiliation with DeepSeek/Hangfang, and it is not part of the official DeepSeek app store.
What This Is¶
2006spy/dsh-token-billing is a real-time token billing plugin for DeepSeek Harness (dsh), licensed under MIT, and categorized as a networking tool in the documentation.
It targets DSH Web, addressing the issues of unclear in-session costs, difficult historical cost queries, and the challenge of categorizing costs across multiple Providers.
Core Features¶
Here are the main capabilities listed in the documentation:
- Direct billing based on DeepSeek official RMB prices: The default price source is the DeepSeek official Chinese page, with the English page as a fallback; foreign currency prices can be automatically converted to RMB.
- Prices follow the official website in real-time: Price tables can be updated as the official website changes, reducing manual maintenance of fixed prices.
- Automatic peak/off-peak switching: The plugin distinguishes between peak and off-peak periods according to official billing rules.
- Visual custom model pricing: Maintain model price overrides in the plugin configuration; these overrides have the highest priority and do not participate in peak/off-peak switching.
- Multi-currency fallback: Foreign currency prices can be converted to avoid incomplete display when using a single currency.
- Persistent historical ledger + multi-dimensional statistics: Settlement results are saved as a historical ledger and used for subsequent statistics.
- Account balance query: Requires a
DEEPSEEK_API_KEY; the documentation states the key is not sent to the browser. - CSV / JSON export: Supports exporting the ledger as CSV or JSON.
- Local model savings statistics: Used to compare local model calls against nominal API prices to calculate savings.
- Provider billing type classification: Supports subscription, free, and local billing types to distinguish actual spending from nominal value.
- Token usage and cache hit statistics: View token usage and cache hit information.
- Statistics page dashboard: Provides a dashboard-style statistics page for an overview of costs and usage.
Installation and Activation¶
Before installing, confirm you are operating within a DSH web profile. The installation methods given in the documentation include the plugin marketplace, pnpm dependencies, and local source code linking.
Plugin Marketplace (Marked as Pending in Documentation)¶
The entry points given in the documentation are:
- Open DSH
- Go to
Settings → Plugins → Marketplace - Search for
dsh-token-billing - Click Install
Note: The documentation marks this method as recommended but pending listing; whether it is actually listed has not been confirmed in verified materials. If the search yields no results, you can use the dependency installation method below instead.
Installing Dependencies in the Web Profile Directory¶
This step adds the plugin as a dependency to the DSH web profile. Execute the following in the web profile directory:
pnpm add github:2006spy/dsh-token-billing#main
Then mount the plugin. Append the following to ~/.dsh/profiles/web/cordis.patch.yml:
- insert:
- id: token-billing
name: dsh-token-billing
After completing these steps, restart DSH for the plugin to load and take effect.
Local Source Code Linking¶
If you want to read the source code or modify configurations, you can clone the repository first:
git clone https://github.com/2006spy/dsh-token-billing.git
Then connect it to the web profile as a link dependency. The documentation does not provide more specific examples for local linking fields; follow DSH’s dependency configuration method in practice.
Basic Usage After Activation¶
- Open
Settings → Plugins → Web UI Plugins → Token Billing, and save the configuration for immediate effect. - Initiate a DeepSeek request in a DSH Web session and check if a cost line appears.
- Go to the statistics page to view the historical ledger, token usage and cache hits, balance, and export options.
- To adjust prices, maintain model price overrides; this configuration has the highest priority and does not participate in peak/off-peak switching.
- If using local or subscription Providers, configure the Provider billing type classification to distinguish actual spending from nominal value.
Under DSH desktop version 2.0.2 (core 0.1.1-rc.1+), the documentation requires updating the plugin to v0.7.1 and restarting DSH; otherwise, the cost line will not display and the ledger will be frozen.
Applicable Scenarios and Notes¶
Suitable for the following usage patterns:
- Calling DeepSeek models within DSH Web and wanting to see session costs in real-time.
- Needing to view the historical ledger and export it as CSV / JSON.
- Using local models, subscription Providers, or free Providers, and wanting to distinguish between “actual spending” and “nominal value”.
- Needing account balance queries and being able to accept using a
DEEPSEEK_API_KEYfor balance checks.
Points to note before use:
- The plugin runs with the permissions of the current DSH process; inspect the source code and license before installation. This plugin is licensed under MIT.
- The directory page, GitHub page, and plugin leads in the documentation come from third-party repositories and cannot replace the official DeepSeek price page. Cost calculations should be based on the price source, configuration, and official rules you actually use.
- Account balance queries depend on the
DEEPSEEK_API_KEY; the documentation states the key is not sent to the browser. - The official peak/weekend off-peak rule takes effect from
2026-08-23 00:00Beijing time; before that date, weekends are still billed at peak rates, and historical reviews will not be halved. - The availability of the plugin marketplace entry has not been confirmed; the documentation marks it as pending listing.
Links¶
- Directory page: https://www.skillhub.cn/plugins/2006spy/dsh-token-billing
- GitHub: https://github.com/2006spy/dsh-token-billing