dsh-token-price
Manifest valid★ 3DSH Real-Time Token Cost and Account Balance Display Plugin (Per-Round Cost · Total Cost · Balance)
dsh-token-price
English | 汉语
Accurate token-cost and account-balance readouts for the DeepSeek Harness Web chat UI.
What it shows
- Per-message cost: the cost for completed request steps in that turn, shown as
¥...after each assistant reply's statistics line on hover. - Session total: the sum of every reported request step, including a cancelled request that emitted usage but no final assistant message.
- Estimated CNY: a market-rate USD/CNY conversion shown as
¥.... USD is not rendered in the UI. This is not an account debit or official per-request CNY charge. - Account balance: the official
GET /user/balanceresult. The plugin prefers the returned CNY balance and otherwise preserves the API's returned currency.
USD remains the internal accounting value. An unknown provider/model route is shown as 未定价, never as a zero-cost amount.
Install
One command (requires pnpm):
dsh plugin --profile web add dsh-token-price
The package declares dsh.bundle and dsh.client, so this activates both the host service and browser readouts.
Configuration
- id: token-price
name: dsh-token-price
config:
balanceBaseURL: https://api.deepseek.com
balanceApiKeyEnv: DEEPSEEK_API_KEY
balanceRefreshIntervalMs: 60000
referenceRateRefreshIntervalMs: 3600000
requestTimeoutMs: 5000
balanceApiKeyEnv names the credential holding the DeepSeek API key used for the balance request. The key remains on the host. A failed refresh keeps the last balance sample.
Pricing and rates
prices.json is the local, versioned source of official USD rates per million tokens. It is an append-only history: each rule has an effectiveFrom timestamp, Beijing peak windows, and explicit prices for each supported route. New official prices must append a rule; past rules must not be changed.
The tokenCost projection snapshots the request route and time at request/header, then calculates each (turn, step) from the matching historical USD rule. Replaying the same session log therefore yields the same USD result. The host never scrapes the official price page at runtime.
USD/CNY is refreshed server-side from public market-rate sources every hour. When that refresh fails, the UI uses the current rule's bundled fallback rate. Both values remain estimates (¥) and never affect USD accounting.
Development
npm install
npm test
npm test builds lib/, emits type declarations, and runs accounting tests. Restart the DSH Web process after rebuilding so it loads the new artifacts.
License
MIT
Compatibility
Versions
| Latest version | Published | Size |
|---|---|---|
| 0.2.0 | — | — |
Comments
Loading…
Similar plugins
by jsoncode
余额与费用查询插件,支持多账号查询,实时token实时统计,中英双语,界面交互直观、开箱即用
★ 0
JavaScript
Sep 11, 2026
dsh plugin --profile web add dsh-get-balanceby olimc2016
DSH(DeepSeek Harness)Token 用量与花费面板插件:今日消费、预算进度、成本构成、缓存命中省下的钱。社区插件,非官方。
★ 1
MIT
JavaScript
Oct 19, 2026
dsh plugin --profile web add dsh-token-meter-panelby LaoYueHanNi
贴近 DSH 原生设计风格的 token 用量统计插件:实时记录每次请求的用量与费用,在 Web UI 中提供趋势图表、按模型定价明细和供应商配额显示。
★ 16
↓ 1.3k/wk
MIT
TypeScript
Oct 28, 2026
dsh plugin --profile web add @laoyuehanni/dsh-token-usageby YuGaN525
DSH plugin: show per-turn token usage, estimated cost, and DeepSeek balance under every completed turn.
★ 1
MIT
JavaScript
Oct 23, 2026
dsh plugin --profile web add dsh-turn-costby xfpuls
DSH 用量与费用统计 + 提问置顶:本轮花费、今日 token 与消费、空闲/高峰时段,并钉住最新提问
★ 0
MIT
JavaScript
Oct 6, 2026
dsh plugin --profile web add dsh-usage-suiteby Mirfakk
DSH 额度面板:输入框下方实时显示本会话消费金额(官方峰谷分时计价)、token 用量与 DeepSeek 账户余额。
★ 0
MIT
JavaScript
Sep 21, 2026
dsh plugin --profile web add dsh-peak-usage