In DeepSeek Harness (DSH) development, developers need to monitor account balance in real time, understand peak/off-peak billing periods, and estimate today’s API consumption. The dsh-web-quota-meter plugin provides a quota dashboard in the bottom-right corner of the DSH Web interface and is a pluggable component.
Core features¶
This plugin provides the following features:
- Official balance: Retrieves the current account balance via the official public API.
- Today’s consumption: Based on a local estimate, i.e., “daily baseline balance − current balance”.
- Peak/off-peak billing periods: Shows whether the current time is peak (9:00–12:00, 14:00–18:00) or off-peak, based on Beijing Time (UTC+8).
- Configurable reset time: Supports customizing the daily reset time; the default is 05:00.
- Installable and removable: Supports installation, removal, and upgrading through the official plugin mechanism.
Installation and enablement¶
Install it using the official plugin mechanism. After installation, restart dsh web to load it automatically.
dsh plugin --profile web add github:wangfujian762/dsh-web-quota-meter
After successful installation, the API key is automatically stored in the official credential store, so you do not need to enter it again after restarting dsh web. Each future startup of DSH Web will automatically load the plugin.
Uninstallation and upgrade¶
Use the following commands to uninstall or upgrade the plugin:
# 卸载
dsh plugin --profile web remove dsh-web-quota-meter
# 升级
dsh plugin --profile web update dsh-web-quota-meter
The plugin configuration file is usually located at ~/.dsh/profiles/web/cordis.patch.yml.
How It Works and Notes¶
- Balance source: The plugin sends a request to the official endpoint
GET https://api.deepseek.com/user/balanceand must includeAuthorization: Bearer <your API key>. The API key is stored only in the official credential store. The code contains no secrets, and the key is never sent to any address other than DeepSeek. - Today’s consumption: This is a locally estimated value. At each day’s reset time (default 05:00), the plugin records the balance as a baseline and then calculates consumption as baseline balance minus current balance. If a top-up occurs during this period, the displayed consumption will be lower than the actual consumption. After the plugin restarts, the baseline for “today’s consumption” is reset.
- Reset time: The reset time is currently stored only in memory and reverts to the default 05:00 after DSH restarts.
- Peak/off-peak periods: Calculated based on Beijing Time and corresponding to DeepSeek’s peak/off-peak pricing model.
Ecosystem background¶
The DSH philosophy is “everything is a plugin”. This plugin is maintained by community developer wangfujian762 and is released under the MIT License. For more details, see the GitHub repository.