The DSH Web sidebar currently does not have a direct location to display the DeepSeek API balance. Developers need to open the web page or check Settings to know the current usage. The dsh-dsbal plugin adds a balance button at the bottom of the sidebar (above the Settings button), showing the current balance in RMB and providing detailed breakdown and alerts.

Core Features

1. Balance Display
Displays a balance button at the bottom of the sidebar, positioned above the Settings button. The button shows a wallet icon on the left and the RMB amount ¥xx.xx on the right.

2. Automatic and Manual Refresh
A 30-second auto-refresh mechanism is enabled by default. Click the button to refresh the balance immediately and reset the 30-second refresh cycle.

3. Hover Detail Card
Hovering over the button displays a detail card, including:
- The current total balance displayed in a larger font.
- Balance breakdown: purchased balance and gifted balance.
- Peak/off-peak pricing rules.
- Refresh rules and the current time.
- The plugin version number.

4. Peak/Off-Peak Pricing and Alerts
- Pricing is based on Beijing time: Monday to Friday 09:00-12:00 and 14:00-18:00 are peak periods; all other times are off-peak periods, including weekends and public holidays.
- Balance alerts: the button border color changes based on thresholds. Balance < 50 shows a yellow dashed border, < 30 shows an orange dashed border, < 10 shows a red dashed border, and ≥ 50 is the normal state.

5. Language Following
All text content automatically follows DSH’s interface language setting (Chinese/English).

Install and Enable

Install it directly using the command provided by the official:

dsh plugin --profile web add github:flyingfishzxf/dsh-dsbal

After installation, restart dsh web and hard-refresh the browser (Ctrl+Shift+R or Cmd+Shift+R) to load the new plugin.

Typical Usage

  1. Configure credentials: Configure DEEPSEEK_API_KEY in DSH, or log in directly to a DeepSeek account (applicable to the DSH desktop application).
  2. View balance: View the current RMB balance at the bottom of the sidebar.
  3. Refresh balance: Click the button to refresh manually, or wait for the automatic refresh every 30 seconds.
  4. View details: Hover over the button to view the detailed balance composition, peak/off-peak pricing, and current status.

Use Cases and Notes

Use Cases
- Developers who need to frequently monitor DeepSeek API usage.
- Developers who use the DSH Web interface and want to integrate the API balance into the sidebar.

Notes
- Read-only functionality: The plugin only displays the balance; it cannot perform top-ups or any account operations.
- Fixed refresh interval: The refresh interval is 30 seconds and cannot be changed in the configuration file.
- System dependencies:
- POSIX systems (Linux/macOS) require the curl command.
- Windows systems require a node environment.
- Host compatibility: DSH host compatibility support is required, using a newer API interface.

Conclusion

dsh-dsbal is a practical plugin focused on a single function, seamlessly integrating DeepSeek balance information into the DSH sidebar. Through simple button interaction and an auto-refresh mechanism, developers can more intuitively track API usage.