Introduction¶
When developing agents or debugging models with DeepSeek Harness, you often need to switch between different model providers (for example, from DeepSeek to OpenRouter or Kimi). If you can directly see the account balance of the corresponding provider when switching models, you can more intuitively control costs.
The dsh-balance plugin is designed for this purpose. It is a lightweight component that automatically appears at the bottom of the sidebar (to the right of the settings button), displaying the balance of the current model’s provider.
Plugin Positioning¶
dsh-balance is a “Provider-aware balance chip”. It does not rely on any runtime environment and does not modify the core code of DeepSeek Harness. It is an independent plugin package.
Core Features¶
This plugin mainly solves the problem of “how to quickly view the balance of the current model provider in the sidebar”.
-
Automatic provider switching
The plugin reads the model routing for the current session (such asdeepseek,openrouter,moonshotai,zhipu,minimax, etc.) and displays the corresponding provider’s balance. When switching models, the balance chip is updated automatically. -
DeepSeek peak and off-peak billing awareness
For the DeepSeek provider, the plugin recognizes the current billing window:- Peak hours (red dot): Monday to Friday, Beijing time 09:00–12:00 and 14:00–18:00.
- Off-peak hours (green dot): Other times.
This helps developers avoid high-price periods.
-
Zero dependencies and lightweight
- Zero runtime dependencies: The dependency list is empty; it only uses the platform modules provided by Harness and React.
- Small size: About 11 kB after packaging (gzipped).
- No core modifications: It is an out-of-tree package and does not modify Harness’s source code or CSS.
-
Real-time refresh and fault tolerance
- Automatic refresh: The balance is refreshed automatically every 60 seconds.
- Manual refresh: Click the chip to refresh immediately.
- Graceful degradation: If the API key is missing or an upstream API error occurs, the chip displays a silent “Balance —” style, and the reason is shown in the hover tooltip without breaking the interface layout.
Usage¶
After installing the plugin, the operation is very simple:
* View balance: Find the balance chip at the bottom of the sidebar. It automatically displays the balance of the provider corresponding to the currently selected model (for example, OpenRouter’s remaining credits or Kimi’s available balance).
* View details: Hover your mouse over the chip to see a detailed breakdown of the balance (for example: total amount, gifted amount, and purchased amount).
* Refresh data: Click the chip to manually trigger a refresh.
Notes and Use Cases¶
- No configuration required: After installation, no configuration items are needed. It works out of the box.
- Security mechanism: API keys are parsed only on the host side. The browser side only receives standardized balance values and does not directly access sensitive credentials.
- Compatibility: If the model routing is not in the supported list (including custom provider IDs), the plugin falls back to displaying DeepSeek’s balance instead of reporting an error.
- UI adaptation: When the sidebar narrows to a width of 56px, the chip automatically collapses to save space.
Conclusion¶
dsh-balance is a tool built to improve development efficiency. It implements a unified display of balances across multiple providers through minimalist code, making it especially suitable for developers who frequently switch between multiple AI service providers. For more details, please refer to the project homepage.