Introduction¶
When running long sessions or spawning sub-agents in DeepSeek Harness (DSH), token usage gets distributed across multiple assistant/message events and real-time streams. Consoles or billing interfaces often lag, making it difficult to see the total cost of the “current session + all sub-sessions” at a glance. If you are accustomed to continuous debugging in the Desktop app, you need a reading near the input box that updates with the logs, rather than having to manually reconcile data afterwards.
Here, we introduce the community plugin dsh-session-cost (maintained by current1990): it displays the cumulative cost (in CNY) for the entire session family below the composer. The data is derived from session logs and host-side projections; the client is responsible only for rendering.
What is this¶
dsh-session-cost is a client plugin for DSH (package.json version 0.3.7, MIT License), targeting DSH Desktop 0.2.x (the README specifies compatibility with the 0.2.1-rc.x projection and useProjection contract).
In short: it accumulates tokens from usage events in the session log one by one, converts them to CNY based on an editable “by model, by effective date” price list, and pushes the total and tree-view breakdown below the input box. Unit prices are based on the DeepSeek Official Pricing Page; the plugin is marked as an estimation tool and is not an official billing receipt.
Directory Page: SkillHub - dsh-session-cost
Source Code: github.com/current1990/dsh-session-cost
Core Features¶
Real-time Reading & Tree Details¶
- Displays the cumulative cost of the entire session family below the input box. Example format:
Session Cost ¥0.27 · 60 Calls · 2 Sub-agents(Current session + sub-agent sessions). - The reading is a button; clicking it expands a small panel showing the cost, call count, and tokens for the current session and each sub-agent line by line.
Log Authority & Anti-Double Counting¶
Costs are accumulated item-by-item from the usage events of assistant/message in the session log (splitting cache hits/misses). Retries and replays will not result in double counting.
Pricing by Call Time (ERAS)¶
The price list includes effective dates (ERAS in the host’s index.js). Each call retrieves the unit price at that time based on the log event’s time, so price adjustments will not rewrite the amounts of historical calls. To add a price adjustment, simply insert an entry (containing since and models) into ERAS.
The README includes two pricing intervals (CNY/million tokens):
Since 2026-10-17 (Peak/Off-peak: Off-peak price is half of Peak; Peak = Monday to Friday 9:00–12:00, 14:00–18:00 Beijing Time)
| Model | Input (Cache Hit) | Input (Cache Miss) | Output |
|---|---|---|---|
| deepseek-flash (Off-peak/Peak) | 0.02 / 0.04 | 1 / 2 | 4 / 8 |
| deepseek-v4-pro (Off-peak/Peak) | 0.15 / 0.30 | 4.5 / 9.0 | 13.5 / 27.0 |
Before 2026-10-17 (Single price, no peak/off-peak)
| Model | Input (Cache Hit) | Input (Cache Miss) | Output |
|---|---|---|---|
| deepseek-v4-flash | 0.02 | 1 | 2 |
| deepseek-v4-pro | 0.025 | 3 | 6 |
| deepseek-chat | 0.5 | 2 | 8 |
| deepseek-reasoner | 1 | 4 | 16 |
Models not listed are calculated as deepseek-flash (conservative estimate). Billing formula:
Cost = Uncached Input × Miss Price + Cache Read × Hit Price + Cache Write × Miss Price + Output × Output Price
Hovering over the reading allows you to view peak/off-peak costs, as well as the specific cost incurred in each pricing interval (e.g., 2026-10-17, pre-2026-10-17).
Channels & Architecture¶
- Only prices DeepSeek Official Channels: Only
deepseek-official/deepseek-accounthave unit prices; other channels only accumulate tokens without calculating amounts, and the reading is marked “Not Priced”. - Zero Client-side Calculation: The host-side
sessionCostprojection collapses the results and pushes them to the page viawire.view; the client reads the aggregate value viauseProjection('sessionCost')and performs no event folding.
The plugin does not rely on additional npm packages; the bundle includes host and client code, requiring no build during installation.
Installation & Activation¶
In DSH Desktop: Go to Settings → Plugins → Add, select the local plugin directory, or install by package name (depending on the Desktop plugin manager; the README does not provide a CLI command like dsh plugin add …).
The Harness will install the plugin into the current profile (desktop) and automatically insert the following into cordis.patch.yml:
- insert:
- id: session-cost
name: dsh-session-cost
It takes effect without a restart after installation (the host activates via HMR; refresh the page to see the reading).
Typical Usage¶
After installation and page refresh, simply converse in the Desktop as usual; no additional configuration is required.
- View the total reading below the composer (cost, call count, number of sub-agents).
- Click the reading to expand the tree details and verify the tokens and costs for the current session and each sub-agent.
- If using non-official channels, pay attention to the “Not Priced” prompt on the reading; the amount is for token statistics reference only.
- If official pricing changes, you can append a new interval to
ERASinindex.jsyourself; historical calls will still be calculated at the old price.
Use Cases & Notes¶
Who it is for: Users who develop and debug agents on DSH Desktop long-term and wish to keep a real-time grasp of the session family’s token usage and estimated CNY costs.
Permissions & Security: The plugin runs with the permissions of the current DSH process and will read session logs and projection states. Before installing, please review the source code and MIT License on the GitHub Repository to ensure it complies with your environment policies. The community directory SkillHub is an independent site and has no official affiliation with DeepSeek or High-Flyer.
Known Limitations (Excerpt from README):
- The amounts for finished sub-sessions rely on the projection cache; after a restart, they are warmed up from
session_projcache. If the version mismatches, sub-session logs may be re-read (up to 200 at startup). Only when both cache and logs are unavailable will the sub-session display “Not Loaded” and not be included in the total. - Statutory holidays cannot be derived from logs; peak/off-peak is priced according to workday time slots.
- The total refreshes when the parent session has new events; readings may lag slightly while sub-agents are running and will be updated after they finish.
For edge case explanations, please refer to docs/RFC-0001-billing-edge-cases.md in the repository.
Conclusion¶
dsh-session-cost collapses usage from session logs into a CNY estimation reading below the composer and supports splitting by effective date and peak/off-peak prices, making it suitable for daily session cost monitoring on Desktop 0.2.x. For details or to modify the price list, please refer directly to the repository README and ERAS in index.js.
- Directory Page: https://www.skillhub.cn/plugins/current1990/dsh-session-cost
- GitHub: https://github.com/current1990/dsh-session-cost