DeepSeek Harness (DSH) adopts a plugin-based architecture, and its Web interface allows functionality to be extended with custom plugins. When debugging or developing agents locally, frequently switching to the Web backend to check API consumption and balance is inefficient. The dsh-usage-blance plugin embeds monitoring data into the conversation.input.dock slot above the chat input box, making it possible to view DeepSeek API usage and balance directly during a conversation.
Features¶
The plugin displays five core metrics above the input box in the chat interface: this month’s consumption, average daily consumption this month, yesterday’s consumption, today’s consumption, and account balance.
Clicking any billing data row opens a control panel. The panel supports the following configurations:
* Glassmorphism adjustment: Supports real-time adjustment of opacity, blur, and saturation.
* Position switching: The billing bar can be pinned above or below the input box, and the setting is persistently saved.
* Two-column layout: Configure userToken on the left side, and adjust theme and position on the right side.
* Balance warning: You can set a balance threshold. When the balance falls below the threshold, the balance value is displayed in red with an exclamation mark, and a top-up button appears.
Data refreshes automatically every 60 seconds. If an error occurs (such as a missing Key, expired Token, or network failure), the corresponding data row displays an error prompt. The UI colors follow the DSH application’s own theme colors (--dsw-* tokens).
Installation and Activation¶
Before installation, ensure DSH CLI and pnpm are installed.
- Clone the repository and install:
git clone https://github.com/zhou-yihang/dsh-usage-blance.git
cd dsh-usage-blance
dsh plugin --profile web add .
- Restart the DSH Web service to load the plugin:
dsh web
- Open the Web interface and refresh the page. The billing bar will appear below the dialog box.
Configuration¶
The plugin requires two key configuration items to retrieve data from different dimensions.
1. Obtain userToken (for usage data)¶
Usage data (today’s, yesterday’s, and this month’s consumption) requires a platform session token. After clicking a billing row to open the control panel:
1. Log in to platform.deepseek.com.
2. Open browser developer tools (F12).
3. Run the following command in the Console to obtain the token:
JSON.parse(localStorage.getItem('userToken')).value
- Paste the obtained string into the input box in the control panel and click “Save”. The configuration will be stored in
$DSH_HOME/storages/dsh-usage-blance.json.
2. Use DEEPSEEK_API_KEY (for balance data)¶
Balance data is fetched directly from the official API. The plugin automatically reads DEEPSEEK_API_KEY from environment variables or ~/.dsh/.credentials.yaml. If it is not configured, the balance row will indicate a missing Key, but usage data can still be displayed normally.
Data Sources and Privacy¶
- Data sources:
- Balance: Official public API
GET https://api.deepseek.com/user/balance. - Usage: Platform dashboard API
GET https://platform.deepseek.com/api/v0/usage/by_api_key/cost(requires userToken).
- Balance: Official public API
- Time window: Anchored to Beijing time (UTC+8).
- Privacy and security: The API Key and userToken are only transmitted over local routes and do not leave the machine. All data requests are initiated by the DSH process, and user preferences are persisted in
localStorageand$DSH_HOME/storages/dsh-usage-blance.
Summary¶
By aggregating and displaying data from official APIs above the input box in the DSH Web interface, dsh-usage-blance addresses the need to monitor API costs during local development. The plugin is released under the MIT license, its code is hosted on GitHub, and it is suitable for developers who frequently need to check DeepSeek API usage locally.