Shows the DeepSeek API account balance under the brand row of the DSH sidebar and refreshes it every 60 seconds. A dot turns green when the account is available, red when it is not, and orange when the request fails. The balance is read through a same-origin endpoint served by the host, and that endpoint rejects untrusted requests, so neither the API key nor the account token reaches the browser. When a DeepSeek account is signed in, the balance comes from the account wallet, adding top-up and bonus credit per currency; otherwise it falls back to the DEEPSEEK_API_KEY balance API. Next to the amount, a label shows whether the current time falls in DeepSeek peak or off-peak pricing.
Install
# from a prebuilt release tarball
dsh plugin --profile web add "https://github.com/happyde2b/dsh-balance-display-simple/releases/latest/download/dsh-balance-display-simple.tgz"
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:happyde2b/dsh-balance-display-simple
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 侧边栏顶部品牌行下方实时显示 DeepSeek API 账户余额。
名字里的
simple是实话:只做「查余额、显示余额」。没有图表、历史记账、多供应商切换。
功能
- 侧边栏 deepseek 标题正下方显示
API 余额 ¥19.74,多币种用·拼接 - 每 60 秒自动刷新;点击余额条立即刷新
- 状态圆点:绿 = 正常,红 = 账户不可用,橙 = 查询失败(保留上次数值)
- 侧边栏折叠成 rail 时自动隐藏
- 跟随主题配色
安全设计
浏览器 / 渲染进程不接触 API Key:
- Host 半区(
lib/index.js)注册同源端点GET /api/deepseek-balance-simple,通过credentials服务解析DEEPSEEK_API_KEY(来源:进程环境 ><DSH_HOME>/.credentials.yaml>.env), 由服务端调用https://api.deepseek.com/user/balance(15 秒超时,cache-control: no-store)。 - Client 半区(
lib/client.js)只请求这个本地端点,经 MutationObserver 在侧边栏品牌行后注入余额条, React 重渲染后自动重新挂载。
安装
前置:Node.js 20+;DSH_HOME 指向 DSH 数据家,或用 --dsh-home 显式传入。
方式 A:手动复制(不需要 pnpm)
git clone https://github.com/happyde2b/dsh-balance-display-simple.git
cd dsh-balance-display-simple
node install.js # → <DSH_HOME>\profiles\desktop\node_modules\dsh-balance-display-simple
node install.js --profile web # 指定 profile
# 同时更新 profile 的 package.json(dependencies + dsh.profile.bundles)
方式 B:官方插件管理器
node install.js --pack # 产物:<DSH_HOME>\downloads\dsh-balance-display-simple-<版本>.tgz
# 在 DSH「插件 → 添加插件」里填该 tgz 的绝对路径,安装后启用
安装后重启 DSH 桌面端生效。
配置
暂无配置项。轮询间隔在 lib/client.js 顶部 REFRESH_MS = 60000,改后重启桌面端。
验证
node --check lib/index.js
node --check lib/client.js
桌面端运行中可直接查端点:
curl http://127.0.0.1:<DSH Web 端口>/api/deepseek-balance-simple
# {"ok":true,"fetchedAt":...,"is_available":true,"balance_infos":[{"currency":"CNY","total_balance":"19.74"}]}
目录结构
lib/index.js Host 半区:注册余额端点
lib/client.js Client 半区:侧边栏余额条
cordis.patch.yml bundle 配置层(插入插件行)
install.js 手动安装 / 打包脚本
许可
MIT
Links
More in this category
bowenliang123/dsh-context★ 5364
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★ 737
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★ 290
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
zh667/TokenLedger★ 205
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★ 192
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.