The philosophy of DSH (DeepSeek Harness) is “Everything is a plugin.” In development or daily use, managing balances across multiple API providers and subscriptions is a repetitive task. dsh-route-balance aims to solve this problem by allowing developers to view the balances of all configured API routes and the remaining quotas for ChatGPT/Codex subscriptions in a single location.
Core Features¶
This plugin directly displays account balances for various API routes (model vendors and proxies) in the DSH sidebar. It supports multiple data sources, including DeepSeek, OpenRouter, Zhipu, Xiaomi MiMo, etc. The display format is typically a combination of currency symbols and amounts, such as ● ¥12.90 · $13.14 · GPT 剩 49%.
In addition to API balances, the plugin also supports reading quota information from the local Codex service.
Installation and Activation¶
Before use, please ensure the following environment requirements are met:
* Node.js version 20 or higher
* DSH version 0.2.0-rc.2 or higher
Note: The current version (0.6.4) is a pre-release version. Interfaces and configuration defaults may change. The npm package has not been published yet, so please install via the pinned version on GitHub rather than following floating branch names.
Execute the following command in the terminal to install:
dsh plugin --profile desktop add github:Ronniealgo/dsh-route-balance#v0.6.4
After successful installation, restart the application according to the DSH prompt.
Configuration Instructions¶
By default, the plugin inserts the component at the bottom of the sidebar. The following parameters can be adjusted via the YAML configuration file:
- insert:
- id: route-balance
name: "dsh-route-balance"
config:
slot: sidebar.footer.action
refreshMs: 300000
requestTimeoutMs: 15000
cacheMs: 10000
maxStaleMs: 86400000
codex:
strategy: auto
warmMs: 240000
timeoutMs: 20000
snapshotPath: null
| Config Item | Description |
|---|---|
slot |
Component insertion position, defaults to the bottom of the sidebar |
refreshMs |
Page polling refresh interval, default 5 minutes |
requestTimeoutMs |
Total time limit for reading each provider, default 15 seconds |
cacheMs |
Short cache time for each host, default 10 seconds |
maxStaleMs |
Maximum retention time for the last successful reading, default 24 hours |
codex.strategy |
Codex quota reading strategy: auto (background reading), snapshot (read snapshot only), off (hidden and not read) |
codex.snapshotPath |
Snapshot file path, defaults to looking for the environment variable CODEX_HOME or the user’s Codex home |
Usage Examples¶
Interface Display Example:
● ¥12.90 · $13.14 · ¥0.10 · GPT 剩 49%
Codex Snapshot Command:
node tools/codex-quota.mjs --write
Use Cases and Precautions¶
- Disconnection Protection: Requests are paused when the page is hidden or the network is disconnected, and update immediately upon recovery. The last displayed balance is retained during disconnection.
- Security Mechanism: API Keys are only used on the host and are resolved through DSH’s credential resolution service; the
authfile is not read directly. - Cache Clearing: Authentication failures, credential access denials, or configuration changes will clear the corresponding old balances.
- Independent Fault Tolerance: Each source has independent timeout and recovery; if one interface hangs, it will not freeze the entire balance bar.
- Ecosystem Background: This plugin is a community plugin. DSH officials and DeepSeek/Huanfang have no affiliation. Market inclusion and “Verified” status only represent automated detection results and do not constitute a security audit.
Conclusion¶
dsh-route-balance provides a centralized, real-time balance monitoring view, suitable for DSH users who frequently switch or manage multiple API resources. Please verify the source code and license before use.