Preface¶
When running main and sub-agents in DeepSeek Harness (DSH), a single session may generate multiple model calls, with input, output, and cache read/write tokens scattered across settlement logs. Since console or billing interfaces often lag behind, it is difficult for developers to quickly see “approximately how much was spent” within the current Web session. The community plugin dsh-token-cost (maintainer: yoggu, category: Model Inference) utilizes the settlement data already recorded by DSH, combined with the locally parsable pi-ai price list, to provide an estimated cost at the bottom of the interface, explicitly stating that this is not an invoice or actual billing amount.
The following sections introduce its positioning, how to read the figures, installation steps, as well as price mapping and usage boundaries.
What is this¶
dsh-token-cost is designed for the DSH Web configuration (--profile web). The Host side reads the durable settlement logs of the current session (including sub-agents): each record contains the provider route, model ID, and non-overlapping input / output / cache-read / cache-write token counts. Valuation uses the pi-ai catalog parsed by the @deepseek-ai/dsh-llm-pi-ai adapter accompanying the Harness process, along with the calculateCost function included in that adapter. The plugin itself does not initiate paid inference, does not open HTTP endpoints, and does not require the dsh-model-pricing service or account credentials.
The package.json describes it as: displaying the estimated cost of tokens for the current session based on local pi-ai catalog prices; this is not a billing amount. The current released version is 0.2.2, licensed under MIT.
Interface Reading¶
There is a cost button in the bottom row, which by default only shows the aggregated total amount. Clicking it brings up a popover displaying the breakdown:
- Main agent
- Subagents (including nested sub-agents)
- Total
Pressing Escape, clicking outside the area, or clicking the button again will close it. The original hover tooltip remains brief: “Estimated cost”; subscription-based routes will be marked as subscription. The subscription route estimate uses the short note “(sub) · Subscription estimate” in the explanation.
Each session only counts requests generated by the session itself: history inherited from a fork is not counted; descendant deduplication applies; normal user forks are not counted as sub-agents. Sub-node discovery relies on the durable subagent catalog, and completed or unopened subtasks are also included. Standard non-active projection reads will hydrate cold sub-nodes; subsequent updates are pushed, requiring no polling or paid inference. If sub-node usage is missing, discovery is incomplete, or a request cannot be priced, it will be marked in the popover rather than treated as free. Independent rounding of each row may cause slight discrepancies with the aggregate total; readings will dim when coverage is partial, and unpriced calls will not be shown as $0.
Installation and Activation¶
Install the GitHub release package for a specific tag (command from the project README):
dsh plugin --profile web add 'https://github.com/yoggu/dsh-token-cost.git#v0.2.2'
The README also provides a link installation method for local checkouts (requiring the directory to remain in place); this article does not expand on the clone process.
After replacing an installed version, you should restart DSH and refresh your browser. To uninstall:
dsh plugin --profile web remove dsh-token-cost
Uninstallation only removes the reading UI and does not delete session logs or credentials.
Runtime environment requirements (package.json): Node >=22.19.0; DSH engine ^0.1.7-rc.2 || ^0.2.0-rc.1. The shipped llm-pi-ai adapter and its pi-ai dependencies must be resolvable from the running Harness process; arbitrary process-level searching, cwd fallback, consumer local pi-ai copies, or arbitrary file system overrides are not accepted; the legacy DSH_PI_AI_DATA override is no longer used. If owner resolution or catalog validation fails, settlements will show as unpriced rather than free. The current implementation is tested against pi-ai 0.99.1 and does not modify the shipped adapter or its dependencies.
Pricing Source and Mapping¶
The valuation logic highlights are as follows (all from the README description):
- openrouter: Exact
openrouterroutes use the installed pi-aiopenroutercatalog; custom gateway aliases are not inferred. - openai-codex: Exact built-in
openai-codexroutes use theopenai-codexcatalog; the displayed USD is an API-equivalent subscription estimate, not a ChatGPT subscription invoice. - Legacy codex routes:
codex-business,codex-personalin logs continue to use the current shipped pi-aiopenai-codexcatalog for legacy subscription estimation (lookup only via old event IDs) after the removal of legacy account adapters. - deepseek-official: Exact routes use the
deepseekcatalog as an independent list-price estimate; the Messages endpoint is not provided by pi-ai, and billing consistency is not proven by this plugin. Unknown model IDs or gateway routes remain unpriced.
For valid entries, the Host report retains the pi-ai package name, version, catalog file SHA-256, exact route binding tags, and the number of contributing settlement entries; the Web tooltip still only writes “Estimated cost” (plus subscription for subscription routes). Displayed amounts are calculated based on the currently installed catalog; DSH logs store token counts, not historical USD. If prices change after a pi-ai upgrade, the projection stateVersion must be increased per documentation intent, and cold events replayed before claiming history has been repriced; a catalog revision alone does not invalidate checkpoints. This version supports pi-ai 0.99.1’s typed chat:<model-id> catalog keys (and legacy bare keys), using the bare model ID recorded by DSH for lookups; image/classifier entries are not used for chat pricing; using stateVersion: 7 to replay checkpoints from 1–6, etc. The fold process involves no catalog file system I/O.
calculateCost selects the applicable tier based on uncached input plus cache read/write; reasoning is included in output. Incomplete/non-finite/negative prices and ambiguous duplicate model entries will fail closed. DSH lacks the cacheWrite1h bucket; models with time-based write rates or Anthropic protocol cache writes that cannot faithfully restore billing will be unpriced.
Limitations (emphasized in original): An explicit route ID cannot prove custom endpoint ownership or actual billing; profile owners should not silently redirect to audited routes. Estimates do not include non-model fees. DeepSeek parity and historical subscription prices have specific disclaimers.
Typical Usage¶
After installing, restarting, and refreshing the browser, you can see the estimated total cost at the bottom of the Web interface without additional configuration. When developing or debugging long sessions or multi-sub-agent tasks:
- Observe the aggregated total at the bottom to grasp the approximate cost trend of the current session.
- Click the cost button to distinguish contributions from the main agent and sub-agents (including nested ones).
- If the popover shows unpriced or incomplete coverage prompts, check against the route, model ID, and whether the pi-ai catalog is parseable, rather than treating the missing data as $0.
The project’s complete offline tests can be run via npm test (within the maintainer’s repository).
Applicable Scenarios and Notes¶
Suitable for: Users doing agent development, joint debugging, or multi-sub-agent orchestration in DSH Web, who need to quickly view token estimates based on local pi-ai price lists within the same session, and who accept the “non-billing, non-invoice” semantics.
Notes:
- The plugin runs with the permissions of the DSH process; you should review the GitHub Source Code and MIT license yourself before installation.
- The community directory SkillHub Plugin Page is an independent ecosystem site and has no official affiliation with DeepSeek / High-Flyer.
- Stars and versions are subject to the repository and directory pages; at the time of writing, the GitHub public star count was 0.
Conclusion¶
dsh-token-cost connects the session settlement recorded by DSH and the calculateCost of the shipped pi-ai catalog to the bottom reading of the Web interface, making the breakdown between main agent and sub-agent costs visible, and distinguishing between estimates, subscription estimates, and unpriced. If you need to view local list-price estimates (rather than actual charges) against token usage within a Harness Web session, you can install v0.2.2 according to the README and pay attention to the mapping and limitations mentioned above.
- Directory Page: https://www.skillhub.cn/plugins/yoggu/dsh-token-cost
- GitHub: https://github.com/yoggu/dsh-token-cost