Real-time cost tracking for the current DSH conversation: a composer-dock line showing the running token usage and DeepSeek official price estimate (base and peak/valley pricing).
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-convo-cost
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:ljr282341583/dsh-convo-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. Only install sources you trust, and pin a commit (github:owner/repo#sha).
README
Real-time token usage and cost tracking for the current DSH conversation: a status line under the composer
shows ¥x.xx · xx tok for this conversation, and hovering reveals call count / input (cache-hit included) /
output (reasoning included) / cost / pricing regime / model details.
- Pricing: DeepSeek official price list (CNY per 1M tokens), cross-checked against api-docs.deepseek.com/zh-cn/quick_start/pricing
- Automatic regime switch: base prices before
2026-08-17 00:00(Beijing time), peak/valley prices after - Peak hours (Beijing time 09:00-12:00 and 14:00-18:00) are billed at the peak rate automatically
- The model name is read from request headers; unknown models are billed as ¥0
Install
dsh plugin --profile web add dsh-convo-cost
Restart dsh web, and the conversation status line shows 本对话 ¥x.xx · xx tok.
Effect
| Status line | Hover details |
|---|---|
本对话 ¥1.47 · 20.9M tok |
152 calls · input 20,812,672 tok (cache hit 20,812,672) · output 118,945 tok (reasoning …) · ≈ ¥1.47 · pricing: base · model: deepseek-v4-flash |
How it works
- Host side (
lib/index.js): subscribes to the session event stream through thesessionProjectionsservice, accumulates tokens on eachassistant/messageevent's exact usage, prices them against the official table, and registers theconvoCostprojection. - Client side (
lib/client.js): injects into theconversation.composer.dockslot and renders the cost line withuseProjection("convoCost"), refreshing live with the conversation.
Pricing table (deepseek-v4-flash, CNY per 1M tokens)
| Item | Base (before 08-17) | Peak/valley · off-peak | Peak/valley · peak |
|---|---|---|---|
| Input · cache hit | 0.02 | 0.05 | 0.10 |
| Input · cache miss | 1.0 | 1.5 | 3.0 |
| Output | 2.0 | 4.5 | 9.0 |
deepseek-v4-pro and the full peak/valley table live in the PRICING table in lib/index.js; prices follow
the official DeepSeek page — update the table there when the official prices change.
Test
npm test
The projection's token accounting and billing are verified with a simulated event stream (no network, no real calls).
FAQ
| Symptom | Cause / fix |
|---|---|
| Status line missing | Restart dsh web after install; confirm the plugin joined dsh.profile.bundles (dsh plugin add reconciles it automatically) |
| Always shows ¥0.00 | The model is not in the official price table (unknown models bill at ¥0); wait for the first assistant/message event carrying usage |
| Amount differs from the bill | Estimate only: priced from the request-header model name and the official table, excluding discounts/promotions/platform markup; the official bill is authoritative |
| Prices changed officially | Update the PRICING table and EFFECTIVE_AT in lib/index.js, then republish the npm package and update |
| Hover details empty | The projection needs at least one assistant/message event with usage; new sessions start from 0 |
License
MIT
Links
More in this category
bowenliang123/dsh-context★ 249
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.
zh667/TokenLedger★ 95
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.
Han-1413141/dsh-cost-meter★ 90
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
Ychris12138/dsh-usage-stats★ 68
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
feibi-mochi/deepseek-harness-control-center★ 31
DeepSeek Harness control center for official balance monitoring, per-session costs and tokens, third-party token totals, completion alerts, official recharge, flexible layouts, and agent-assisted session controls.
zhu168/dsh-save-money★ 30
Pause and resume tasks automatically during user-defined time windows to avoid peak-hour API costs; includes account balance display and 10-minute granularity spend bar chart.