Ghost011118/dsh-balance-meter ↗★ 18

dsh-balance-meter

Official, proxy-compatible, or locally accounted balance and session-cost readout for the DSH web GUI. 适合需要直观查看 DeepSeek 官方或代理余额,并估算单次会话成本的用户。

Package
dsh-balance-meter
Compatibility
Unverified
Harness peer range
^0.1.0-rc.6
Version
0.1.0
License
BSD-3-Clause
Last updated
Aug 20, 2026

Other repositories with this package name

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Ghost011118/dsh-balance-meter

Configuration

The plugin is zero-config by default (uses DEEPSEEK_API_KEY and the official pricing page). Optional composition settings:

- insert:
    - id: balance
      name: 'dsh-balance-meter'
      config:
        source: official    # official (default) | proxy | manual
        model: auto         # 'auto' (default) | 'flash' | 'pro'
        pricingRefreshHours: 6
KeyTypeDefaultMeaning
source'official' | 'proxy' | 'manual'officialProvenance of the displayed balance. A legacy custom baseUrl with no source is automatically classified as proxy
balanceEndpointstring/user/balanceProxy balance path or absolute HTTP(S) URL
proxyBalancePathstringunsetDot path (for example data.balance) to a numeric balance when the proxy does not return DeepSeek-compatible balance_infos
proxyCurrencystringCNYCurrency paired with proxyBalancePath
manualBalancenumber >= 0unsetCurrent balance entered by the user; changing it creates a new local accounting baseline
manualCurrencystringCNYCurrency of the manual balance
model'auto' | 'flash' | 'pro'autoauto detects each session's model from its request header (flash/pro); flash/pro force that preset regardless of auto-detection
pricingRefreshHoursnumber6Hours between automatic official-pricing refreshes
apiKeyEnvstringDEEPSEEK_API_KEYCredential ref storing the DeepSeek API key
baseUrlstringhttps://api.deepseek.comAPI base URL (gateway/compat override)
refreshIntervalSecondsnumber30Minimum seconds between balance queries

Proxy and manual modes

proxy mode keeps the API key on the DSH host and sends it only as a Bearer credential to the configured endpoint. A DeepSeek-compatible relay may return balance_infos directly. Other relays must configure proxyBalancePath; a missing or non-numeric value is reported as a proxy error and is never labelled as an official balance.

manual mode requires a writable DSH settings provider. The hidden ledger is stored inside the existing balance settings namespace, not in a separate plaintext file and never in the browser response. It records a baseline, remaining amount, locally charged spend, and per-session cumulative-token checkpoints. Only positive token deltas after the last persisted checkpoint are charged, so polling or restarting DSH cannot deduct the same cumulative session usage twice. Changing manualBalance or manualCurrency intentionally creates a new baseline and checkpoints all currently live sessions.