Auto-detect the current model vendor (7 built-in) and show its balance or quota in the composer input row, with custom endpoints for unsupported vendors.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:jacujay/dsh-model-balance
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
Auto-detect the current model vendor and show its balance / quota right in the composer input row — a small button left of the model name, hover to peek, click to refresh. A settings page covers vendors without a public balance endpoint via custom endpoints.
Built for DeepSeek Harness (DSH web).
Features
- Auto vendor detection — reads the current default model's provider from DSH configuration and identifies the vendor by provider id, then by baseURL hostname as a fallback. Custom provider ids (e.g.
minimax-cn) still match. - Built-in vendors — DeepSeek, Moonshot/Kimi, MiniMax, StepFun, Zhipu (quota only), SiliconFlow, OpenRouter.
- Two result kinds — monetary balance (with granted/topped-up breakdown where the API provides it) and quota (MiniMax / Zhipu, which expose usage plans instead of money).
- Input-row button — a small
◈icon before the model name in the native composer row. Hover opens a peek panel; click refreshes. Error / unsupported / quota states get their own colors. - Settings page — Settings → Balance lookup: lists supported vendors and lets you add a custom balance endpoint for any provider (URL + response field path + bearer/raw auth + display name).
- Key-safe — API keys are resolved host-side through the DSH credentials store and never reach the browser. Custom endpoint config persists at
~/.dsh/dsh-model-balance.jsonwithout any secrets. - Live in seconds — the host answers over same-origin HTTP routes; no restart needed after a page refresh.
Install
Requires DSH web. From the plugin market or:
# from GitHub
dsh plugin --profile web add github:jacujay/dsh-model-balance
Then refresh the browser page.
Supported vendors
| Vendor | Endpoint | Kind |
|---|---|---|
| DeepSeek | /user/balance |
balance (CNY) |
| Moonshot / Kimi | /v1/users/me/balance |
balance |
| MiniMax | /v1/token_plan/remains |
quota (per-model %) |
| StepFun | /v1/accounts |
balance |
| Zhipu GLM | /api/monitor/usage/quota/limit |
quota only |
| SiliconFlow | /v1/user/info |
balance |
| OpenRouter | /api/v1/auth/key |
balance (USD) / unlimited |
New API-compatible proxies
New API exposes token usage at /api/usage/token, authenticated with the same API key used for model calls. Add a custom endpoint for the matching DSH provider (often openai) in Settings → Balance lookup:
- URL:
https://your-relay.example.com/api/usage/token - Response path:
data.total_available - Authentication:
Bearer Token - Display name: optional
The plugin recognizes New API's token_usage response automatically. It shows unlimited quota when unlimited_quota is true, otherwise it reports the remaining amount, total granted amount, and usage.
Anything else: add a custom endpoint in Settings → Balance lookup. The API key still comes from DSH credentials (apiKeyEnv of the provider), and the custom URL is called host-side with it.
Privacy & security notes
- Balance requests are issued by the local DSH host with the provider's API key; the key never leaves this machine and never enters the browser.
- The settings page stores only endpoint metadata (
~/.dsh/dsh-model-balance.json), no secrets. - The host routes are same-origin HTTP on the existing DSH web server; mutating routes (custom endpoint save/delete) carry a same-origin check.
- Custom endpoint URLs are user-provided and may point anywhere; review them before saving.
Development
# no build step — host is plain ESM (lib/index.js), client is a plain
# __ModuleLoader__ bundle (client/client.js)
node --check lib/index.js
node --check client/client.js
License
MIT
Links
More in this category
bowenliang123/dsh-context★ 1831
DSH context insight panel: Context dashboard + /context command + Context browser — one-stop context lifecycle management with categorized composition, content details, evolution trends, compaction/injection events, and stats.
Han-1413141/dsh-cost-meter★ 369
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
wssfk12138/dsh-damage-pulse★ 237
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
zh667/TokenLedger★ 202
Sidebar usage panel that attributes tokens to the relay site that served each request, read from your existing provider config: today/month/all-time totals, per-site and per-model breakdowns, a year activity heatmap, and New API / Sub2API / DeepSeek balances.
Ychris12138/dsh-usage-stats★ 169
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
PolinniZhong/dsh-personal-center★ 118
Personal center for DeepSeek Harness: cross-session usage statistics, per-model cost estimation, global custom instructions, a global font-size adjuster, a data-driven desktop pet with bitmap & vector skins, and a conversation status overview, all local and offline.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.