Introduction¶
Running agents in DeepSeek Harness (DSH) often only shows token usage in the console, making it difficult to directly correlate costs with “this request, this turn, or the entire conversation.” When using the official API, there are billing delays; with subscriptions or reseller channels, per-request charges are often invisible. To convert existing usage into readable amounts without modifying requests or calling the LLM, and to compare public prices against billing figures, a read-only billing statistics plugin is needed. Below is an introduction to the community plugin dsh-billing-stats (maintainer: SSHOOTING, category: Model Inference), its positioning, and usage.
What is this¶
dsh-billing-stats is a read-only billing statistics plugin for DSH: it does not call the LLM, does not modify requests, does not guess tokens, and only reads the events generated by DSH and the local ledger to convert usage into amounts and display line items.
Brief introduction (consistent with the TOC): Read-only DSH token billing statistics with equivalent API cost. The current release version is 0.1.0 (MIT License). The built-in price list currently only covers DeepSeek series models and has completed real feature acceptance in the DSH 0.2.0-rc.2 web profile.
What problems does it solve¶
The plugin organizes capabilities around three common problems:
- How much did this request cost? Expanding the amount capsule reveals uncached input, cache read/write, output (including reasoning), search fixed fees, and unknown items, rather than just the total number of tokens.
- How much did this turn or this session cost in total? The bottom native usage area displays session accumulation; after each turn completes, it displays the current turn’s amount and time, updating incrementally with usage.
- How do subscription or gateway users estimate “value”? It simultaneously provides Public Price (equivalent amounts calculated based on public API unit prices) and billing standards (estimates after importing bills for calibration; local estimates, not supplier invoices).
The plugin does not equate high token consumption directly with high value; it is only responsible for calculating usage clearly.
Core Features¶
The following capabilities come from the project README and package.json descriptions:
- Per-request statistics: Itemized fees for input, cache read/write, output, and search.
- Per-turn and session accumulation: Fits the DSH native usage area without creating a separate, disjointed dashboard.
- Public Price + billing standards: Side-by-side equivalent API value and billing import calibration.
- Price Profile Switching: Built-in configurations for DeepSeek Official API and OpenCode Go; switching only affects requests after the switch, historical requests are not recalculated.
- Bill Fitting: Supports importing CSV / JSON / JSONL; first fits account multipliers, then fits bucket unit prices when sufficient samples are available.
- Search Attribution: Associates search ledger with request body fingerprints and FIFO (configurable to enable); fixed fees are listed separately.
- Local Traceability: usage ledger, search state, and fitting results are saved locally in JSONL / JSON.
- Shareable Reports: Can generate offline HTML cost explanations without uploading to third parties.
Clear execution boundaries: Does not modify low / high / max thinking levels or maxTokens; does not block requests or tool calls; no internet connection required; unknown tokens are not calculated as 0 RMB.
Where does the data come from¶
The plugin reads DSH’s existing usage (provider / model / token), optional supplier bills, and optional search shim ledgers in read-only mode. It derives per-request costs through price profiles and fitting results, aggregates them to the current turn/session, and displays them in the UI capsule and /cost command. Self-deployed GPU / Power / Operations TCO is currently not covered.
Interface and Commands¶
Interface side (web profile):
- The bottom of the session displays a “Session cost ¥Amount” capsule;
- After each turn completes, it displays “Usage ¥Amount + Time”;
- Clicking the amount allows viewing token, unit price, and fee breakdown for the current turn and recent requests;
- Search requests display the count and fixed fee.
Commands:
/cost View current turn and session accumulation
/cost explain View token, unit price, and fee breakdown of the most recent request
/cost profiles View price profiles
/cost profile auto Automatically select a price profile based on provider
/cost profile opencode-go Switch to the specified profile
Installation and Enablement¶
The plugin targets the web profile. The package.json requires Node.js ^22.19.0 || >=24.0.0 and DSH >=0.2.0-rc.2 <0.2.1.
npm¶
dsh plugin --profile web add dsh-billing-stats@0.1.0
GitHub Release tarball¶
dsh plugin --profile web add https://github.com/SSHOOTING/dsh-billing-stats/releases/download/v0.1.0/dsh-billing-stats-0.1.0.tgz
After installation, confirm that the profile’s package.json has added dsh-billing-stats to dsh.profile.bundles, then restart the DSH web process. Refreshing the page is sufficient when only changing client cards; a restart is mandatory after Host code changes. For a more complete installation, configuration, and rollback, see install/README.md in the repository.
Local development link example (original README text, paths adjusted to your machine):
dsh plugin --profile web add link:E:/programs/dsh-billing-attribution
Configuration¶
The release package comes with a cordis.patch.yml using portable defaults, and search ledger association is disabled by default. If you need to persist the ledger or enable search, override it in the profile’s cordis.patch.yml, for example:
- id: billing-attribution
config:
displayCurrency: CNY
ledgerPath: '<writable data directory>/usage-ledger.jsonl'
searchStatePath: '<writable data directory>/search-state.json'
searchLedgerEnabled: true
searchLedgerPath: '<path to search shim JSONL>'
activeProfile: auto
maxRecentRequests: 20
ledgerPath and searchStatePath should be placed in a directory that is writable and can be backed up. If the search ledger does not exist, the plugin skips search association, which does not affect model billing.
Typical Usage¶
In daily use, first check the bottom capsule or run /cost to grasp the accumulation. Execute /cost explain when you need to verify a single request. If using a subscription or gateway, you can import a bill and compare it against the public price; use /cost profiles and /cost profile <name> to switch price profiles.
Development and verification (from README):
npm test
npm run check
npm run bill:import -- --bill .\examples\bill.sample.csv --out .\data\bill.normalized.jsonl
npm run bill:fit -- --usage .\examples\usage.sample.jsonl --bill .\data\bill.normalized.jsonl --profile deepseek-official --out .\pricing\fitted\deepseek-official.json
npm run report -- --bill .\examples\bill.sample.csv --out .\reports\billing-explainer.html
On Windows, Node.js v24.19.0, DSH 0.2.0-rc.2 web profile, the README records practical test results for items such as npm test (21/21), /cost, profile switching, native amount UI, search association, and HTML reports.
Suitable Scenarios and Notes¶
Who is it for:
| Usage Method | Directions the plugin can help answer |
|---|---|
| Official API | Per-request / per-turn / session amounts, bill import and multiplier fitting |
| Subscription Account | Public price equivalent amounts, real-time accumulation and session comparison |
| Gateway API | Side-by-side public price and billing standards, import gateway bills for calibration |
| Self-deployed | Currently does not cover GPU / TCO |
Pre-installation Notes:
DSH plugins run under the current DSH process permissions, reading session usage and potentially reading/writing to the ledger paths you configured. Before installing, please review the GitHub repository source code and MIT license to confirm that the paths and bill data are acceptable.
Known Boundaries (v0.1.0):
- Only built-in DeepSeek series prices; other models require providing your own price profile.
- Public price is an equivalent calculation; billing standards are not invoices; it is difficult to reliably split four token buckets when there is no request-level billing.
- Fixed exchange rate
1 USD = 7.2 CNY; peak hours configured according to Beijing Time working days, no built-in statutory holidays. - Search association is best-effort; negative amounts, refunds, and promotional credits are out of scope.
The community directory SkillHub Plugin Page and GitHub are independent ecosystem entry points with no official affiliation to DeepSeek / Hyperbolic; choosing this plugin is a personal environment decision.
Conclusion¶
dsh-billing-stats converts the token usage already occurring in DSH into interpretable amounts and line items, providing two readings for the same usage between public prices and the billing standards. It is suitable for developers who need to see costs immediately during development and debugging, and who need to perform mental accounting for subscription or gateway scenarios. For details and updates, refer to the repository README:
- TOC: https://www.skillhub.cn/plugins/SSHOOTING/dsh-billing-stats
- GitHub: https://github.com/SSHOOTING/dsh-billing-stats