dsh-wallet-pill
A composer-dock wallet pill for DeepSeek Harness that shows the account balance behind DEEPSEEK_API_KEY and opens a panel with the peak/off-peak billing window, a live switch countdown, and per-model token prices.
Install
dsh plugin --profile web add dsh-wallet-pill
Sandbox test results
| Stage | Result |
|---|---|
| 1 install | ✓ |
| 2 list | ✓ |
| 3 mount | ✓ |
| 4 boot | — |
Four stages run in an isolated sandbox: install (network on) → list → mount → boot (last three with no network).
README
dsh-wallet-pill






DeepSeek Harness 的余额胶囊:在输入框下方显示账户余额,点开查看峰谷价目与切换倒计时。零配置、不落盘。
非官方社区插件,与 DeepSeek 官方无隶属关系。
预览
深色主题 · 浅色主题
!深色主题下的余额胶囊与价目面板 · !浅色主题下的余额胶囊与价目面板
胶囊在输入框下方,与官方的「缓存命中 / 轮次」统计条同排;点开是价目面板。
它做什么
胶囊(输入框下方,官方统计行之后)
余额 ¥12.34—— 取DEEPSEEK_API_KEY对应账户的钱包余额;读不到时显示余额 —并带一个状态点。- 没配置 key 时整条不渲染,不占位置。
- 点击展开面板,
aria-haspopup="dialog",Esc 或点击外部关闭,焦点回到胶囊。
面板
区块 · 内容
余额 · 总额、充值余额、赠送余额;读取失败时给出可读原因
计费时段 · 当前是高峰还是空闲、下一切换时刻的实时倒计时
价目 · 缓存命中 / 未命中 / 输出三档,空闲价与高峰价两列,当前时段高亮;多模型可切换
底部 · 上次读数时间、价目表版本、手动刷新按钮
每 60 秒自动刷新一次(页面不可见时暂停),回到页面时立即刷新。
数据与口径
- 余额:Host 侧用
DEEPSEEK_API_KEY调GET https://api.deepseek.com/user/balance,60 秒缓存。密钥只在 Host 进程内使用,浏览器只访问本机路由/wallet-pill/state,响应里只有聚合后的金额。 - 峰谷:北京时间周一至周五 09:00–12:00、14:00–18:00 为高峰,其余时段(含周末、法定节假日全天)为空闲;高峰价是空闲价的 2 倍。
- 价目(CNY / 百万 token):
deepseek-flash0.02 / 1 / 4,deepseek-v4-pro0.15 / 4.5 / 13.5(空闲价;高峰加倍)。来源为 DeepSeek 官方定价页,版本2026-09-19。
官方调价或公布次年放假安排时,改 src/host/pricing.ts 里的 MODELS / HOLIDAYS 与 PRICE_TABLE_VERSION,面板上显示的版本号会跟着变。
安装
已发布到 npm:dsh-wallet-pill,当前版本 1.0.1。
# 桌面端 dsh plugin --profile desktop add dsh-wallet-pill # CLI / Web dsh plugin --profile web add dsh-wallet-pill
需要固定版本时写成 dsh-wallet-pill@1.0.1。
也可以直接从 GitHub 源安装(商店生成的命令):
dsh plugin --profile web add github:LumiDesk/dsh-wallet-pill
装好后需要重启 Harness 进程(Host 侧改动不是刷新页面就能生效),再刷新页面。
卸载:
dsh plugin --profile desktop remove dsh-wallet-pill
开发
pnpm install # 安装依赖 pnpm hooks:install # 可选:装 husky git hooks pnpm build # host(tsc)+ client(esbuild) pnpm typecheck # host / client / test 三个 tsconfig 各过一遍 pnpm lint # eslint pnpm test # node --test,会先自动 build pnpm format # prettier --write pnpm release patch # 发版:校验 → 升版本 → 打 tag → npm publish
Node 22+(本机 24),pnpm 12。客户端产物是 dist/client.js,包在 Harness 的 window.__ModuleLoader__.load(...) 工厂里;react 与 react-dom 从页面模块表取,不打包。
仓库不声明 prepare 等安装期脚本:pnpm 12 默认拒绝执行 git 依赖的构建脚本,保留它会让商店生成的 github: 安装命令报 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED;git hooks 用 pnpm hooks:install 手动装。
dist/ 是入库的构建产物,不是临时目录:npm tarball 通过 files 带上它,商店的 github:owner/repo 安装则直接从 commit 取文件、不执行构建,pnpm 也默认拒绝 git 依赖的安装期脚本。不提交 dist/ 时,GitHub 源安装能装上但找不到 dist/index.js / dist/client.js。改完 src/ 后运行 pnpm build 并提交 dist/;pnpm release 的 version 脚本会自动 build 并 git add dist。
技术栈
层 · 选择
语言 · TypeScript(strict、noUncheckedIndexedAccess),全仓无 any
Host · Node 22+ ESM,tsc 编译到 dist/index.js,运行时零依赖
Client · React 18(宿主页面模块表提供,不打包)+ esbuild 打成 __ModuleLoader__ 工厂
样式 · 只用宿主 --dsw-* 主题 token,无 CSS 框架;浮层复用官方 menu surface(--dsw-specific-menu + --dsw-elevation-prominent)
测试 · node --test 直接跑 .ts(Node 24 类型剥离),39 条用例,零测试框架
规范 · ESLint + Prettier + Commitlint(Conventional Commits)+ Husky + lint-staged
兼容 · DeepSeek Harness ≥ 0.2.1-rc.3;不声明 @deepseek-ai/dsh-* 的 peer 依赖(否则会被安装闸门拒绝)
目录
src/host/index.ts Host 入口:HTTP 路由、信任栅栏、状态装配 src/host/balance.ts 余额取数、缓存、错误映射 src/host/pricing.ts 价目表、峰谷判定、节假日 src/client/index.tsx Client 入口:槽位注册、字典、样式注入 src/client/pill.tsx 胶囊与面板 src/client/api.ts 状态请求 src/client/format.ts 金额 / 时长 / 时间格式化 src/client/locales.ts zh / en 文案 scripts/build-client.mjs Client 的 IIFE 打包 scripts/release.mjs 发版助手 dist/ 入库的构建产物:npm tarball 与 GitHub 源安装都直接使用 test/ node --test 测试与 TS 项目 locale/ 插件元数据(zh / en) docs/assets/ README 截图(深色 …(truncated)
Rendered from the README published on npm. Formatted only, not edited.
Versions
Published on npm::2,最后更新 2026-10-26