DeepSeek Harness (DSH) is a plugin-based client environment. During actual development or use, frequently opening the official pricing page or billing page to check balances and costs can interrupt the conversation flow. The following introduces dsh-ui-balance, which solves this problem by displaying this data directly in the interface.
Plugin Overview¶
dsh-ui-balance is a client plugin maintained by EasyTZ. Its core function is to display the DeepSeek API balance, spending, and peak/off-peak period markers directly in the sidebar of a session. It parses session logs and the official pricing page to provide users with real-time cost estimates and usage summaries.
Core Features¶
The plugin mainly provides the following capabilities:
- Sidebar Overview: Displays a single line of data in the sidebar, including the balance and daily spending (updated in real time).
- Detail Panel: Clicking the sidebar line opens a detail panel, showing the API provider, balance, usage summary, cost summary, and current unit price.
- Multi-provider Support: Supports multiple providers such as DeepSeek and Kimi (Moonshot), but only DeepSeek and Moonshot/Kimi support directly querying balance endpoints.
- Price Synchronization: Automatically synchronizes prices from the official pricing page. It fetches once on startup, then synchronizes again every 20 seconds or every half day. If synchronization fails, it continues using the last known price.
- Peak/Off-Peak Periods and Holidays: Supports custom peak period rules (
peakDays,peakWindows) and statutory holiday configuration (peakHolidays).
Installation and Enablement¶
Before installation, make sure the DEEPSEEK_API_KEY credential is configured.
Use the following command to install (<name> is the required profile name; the desktop version is usually web, and TUI is tui):
dsh plugin --profile <name> add @easytz/dsh-ui-balance
After installation, restart DSH to use it.
Typical Usage¶
Sidebar Display: After installation, a line of data appears in the sidebar, including “Balance: xx yuan” and “Spending: xx yuan/day”. The spending updates in real time as messages are generated. On the far right, a green “off-peak” or blue “peak” marker indicates the current billing period.
View Details: Click the line in the sidebar to open the cost detail panel. From top to bottom, the panel shows: API provider, balance, usage summary (with daily/weekly/monthly switching), cost summary, and current unit price.
Custom Rules: To customize peak periods, configure peakDays (e.g., 1-5) and peakWindows (e.g., 9:00-12:00,14:00-18:00). Setting none means there are no peak periods.
Notes¶
- Balance Query Limitation: Balance queries are only available via public endpoints for DeepSeek and Moonshot/Kimi; other providers display “Unable to query balance”.
- Cost Nature: The costs in the panel are estimated values calculated using the current unit price, not official bills. They aggregate API calls from local session logs.
- Log Scanning: When there are many sessions, the first plugin startup scans all logs. Subsequent updates are incremental based on file size.
- Path Dependency: If you modified the
rootpath ofdsh-session-persistence-lin a local patch, make sure to configure the plugin’ssessionsRootto the same path; otherwise, cost statistics may all be 0.
Summary¶
dsh-ui-balance solves the pain point of frequently checking costs in DSH by integrating official pricing, real-time usage, and estimated costs into the interface. It supports multiple providers, automatic price synchronization, and custom peak/off-peak rules, making it suitable for DeepSeek developers who need fine-grained control over API usage costs. The project source code is on GitHub: https://github.com/EasyTZ/dsh-ui-balance.