Preface¶
When writing long conversations with multi-turn tool calls in DeepSeek Harness (DSH), the interface typically only shows a context usage ring, making it hard to intuitively map it to “how much this conversation cost.” If you want to estimate costs based on the DeepSeek Open Platform pricing, you’d have to consult the documentation yourself and distinguish between peak/off-peak hours and cache-hit types. Below we introduce the community client plugin dsh-cost-meter (npm package @max/dsh-cost-meter, maintained by PennChong95): it displays token details and estimated RMB costs (based on official pricing) for the current session below the Web interface input box, to the right of the context usage indicator.
What Is This¶
dsh-cost-meter is a client-side plugin for DSH: the Host-side index.js is empty; the logic lives entirely in client.js, which is loaded directly in the browser, with zero dependencies and zero build steps. It reads the conversation projections tokenUsage and modelSelection, registers into conversation.composer.dock, does not modify server-side billing, and displays results as estimates (excluding sub-sessions, other sessions, and non-token billing items; actual charges are subject to the DeepSeek Open Platform invoice).
- Directory page: https://www.skillhub.cn/plugins/PennChong95/dsh-cost-meter
- Source code: https://github.com/PennChong95/dsh-cost-meter
- Version referenced in this document: 1.1.1, License MIT
Core Features¶
UI Behavior¶
After installation, refresh the page. Below the input box and to the right of the context usage ring, a ¥ capsule (e.g., ¥0.1234) appears, indicating the estimated cost of the current session based on DeepSeek’s official pricing. Clicking it expands a detail panel (within the viewport) that typically includes:
- Token counts and respective monetary amounts for input·cache hit / input·cache miss / input·cache write / output;
- Total tokens;
- Cumulative amounts for peak / off-peak hours separately (default
mode: ledger); - The priced model, current time tier, and current rate (RMB per million tokens).
When the model is not in the price list, — may be displayed (see the unknownModel configuration below).
Pricing Basis¶
Prices are taken from DeepSeek’s official “Models & Pricing” page (RMB / million tokens). The plugin’s built-in table includes the four peak/off-peak input/output unit prices for deepseek-flash and deepseek-v4-pro. Time-tier rules match the official description: Beijing time, Monday–Friday (excluding Chinese public holidays), 9:00–12:00 and 14:00–18:00 are peak hours; everything else is off-peak (priced at half the peak rate), including weekends, public holidays, and adjusted make-up working days per official scheduling.
Holidays for 2026 are built in per the State Council General Office notice (国办发明电〔2025〕7号); years not covered can be added via the extraHolidays configuration. cacheWrite is billed at the cache-miss price; discontinued model ids are mapped to Flash or Pro prices.
Two Pricing Modes¶
- ledger (default): each observed usage increment is recorded to browser localStorage at the current rate at that moment, accumulated across time tiers and models;
seenonly increases and never decreases, avoiding double counting. - estimate: multiplies the current time-tier unit price directly by the session’s total volume; simpler to implement, but with larger errors across time boundaries.
Installation & Activation¶
First obtain the full package containing cordis.patch.yml (.tgz, local directory, or git repository), then have DSH install it into the current profile.
Method 1: Compressed package or local directory
dsh plugin add "D:\下载\max-dsh-cost-meter-<版本>.tgz"
dsh plugin add "D:\下载\dsh-cost-meter"
Method 2: git
dsh plugin add "github:PennChong95/dsh-cost-meter"
The repository must contain the committed client.js artifact; git installation pulls the whole repository, so the files whitelist in package.json does not apply — do not commit node_modules. If GitHub connectivity checks fail domestically, the UI may show “Cannot access GitHub”; in that case, .tgz or a local directory is more reliable.
Desktop users: desktop profiles are exclusively owned by the app. In the sidebar, go to Plugins → Add Plugin, paste the spec above, then click Install; it is enabled by default after installation.
Please refresh the page once after installation, otherwise the old module may still be loaded. DSH plugins currently do not support automatic updates; upgrading requires uninstalling first and then installing the new version.
Environment requirements: verified on DSH 0.2.0-rc.2 (Desktop), relying on the conversation.composer.dock slot and the tokenUsage and modelSelection projections; earlier versions may fail to load, and the plugin list will show the reason.
Configuration¶
Behavior can be adjusted in the plugin config within cordis.patch.yml, for example:
- insert:
- id: cost-meter
name: '@max/dsh-cost-meter'
config:
tier: auto # auto | peak | offPeak
mode: ledger # ledger | estimate
defaultModel: deepseek-flash
unknownModel: unpriced # unpriced | defaultModel
extraHolidays: [] # YYYY-MM-DD
extraWorkdays: [] # YYYY-MM-DD,覆盖内置节假日
rates: # 可选,按模型合并覆盖官方价
deepseek-flash:
peak: { output: 8 }
| Field | Default | Meaning |
|---|---|---|
tier |
auto |
Automatically determines peak/off-peak by Beijing time, or fixes to peak / offPeak. |
mode |
ledger |
See ledger / estimate above. |
defaultModel |
deepseek-flash |
Model used when modelSelection is unavailable. |
unknownModel |
unpriced |
Unknown model behavior: unpriced shows —; defaultModel estimates using the default model. |
extraHolidays / extraWorkdays |
[] |
Add holidays or force working-day rules (workdays take precedence over holidays). |
rates |
None | Override official pricing. |
Typical Usage & Notes¶
- After installation and refresh, observe the
¥capsule and details below the current session composer, and confirm against the token ring that only the current session is counted. - If crossing years whose built-in holiday table hasn’t been updated, the panel may show “Holiday schedule for this year not yet built in”; temporarily add dates in
extraHolidays, or wait for a plugin update. - On first entering a session with existing history, the plugin will immediately count all existing usage at the current rate in one go (
tokenUsagehas no per-request timestamps). For sessions started before crossing 09:00, 18:00, or holiday boundaries, the first displayed number may be too high or too low; subsequent increments are priced at their time of occurrence. - Clearing browser data wipes the localStorage ledger (key prefix
max-dsh-cost-meter:v2:), and accumulated amounts restart from zero.
After developers modify source code locally, the profile contains a file: copy, so the dependency must be removed and re-added, then the page refreshed; publishing a semantic version requires bumping package.json’s version. Test command:
node --test test/pricing.test.mjs
Use Cases & Permissions¶
Suitable for users doing daily conversations, agent debugging, or who need session-level cost awareness in DSH Web/Desktop. It is not a replacement for Open Platform invoice reconciliation, and does not count sub-agents or other parallel sessions.
The plugin runs in the current DSH process / browser context, only reads existing conversation projections and writes a ledger to localStorage; before installing, it is recommended to review the repository source code and the MIT license yourself to ensure compliance with your security and compliance requirements. The community directory SkillHub has no official affiliation with DeepSeek / High-Flyer and is a third-party extension within DSH’s “everything is a plugin” ecosystem.
Links¶
- Plugin directory: https://www.skillhub.cn/plugins/PennChong95/dsh-cost-meter
- GitHub: https://github.com/PennChong95/dsh-cost-meter
- Price reference: DeepSeek API · Models & Pricing