DSH Plugins Marketplace

DSH Plugins

Plugins

/

Tools & Capabilities

/

dsh-spend-badge

d

dsh-spend-badge

Manifest valid

Appends what each turn cost to its usage row and the running session total to the composer status bar, priced on DeepSeek's published peak and off-peak rates. Its HTTP routes have no DSH access check,

hasBundlePatch

dsh-spend-badge

Shows what a reply cost, inline in the DeepSeek Harness chat.

WhereLooks likeMeaning
End of each assistant reply's usage row用量 45.6K tok · ¥0.036cost of that turn, including every tool call inside it
Composer status bar under the input box45.6K tok · 缓存命中 23% · ¥0.87cost of the whole session so far

The amount is appended to the existing usage pill, so it inherits that pill's font size, colour and tooltip; nothing new is drawn on the page. Hovering the pill opens the usage details panel as before.

Per-turn amount on the usage row

Session total on the composer status bar

Prices are DeepSeek's published peak / off-peak rates, converted at the same numbers the provider charges.

Pricing model

CNY per million tokens, [off-peak, peak]:

ModelCache hitCache missOutput
deepseek-flash, deepseek-v4-flash0.02 / 0.041 / 24 / 8
deepseek-v4-pro0.15 / 0.34.5 / 9.013.5 / 27.0
  • Peak: Monday to Friday, 09:00–12:00 and 14:00–18:00 Beijing time.
  • Off-peak: every other hour, plus weekends and public holidays from 2026-08-23 onward.
  • One step costs hit_tokens × hit_price + miss_tokens × miss_price + output_tokens × output_price. Reasoning tokens are already inside output tokens and are not charged twice.
  • Models not in the table fall back to the flash rate.

Where the numbers come from

Two sources, same events:

  1. Live — the plugin subscribes to the host's session/event stream and accumulates assistant/message usage by (session, turn). This only covers calls made after the plugin loaded.
  2. Session log — ~/.dsh/sessions/<cwd>/session-<id>/session.v4.jsonl.zstd is replayed to recover the whole history, including turns from before the plugin was installed. The file is a sequence of concatenated zstd frames; Node's zstdDecompressSync stops after the first frame, so the reader splits on the 28 B5 2F FD magic and decodes each frame separately.

For each turn the larger of the two values wins: the log is the authoritative ledger but may lag behind the newest step, while the live counter only ever holds a fragment that started at zero.

HTTP surface

Both routes are read-only and served from the harness's own origin:

  • GET /dsh-spend/client.js — the page script
  • GET /dsh-spend/data?session=<id> — { ok, sessionId, turns: { turn: cny }, total, peak, file, debug }

Requests carrying a foreign Origin (or a cross-site fetch) are rejected.

DOM anchors

The page script locates two elements and appends a text node; it re-applies itself through a MutationObserver with a 120 ms debounce plus a 3 s poll, so re-renders and conversation switches are picked up.

  • [data-turn-tail] — one per turn, the attribute value is the turn number
  • [data-composer-stat="usage"] — the composer usage stat

Install

From the market, or directly from this repository:

dsh plugin add github:zhangqi423820-ai/dsh-spend-badge

Then restart DSH once. The client script itself is re-read on every request, so edits to assets/spend-meter.js only need a page refresh.

Uninstall

Remove the bundle from the profile (dsh.profile.bundles, or enabled: false) and restart DSH.

A restart is required for host-side changes: the harness does not watch plugin source, and a route registered through ctx.webServer.register() outlives the plugin instance that registered it if teardown is not wired up — this plugin registers its disposal through ctx.effect() for that reason.

Troubleshooting

debug in the data route reports what each half saw:

  • logBytes / logTurns — log size, turns decoded
  • liveTurns — turns held by the live counter
  • cache — whether the log parse was served from cache (key: mtime + size)
  • logError — decode failure, if any

logTurns: 0 with a non-null logError means the log could not be decoded; liveTurns: 0 means no session/event reached the plugin.

Compatibility

Written against DeepSeek Harness 0.2.2-rc.1. It relies on the session/event event payload (data.turn, data.usage, data.message.source.model), the webserver/index-inject hook, and the session.v4.jsonl.zstd log format.

License

MIT

Comments

Loading…

Similar plugins

dsh-cost-pill

by Shuaige-Da

Writes the session's estimated cost into the composer token-usage pill, and adds a per-bucket amount plus an estimated total to the usage dialogs, using DeepSeek's official peak and off-peak rates in

Tools & CapabilitiesManifest valid

★ 0

MIT

JavaScript

Nov 3, 2026

dsh plugin --profile web add dsh-cost-pill-cny

by LZ-jun

Shows the DeepSeek account balance and the current peak / off-peak phase in the sidebar, and estimates per-session and per-turn cost using the official peak and off-peak rates.

Tools & CapabilitiesManifest valid

★ 0

MIT

JavaScript

Oct 16, 2026

dsh plugin --profile web add dsh-balance-usage

by niliemi

DSH plugin: prices tokens with the official model price table, shows the running cost beside the composer context meter, and blocks a turn once spend passes the ceiling you set.

Tools & CapabilitiesDevelopment & InfrastructureManifest valid

★ 0

MIT

JavaScript

Sep 30, 2026

dsh plugin --profile web add yoka-dsh-billing

by LanFeng97

DSH web plugin: per-turn session cost chip in the composer stats row — per-turn spend and cache-hit / cache-miss totals (CNY), priced from an official price table refreshed on demand. · DSH 网页插件:输入框下方统计栏里的会话费用胶囊——逐轮花费与命中/未命中两项总额(CNY),价目表按需从官方定价页刷新。

Tools & CapabilitiesDevelopment & InfrastructureManifest valid

★ 3

↓ 251/wk

MIT

JavaScript

Nov 15, 2026

dsh plugin --profile web add dsh-bottom-cost

by Arun1016

Account balance and per-session cost pill for DeepSeek Harness (dsh) web GUI: official peak/off-peak pricing, per-model breakdown, no credentials stored.

Tools & CapabilitiesTerminal & ClientsSessions & MessagesManifest valid

★ 1

MIT

TypeScript

Oct 30, 2026

dsh plugin --profile web add dsh-cost

by BigFatFish4Wm

DSH plugin: per-turn token usage, cost, session totals and account balance in the Harness Web UI, with a workspace-local ledger.

Terminal & ClientsManifest valid

★ 0

MIT

JavaScript

Oct 26, 2026

dsh plugin --profile web add dsh-token-cost