dshbase

插件目录 / Developer / dsh-token-price

dsh-token-price

未验证 spoon-man569

✓ 持续维护 基于 9 个官方 DSH 包

查看 GitHub ↗ ← 返回插件目录

2Stars
0Forks
0未关闭 issue
语言
2026-08-16最近推送
跨平台平台

功能简介

DSH 实时 Token 花费与账户余额显示插件(每轮花费 · 总花费 · 余额)

我们的评价
未验证 — 尚未实测

DSH 实时 Token 花费与账户余额显示插件(每轮花费 · 总花费 · 余额) 尚未验证——请自行安装测试。

「未验证」表示我们的自动化 CI 尚未安装过该插件。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

你是插件作者? 想拿到「已验证」标签——提交你自己的验证证据(截图、日志或短视频),我们审核通过后即改为「已验证」。

提交验证证据 ↗

README

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/balance result. 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

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-token-price」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

dsh plugin --profile web add github:spoon-man569/dsh-token-price

Headless(CLI)profile:

dsh plugin --profile headless add github:spoon-man569/dsh-token-price

实测报告

尚未 L3 验证——若已跑过,见下方失败备注。

状态:pending · 最近测试 2026-08-26
备注:验证: runtime-fail 浏览全部待验证失败 →
安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Developer 里更多

浏览全部 7789 个插件 →