Kihara777/dsh-api-balance

API 用量余额插件 for DeepSeek Harness — webui 用量圆圈内提供「用量 / 余额」标签切换,展示账户余额与用量明细

Project Overview项目介绍

dsh-api-balance is a native plugin built exclusively for DeepSeek Harness, designed to track DeepSeek API usage and display account balance information directly within DSH’s web user interface. The plugin adds a new “Usage / Balance” tab to the popup panel of the usage indicator circle, which sits to the left of the webui’s send button. It pulls account balance data via DeepSeek’s official GET /user/balance endpoint, can automatically scan for valid authentication tokens from the local browser, and generates charts for consumption broken down by date and model. It also adds small UI enhancements like red labeling for peak billing hours and improved scrolling for help modals.

Most users can install the plugin directly from GitHub via the DSH command line, using the command dsh plugin --profile web add github:Kihara777/dsh-api-balance. Once installed, it activates automatically as a layer of the DSH web profile, and can be uninstalled later with a matching remove command. For NixOS users, there is a declarative Nix Flake installation option available through the NixKits dsh module, which locks plugin versions with the system update for full reproducibility. This plugin is ideal for any DSH user that regularly uses DeepSeek API calls and wants to keep close track of their spending and usage.

The plugin is written entirely in plain JavaScript, with no build step required for installation or development. Dependencies are handled by the host DSH runtime, so local developers only need to run npm install --legacy-peer-deps to get set up. The project is released under the open source MIT license, but it is currently not published as an npm package due to the maintainer’s visual impairment that prevents completing the npm package submission process. Users can only install it via source code or the Nix Flake method, and the maintainer apologizes for any temporary inconvenience.

这是专为 DeepSeek Harness 开发的原生插件,用于追踪 DeepSeek API 的用量消耗与账户余额。它会在网页端界面发送按钮左侧的用量指示圆圈弹出面板中,新增「用量/余额」标签切换栏,支持通过 DeepSeek 官方接口查询账户余额,可自动从本地浏览器登录态获取令牌,展示按日、月、模型分类的详细消耗数据并生成统计图表。

普通用户可通过 DSH 命令行直接从 GitHub 源码安装,命令是 dsh plugin --profile web add github:Kihara777/dsh-api-balance,安装后即作为 web profile 的层级激活生效。NixOS 用户还可使用声明式 Nix Flake 方案安装,版本会随系统更新自动锁定,可复现性更强。这款插件适合经常调用 DeepSeek API 的 DSH 用户,方便随时掌握 API 消耗情况,避免余额不足中断服务。

本插件是纯 JavaScript 开发,不需要构建步骤,依赖由宿主 DSH 在运行时提供,本地开发只需要执行 npm install 安装依赖即可。项目采用 MIT 许可开源,目前暂不提供 npm 打包发布,用户只能通过源码或 Nix 方式安装。维护者因视力障碍暂时无法完成 npm 提交流程,感谢用户的理解。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:Kihara777/dsh-api-balance

把 Kihara777/dsh-api-balance 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-api-balance

中文 | English | 日本語 | 偽中国語

API 用量余额插件(DeepSeek Harness)——在 webui 用量圆圈(发送按钮左侧的上下文已用显示)的弹出面板中提供「用量 / 余额」标签切换。

[!NOTE] 由于维护者(狐莉)患有罕见的视网膜色素变性(锥杆营养不良15型)疾病,并经中华人民共和国残疾人联合会认证属于一级视力残疾,暂时无法独立完成 NPM 软件包提交流程,故本仓库暂时不会提供 npm 打包。我们(狐莉与小爪)对此引起的不便表示抱歉,该问题终有一天会得到解决,但十分遗憾可能并不是现在立刻马上。在此之前,辛苦各位使用者通过 GitHub 源码安装(详见文档)。当然,这位用户,可以耽误您一点时间吗嘛?请允许我向您介绍我们声明式和可复现的 NixOS 以及更加符合狐莉美学的 nix flake 安装方案。(乖巧

安装

从 GitHub 源码安装

dsh plugin --profile web add github:Kihara777/dsh-api-balance

包内 dsh.bundle 指向 cordis.patch.yml,安装后即作为 profile 的一个 layer 激活。 卸载:dsh plugin --profile web remove @kihara777/dsh-api-balance。

声明式安装(NixOS)

NixOS 用户可经 NixKits 的 nixkits.dsh 模块声明式安装—— 版本由 Nix 锁定、随系统代际更新、可复现:

{
  nixkits.dsh.plugins.packages = [{
    package = pkgs.dsh-api-balance;
    id = "api-balance";
    name = "@kihara777/dsh-api-balance";
  }];
}

详见完整文档。

功能

  • 余额 / 用量面板:webui 用量圆圈弹出面板内的「用量 / 余额」标签切换
  • 账户余额:DeepSeek 官方 GET /user/balance(API key 认证)
  • 用量明细:当日 / 当月 / 30 日消耗(金额 + token + 分模型明细)与图表
  • 平台令牌自动获取:默认从本机浏览器登录态自动扫描,手动连接为回退
  • 语音播报:语音包 + TTS(浏览器内置 / 自定义 API),峰谷计费自动提示;音色按界面语言与话的变体自动匹配(请求普通话不会挑到粤语音色),也可在语音设置里直接指定音色
  • 界面增强:峰时红色标识、疑问窗口滚动优化、回车换行开关等

开发

纯 JS 插件,无构建步骤(lib/index.js + lib/client.js 直接提交):

npm install --legacy-peer-deps    # 安装依赖(peer 由宿主 dsh 在运行时提供)

代码结构:

文件 作用
lib/index.js host 半部:端点、令牌管理、上游查询
lib/client.js client 半部:webui 面板与交互
cordis.patch.yml bundle patch:供 dsh plugin add 注册本插件

许可

MIT

安全政策(含已评估的外部报告清单——误报不再重复受理)见 SECURITY.md。

← 上一个 Prev dsh-siyuan 下一个 Next dsh-approval-center →