中文EN

dsh-api-balance-plugin

workflow已测通过npmUnlicense 條件偏離

Resident DeepSeek API balance pill and detail popover under the composer, plus a /balance command and an api_balance agent tool.

📦 体积
0.05 MB · 小巧
🔌 需要联网
未声明
✅ 沙箱测试
已通过
🏷️ 已发布版本
2 个

這個插件適合誰

  • 想找、想管插件的人
下载量 / Downloads
0
依赖体积 / node_modules
0.05 MB
测试时间 / Tested
2026-11-07
DSH 版本 / Version
0.2.2-rc.1

安装

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

沙箱测试结果

條件偏離 —— 本結果在 DSHIO/T 21 v0.9 條件下產生(內存 1g、CPU 1.5、T4 超時 60s,未記鏡像 digest)。偏離條款:5.1.3(内存 768MB)、5.1.3(CPU 1 核)、5.1.6(T4 超时 90s)、5.1.2(镜像 digest)。按 DSHIO/T 21 §8.2,該判定不得與標準條件結果比較,不得用作認證依據。
阶段结果
T0 静态检查—
T1 安装✓
T2 列装✓
T3 挂载✓
T4 启动—

四阶段在隔离沙箱里跑:安装(有网)→ 列装 → 挂载 → 启动(后三步断网)。

README

dsh-api-balance

DeepSeek Harness 内置余额显示 · npm package: dsh-api-balance-plugin

A DeepSeek Harness plugin bundle that keeps your DeepSeek

API balance in sight: a resident pill under the composer, a click-through detail popover, a /balance command,

and an api_balance tool the agent can call on its own.

This is a Harness plugin (a Host half + a browser half + a bundle patch), not a model-facing skill.
Installing it adds real UI and a real tool to the Harness; a skill only adds instructions to the prompt.

[中文说明](#中文说明) · [Install](#install) · [Configuration](#configuration) · [How it works](#how-it-works) · [Privacy](#data--privacy) · [Limitations](#limitations)


Features

  • Resident pill in the composer dock, beside the built-in activity and usage entries: ¥128.40. It refreshes on

its own and never needs a click to stay current.

  • Detail popover on click: total balance, topped-up credit, granted credit, the update time, and links to the

Platform pages for usage detail and top-up.

  • /balance command: type it in the composer and the balance lands in the conversation as a plain text row.

Nothing is sent to the model and no tokens are spent.

  • api_balance tool: ask the agent “how much credit is left?” and it reads the same values.
  • Both credential styles: a signed-in DeepSeek account (wallet balances from the account grant) or a plain

DEEPSEEK_API_KEY. It picks whichever you actually have.

  • Theme- and locale-aware: only --dsw-alias-* tokens are used, and the copy follows the active UI language

(English and Chinese are bundled).

Requirements

Requirement · Notes

DeepSeek Harness >= 0.2.1-rc.2 · Tested against 0.2.1-rc.2 (desktop and web).

A credential · A signed-in DeepSeek account in the app, or the DEEPSEEK_API_KEY credential reference.

A DeepSeek account · Other providers do not expose a balance endpoint; see [Limitations](#limitations).

Install

From this repository (works today) — clone it, then install the directory:

git clone https://github.com/Muzi1015/dsh-api-balance.git

Then tell your agent:

Install the plugin bundle at <absolute path>/dsh-api-balance.

From npm (once dsh-api-balance-plugin is published) — ask your agent:

Install the dsh-api-balance-plugin plugin bundle.

Either route runs Plugin Manager's install_bundle, links the package into your profile, and enables it. You can also

install by package name from the app's Settings → Plugins area. Both survive restarts because the bundle is recorded

in your profile, not in a session.

Configuration

Two knobs, both with safe defaults. Override them by targeting the row id api-balance in your profile patch layer

(~/.dsh/profiles/<profile>/cordis.patch.yml). A matching override replaces the whole config, so repeat every

key you still want:

- id: api-balance
  name: 'dsh-api-balance-plugin'
  config:
    refreshSeconds: 120
    lowBalance: 20

Key · Default · Meaning

refreshSeconds · 60 · How often the Host re-reads the balance (clamped to 15–3600). The pill polls the Host at the same rate.

lowBalance · 5 · Below this amount the pill switches to the warning tone and the popover adds a low-balance note. 0 disables it.

Usage

Surface · What happens

Composer dock · ¥128.40 with a state dot. Green = available, amber = low balance or a failed read, grey = unavailable.

Click the pill · Popover with 总余额 / 充值 / 赠送, update time, 用量明细 and 去充值 links, plus an Esc-to-close dialog and a manual refresh button.

/balance · A command row with the same numbers; errors (no credential, 401, timeout) print their reason.

Agent tool · api_balance with an optional fresh flag to bypass the Host cache.

The popover reads through the Host, so the API key never reaches the browser: the page only ever sees amounts.

Data & privacy

  • The Host reads ctx.deepseekAccount.getBalance() when an account grant is stored; otherwise it resolves the

DEEPSEEK_API_KEY credential reference (provider store first, then the ambient environment) and calls

GET https://api.deepseek.com/user/balance.

  • The browser receives a JSON snapshot of amounts only — no token, no key, no profile.
  • The snapshot route is GET /plugin/api-balance/snapshot, same-origin guarded (a cross-site sec-fetch-site

is answered with 403; other methods get 405). It is registered on the local Harness web server only.

  • The Host caches one snapshot for refreshSeconds so several surfaces never multiply upstream calls.
  • Nothing is written to disk by this plugin; it keeps no history and sends no telemetry.

Limitations

  • DeepSeek only. The plugin reads the DeepSeek Platform wallet. OpenAI, Anthropic and most other providers do not

publish a balance endpoint, so a generic “balance” panel is not something one adapter can cover.

  • Balance, not itemized usage. The public API exposes the wallet, not a usage ledger, so “usage detail” is a link

into the Platform page where you are already signed in.

  • Sign-in happens in the app. If you use an API key, that is all the plugin needs. Account wallets only appear when

the Harness account sign-in is complete.

  • The pill needs a Web-surface client (the composer dock is a browser slot); /balance and the tool are Host-side and

work wherever a composer or an agent exists.

How it works

File · Role

index.js · Host half: one read() shared by the HTTP route, the /balance command and the api_balance tool, with a TTL cache and upstream failure reporting.

client.js · Browser half: a conversation.composer.dock entry that renders the pill and a fixed-position popover, polls the route, and follows ctx.locale.

cordis.patch.yml · Bundle patch: inserts row api-balance with its default confi

…(truncated)

以上内容来自 npm 上的 README,我们只做格式化,不改内容。

嵌入徽章

两个徽章各用自己站的标识:左边是**标准**(DSHIO 发布),右边是**检测机构**(deepseekbase 检测)。每次展示都指向标准原文和检验报告。

DSHIO/T 10deepseekbase

Markdown(推荐,两个一起)

[![DSHIO/T 10](https://deepseekbase.com/badge/std.svg)](https://dshio.org/10/) [![deepseekbase](https://deepseekbase.com/badge/dsh-api-balance-plugin.svg)](https://deepseekbase.com/zh/plugins/dsh-api-balance-plugin/)

注意:这不是认证。DSHIO/T 32 认证规则尚未启用。

版本

npm 上共发布:2,最后更新 2026-10-20

链接

GitHub · Homepage · npm

常見問題

怎麼安裝 dsh-api-balance-plugin?
在 DSH 裡執行 dsh plugin --profile web add dsh-api-balance-plugin。如果你用的是 DSH Desktop,也可以在插件頁面直接貼套件名。
裝不上怎麼辦?
先確認 DSH 版本夠新(dsh --version),再看上面測試結果區的第一條錯誤。還不行就到 GitHub 倉庫提 issue。
怎麼卸載?
執行 dsh plugin --profile web remove dsh-api-balance-plugin。

同类插件

同類插件對比

插件下載沙箱判定體積
dsh-image-gen56.2K✅ 通過35.73 MB
@nanmicoder/dsh-agent-teams51.7K✅ 通過3.32 MB
@michengai/dsh-automation37.5K✅ 通過26.32 MB
@morehao/dsh-github-trending11.0K✅ 通過2.39 MB
dsh-speak-up10.9K✅ 通過0.2 MB
@goodandready/dsh-cron8.8K✅ 通過1.69 MB
dsh-openwrite8.1K❌ 裝不上—
dsh-novel-forge8.0K✅ 通過1.79 MB