跳到正文

stevenx65/dsh-balance-plugin

60最近提交 2026年8月14日

dsh-balance-plugin DSH 插件

该插件在 DSH 网页侧边栏(端口 3080)底部添加一个余额按钮,显示 DeepSeek API 余额和 token 用量统计,支持今日/全部切换。它复用 dsh 的凭证,并读取会话日志来聚合数据。

如何安装 dsh-balance-plugin DSH 插件

dsh plugin --profile web add dsh-balance-plugin

复制不会执行命令。安装 dsh-balance-plugin DSH 插件前请核对仓库和版本。

dsh-balance-plugin DSH 插件数据来源

dsh-balance-plugin DSH 插件快照日期:2026年8月16日

discovered

dsh-balance-plugin DSH 插件能做什么

  • 通过官方 GET /user/balance 接口显示 DeepSeek API 余额
  • 显示 token 用量:未缓存输入、缓存读取、输出、模型调用次数
  • 支持今日(北京时间)和全部历史切换
  • 自动适配亮/暗主题
  • 复用 dsh 凭证,无需手动输入密钥

dsh-balance-plugin DSH 插件适合哪些场景

  • 监控 DeepSeek API 余额,避免额度耗尽
  • 跟踪每日 token 消耗,进行成本管理
  • 分析模型调用模式和用量趋势

dsh-balance-plugin DSH 插件适合谁

  • 使用 DeepSeek Harness 网页配置的开发者
  • 需要管理 DeepSeek API 成本和用量的用户

dsh-balance-plugin DSH 插件的限制

  • 仅支持 deepseek-official 提供商,忽略其他提供商
  • 需要 zstd 命令行工具解压会话日志
  • 依赖 dsh 0.1.0-rc.6 及以上版本的浏览器对等依赖
  • 仅适用于网页平台(端口 3080)

dsh-balance-plugin DSH 插件的仓库 README 摘录

以下文字摘自 dsh-balance-plugin DSH 插件的上游仓库 stevenx65/dsh-balance-plugin 的 README,版权归原作者,仅作引用。

A DeepSeek Harness (dsh) web plugin: shows **DeepSeek API balance** and **token usage** at the bottom of the web sidebar (port 3080), with a **Today / All-time** toggle, filtered by provider (only `deepseek-official`, ignoring other vendors). ## Features - 💰 Balance: calls DeepSeek's official `GET /user/balance`, reusing dsh's credentials (`~/.dsh/.credentials.yaml`) — no manual key entry - 📊 Token usage: reads dsh session logs (`session.jsonl.zstd`), aggregates by provider - Uncached input / cache read / output / model call count - 🔄 Today / All-time toggle: today (Beijing time) or full history - 🎨 Auto-adapts to light/dark theme ## Screenshot ![dsh-balance-plugin](docs/screenshot.png) ## Install (from the plugin market) ```sh dsh plugin --profile web add dsh-balance-plugin ``` Restart `dsh web`, then refresh the page — a balance button appears at the bottom of the sidebar. ## Architecture ``` Browser (3080 page) client.js ──fetch──▶ /dsh-balance/data?scope=today|all │ node side (index.js, inside the dsh process) ├── credentials.resolve("DEEPSEEK_API_KEY") ← reuses dsh's key ├── fetch(https://api.deepseek.com/user/balance) └──

阅读完整 README仓库许可: MIT

dsh-balance-plugin DSH 插件常见问题

如何安装 dsh-balance-plugin?

在终端运行 `dsh plugin --profile web add dsh-balance-plugin`,然后重启 `dsh web` 并刷新浏览器页面。插件会以按钮形式出现在侧边栏底部。

如何卸载这个插件?

可以通过运行 `dsh plugin --profile web remove dsh-balance-plugin` 并重启 `dsh web` 来卸载。或者手动删除 `~/.dsh/profiles/web/node_modules/` 下的插件文件夹,并从 `cordis.patch.yml` 中移除相关条目。

数据从哪里来?

余额数据来自 DeepSeek 官方 API `/user/balance`,使用的是 `~/.dsh/.credentials.yaml` 中存储的凭证。Token 用量数据来自本地 dsh 会话日志(`session.jsonl.zstd` 文件),位于 `~/.dsh/sessions/` 目录下。

是否支持其他提供商,比如 Azure 或 OpenAI?

不支持,该插件目前只过滤 `deepseek-official` 提供商。会话日志中其他提供商的数据会被忽略。如果你使用多个提供商,只有 DeepSeek 的用量会显示。

可以不通过 dsh plugin 命令手动安装吗?

可以。将文件(index.js, client.js, cordis.patch.yml, package.json)复制到 `~/.dsh/profiles/web/node_modules/dsh-balance-plugin/`,然后在 `~/.dsh/profiles/web/cordis.patch.yml` 中添加插件条目,最后重启 `dsh web` 即可。