DeepSeek Harness Plugin Hub

发布与管理完整 Harness Profiles,发现适合你的插件。

探索

插件目录环境预设文档中心动态

社区

发布插件联系我们报告问题

相关链接

Plugin Hub GitHubDeepSeek Harness 官方项目系统状态隐私说明
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

独立、非官方社区项目,与 DeepSeek 官方无隶属、授权或背书关系。

Balance Monitor — DeepSeek Harness 插件(DSH Plugin)
DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录
← Plugins

@rainronin/dsh-balance-monitor

Balance Monitor

DeepSeek Harness 插件:DeepSeek API 余额实时监测(官方 /user/balance 快照 + ds_balance 工具 + 峰谷计价状态 + 单会话费用估算 + Matrix/原生双风格侧边栏徽章)

插件会安装到这里;不确定时保持 web。

npx -y @deepseek-ai/dsh plugin --profile web add @rainronin/dsh-balance-monitor@0.3.0
README兼容性版本
dsh 原生风格

兼容性与来源证明

Balance Monitor 以 @rainronin/dsh-balance-monitor 发布,当前版本为 0.3.0。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

DSH 兼容范围
*
运行环境
web
发布来源
npm
Registry 更新时间
2026/9/20

版本

0.3.0stable
2026/8/31
0.2.1stable
2026/8/20
0.2.0stable
2026/8/17
查看其余 1 个版本收起版本
0.1.0stable
2026/8/16

相关插件

正在加载相关插件…

最新版
0.3.0
DSH
*
HMR
重启进程
Tree shaking
未声明可安全裁剪
解包体积
82.2 kB
文件数
12
Surface
web
许可证
MIT
发布源
npm
GitHub
★ 3
周下载
97
最近提交
2026/8/31
查看源码 ↗项目主页 ↗
README Badge

点击下方 Badge 复制 Markdown,粘贴到 README 即可。

这是你的 Plugin?认领权益 · 优先安全扫描

验证 package.json 声明的 GitHub 仓库,即可管理这个公开页面。认领后,Hub 会优先安排当前版本的安全扫描,并在通过后公开展示结果。

认领这个 Plugin →
报告问题

相关插件

继续浏览 models-usage 分类下经过校验的插件。

Usage@linxin666/dsh-usagedsh Web GUI 的使用统计插件:检测各提供商余额和编码计划配额,并提供实时令牌使用记录,以及当前提供商的专属宠物气泡Whale Widgetdsh-whale-widgetDSH Web 界面右下角的 DeepSeek 余额小鲸鱼挂件:余额/今日已用/峰谷定价、自定义泡泡点击序列(文本/余额/今日/峰谷/图片/随机语句与并列加权选择)、逐行样式与字体、悬浮快捷编辑、音效与每轮消耗、自定义角色/动图/音效、吸附与翻转自定义Usage Stats@ychris12138/dsh-usage-statsdsh Web GUI 的令牌使用热力图、提供商余额和订阅配额Codex Connectdsh-codex-connect用于 DeepSeek Harness 的 ChatGPT OAuth 和 Codex 模型。

README

dsh-balance-monitor

English | 中文

A DeepSeek Harness plugin that monitors your DeepSeek API account balance: official /user/balance snapshots, in-session queries, Beijing-time peak/off-peak pricing status, and a native-style sidebar badge.

dsh 原生风格


English

Features

CapabilityDescription
💬 In-session queryds_balance tool: the agent can fetch the official balance snapshot anytime (force: true bypasses the cache)
🔄 Optional per-turn injectionFresh balance can be injected into the model context before every turn (off by default — the badge + ds_balance tool already cover it; cache-only read, never blocks the conversation)
🖥️ Sidebar badgeNative dsh style: 余额 CNY ¥32.81 · 连接正常, 刷新 button for on-demand refresh, 30s auto polling, rail state collapses into a status lamp
🔐 Zero-config keyReuses DEEPSEEK_API_KEY from dsh's credential service (never written to disk, never logged)
💱 Multi-currencyCNY/USD both listed (CNY first, $/€/£ rendered per currency); amounts stay strings end-to-end, no float math
⛰️ Peak/off-peak pricingShows 高峰 HH:MM:SS / 空闲 in the status bar; during peak hours it counts down to the next off-peak period (Beijing time). Before 2026-08-17 the same windows are previewed, with the official billing start shown in the tooltip.
💰 Session costThe sidebar badge also shows the current conversation's estimated cumulative cost (本会话 ¥xx.xx), calculated from official DeepSeek V4 peak/off-peak pricing; it follows the currently selected session automatically
🛡️ Rate-limit friendly30s TTL cache + request serialization (at most one in-flight request) + 5s timeout

Installation

# Option 1: install from npm (recommended)
# Web profile
dsh plugin --profile web add @rainronin/dsh-balance-monitor
# DSH Desktop profile (or run inside Desktop's own terminal without --profile)
dsh plugin --profile desktop add @rainronin/dsh-balance-monitor

# Option 2: install straight from GitHub
dsh plugin --profile web add github:Rainronin/dsh-balance-monitor
dsh plugin --profile desktop add github:Rainronin/dsh-balance-monitor

# Option 3: clone and link-install locally (instant reload while developing)
git clone https://github.com/Rainronin/dsh-balance-monitor.git
cd dsh-balance-monitor
dsh plugin --profile web add .
dsh plugin --profile desktop add .

# host-side changes require a restart
dsh web

If pnpm blocks the prepare build script of a git-hosted plugin, add the printed key to allowBuilds in $DSH_HOME/profiles/<profile>/pnpm-workspace.yaml and re-run.

The plugin joins dsh.profile.bundles automatically. Inspect the composed tree:

dsh --profile web --dump-config
dsh --profile desktop --dump-config

Usage

In-session query — just ask the agent:

查一下 DeepSeek 余额 / check my DeepSeek balance

Sidebar badge — at the sidebar footer next to Settings: 刷新 force-refreshes past the cache; polling follows the host-configured interval (30s by default); the collapsed (rail) state shows a single status lamp (green = 连接正常, amber = degraded). The badge follows the dsh native theme. When a conversation is selected, the badge also shows 本会话 ¥xx.xx — the estimated cumulative cost of that conversation, calculated from official DeepSeek V4 peak/off-peak pricing; switching conversations switches the cost automatically.

Configuration

KeyDefaultMeaning
apiKeyEnvDEEPSEEK_API_KEYCredential reference (env var name); change for a different account
cacheTtlMs30000Cache lifetime in ms
pollIntervalMs30000Background polling interval in ms
injectEveryTurnfalseWhether to inject the balance into context every turn (opt-in; the badge and ds_balance tool are on by default)
requestTimeoutMs5000Official-API request timeout in ms

Override in the profile's cordis.patch.yml:

- id: balance-monitor
  config:
    cacheTtlMs: 10000
    pollIntervalMs: 10000

Error semantics

StateBehavior
No API key configuredTool returns a Chinese hint; badge shows amber 未配置密钥
API failure + stale cacheLast snapshot is returned, marked "snapshot expired Ns (last refresh failed, retrying)"
API failure + no cacheThe real failure (HTTP status / network / timeout / bad response) is surfaced; badge shows amber 无信号
Invalid or rejected API keyTool returns the real reason; badge shows amber 未配置密钥
Injection-time API failureSilent degradation: nothing injected, conversation unaffected

Peak/off-peak pricing status

The official pricing page defines peak hours as Beijing time 09:00-12:00 and 14:00-18:00; all other hours are off-peak. The new pricing takes effect at 2026-08-17 00:00 Beijing time. The host computes the current phase and the badge shows:

PhaseStatus text
Peak高峰 02:14:23 — counts down to the off-peak period
Off-peak空闲
Before 2026-08-17Same windows are previewed; the tooltip notes 2026-08-17 00:00 as the billing start

Architecture

host half (Node)
  BalanceRemoteService (service key `balance`; loader mounts the default-exported class)
  ├─ credential lookup → GET https://api.deepseek.com/user/balance → 30s TTL cache + serialization
  ├─ ds_balance tool + optional agent/pre-step injection + configurable polling
  ├─ peak/off-peak pricing state computed on Beijing time (09:00-12:00, 14:00-18:00 peak)
  ├─ balance/sessionCost: scans the selected session's event log and estimates cumulative
  │   cost using official DeepSeek V4 peak/off-peak prices
  └─ typert/typert-host.js: hand-written TYPERT strict manifest (exported as ./typert,
      registered by typert-loader; api-gateway claims /api/balance/* via the strict definition)

browser half (client.tsx → lib/client.js, wrapped in the official __ModuleLoader__ shell)
  ├─ sidebar.footer.action slot: native-style badge (wide/rail states)
  └─ data channel: direct calls over the official RPC protocol (POST /api/balance/<method>,
      client-request envelope), host-configured polling + `刷新` force refresh + phase-transition refresh

The third-party Typert Remote client path ($mount contribution → namespace service) failed silently in practice, so the badge talks the official RPC wire protocol directly (dsh-host-apiproxy fetch-carrier envelope), while the host side keeps the official TYPERT strict registration.

Development

npm install            # toolchain (typescript/pnpm + type deps)
npm run build          # clean + tsc (host ESM/client CJS) + wrap-client + RPC/typert self-checks
node scripts/diagnose.mjs # local cordis integration diagnosis (mock services)
dsh plugin --profile web add .   # link install

Build notes: npm run build cleans lib/ first, compiles the host half as ESM and the browser half as CommonJS, wraps the client with scripts/wrap-client.mjs into the official window.__ModuleLoader__.load shell (same shape as official dsh-client-ui-* artifacts, served by dsh-client-modules as /plugins/<id>/client.js), then runs scripts/verify-client.mjs (bundle registration, slot mounting, RPC envelope and rpcId echo) and scripts/verify-typert.mjs (strict codec positive/negative cases).


中文

DeepSeek Harness 插件:DeepSeek API 账户余额监测——官方 /user/balance 接口快照 + 会话内查询 + 北京时间峰谷计价状态 + dsh 原生风格侧边栏徽章。

功能

能力说明
💬 会话内查询ds_balance 工具:agent 随时可查官方余额快照(force: true 穿透缓存)
🔄 每轮注入(可选)默认关闭。开启后每轮对话前自动把最新余额放进模型上下文(只读缓存,绝不阻塞对话)——徽章与工具已默认覆盖该信息
🖥️ 侧边栏徽章dsh 原生风格:余额 CNY ¥32.81 · 连接正常,刷新 按钮手动穿透刷新,30s 自动轮询,折叠态退化为状态灯
🔐 零配置密钥复用 dsh 凭证服务里的 DEEPSEEK_API_KEY(不落盘、不打印、不缓存)
💱 多币种CNY/USD 全列(CNY 优先,USD/EUR/GBP 显示对应货币符号),金额全程字符串透传,无浮点运算
⛰️ 峰谷计价状态状态栏显示 高峰 HH:MM:SS / 空闲;高峰期实时倒计时到空闲阶段(北京时间)。2026-08-17 前按同一窗口预览,tooltip 标注正式计费生效时间
💰 单会话费用侧边栏徽章额外显示当前会话累计估算费用(本会话 ¥xx.xx),按 DeepSeek 官方 V4 峰谷价格计算,切换会话时自动跟随当前会话
🛡️ 限流友好30s TTL 缓存 + 请求串行化(同一时刻最多一个在途请求)+ 5s 超时

安装

# 方式一:npm 直装(推荐)
# Web profile
dsh plugin --profile web add @rainronin/dsh-balance-monitor
# DSH Desktop profile(或在 Desktop 专用终端里直接 dsh plugin add,无需 --profile)
dsh plugin --profile desktop add @rainronin/dsh-balance-monitor

# 方式二:GitHub 直装
dsh plugin --profile web add github:Rainronin/dsh-balance-monitor
dsh plugin --profile desktop add github:Rainronin/dsh-balance-monitor

# 方式三:本地 clone 后 link 安装(改代码即时生效,适合二次开发)
git clone https://github.com/Rainronin/dsh-balance-monitor.git
cd dsh-balance-monitor
dsh plugin --profile web add .
dsh plugin --profile desktop add .

# host 半改动后重启生效
dsh web

git 托管插件若被 pnpm 拦截 prepare 构建脚本,按提示把键加进 $DSH_HOME/profiles/<profile>/pnpm-workspace.yaml 的 allowBuilds 再重跑。

安装后插件自动进入 dsh.profile.bundles 层列表;检查配置树:

dsh --profile web --dump-config
dsh --profile desktop --dump-config

使用

会话内查询——直接让 agent 查:

帮我查一下 DeepSeek 余额

侧边栏徽章——侧边栏底部(Settings 旁):刷新 按钮穿透缓存立即刷新; 轮询间隔跟随 host 配置(默认 30s);折叠态(rail)显示单色状态灯(绿 = 连接正常, 琥珀 = 异常)。徽章跟随 dsh 原生主题。选中某个会话时,徽章还会显示 本会话 ¥xx.xx—— 按 DeepSeek 官方 V4 峰谷价格估算的当前会话累计费用;切换会话时会自动跟随当前会话。

配置

键默认值说明
apiKeyEnvDEEPSEEK_API_KEY凭证引用名(环境变量名),多账号时改这里
cacheTtlMs30000缓存有效期(毫秒)
pollIntervalMs30000后台轮询间隔(毫秒)
injectEveryTurnfalse是否每轮注入余额到模型上下文(默认关闭,按需开启)
requestTimeoutMs5000官方接口请求超时(毫秒)

覆盖示例(profile 的 cordis.patch.yml):

- id: balance-monitor
  config:
    cacheTtlMs: 10000
    pollIntervalMs: 10000

错误语义

状态表现
未配置 key工具返回中文提示;徽章显示琥珀 未配置密钥
接口失败 + 有旧缓存返回最后一次快照并标注"快照已过期 Ns(最近一次刷新失败,自动重试中)"
接口失败 + 无缓存返回真实失败原因(HTTP 状态码 / 网络 / 超时 / 响应格式);徽章显示琥珀 无信号
key 无效或未授权返回真实原因;徽章显示琥珀 未配置密钥
每轮注入时接口失败静默降级:不注入、不打断对话

峰谷计价状态

官方价格页定义高峰时段为北京时间 09:00-12:00、14:00-18:00,其余为空闲; 新计价于 2026-08-17 00:00 北京时间生效。host 计算当前阶段,徽章显示:

阶段状态栏
高峰高峰 02:14:23——倒计时到进入空闲阶段
空闲空闲
2026-08-17 前按同一窗口预览;tooltip 标注 2026-08-17 00:00 为正式计费起点

架构

host 半(Node)
  BalanceRemoteService(服务键 balance,loader 行直接挂载 default 导出类)
  ├─ 凭证解析 → GET https://api.deepseek.com/user/balance → 30s TTL 缓存 + 串行化
  ├─ ds_balance 工具 + 可配置轮询(每轮注入为可选项,默认关闭)
  ├─ 峰谷计价状态:按北京时间 09:00-12:00、14:00-18:00 计算高峰
  ├─ balance/sessionCost:扫描所选会话事件日志,按官方 DeepSeek V4 峰谷价格估算累计费用
  └─ typert/typert-host.js:手写 TYPERT strict 元数据(./typert 导出,typert-loader 注册,
      api-gateway 按 strict 定义认领 /api/balance/* 端点)

browser 半(client.tsx → lib/client.js,__ModuleLoader__ 注册壳)
  ├─ sidebar.footer.action slot:dsh 原生风格徽章(wide/rail 双态)
  └─ 数据通道:官方 RPC 公开协议直调(POST /api/balance/<method>,
      client-request 信封),host 配置轮询 + `刷新` 穿透刷新 + 阶段切换即时刷新

第三方 Typert Remote 客户端链路($mount 贡献 → 命名空间服务)在本机环境实测 静默失效,故徽章改用官方 RPC 公开协议直调(dsh-host-apiproxy fetch carrier 信封), host 端严格保留官方 TYPERT strict 注册路径。

开发

npm install            # 装工具链(typescript/pnpm,含类型依赖)
npm run build          # clean + tsc(host ESM/client CJS)+ wrap-client 包壳 + RPC/typert 自检
node scripts/diagnose.mjs # 本地 cordis 集成诊断(mock 服务验证工具注册与服务可见性)
dsh plugin --profile web add .   # link 安装

构建说明:npm run build 先清空 lib/,host 半编译为 ESM、browser 半编译为 CommonJS,再经 scripts/wrap-client.mjs 包进官方 window.__ModuleLoader__.load 注册壳 (与官方 dsh-client-ui-* 产物同构,由 dsh-client-modules 服务为 /plugins/<id>/client.js);随后 scripts/verify-client.mjs 验证 bundle 注册、slot 挂载、RPC 信封与 rpcId 回显,scripts/verify-typert.mjs 验证 strict codec 正反例。