dsh-spend-meter
Per-turn DeepSeek spend, live official pricing, and current balance for DeepSeek Harness Web.
linhuantanly
@linhuantanly
⬇ 1
★ 0
main
安装
dsh plugin --profile web add github:linhuantanly/dsh-spend-meter
需要可复现安装时,可在仓库后追加 #commit 固定提交。
Per-turn DeepSeek spend, live official pricing, and current balance for DeepSeek Harness Web.
该插件未提供要点说明,请参考仓库 README。
- 安装并启动 DeepSeek Harness:
npx @deepseek-ai/dsh web - 在终端执行上面的安装命令(CLI 会解析插件并核验来源)
- 用 dsh plugins list 确认已安装,必要时重启 Harness 生效
插件以当前 dsh 进程的权限运行,安装时可能执行代码。请先通读仓库源码与许可证,确认无破坏性命令与越权访问;本站只做索引,不对第三方插件安全性作担保。
| 代码仓库 | github.com/linhuantanly/dsh-spend-meter |
| 许可证 | MIT |
| 主要语言 | main |
| 下载量 | 1 |
| GitHub 星标 | 0 |
| 最近推送 | 2026-08-19 |
| 收录日期 | 2026-09-19 |
| 分类 | 工具与能力 |
事实信息来自公开插件目录快照(2026-10-01),介绍文案由本站再加工。
以下为插件仓库 README 全文(原始内容,由公开目录抓取整理)。
# dsh-spend-meter [简体中文](README.zh-CN.md) A spend monitor for DeepSeek Harness Web. It shows the cost of every root turn—including main-agent steps, subagents, compaction, session-title generation, and other DeepSeek calls—and keeps the current balance, session total, and pricing freshness visible under the composer. > Turn ¥0.0231 · 5 calls ▾ > > Balance ≈¥96.38 · Session ¥1.27 · Price updated just now ## How it differs from `dsh-turn-cost` [`dsh-turn-cost`](https://github.com/WFMinerva/dsh-turn-cost) is a good lightweight option with bundled CNY prices, no network, and no credential access. `dsh-spend-meter` serves a different contract: it refreshes official pricing, reads the official balance, freezes an auditable price claim per request, and includes auxiliary and descendant model calls. Do not install both plugins: their per-turn UI overlaps. ## Features - Root-turn attribution across main steps, child agents, compaction, title generation, and other DSH model calls. - Exact provider usage buckets from DSH `rc.7`; reasoning is already part of output and is not charged twice. - Official CNY/USD price refresh on startup and every 30 minutes, plus manual refresh. - Official `/user/balance` refresh at startup, after root turns, and every 60 seconds while the page is visible. - Request-time peak/off-peak selection and immutable historical price claims. - Explicit `≈` fallback estimates and unknown-cost states when provider usage is absent. - Integer pico-unit accounting (`1e-12` currency unit), so totals never accumulate floating-point or per-turn rounding error. - Safe sidecar persistence at `~/.dsh/storages/dsh_spend_meter.json`; no third-party events are written into DSH session logs. ## Formula ```text call cost = cache-read tokens × cache-hit rate + (uncached-input tokens + cache-write tokens) × cache-miss rate + output tokens × output rate ``` The request start time selects the price tier. Currency follows the first official currency returned by `/user/balance`: `CNY` uses the [CNY price page](https://api-docs.deepseek.com/zh-cn/quick_start/pricing/) and `USD` uses the [USD price page](https://api-docs.deepseek.com/quick_start/pricing/). The plugin never performs FX conversion or adds unlike currencies. ## Install Install from npm: ```bash dsh plugin --profile web add dsh-spend-meter dsh web ``` You can also install an absolute path to a local tarball or checkout: ```bash dsh plugin --profile web add /absolute/path/to/dsh-spend-meter-0.1.0.tgz dsh web ``` Requires `@deepseek-ai/dsh >= 0.1.0-rc.7 < 0.2.0`. ## Uninstall ```bash dsh plugin --profile web remove dsh-spend-meter ``` Uninstalling cannot damage a session. To remove the optional sidecar data, stop DSH and delete `~/.dsh/storages/dsh_spend_meter.json` manually. ## Network and privacy The Host contacts only these fixed official endpoints: - `https://api-docs.deepseek.com/zh-cn/quick_start/pricing/` - `https://api-docs.deepseek.com/quick_start/pricing/` - `https://api.deepseek.com/user/balance` The API key is resolved per balance operation through DSH credentials and remains in the Host Authorization header. It never reaches the browser, logs, or sidecar storage. Prompts, responses, tool arguments, and provider response bodies are never persisted. Only the latest official balance snapshot is cached. The per-session sidecar stores request classification, model, usage, timestamps, price claim, accuracy, and amount. ## Failure semantics - Pricing unavailable or structurally changed: retain the last valid live snapshot; otherwise use the bundled 2026-08-19 snapshot and show stale pricing. - Balance unavailable: retain and mark the last official snapshot stale. - Missing usage with observed output: estimate and mark `≈`; otherwise record unknown rather than zero. - Storage failure: never block the model stream; the call may be absent from the ledger and one redacted warning is logged. - The plugin never blocks, cancels, or mutates model requests. ## Development ```bash npm install --ignore-scripts --legacy-peer-deps npm test npm run verify ``` Tests use sanitized fixtures and mock streams and make no paid model calls. See [`docs/architecture.md`](docs/architecture.md). ## License MIT. See [NOTICE](NOTICE) for acknowledgements.
数据来源:公开的 DeepSeek Harness 插件目录与各插件 GitHub 仓库。本站为独立第三方目录,与 DeepSeek、幻方(High-Flyer)及插件作者均无隶属或背书关系。