편집자 노트

API 余额

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:

이것은 DeepSeek Harness(DSH) 플러그인입니다. 이 사이트는 GitHub README, 설치 정보, 유지보수 상태, 공개 보안 시그널을 모아 보여줍니다.

업스트림에서 중국어 README를 제공하지 않아 저장소 원본 내용을 표시합니다.

@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.
REPOSITORY SIGNALS

보안 및 설치 증거

이 점수는 공개 저장소 메타데이터와 이 사이트에 등록된 설치 증거에만 기반하며, 코드 보안 감사와 다릅니다.

출처 추적 가능

공개 플러그인 카탈로그에서 왔으며, 공개 GitHub 저장소로 연결됩니다.

라이선스

저장소가 BSD-3-Clause 라이선스를 선언했습니다.

유지보수 활동

최근 180일 내 코드 업데이트가 있습니다.

설치 증거

재현 가능한 정확한 설치 메타데이터가 아직 등록되지 않았습니다. 저장소 설명에 따라 직접 확인하세요.

설치 라이프사이클 스크립트

검사한 패키지 메타데이터에 설치 라이프사이클 스크립트가 선언되지 않았습니다.