Multi-provider LLM API balances under the chat input, with presets for DeepSeek, OpenRouter and SiliconFlow.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:JonyChan8394/dsh-llm-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. Only install sources you trust, and pin a commit (github:owner/repo#sha).
README
Show the balances of exactly the LLM providers you have configured in dsh, right below the chat input box.
- Below the chat input — a compact readout in the composer's footer band (the seat under the input card, where the stats line lives) that refreshes automatically (default every 60 s) with a manual refresh link.
- Driven by your dsh configuration — the strip shows exactly the providers registered in dsh (the Models page /
llm-pi-aisettings + the built-in adapters you use). Configure a new LLM in dsh and it appears on the next refresh; remove it and it disappears. No restart, no config editing. - No public balance API? — providers like Qwen/DashScope, OpenAI and Anthropic have a public API key but no public balance endpoint. When such a provider is configured with a key, the strip shows "未开放查询API / no balance API" instead of hiding it.
- Keys stay on the host — API keys are resolved from DSH credentials (or environment) host-side; the browser only ever sees the fetched balances.
Install
dsh plugin --profile web add github:JonyChan8394/dsh-llm-balance
Restart dsh web. The balance readout appears under the chat input as soon as at least one configured provider has a key.
Configure
Nothing to configure — the plugin follows the providers you already set up in dsh. Balance endpoints are known for these routes:
| Provider route | Balance API |
|---|---|
DeepSeek (deepseek, deepseek-official) |
✅ |
OpenRouter (openrouter) |
✅ |
SiliconFlow (siliconflow) |
✅ |
Moonshot / Kimi (moonshot) |
✅ |
MiniMax (minimax) |
✅ |
StepFun (stepfun) |
✅ |
Zhipu / GLM (zhipu) |
✅ |
| Any other configured provider | ❌ shows "未开放查询API" |
To add a balance endpoint for a provider not in the list (e.g. an aggregator route with its own balance endpoint), override the plugin config in your profile's cordis.patch.yml:
- id: llm-balance
config:
refreshMs: 30000
endpoints:
- id: myprovider
name: MyProvider
apiKeyEnv: MYPROVIDER_API_KEY
url: https://api.example.com/v1/balance
balancePath: data.remaining
currencyPath: data.currency
A provider without a configured key is hidden from the strip; a provider whose request fails shows "获取失败 / fetch failed".
How it works
- Host half (
lib/index.js) readsctx.llm.listProviders()— the exact set of LLM routes configured in dsh — on every request. For each provider with a known balance endpoint it resolves the key throughctx.credentialsand calls the endpoint; for a configured provider with a key but no endpoint it reportserror: 'no-api'. Results are served asGET /llm-balanceJSON through the webserver route registry. - Browser half (
lib/client.js) registers aconversation.composer.dockentry (order 10) that polls/llm-balanceand renders the readout under the input card.
License
MIT
Links
More in this category
Han-1413141/dsh-cost-meter★ 57
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
Ychris12138/dsh-usage-stats★ 56
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
zh667/TokenLedger★ 22
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.
feibi-mochi/deepseek-harness-control-center★ 21
DeepSeek Harness control center for official balance monitoring, per-session costs and tokens, third-party token totals, completion alerts, official recharge, flexible layouts, and agent-assisted session controls.
SenmuuuuW/dsh-whale-report★ 19
DeepTrace — deterministic agent reports from session logs (daily/weekly/monthly/yearly/custom): cost & token breakdown, 8 insight rules, collaboration review, live provider balance, PDF/PNG/HTML export; read-only, never rewrites history.
Ghost011118/dsh-balance-meter★ 16
DeepSeek account balance and session cost in the composer dock, with auto-fetched official pricing and peak/off-peak support.