Introduction¶
When running conversations, sub-agents, and web search tasks with DeepSeek Harness (DSH), tokens get scattered across many sessions and background calls. The DeepSeek console provides account-level billing, which makes it hard to answer “how much did this conversation on this machine today cost”. If you manually calculate costs based on official off-peak/peak pricing, you also need to distinguish cache hits vs misses, model ids, and holiday boundaries — the cost is error-prone and easy to undercount.
Below is a community plugin, dsh-cost-meter (maintainer maxwell234smith): within a local DSH installation, it records every model call based on official price lists and peak/off-peak rules, and displays a real-time RMB amount in the status area below the input box.
What Is This¶
dsh-cost-meter is a Cordis plugin for DSH (category: web tools), current version 0.1.0 (MIT). It does not query bills remotely on your behalf; instead, it subscribes to model completion events on the local Host side, accumulates costs locally, and the browser fetches a snapshot roughly every 3 seconds for display. The statistics scope is all calls on this local DSH installation; costs generated by the same API key on other machines or other tools will not enter this ledger.
Core Features¶
Statistics Scope¶
- Across all sessions: the current conversation, history sessions, sub-agents, background tasks, session title generation, compaction, web search, and experimental calls made directly via
ctx.llm.stream()in plugins are all counted. - Local only: running multiple DSH windows still counts only once; it cannot distinguish “other people sharing the same key” — the platform has no official per-person/per-key billing interface.
- Real-time persistence: the Host records a call as soon as it completes; the interface refreshes periodically. The ledger and diagnostics files live in
$DSH_HOME/storages/cost-meter/(Windows default:%USERPROFILE%\.dsh).
Billing Rules¶
Prices align with the DeepSeek official pricing documentation (README notes checked on 2026-09-29), in RMB yuan per million tokens. The table below shows peak-hour prices:
| Model | Cache-hit input | Cache-miss input | Output |
|---|---|---|---|
deepseek-flash |
¥0.04 | ¥2.00 | ¥8.00 |
deepseek-v4-pro |
¥0.30 | ¥9.00 | ¥27.00 |
- Peak hours: Beijing time Monday–Friday 09:00–12:00 and 14:00–18:00, on days that are not Chinese statutory holidays.
- Off-peak hours: all other times (including weekends, statutory holidays all day, and the 12:00–14:00 lunch break); unit price = peak price × 0.5; each call is judged by its own occurrence time, not a discount applied to the total.
- Legacy model ids (e.g.
deepseek-v4-flash) are normalized todeepseek-flash; unregistered models default todeepseek-flashpricing, and additional prices can be configured. - Holiday data is built-in for the 2025 and 2026 State Council announcements; makeup workdays (weekends worked due to holiday adjustment) do not count as peak by default. If you want makeup workdays treated as workdays, set
makeupWorkdaysArePeak: true.
Interface Display¶
Example status area (mounted on the conversation.composer.dock slot, on the same status bar as the official token statistics):
[Off-peak] This session ¥0.1234 · Today ¥8.6027 · Total ¥20.6143
[Peak]/[Off-peak]: the current time period; hover to see the next switch time.- This session: accumulated for the current conversation; Today: Beijing time today; Total: all local history (first-time installation backfills historical session logs).
- The hover badge lets you view peak/off-peak split, today’s token buckets, non-conversation experimental calls, backfill status, etc.
Installation and Activation¶
The plugin has zero runtime dependencies; lib/client.js is a handwritten browser bundle with no build step required.
Install from GitHub (the README recommends pinning to a tag or commit, see the repository Releases):
dsh plugin --profile desktop add github:maxwell234smith/dsh-cost-meter#v0.1.0
For local development, you can link a source directory:
dsh plugin --profile desktop add link:D:\path\to\dsh-cost-meter
You can also fill in github:maxwell234smith/dsh-cost-meter in the DSH web version under Sidebar → Plugins → Install bundle. After installation, reload the page; the Host side hot-reloads with the profile, but the browser side needs a page reload.
Before installing, review the GitHub repository source code and MIT license yourself. The plugin runs with the permissions of the current DSH process and will read/write ledger files under the local $DSH_HOME.
Typical Usage¶
After installation and refresh, no additional commands are needed: just use DSH normally, and a cost badge will appear below the input box.
To override unit prices, company holidays, ledger paths, or HTTP fetch routes, configure by plugin id in the profile’s cordis.patch.yml, for example:
- id: dsh-cost-meter
name: dsh-cost-meter
config:
prices:
deepseek-flash:
output: 8.0
my-proxy-model:
cacheHitInput: 0.1
cacheMissInput: 3.0
output: 12.0
extraHolidays:
- 2026-12-31
makeupWorkdaysArePeak: false
ledgerPath: storages/cost-meter/ledger.json
httpPath: /cost-meter/snapshot
allowHosts: []
backfill: true
To reset to zero: stop DSH, delete ledger.json, then start again (it will automatically backfill history again, but the cumulative logic is still protected by the watermark, so already-processed events will not be double-counted).
The browser preferentially fetches data via GET /cost-meter/snapshot; if the interface shows “read failed”, check $DSH_HOME/storages/cost-meter/diagnostics.json for httpRegistered, lastHttpError, lastClientReport, or look at the badge’s hover tip.
Use Cases and Caveats¶
Suitable for: developers who long-term use the DeepSeek API on local DSH, want to see “this session / today / total” RMB costs based on official off-peak/peak and model pricing, and want to distinguish local calls from the console account’s overall bill.
Notes:
- The amounts are local estimates, not equivalent to DeepSeek bills; retries, completion times crossing peak/off-peak boundaries, etc. introduce the known deviations listed in the README.
- Shared keys cannot be split per person; server-side splitting requires each person to have an independent key.
- After modifying Host-side code (
index.js,src/*.js), restart DSH and confirm it took effect by checking whethercodeRevisionindiagnostics.jsonequals the sourceCODE_REVISION. - The community directory SkillHub plugin page and GitHub are independent ecosystem entries, with no official affiliation with DeepSeek / 幻方.
Conclusion¶
dsh-cost-meter collapses “all model calls on this local DSH” into a single RMB reading on the status bar, and prices each call at the official half-price off-peak and standard peak rates. For installation commands, price tables, and troubleshooting details, refer to the repository README.