Composer cost chip: prices the current session DeepSeek API spend message-by-message with the official pricing table (incl. the 2026-08-17 peak/off-peak policy); hover for the breakdown, today (DSH) total and account balance. DeepSeek models only.
Install
# from npm (prebuilt)
dsh plugin --profile web add @phynez_1103/dsh-session-cost
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Lzh3070/dsh-session-cost
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
English | 中文
dsh-session-cost
A DeepSeek Harness (dsh) web plugin that shows the current session's DeepSeek API cost as a small chip beside the composer input.
Features
- Live session cost — a chip in the
conversation.input.rightslot (left of the model selector) shows the current session's DeepSeek API spend (¥), refreshed every 5 seconds. - Strict model gate — the chip only appears when the session's current model is DeepSeek; other models (MiniMax, Kimi, …) are never priced and never enter the statistics.
- Hover popover — a project-styled card with:
- a session cost breakdown table: input (cache miss) / cache hit / output × tokens × effective rate = amount;
- today's DSH usage: DeepSeek spend across local DSH sessions for today (Beijing time);
- account balance: read from the DSH credential
DEEPSEEK_API_KEYvia the officialuser/balanceendpoint.
- Official pricing engine — every
assistant/messageevent is priced by its own timestamp against the official DeepSeek pricing timeline, including the 2026-08-17 peak/off-peak policy (Beijing 09:00–12:00 / 14:00–18:00 peak, half price otherwise), and covering history from before this plugin was installed. - Performance friendly — session log replays are cached by log revision (a 5-second poll costs one stat, not a re-decompress); today/balance refresh on their own 60-second cadence.
Install
dsh plugin --profile web add @phynez_1103/dsh-session-cost
⚠️ Note: this plugin's npm package name is scoped:
@phynez_1103/dsh-session-cost. The unscopeddsh-session-costpackage on npm (ChengChe106/dsh-session-cost) is a different, same-named plugin, unrelated to this repo —dsh plugin add dsh-session-costinstalls that one, not this one.
Or install straight from the GitHub repo:
dsh plugin --profile web add github:Lzh3070/dsh-session-cost
Or from the Gitee mirror (faster in mainland China):
dsh plugin --profile web add https://gitee.com/lzh10602042_gitee/dsh-session-cost/repository/archive/master.zip
Restart the dsh web service and hard-refresh the browser (Ctrl+Shift+R).
First use: configure DEEPSEEK_API_KEY in Settings → Models (used for the balance and today's total; without it the balance shows --, session cost still works).
Screenshot
The chip (¥0.12) beside the composer input, with the hover popover:

Popover contents example:
当前会话花费 ¥6.55
项目 数量 单价 金额
输入(未命中) 3.5M ¥1.000/M ¥3.49
缓存命中 111.8M ¥0.020/M ¥2.24
输出 410.5K ¥2.00/M ¥0.821
──────────────────────────────
今日(DSH) ¥0.356
账户余额 ¥197.66
Pricing
Built-in official DeepSeek policy timeline (CNY per 1M tokens):
| Model | Stage | Input (miss) | Cache hit | Output |
|---|---|---|---|---|
| deepseek-v4-flash | current (since 2026-05-22) | 1 | 0.02 | 2 |
| deepseek-v4-flash | peak (since 2026-08-17) | 3 | 0.1 | 9 |
| deepseek-v4-flash | off-peak (since 2026-08-17) | 1.5 | 0.05 | 4.5 |
| deepseek-v4-pro | current (since 2026-05-22) | 3 | 0.025 | 6 |
| deepseek-v4-pro | peak (since 2026-08-17) | 9 | 0.3 | 27 |
| deepseek-v4-pro | off-peak (since 2026-08-17) | 4.5 | 0.15 | 13.5 |
The table lives in OFFICIAL_PRICING_POLICIES in lib/index.js; append entries to the since timeline when the official pricing changes.
Structure
cordis.patch.yml inserts the plugin row into the host composition
dsh.plugin.json plugin metadata (entry id + client platform)
lib/index.js host entry: SessionCostRuntime (TypertRemoteService) +
official pricing engine + strict Typert manifest
lib/client.js single-file client bundle (ModuleLoader handshake):
composer cost chip + hover popover (class component)
lib/invariant.js invariants companion entry
Data flow
- Host
sessionCost(sessionId): replays the persisted session log viasessionPersistence.readRaw, prices every message, cached by log revision. - Host
accountSummary(): replays all sessions for today's (Beijing) DeepSeek usage; readsDEEPSEEK_API_KEYfrom DSH credentials for the officialuser/balancecall. - Client: registered in the
conversation.input.rightslot, 5s session poll + 60s account cadence + hover popover.
License
MIT. The pricing engine is ported from dsh-deepseek-quota (MIT, itself ported from bpc-oss/dsh-web-billing, MIT).
Links
More in this category
bowenliang123/dsh-context★ 1728
DSH context insight panel: Context dashboard + /context command + Context browser — one-stop context lifecycle management with categorized composition, content details, evolution trends, compaction/injection events, and stats.
Han-1413141/dsh-cost-meter★ 361
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
wssfk12138/dsh-damage-pulse★ 236
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
zh667/TokenLedger★ 202
Sidebar usage panel that attributes tokens to the relay site that served each request, read from your existing provider config: today/month/all-time totals, per-site and per-model breakdowns, a year activity heatmap, and New API / Sub2API / DeepSeek balances.
Ychris12138/dsh-usage-stats★ 169
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
PolinniZhong/dsh-personal-center★ 118
Personal center for DeepSeek Harness: cross-session usage statistics, per-model cost estimation, global custom instructions, a global font-size adjuster, a data-driven desktop pet with bitmap & vector skins, and a conversation status overview, all local and offline.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.