Introduction¶
DSH supports extending the web host via plugins. @choi-p/dsh-deepseek-balance is a balance monitoring plugin: it displays the DeepSeek account balance at the bottom of the sidebar in dsh web, above the Settings button, and supports real-time configuration of the display currency and warning thresholds.
What is this¶
@choi-p/dsh-deepseek-balance is a DSH plugin by author Choi-Peng with an MIT license.
It solves the problem of continuously viewing the DeepSeek account balance within the current DSH Web interface and allows adjusting the display method and warning thresholds on the plugin settings page.
The plugin reads the DeepSeek API key from environment variables, registers proxy routes and a settings namespace on the host side, injects the balance display into the sidebar on the client side, and provides a configuration card on the plugin settings page.
Core Features¶
- Displays the current DeepSeek account balance at the bottom of the left sidebar, above the
Settingsbutton. - Balance auto-refreshes every 60 seconds.
- Supports three display modes: CNY only, USD only, and showing both CNY/USD.
- Supports configuring warning thresholds separately for CNY and USD.
- Configuration takes effect in real-time; no need to restart
dsh web. - Automatically hides the balance display when the sidebar is collapsed into rail mode.
- Reads the API key from the
DEEPSEEK_API_KEYenvironment variable. - Edit configuration and save or reset in the
Settings → Plugins → Balance Monitorcard.
Host and Client Integration Points¶
This plugin consists of both host and client parts:
- Host side registers
/deepseek-balanceproxy route anddeepseek-balancesettings namespace. - Client side registers the balance display in the
sidebar.footer.actionslot and registers theBalance Monitorcard insettings.plugin.item.
The API key is only held by the host side and sent with the request as Bearer, never sent to the browser.
Installation and Usage¶
First, confirm the host version. This plugin targets dsh >= 0.1.2-alpha.3; if the host is generation 0.1.1, you should install:
@choi-p/dsh-deepseek-balance@0.4.0
Install via plugin-registry¶
In Settings → Plugins → Install, fill in source as:
@choi-p/dsh-deepseek-balance
or:
github:Choi-Peng/dsh-deepseek-balance
Manual Installation¶
dsh plugin --profile web add "github:Choi-Peng/dsh-deepseek-balance"
Uninstall¶
dsh plugin --profile web remove @choi-p/dsh-deepseek-balance
Typical Usage¶
- Start
dsh webafter setting the environment variableDEEPSEEK_API_KEY.
DEEPSEEK_API_KEY
After startup, the balance reading will be displayed at the bottom of the sidebar, above Settings, and refreshes every 60 seconds.
- Go to the
Settings → Plugins → Balance Monitorcard.
Select the display currency, set CNY / USD warning thresholds, and then save. The configuration takes effect in real-time, and there is no need to restart dsh web.
Default Configuration¶
The plugin’s base layer default configuration is:
displayCurrency: cny
warningThresholdCny: 0
warningThresholdUsd: 0
Where displayCurrency controls the display currency for the balance, and warningThresholdCny and warningThresholdUsd control the warning thresholds for CNY and USD respectively.
Dependency Versions¶
The package.json declared peerDependencies are:
{
"@deepseek-ai/cordis": "^4.0.2",
"@deepseek-ai/dsh-settings": "^0.1.2-alpha.3",
"@deepseek-ai/schemastery": "^3.18.2"
}
Use Cases and Notes¶
This plugin is suitable for developers who need to constantly check the DeepSeek balance in the DSH Web host and want to avoid manually querying the API.
Notes before use:
- The plugin is generated by AI and may contain errors, security vulnerabilities, or unexpected behaviors; you must review the code and test it yourself before using it.
- The plugin runs with the current
dshprocess permissions; you should check the source code and the MIT license before installing. - The API key is injected into the host side via
DEEPSEEK_API_KEY, and the browser side will not receive the key. - Saving uses revision optimistic concurrency; if the configuration has been modified elsewhere, a conflict will return 409 or prompt to load the latest value.
- The plugin package comes with a
cordis.patch.yml; it is automatically applied bydshduring installation, so you do not need to manually modify thecordis.patch.ymlin the profile layer.
Conclusion¶
The value of @choi-p/dsh-deepseek-balance is small but clear: turning the DeepSeek balance check from an external query into a real-time reading in the DSH Web sidebar, and allowing local adjustment of the display and thresholds.
GitHub repository: https://github.com/Choi-Peng/dsh-deepseek-balance