Rainronin/dsh-balance-monitor ↗★ 1
dsh-balance-monitor
DeepSeek Harness 插件:DeepSeek API 余额实时监测(官方 /user/balance 快照 + ds_balance 工具 + 每轮注入 + Matrix 侧边栏徽章)
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Rainronin/dsh-balance-monitor说明文档
阅读完整 README ↗dsh-balance-monitor
A DeepSeek Harness plugin that monitors your DeepSeek API account balance: official /user/balance snapshots, in-session queries, per-turn context injection, and a Matrix-style sidebar badge.

English
Features
| Capability | Description |
|---|---|
| 💬 In-session query | ds_balance tool: the agent can fetch the official balance snapshot anytime (force: true bypasses the cache) |
| 🔄 Per-turn injection | Fresh balance is injected into the model context before every turn (cache-only read, never blocks the conversation) |
| 🖥️ Sidebar badge | Matrix green-phosphor CRT style: ▸ BALANCE CNY ¥32.81 · LINK OK, SYNC button for on-demand refresh, 30s auto polling, rail state collapses into a status lamp |
| 🔐 Zero-config key | Reuses DEEPSEEK_API_KEY from dsh's credential service (never written to disk, never logged) |
| 💱 Multi-currency | CNY/USD both listed (CNY first); amounts stay strings end-to-end, no float math |
| 🛡️ Rate-limit friendly | 30s TTL cache + request serialization (at most one in-flight request) + 5s timeout |
Installation
# Option 1: install straight from GitHub (recommended)
dsh plugin --profile web add github:Rainronin/dsh-balance-monitor
# Option 2: clone and link-install locally (instant reload while developing)
git clone https://github.com/Rainronin/dsh-balance-monitor.git
cd dsh-balance-monitor
dsh plugin --profile web add .
# host-side changes require a restart
dsh web
If pnpm blocks the
preparebuild script of a git-hosted plugin, add the printed key toallowBuildsin$DSH_HOME/profiles/web/pnpm-workspace.yamland re-run.
The plugin joins dsh.profile.bundles automatically. Inspect the composed tree:
dsh --profile web --dump-config
Usage
In-session query — just ask the agent:
查一下 DeepSeek 余额 / check my DeepSeek balance