DeepSeek Harness plugin

dsh-api-balance

DeepSeek account balance readout in the composer stats line for DSH Web

Jump to install

Source facts

Repository
9Epuuuu/dsh-api-balance
Latest update
Aug 14, 2026
Category
Usage & Billing
GitHub stars
2
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/9Epuuuu/dsh-api-balance
Plugin: dsh-api-balance
Author: 9Epuuuu

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer4 files
README.mdSource · read only
README language

@9Epuuuu/dsh-api-balance

English | 中文

DeepSeek account balance in the DSH Web composer stats line: an ambient readout, always visible above the input box, that shows the account balance and the per-session spend:

余额 ¥128.50 · 本次会话用量 ¥3.25

The balance comes from the official DeepSeek GET /user/balance endpoint, fetched by the host half (which sidesteps browser CORS). The per-session spend uses the balance-difference method: the first balance read for a session is recorded as its starting balance, and spend is the drop from it, clamped to zero.

What it does

  • Host half: registers GET /api/balance (loopback-only), resolves the API key through DSH's ctx.credentials service, fetches and caches the DeepSeek balance for the configured interval, and registers the api-balance settings namespace.
  • Client half: mounts a line in conversation.composer.dock (the built-in stats line above the input box) and a settings card in the Web UI plugin group.

Installation

Install the family aggregate package @linxin666/dsh-web-ui-all (all plugins and skins in one) or this plugin alone:

# Recommended: install directly from npm
dsh plugin --profile web add @9Epuuuu/dsh-api-balance

# Or from the repository (development loop)
git clone https://github.com/9Epuuuu/dsh-api-balance.git
cd dsh-api-balance
pnpm install && pnpm build
dsh plugin --profile web add link:$(pwd)

Restart dsh web, set the API key credential reference in the plugin settings, and the balance line appears above the input box.

Configuration

KeyTypeDefaultMeaning
apiKeyEnvstring''DSH credential reference to resolve the DeepSeek API key from, e.g. DEEPSEEK_API_KEY
refreshIntervalSecnumber60Minimum seconds between balance fetches (also the browser poll cadence)
enabledbooleantrueMaster switch for the plugin (browser half + host route)

How per-session spend is computed

The account balance is global; the per-session spend is derived per sessionId:

1. On the first successful balance read for a session, the balance is persisted (in localStorage, keyed by session id) as that session's starting balance. 2. On every later poll, spend = max(0, starting balance - current balance). 3. Refreshing the page keeps the baseline; switching sessions starts a fresh baseline.

Export shape

A function/namespace plugin: inject / Config / apply, no default export. The DeepSeek adapter (./deepseek-balance) is a pure fetch-and-normalize helper.

Model Experience

Prompt and tool surface

#### What the model sees

Nothing. The plugin injects no prompt sections, registers no tools, and emits no session events of its own.

#### Token effect

Zero per request.

#### KV Cache effect

No system-prompt contribution, so no cache-stability effect.

Known Limitations and Deferred Work

  • Account-level snapshot: the balance is a provider-side snapshot with minute-level latency, not per-message billing precision.
  • Spend drift: the balance-difference spend includes any other concurrent consumption (other sessions, tools) and clamps to zero across a top-up.
  • DeepSeek only: the balance endpoint is DeepSeek-specific; other providers need their own adapter.