Ghost011118/dsh-balance-meter ↗★ 18
dsh-balance-meter
在输入框旁展示 API 余额与会话花费 适合需要直观查看 DeepSeek 官方或代理余额,并估算单次会话成本的用户。
同名套件的其他儲存庫
安裝
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Ghost011118/dsh-balance-meter說明文件
閱讀完整 README ↗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
| Key | Type | Default | Meaning |
|---|---|---|---|
source | 'official' | 'proxy' | 'manual' | official | Provenance of the displayed balance. A legacy custom baseUrl with no source is automatically classified as proxy |
balanceEndpoint | string | /user/balance | Proxy balance path or absolute HTTP(S) URL |
proxyBalancePath | string | unset | Dot path (for example data.balance) to a numeric balance when the proxy does not return DeepSeek-compatible balance_infos |
proxyCurrency | string | CNY | Currency paired with proxyBalancePath |
manualBalance | number >= 0 | unset | Current balance entered by the user; changing it creates a new local accounting baseline |
manualCurrency | string | CNY | Currency of the manual balance |
model | 'auto' | 'flash' | 'pro' | auto | auto detects each session's model from its request header (flash/pro); flash/pro force that preset regardless of auto-detection |
pricingRefreshHours | number | 6 | Hours between automatic official-pricing refreshes |
apiKeyEnv | string | DEEPSEEK_API_KEY | Credential ref storing the DeepSeek API key |
baseUrl | string | https://api.deepseek.com | API base URL (gateway/compat override) |
refreshIntervalSeconds | number | 30 | Minimum 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.