Preface¶
When running agents with API credits or subscriptions, two common issues arise: discovering that funds or quotas have run out only halfway through a task, or having to maintain multiple consoles for DeepSeek, Kimi, Zhipu, etc., where display dimensions vary—some show monetary amounts, while others show periodic percentages. DeepSeek Harness (DSH) centralizes model routing and the conversation interface, but if balance information remains scattered across various vendor backends, troubleshooting costs can be significant.
dsh-balance-meter (npm package name @zhujiuyi/dsh-balance) is a DSH networking plugin released by community maintainer zhujiuyi. It identifies the underlying vendor based on the model routing actually used in the current session, calls their official or agreed endpoints to query API balances or subscription quotas, and displays them uniformly in the statistics row below the input box. It does not launch subprocesses, does not request exec permissions, and sends requests only to your configured gateway.
What is this¶
In one sentence: it tells you how much credit or quota remains on the route you are currently using; if it cannot read the value, it explains the reason rather than guessing a number.
- Maintainer: zhujiuyi
- Repository: github.com/zhujiuyi/dsh-balance-meter
- Community Directory: skillhub.cn/plugins/zhujiuyi/dsh-balance-meter
- License: MIT (see repository
package.json) - Version in current documentation: 0.2.5
The community plugin directory is an independent site with no official affiliation with DeepSeek / High-Flyer. It is recommended to review the source code and license yourself before installing. The plugin runs under DSH process privileges and uses keys from the DSH credential store to initiate queries to the corresponding gateways.
Core Features¶
Unified Reading Logic¶
Balances are tallied by vendor (provider). Models under the same vendor share the same fund pool or quota pool, rather than being split by individual models.
The plugin emphasizes three principles (excerpted from the README):
- No Guessing: When parsing fails, it clearly errors out and explains. It prefers to show “unavailable” rather than displaying a plausible but incorrect number.
- Stale Data Labeling: If a refresh fails, the last successful reading may be retained, but it will be marked as potentially stale, and the failure reason will be provided in the details.
- Trend Charts Use Real Sampling Only: If there are fewer than two valid readings, it prompts that collection is ongoing and does not draw fake historical curves.
9 Built-in Supported Vendors¶
| Vendor | Content Read | Display Method |
|---|---|---|
| DeepSeek | Account Balance | Amount (e.g., ¥12.34) |
| OpenRouter | Key Credits | Amount |
| Moonshot / Kimi | Account Balance | Amount |
| SiliconFlow | Account Balance | Amount |
| Zhipu GLM / Z.AI | Subscription Quota | Percentage per time window |
| Kimi Coding | Subscription Quota | Percentage per time window |
| MiniMax | Plan Quota | Percentage per time window |
| OpenCode Go | Subscription Quota | Percentage per time window |
| OpenDesign (AMR) | Wallet + Design Plan Window | Amount + Percentage |
“Window Percentage” indicates that quota bars and reset times are listed separately by rolling/weekly/monthly cycles, making it easy to distinguish between “5-hour window almost used up” and “monthly total running low.”
Self-hosted Relays (Potentially Usable)¶
If the route points to a self-hosted relay (New-API, Sub2API, CloseAI, claude-code-hub, etc.), the plugin attempts a set of common endpoints in order; the endpoint you specify in the configuration takes precedence over the preset list. Preset response shapes are transcribed from public panel documentation, and the author has not verified them against all online environments; unrecognized responses will be reported as “reachable but unparseable” with raw fragments attached, without speculation.
Preset attempt order (original text from materials):
/api/usage/token/ → /v1/dashboard/billing/subscription → /v1/usage
→ /api/v1/me/quota → /dashboard/billing/credit_grants
→ /api/v1/credits → /api/user/self
Situations Explicitly Unsupported or Clearly Stated¶
- No public balance interface for the vendor: Stated directly, no fabricated data.
- Route not in directory and no preset match: Reports “Not Cataloged” with the last raw response attached.
- Credentials not configured: Prompts for the required environment variable name.
- Endpoint responds but structure is unknown: Reports unparseable and provides a desensitized excerpt.
You can specify a custom query address for a route via balance_set_endpoint or the endpoint field in the configuration.
Interface and Agent Tools¶
- The statistics row displays a resident brief reading: API credits show amounts, subscriptions show percentages.
- Clicking opens the full panel: Vendor, billing mode, endpoint, last read time, and progress bars for each quota window.
- During conversation, the agent can call the
balance_checktool to query remaining quota.
Auto-Refresh Strategy¶
- Refresh once after each conversation turn.
- Background check every 15 seconds (refreshes when policy allows).
- Readings older than 5 minutes force a refresh (configurable).
- Manual click “Refresh Now” always executes.
There is also a default minimum interval of 30 seconds and failure cooldown; polling pauses when the page is hidden.
Additional Steps for OpenDesign Users¶
OpenDesign billing is not on the API gateway host; login is required first:
vela login
Login via the OpenDesign desktop app is also acceptable. Credentials are written to ~/.amr/config.json, which the plugin reads from. The documentation states: The sk-amr-… inference key configured in DSH cannot be used for billing queries. If not logged in, it will prompt to execute vela login rather than treating the gateway as an unknown relay and blindly probing it.
Privacy and Implementation Constraints¶
- No
execpermissions, no subprocesses. - Requests are sent only to the configured gateway, with no third-party telemetry.
- Keys are read from the DSH credential store and used only for that gateway’s request headers; they are not written to disk or logs; only variable names appear in browser snapshots.
Installation and Activation¶
The installation method provided in the official README is as follows (note that the package scope is @zhujiuyi/dsh-balance; do not install the unscoped dsh-balance-meter npm package name).
Install via DSH plugin command:
dsh plugin --profile desktop add @zhujiuyi/dsh-balance
After installation, restart DSH, and the reading will appear in the statistics row below the input box.
You can also install the tarball from Releases (/latest/ points to the latest version; the example in the materials corresponds to 0.2.5):
dsh plugin --profile desktop add https://github.com/zhujiuyi/dsh-balance-meter/releases/latest/download/zhujiuyi-dsh-balance-0.2.5.tgz
Or install from the GitHub repository:
dsh plugin --profile desktop add github:zhujiuyi/dsh-balance-meter
Uninstall:
dsh plugin --profile desktop remove @zhujiuyi/dsh-balance
Typical Usage¶
In most cases, no operation is needed; simply install, restart, and view the statistics row.
- Glance: Amount or percentage is resident in the statistics row.
- Open Panel: View endpoint, refresh time, and quota bars for each window.
- Ask in Conversation: For example, “How much quota is left,” and the Agent calls
balance_check.
In the DSH plugin page, you can adjust items such as preferred route, auto-refresh, minimum refresh interval, and “force refresh after” on the @zhujiuyi/dsh-balance card.
To fix a custom endpoint or key environment variable for a route, edit cordis.patch.yml in the profile and add config under the balance-meter entry, for example:
- id: balance-meter
name: "@zhujiuyi/dsh-balance"
config:
primary: deepseek
routes:
- id: my-provider
baseURL: https://api.example.com/v1
apiKeyEnv: MY_PROVIDER_API_KEY
endpoint: '{origin}/v1/balance'
The template supports {origin} (protocol + host) and {base} (full baseURL); the documentation suggests prioritizing {origin} to avoid errors when the baseURL contains path segments.
Use Cases and Notes¶
Suitable for: Users who frequently switch or use multi-vendor routing in DSH and want to grasp the balance/quota corresponding to the current route in a unified interface; users of subscription-based services (Zhipu, Kimi Coding, etc.) who need to see consumption across different time windows; users with self-hosted relays who are willing to configure endpoint according to the documentation.
Notes:
- The plugin’s capability boundaries are subject to the vendors and relay detection logic listed in the README; routes not included in the directory require manual endpoint configuration.
- The response formats for relay presets may not perfectly match your panel; in case of exceptions, it will return an unparseable explanation rather than failing silently.
- Installation and operation depend on the DSH desktop profile and peer dependencies (such as
@deepseek-ai/dsh-tools, etc., seepackage.json); if readings are abnormal after upgrading DSH or the plugin, try manual refresh first and check the failure reason in the panel.
Conclusion¶
dsh-balance-meter brings “how much is left on the current route” into the DSH interface: it has nine common vendors built-in, optional relay detection, does not guess numbers, and does not secretly use the shell to pull data. If you are running long tasks or multiple APIs via DSH, leaving a real reading in the statistics row can help you avoid the pitfall of “running out halfway.”
- Directory Page: https://www.skillhub.cn/plugins/zhujiuyi/dsh-balance-meter
- GitHub: https://github.com/zhujiuyi/dsh-balance-meter