dsh-deepseek-balance
Manifest validDeepSeek Harness dynamic Cordis plugin: real-time DeepSeek account balance + official top-up entry
dsh-deepseek-balance
DeepSeek Harness 静态 dual-face 插件:在页面内实时显示 DeepSeek 账户余额,并提供官方充值入口。
功能
- 实时余额:调用官方接口
api.deepseek.com/user/balance,展示可用总额 / 充值余额 / 赠送余额(支持多币种 CNY/USD); - 今日消耗:每日基线法统计当天余额总消耗,复式记账:
今日消耗 = 当日基线 + 累计充值 − 当前余额(充值不清零消耗);宿主内置午夜快照定时器(00:00 自动抓取余额作为当日基线,跨夜运行的任务消耗精确计入当日;失败自动重试),基线持久化于~/.dsh/dsh-balance-state.json; - 自动刷新:每 60 秒自动刷新,支持手动「立即刷新」,状态灯(绿/黄/红)与「更新于 HH:MM:SS」时间戳;
- 官方充值:「官方充值 ↗」一键直达 DeepSeek 官方充值页
platform.deepseek.com/top_up(新标签页),附 API Key 创建入口; - 嵌入式 UI:显示在左侧边栏底部、Cordis Plugin 选项上方(
sidebar.footer.action插槽),随明暗主题自适应;侧边栏收起(rail)时显示金额图标; - 密钥管理:支持手动输入 / 更换 / 清除 API Key,界面只显示掩码(
sk-···xxxx)。
架构(dual-face,无构建步骤)
| 文件 | 半区 | 说明 |
|---|---|---|
dsh/index.js | Host | ESM 插件:Node 原生 fetch 调用官方余额接口;在本地 dsh web 服务器上注册同源 HTTP 路由(/dsh-balance/config、/dsh-balance/key、/dsh-balance/key/clear、/dsh-balance/fetch、/dsh-balance/topup)供浏览器半区调用 |
dsh/client.js | Client | 手写 lazy-CJS bundle(window.__ModuleLoader__.load 协议,与内置 client 插件同格式):React UI、主题 token 样式、静默重试连接宿主 |
客户端与宿主的通信走同源 HTTP 路由(页面由 dsh 的本地 web 服务器提供),不依赖动态插件专属的 host.call 机制。
安全说明
- 仓库代码中不包含任何 API Key。密钥按以下顺序从运行时获取(始终为 DeepSeek 官方账户):
- 会话内存(用户在面板中输入的密钥);
- 进程环境变量
DEEPSEEK_API_KEY(同步快路径,避免启动期拥塞); - DSH 凭证库 ref
DEEPSEEK_BALANCE_API_KEY(~/.dsh/.credentials.yaml)。
- 密钥仅在本机进程内用于调用官方余额接口,不出网、不落盘。
安装(dsh profile 插件)
本包通过 dsh 的 profile bundle 机制持久挂载(与 modlens 等外置插件同机制;注意:直接写 profile 的 cordis.patch.yml 插入行会在启动时被消费清空、重启后丢失,请使用下面的 bundle 方式):
- 找到你的 dsh profile 目录(默认
~/.dsh/profiles/web/); - 把本包放入 profile 的
node_modules:- 方式 A:在 profile 目录内执行
npm install dsh-deepseek-balance; - 方式 B:手动复制本包到
~/.dsh/profiles/web/node_modules/dsh-deepseek-balance/;
- 方式 A:在 profile 目录内执行
- 编辑 profile 的
package.json,加入依赖与 bundle 条目:
(包内的{ "dependencies": { "dsh-deepseek-balance": "1.2.0" }, "dsh": { "profile": { "bundles": [ "dsh-deepseek-balance" ] } } }cordis.patch.yml作为 bundle 自举补丁在每次启动时自动应用,不会被消费。) - 重启 harness(
dsh web)。卡片自动出现在左侧边栏底部,无需批准、无需每次重装。
版本历史
- 1.3.0 — 移除「按所选模型渠道切换余额」功能:始终显示 DeepSeek 官方账户余额(手动密钥 >
DEEPSEEK_API_KEY> 凭证库); - 1.2.1 — 今日消耗修复:复式记账(充值不清零)+ 午夜快照定时器(跨夜消耗精确计入当日);
- 1.2.0 — 模型渠道感知(按所选模型判别 token 来源并自动重载)+ 今日余额总消耗(每日基线法);
- 1.1.1 — 持久挂载修复:改为 profile bundle 机制(依赖 + bundles 列表 + 包内自举补丁),重启不再丢失;
- 1.1.0 — 静态 dual-face 重构:Node 原生 fetch + 同源 HTTP 路由(不再依赖 shell/curl);嵌入式侧边栏卡片置顶(Cordis Plugin 上方);
- 1.0.x — 动态 Cordis 插件原型(
cordis_define+cordis_run,见 git 历史)。
License
Comments
Loading…
From the same category
by anywhere-labs
为 DeepSeek Harness (DSH) 插件生态打造的现代化桌面端解决方案。万物皆「插件」,桌面本身也是「插件」。
★ 30k
↓ 129/wk
MIT
TypeScript
Oct 3, 2026
dsh plugin --profile web add dsh-plugin-desktopby zhu1090093659
DeepSeek Harness (DSH) Web Plugin Aggregation Ecosystem · Everything is a plugin, distributed via the Creative Workshop
★ 8.4k
↓ 282/wk
Apache-2.0
TypeScript
Oct 7, 2026
dsh plugin --profile web add dsh-webA collection of independent Web UI plugins and skins, including task boards, Git graphs, mobile access, and live token stats.
★ 7.4k
↓ 282/wk
Apache-2.0
TypeScript
dsh plugin --profile web add dsh-webby omdsh-dev
开放的侧边栏底座,支持三方拓展注册新侧边栏页面。内置文件渲染编辑/终端/侧边对话/Git/子代理页面 | Open sidebar foundation, supports third-party extensions to register new sidebar pages. Built-in file rendering/editing, terminal, side chat, Git,
★ 4k
↓ 57.8k/wk
MIT
TypeScript
Oct 5, 2026
dsh plugin --profile web add dsh-better-sidebarby bowenliang123
The best DeepSeek Harness plugin for context insight and management, with context dashboard / browser / sidebar and context command, for context statistics, composition, breakdown, evolution details,
★ 1.9k
↓ 39k/wk
Apache-2.0
TypeScript
Oct 7, 2026
dsh plugin --profile web add dsh-contextby shaobeichen
把 DeepSeek Harness 装进你的口袋:电脑上跑 dsh web,手机扫码即同步访问(局域网 + 公网,实时同屏)Put DeepSeek Harness in your pocket: run dsh web on your computer and access it synchronously by scanning a QR code on your phone (LAN +
★ 1.6k
↓ 3.8k/wk
GPL-2.0
JavaScript
Sep 16, 2026
dsh plugin --profile web add dsh-pocket