DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

lalilulelo3 /

lalilulelo3/dsh-spend-pill

Verified

DeepSeek Harness plugin: a cost pill in the composer status row showing what the previous turn actually cost.

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@0f7a233c

dsh-spend-pill

A cost pill for the DeepSeek Harness composer status row — shows what your previous turn actually cost.

Tiny DSH plugin. The pill reads 上句结算 ¥0.062; click it for the breakdown: how many model calls that turn took, how much was re-reading history, how heavy the context is, and what the next message's fixed "starting price" will be.

Why

DSH's built-in stats row tells you 25 turns · 226 steps and 11.1M tok · 99% cache hit, but not money.

Two things about agent cost are counter-intuitive:

  1. You pay per model call, not per turn. One turn can trigger ~10 calls (read a file, run a command, edit code — each is a separate request), and every request re-bills the whole context.
  2. Re-reading history is often the biggest line item. At 390k tokens of context, each call re-reads 390k tokens — more than the model actually spends thinking and writing.

This plugin puts both on screen.

What it shows

Pill (collapsed)

上句结算 ¥0.062      (previous turn: ¥0.062)

Expanded

本会话已花           ¥2.12      session total
输出                 18.3 万 token
缓存读               5888.3 万 token
未命中               20.7 万 token
────────────────────
上句结算(第 28 轮)  ¥0.062     previous turn, settled
 其中模型调用        6 次        model calls in that turn
本句进行中           ¥0.041     current turn so far
────────────────────
当前上下文           39.3 万(38%)
起步价(重读历史)    ¥0.0079    next message's fixed input cost
按当前空闲·半价时段估算
  • Settled value, not an estimate: the previous turn's cost is folded on the host from the full session log, so it survives restarts and compaction.
  • Thresholds: context turns amber at 50%, red at 60% — DSH auto-compacts around 69%, so these leave headroom.

Install

From GitHub (recommended)

dsh plugin --profile desktop add "github:lalilulelo3/dsh-spend-pill"

Use desktop for the desktop app, web for the CLI web UI. Restart the host afterwards.

Local development (clone + link)

git clone https://github.com/lalilulelo3/dsh-spend-pill.git
dsh plugin --profile desktop add "link:C:/path/to/dsh-spend-pill"

⚠️ Do not install by npm package name yet. The npm entry is a 0.0.0-stage placeholder left behind by npm's staged-publishing flow and contains no lib/, so dsh plugin add dsh-spend-pill would install an empty, unloadable package. This notice will be removed once a real version ships.

How it works

  • Host (lib/index.js) registers a spendStats session projection. It consumes the provider-reported usage on assistant/message, splits turns on turn/end, and folds per-turn token totals. Because the projection replays the full persisted log, restarts / pagination / compaction do not change the result.
  • Client (lib/client.js) registers into the conversation.composer.dock slot with order: -1, and reads the tokenUsage, contextPressure, and spendStats projections.
  • Pricing is hardcoded to DeepSeek official rates (cache hit 0.02, miss 1, output 4 CNY per million tokens, off-peak; doubled at peak), with peak/off-peak detected from Beijing time.
    • Not an invoice: the projection carries no per-call timestamps, so everything is converted at the current rate. Mixed peak/off-peak usage will drift.

Limitations

  • Prices only make sense for DeepSeek; edit PRICE_PEAK / PRICE_OFF for other providers.
  • The settled value is empty on the very first turn (¥—).
  • An interrupted turn with no model calls does not overwrite the last settled value.

License

MIT

—/ 5

No ratings yet

Verified DSH bundle

Commit 0f7a233ce3f3

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout