Shows the DeepSeek account balance (recharge plus bonus) in the DSH composer dock and refreshes it automatically.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:feiniao1933/dsh-token-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
This plugin publishes its README in Chinese only.
dsh-token-balance

A live DeepSeek account-balance chip in the DeepSeek Harness (DSH) composer dock. 在 DeepSeek Harness 输入框下方实时显示 DeepSeek 账户余额。
English
What it does
dsh-token-balance adds a small balance chip to the composer dock — the status row below the message box, next to the context-usage meter.
- Shows the total credit (recharge balance + bonus balance) and keeps it current.
- Hover for the breakdown: total, recharge, bonus, last update time, and the refresh hint.
- Click the chip to refresh immediately.
- Refreshes automatically on mount, every 30 seconds, when the tab becomes visible or focused, and when the current turn finishes.
- Uses the signed-in DeepSeek account through the Host
account/getBalanceRemote. It never reads, stores, or sends an API key. - Signed out → "Not signed in"; read failure → "Balance unavailable" with up to three automatic retries.
- Follows the host theme tokens and the active UI language (English and Chinese dictionaries included).
Install
The npm release is not published yet. Install from the public Git repository:
dsh plugin --profile web add github:feiniao1933/dsh-token-balance
Or pin a commit (recommended for reproducible installs):
dsh plugin --profile web add git+https://github.com/feiniao1933/dsh-token-balance.git#<commit>
Replace web with your profile name. Once the npm package is published, dsh plugin --profile web add dsh-token-balance works too.
Configuration
Override the row in your profile's cordis.patch.yml:
- id: token-balance
config:
refreshIntervalMs: 30000 # 5000–3600000
How it works
The Client half reads ctx.get('remote.account').getBalance(...) and renders the chip through the conversation.composer.dock slot. The Host half only publishes the refresh interval through webserver/index-inject. There is no Host HTTP route and no extra dependency.
Amounts are formatted with the same rules as the account settings page: truncated to cents, positive sub-cent amounts shown as <¥0.01, and wallets joined with +. The chip displays the sum of recharge and bonus wallets; the tooltip keeps them separate.
Compatibility
Tested with DSH 0.2.2-rc.1 on macOS. The bundle declares dsh.bundle.patch, so it installs with dsh plugin add.
License
MIT. See LICENSE.
中文
功能
dsh-token-balance 在输入框下方的状态行(和上下文占用百分比同一行)加一个余额胶囊。
- 显示 账户可用总额(充值余额 + 赠送余额),并持续刷新。
- 悬停显示明细:总额、充值余额、赠送余额、最后更新时间,以及刷新提示。
- 点击胶囊立即刷新。
- 自动刷新:挂载时、每 30 秒、标签页重新可见/获得焦点、当前会话一轮结束时。
- 数据来自已登录 DeepSeek 账户的 Host
account/getBalanceRemote,不读取、不保存、不外发任何 API Key。 - 未登录显示“未登录”;读取失败显示“余额不可用”,并自动重试最多 3 次。
- 使用宿主主题变量,跟随明暗主题;内置中英文文案。
安装
npm 版本尚未发布。先从公开仓库安装:
dsh plugin --profile web add github:feiniao1933/dsh-token-balance
或固定提交(推荐,安装结果可复现):
dsh plugin --profile web add git+https://github.com/feiniao1933/dsh-token-balance.git#<commit>
把 web 换成你的 profile 名称;按宿主要求重启或刷新页面。npm 包发布后也可以用 dsh plugin --profile web add dsh-token-balance。
配置
在 profile 的 cordis.patch.yml 中覆盖该行:
- id: token-balance
config:
refreshIntervalMs: 30000 # 5000–3600000
实现
Client 半通过 ctx.get('remote.account').getBalance(...) 读取余额,并注册到 conversation.composer.dock;Host 半只通过 webserver/index-inject 下发刷新间隔。没有额外的 Host HTTP 路由,也没有运行时依赖。
金额格式与账户设置页一致:截断到分,正的不足一分显示为 <¥0.01,多币种用 + 连接。胶囊显示充值 + 赠送的合计,悬停时分别列出。
兼容性
在 macOS 的 DSH 0.2.2-rc.1 上测试通过。包内声明了 dsh.bundle.patch,可用 dsh plugin add 安装。
许可证
MIT,见 LICENSE。
Links
More in this category
bowenliang123/dsh-context★ 4797
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★ 661
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★ 289
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
zh667/TokenLedger★ 203
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★ 188
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★ 115
Personal center for DeepSeek Harness: cross-session usage statistics with per-provider and per-model breakdown (auto-discovers configured models), per-model cost estimation, global custom instructions, 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.