Real-time DeepSeek account balance readout in the session header: host /api/balance route resolves the API key through the credentials seam (never sent to the browser), 60-second auto-poll plus manual refresh.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:lkshjd/dsh-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.
在 DeepSeek Harness Web UI 的会话标题栏右侧显示 DeepSeek 账户余额,每 60 秒自动刷新,点击可手动刷新。
功能
- 显示账户余额(充值余额 + 赠送余额,人民币)
- 60 秒轮询 + 点击手动刷新
- API key 只在 host 进程内解析,绝不下发浏览器(只回传余额数字)
- 路由只接受环回来源请求(防 DNS rebinding 读他人余额)
- 余额接口失败时优雅降级为"查询失败",不崩界面
技术要点
- 双面插件:host 半注册
GET /api/balance路由(ctx.webServer),用ctx.credentials解析DEEPSEEK_API_KEY调 DeepSeek/user/balance;client 半在conversation.session.header.utilities插槽渲染余额组件 - baseURL 复用 llm-deepseek 约定:默认官方
https://api.deepseek.com,可用DEEPSEEK_BASE_URL环境变量覆盖
安装
# 安装到你的 profile(本插件声明了 dsh.bundle.patch,安装后自动挂载)
dsh plugin --profile web add @sky_sun/dsh-balance
# 或者直接 npm install 到 profile 目录
cd $env:USERPROFILE\.dsh\profiles\web
npm install @sky_sun/dsh-balance
安装后重启 dsh web,标题栏右侧即可看到余额。
配置
| 字段 | 默认 | 说明 |
|---|---|---|
apiKeyEnv |
DEEPSEEK_API_KEY |
凭据引用(环境变量名),host 端解析 |
baseURL |
官方 API | 端点 base,省略时用 $DEEPSEEK_BASE_URL 或官方地址 |
在 profile 的 cordis.patch.yml 里可覆盖:
- id: ui-balance
config:
apiKeyEnv: DEEPSEEK_API_KEY
baseURL: https://api.deepseek.com
依赖
需要 DSH 的 host 提供:@deepseek-ai/dsh-host-webserver(web 服务器)、@deepseek-ai/dsh-credentials(凭据 seam)。web profile 均已内置。
已知限制
- 余额查询频率固定 60 秒 + 手动,不支持自定义间隔
- 只在 web profile 下工作(依赖浏览器插槽)
Links
More in this category
bowenliang123/dsh-context★ 1286
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★ 254
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
zh667/TokenLedger★ 194
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.
wssfk12138/dsh-damage-pulse★ 147
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
Ychris12138/dsh-usage-stats★ 141
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
feibi-mochi/deepseek-harness-control-center★ 67
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.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.