When building agents in DeepSeek Harness (DSH), developers often need to accurately control API call costs. The yyfather/dsh-balance plugin addresses this need by displaying DeepSeek / MiMo account balances and per-request billing information directly in the status bar (composer dock) at the bottom of the conversation.
Features¶
- Real-time balance query: Query DeepSeek account balance in real time. The API key is stored only on the Host side and is accessible only from the local machine. If the current session uses an external model such as MiMo, the DeepSeek balance is not displayed.
- Per-request precise billing: Supports selecting peak/off-peak prices based on each request’s timestamp, selecting prices by model, and deduplicating using official projection replacement rules. Supports four billing dimensions:
- This session: All spending from the creation of the current session to the present.
- This active session: New spending incurred since the current plugin activation.
- Most recent: Spending for the latest step/request in the current session.
- Previous conversation: Spending from the session before the current session (MiMo sessions are converted using Xiaomi USD price × exchange rate).
- Multi-model pricing: Built-in price lists for the DeepSeek V4 series (Flash/Vision Exp/Pro, etc.) and the Xiaomi MiMo V2.5 series. Supports peak/off-peak pricing, which can be edited by model + time period in the panel. USD-priced models are converted using a configurable exchange rate.
- Spending threshold alerts: When the current active spending is greater than or equal to the alert threshold (default ¥1) or the DeepSeek balance is less than the alert threshold (default ¥10), the status bar changes to an orange badge. Click the status bar panel to modify these two alert thresholds.
- Automatic refresh: Automatically refreshes the balance after each conversation and refreshes automatically every 5 minutes (can be toggled in the panel).
Installation¶
Method 1: Plugin market (recommended)¶
Find this plugin in DSH Settings → Plugin market, and click the card on the installable page to complete installation.
Method 2: Manual installation¶
- Clone the repository into the DSH profile dependencies directory:
git clone https://github.com/YYfather/dsh-balance.git "$USERPROFILE\.dsh\profiles\node_modules\@yyfather\dsh-balance"
- Append the following to the end of the profile’s
cordis.patch.yml:
- insert:
- id: dsh-balance
name: '@yyfather/dsh-balance'
- Restart DSH Desktop.
Configuration and Usage¶
- API key configuration: Save the DeepSeek API key in DSH Settings → Models. The plugin references
DEEPSEEK_API_KEYby default. - Host-side overrides: You can override the following configuration items in
cordis.patch.yml:
apiKeyRef: DEEPSEEK_API_KEY # 余额查询凭据引用
baseUrl: https://api.deepseek.com # API 根地址
timeoutMs: 20000 # 上游查询超时
allowRemote: false # 安全默认,不允许非本机访问
- Runtime settings: Click the status bar panel to edit price tiers and alert thresholds. Changes take effect within the process.
Dependencies and Security¶
- Dependencies: Node >= 20 is required to support Host native fetch. Depends on Host-side
webServer,credentials,sessions,sessionQuery, andtimerservices, as well as Client-sideslotsandreact. - Security: API keys are resolved only on the Host side. The browser can access only local routes (
dsh-balance/api/*). By default, non-local access to plugin routes is not allowed (allowRemote: false). Route responses contain no upstream raw text or keys.
Summary¶
This plugin integrates into the status bar, providing developers with intuitive balance monitoring and per-request billing capabilities. It is a practical tool for users who need fine-grained control over DeepSeek API call costs.