Preface¶
When running model tasks in the DSH web version, there are often two things you need to confirm: how much balance is left in the DeepSeek account, and roughly how much the current session has cost. If you have to open the backend, dig through logs, or manually check bills every time, it disrupts the normal development workflow.
dsh-deepseek-billing is a DSH WebUI plugin that places DeepSeek account balance and current session cost estimates in the left sidebar, making it convenient to check directly during conversations. It is a community plugin with the repository at https://github.com/Jolly-J/dsh-deepseek-billing, licensed under MIT.
What This Is¶
dsh-deepseek-billing is positioned as a DSH WebUI plugin that displays DeepSeek account balance in the sidebar and estimates costs based on the current session.
The current repository package.json version is 0.1.0-rc.8. The dependency requirements are as follows:
- Node:
^22.19.0or>=24.0.0 - React peer dependency:
^18.2.0
Users can install it directly using the lib/ artifacts committed in the repository, with no need for local builds.
Core Features¶
Balance Display¶
The plugin persistently displays the DeepSeek account balance at the bottom of the left sidebar in the DSH web version.
The balance data is fetched directly from the DeepSeek official balance endpoint, using the same API key currently used by the active model. No separate balance query key is required.
Refresh method:
- Auto-refreshes every 60 seconds
- Manual refresh is also available via a refresh button
Session Cost Estimation¶
The plugin displays an estimated cost for the current session.
The cost is calculated by pricing each successful assistant reply individually, then summing them up for the total session cost. It does not combine all tokens into a single total and then multiply by a unified rate.
After expanding the card, you can see:
- Recharged balance
- Gifted balance
- Token details
- Cache hit rate
- Input cost subtotal
- Output cost subtotal
- Current rate explanation
Interface behavior includes:
- Scroll animation when numbers change
- Automatic updates when switching sessions
- Automatic hiding when the sidebar is collapsed
One important note: the session cost on the card is an estimate, not a bill. The balance is the only source of truth; the card cost is provided solely for attribution reference.
Installation and Activation¶
Method 1: Install via DSH Plugin Marketplace¶
Search for dsh-deepseek-billing in the DSH web plugin marketplace dsh-market and click Install.
After installation, restart:
dsh web
Method 2: Install via Command¶
Run:
dsh plugin --profile web add https://github.com/Jolly-J/dsh-deepseek-billing.git
After installation, restart:
dsh web
Method 3: Install via DSH Agent¶
Send the repository URL to the DSH agent, have it execute the dsh plugin --profile web add ... installation command above, and prompt you to restart dsh web.
Updating the Plugin¶
Run:
dsh plugin --profile web update dsh-deepseek-billing
After updating, restart:
dsh web
Typical Usage¶
After installation and restarting dsh web, you can use it as follows:
-
Open the DSH web version and view the DeepSeek account balance and current session cost estimate at the bottom of the left sidebar.
-
Click the card to expand details and view recharged/gifted balance, token details, cache hit rate, input/output cost subtotals, and current rate explanations.
-
When switching sessions, the card automatically updates the cost estimate based on the current session.
-
When you need to check the latest balance immediately, manually click the refresh button.
For development verification, you can clone deepseek-harness and dsh-deepseek-billing into the extensions directory of the DSH monorepo:
packages/extensions/dsh-deepseek-billing
Then run:
pnpm install
pnpm run build:lib:host
pnpm --filter dsh-deepseek-billing verify
Applicable Scenarios and Notes¶
This plugin is suitable for the following scenarios:
- Long-term use of the DSH web version
- Frequent need to check DeepSeek account balance
- Desire to roughly understand cost changes in the current session
- Want to reduce the operations of opening the backend or checking bills
Before use, please note:
- The plugin runs with the current
dshprocess permissions; review the source code and license before installation. - Session cost is an estimate, not a bill.
- The balance is the only source of truth; card cost is provided solely for attribution reference.
- The card does not include failed retries.
- The card does not include background model calls, such as session title generation or web search queries.
- The card does not include reasoning tokens.
- The card does not include sub-agent session usage.
- Costs are only tracked for the current session; sub-agent sessions are not yet aggregated.
- Model × time-period grouped details are not saved.
- The interface only displays the session total and input/output subtotals.
- Reasoning tokens are currently counted but not priced.
- The price table is hardcoded in the code; plugin updates are needed after official price changes.
- There is no official price query API.
- The UI text is currently in Chinese.
API Key Security¶
The plugin does not store, steal, or share API keys.
It only temporarily uses DEEPSEEK_API_KEY to call the DeepSeek official balance endpoint and discards it immediately after use.
The scope of key handling is as follows:
- It only exists in the plugin process memory on this machine for an instant
- It is only placed in the
Authorizationrequest header sent to DeepSeek official - It is not included in command-line arguments
- It is not included in environment variables
- It is not included in logs
- It is not included in web interface returns
- It is not persisted to disk
Known general risks include:
- Processes on the same machine with the same permissions can theoretically read the host process memory
- People who can access the DSH web port on the LAN can see the balance number but cannot see the key
If you are concerned about this, it is recommended to add access restrictions to /billing/status at the deployment layer.
Conclusion¶
The value of dsh-deepseek-billing is very specific: it persistently displays the DeepSeek account balance in the DSH web sidebar and provides current session cost estimates. It does not replace billing, but only helps you quickly verify balance and cost attribution during task execution.
Repository address:
https://github.com/Jolly-J/dsh-deepseek-billing