Introduction¶
When engaging in long conversations within DeepSeek Harness (dsh), the token usage panel shows how much was consumed in the current turn. However, calculating “exactly how much this question cost” often requires manual mental arithmetic against the official price list and peak/off-peak time slots. Furthermore, with both topped-up balances and credit balances existing on two separate lines, the total wallet amount is not intuitive.
dsh-cost-receipt is a community-maintained client-side plugin (maintained by divineeagleblackhand). It appends a line of badges below each assistant reply: the CNY cost of the current Q&A round, and (on the latest round) the account balance. Hovering over it reveals a pie chart of the cost breakdown. Pricing is calculated based on the token usage of that round and the official peak/off-peak unit prices. If a price cannot be calculated, the reason is explicitly stated rather than silently failing.
What is this?¶
In short: a “cost receipt” for dsh—a line of monetary figures below each reply, showing the breakdown on hover, with balances fetched via the host’s account interface.
- Repository: divineeagleblackhand/dsh-cost-receipt (MIT, current npm version 0.1.2)
- Category: Client-side (Works on Web / Desktop)
- Host Dependencies: Requires dsh 0.2.0-rc.2 or higher for turn-tail data and the
accountRemote. If badges disappear after a dsh update, prioritize checking version compatibility.
The plugin itself makes no network requests, performs no disk persistence, and has zero runtime dependencies. The balance is queried by the dsh host via account/getBalance (the same path used by the account settings page). It does not write to localStorage, nor does it read API Keys or configuration files.
What you will see on the UI¶
After installation, a line of text similar to the following will appear below each reply (example from README):
本次问答花费 ¥0.165824 账户余额 ¥6.2164 礼金余额 ¥1.5366
Brief explanation of the meanings:
- 本次问答花费 (Current Q&A Cost): The CNY amount calculated based on the pricing of the time slot when the Q&A (one user message → final reply) just ended.
- 账户余额 (Account Balance): Topped-up balance only; 礼金余额 (Credit Balance) is a separate item. The sum of both represents the total wallet amount. If there is no credit balance, the second item is not displayed.
- Balances appear only in the latest round: Historical rounds retain the “cost of that round,” but the balance figures are only meaningful in the latest round.
The HH:MM:SS on the badge indicates the time of the last change in balance (the host caches account queries), not the time it was “just queried.” Hovering over it shows the time of the last query, helping you determine if the reading is stale or if the balance simply hasn’t changed.
Core Features¶
Pricing per “Q&A Round”¶
A line below each reply corresponds to the round that just occurred. Historical rounds are also recalculated based on the peak/off-peak time slot and built-in unit price at the end time of that round, so opening old sessions still shows how much each round cost.
Pricing splits tokens into four buckets, multiplies them by their respective unit prices, and sums them up:
| Bucket | Description |
|---|---|
| Cache-hit Input | Based on official “cache hit” price |
| Uncached Input | Based on “cache miss” input price |
| Cache Write | Priced as “cache miss” input (no separate official price for cache writes) |
| Output | Based on output price |
Unit price unit: CNY / 1M tokens, separated by model, taken from the official price list (maintained by the maintainer in the PRICES constant at the top of client.js).
Peak/Off-Peak and Holidays¶
- Peak (non-idle price): Beijing Time Monday to Friday, 9:00–12:00, 14:00–18:00, excluding statutory holidays.
- Idle: All other times.
- Determination is independent of system timezone; includes the built-in State Council 2026 holiday schedule (19 days). For years not included, no holiday adjustments will be made; it will not intentionally give wrong prices, but simply will not adjust peaks for holidays.
Known boundaries: A full round crossing a peak/off-peak boundary is priced according to the end time of that round, with a worst-case deviation of about 50%. The cumulative conversation total only counts rounds loaded into the view; for very long sessions with pagination, the cumulative total may be lower.
Hover Pie Chart¶
When hovering over the badge, two rings appear side-by-side for Current Q&A and Whole Conversation. They are drawn based on cost proportion, not token proportion. The README explains: cache-hit tokens often account for the vast majority of usage but may account for less of the cost; drawing rings by tokens would make the breakdown nearly invisible.
Hints when price cannot be calculated¶
It will not force a calculation using wrong model unit prices. The badge will directly state the reason, for example:
未收录模型 xxx(Unlisted model xxx)混用多模型(a + b)(Mixed models (a + b))用量未标注模型(Usage missing model tag)
Currency¶
Supports CNY accounts only. If a non-CNY wallet is detected, no amounts are displayed, and it only prompts “仅支持人民币账户” (Supports CNY accounts only).
Installation and Activation¶
Recommended to install from npm (short name, version locking possible):
dsh plugin --profile desktop add dsh-cost-receipt
Or install from the GitHub repository:
dsh plugin --profile desktop add https://github.com/divineeagleblackhand/dsh-cost-receipt
You can also paste any of the above addresses into “Add Plugin” on the dsh plugin page. The desktop profile name is desktop.
After installation, refresh the page; if badges do not appear, completely exit and restart the desktop version. If direct connection to GitHub is difficult, prioritize using the npm command.
Typical Usage¶
No additional configuration is needed after installation and refresh: just chat normally. After each assistant reply ends, the badge appears automatically.
When developing or maintaining your own price tables, the repository provides:
npm test
Tests execute real pricing logic sliced from client.js, covering peak/off-peak boundaries, holidays, pie chart/badge consistency, currency determination, etc. To refresh the built-in holiday table (maintenance script, not distributed to users via npm):
node tools/fetch-holidays.mjs <year>
You can pass the URL of the original State Council notice for cross-validation.
Privacy, Networking, and Suitability Notes¶
The plugin code does not initiate network requests directly: No fetch, XMLHttpRequest, or WebSocket in client.js / index.js; balance queries are entirely via the dsh host. The host queries the account roughly every 30 seconds (about every 3 minutes when the page is not visible), using dsh’s built-in account capabilities, with tokens remaining within the host.
The plugin only reads token usage from the current session (same source as the dsh “current turn usage” panel), with zero storage and zero credential access.
Pre-installation advice: Client plugins run with the permissions of the current dsh process. Before installing, browse the repository source code and the MIT license to ensure it fits your usage environment. The community directories skillhub.cn and dsh-plugin.org are independent of DeepSeek / High-Flyer and are not official app stores.
Suitable for developers who need to see CNY costs clearly per round within the Harness and want to keep an eye on topped-up/credit balances. For non-CNY accounts, or if the dsh 0.2.0-rc.2 dependency is not met, functionality will be limited or unavailable.
Conclusion¶
dsh-cost-receipt connects official peak/off-peak price lists, holidays, and current round token usage to the UI. It answers “how much did this question cost” with a single badge line, and attaches the account balance to the latest round. Hover to see cost breakdowns; if a price cannot be calculated, the reason is explicitly shown. The plugin does not make network requests on its own, does not persist data, and balances are sourced from the same place as the account page.