Introduction¶
When mixing local models and cloud APIs in DeepSeek Harness, the local routing will not generate a bill, which can easily lead to the misconception that “no money was spent.” In reality, the cloud is billed by Token, while local routing consumes compute power and time. To determine if a routing strategy is cost-effective, you need to calculate clearly the “amount saved in this session, amount spent, and net amount,” rather than relying on rough estimates.
CostOps Hub (省流中台) is a DSH plugin released by maintainer yinmyu, classified under model inference. It reads existing session logs from Harness, archives Token usage by request, and then uses official pricing and local/cloud routing rules on the client side to convert amounts. It provides a billing page, a Composer capsule, and session drill-down; it does not set up a proxy, intercept traffic, or send data externally. You can find the community directory entry at SkillHub Item, and the source code and documentation are on GitHub Repository (current version 1.3.0, MIT license).
What is This¶
One-sentence positioning: Cross-session Token cost ledger for DeepSeek Harness—each settled request is priced according to the official list price at the time of execution, distinguishing local routing avoided spending, actual cloud routing spending, and the net amount.
The ledger only stores facts (timestamps, provider, model, four types of Token buckets, etc.) and does not persist currency amounts; price lists, exchange rates, and “whether local routing” are calculated instantly on the browser side. After changing prices or rules, historical bills are recalculated, and there is no need to re-scan logs.
Core Features¶
Data Source and Granularity¶
On the Host side, it replays session logs under ~/.dsh/sessions/** via ctx.sessionQuery (including zstd decoding and format migration). Each settled assistant/message carries a provider, model, and Token usage, attributed per request, not just aggregated per session.
Each fact row contains: [time, session, seq, provider, model, uncached input, cache read, cache write, output]. Forks deduplicate (inheritedEventCount); in-progress sessions are re-read at most once per minute; scanning has a wall-clock budget, and the page displays progress to avoid interface freezing.
Billing Page and Time Windows¶
The main interface is the “Billing Page”; the capsule at the bottom of the Composer displays the current session’s real-time (saved / spent).
Supported time windows include: Current Session, Last 1 Hour (5-minute buckets), Today (Beijing time 0:00 to now, by hour), Last 7 Days, Last 30 Days (the widest window kept by the ledger). Each window can be compared with the previous equal-length interval (shows new if no history, no fake percentages); more saved is blue, more spent is amber.
The summary bar gives the net amount first, then lists “Saved” and “Spent” side-by-side; the trend graph overlays local savings (blue) and cloud spending (amber); the model table sorts by amount and can be expanded to sessions before switching back to a single-session billing. Export CSV writes the current window’s model × provider table (including four Token types, total, and amount) to the plugin data directory and prompts the path.
Routing Rules¶
The second tab configures what constitutes “local”: determined by provider (auto / local / cloud), exceptions set by model (the same provider can cover both local and cloud), and whether sub-agent sessions are counted. Rules only change the view of judgment, not the recorded facts; modifying them immediately recalculates history.
Composer Capsule (The pill)¶
For the current session, it reads projections and trajectories, giving saved, spent, or both according to the price at the time of each request execution; clicking allows viewing the model, price window, and destination of the amount.
First Install: Backfill History¶
Upon first opening, it backfills the last 32 days of session logs (prioritizing new sessions); the interface may display something like reading history 12/49 sessions…; after completion, it only re-reads that session when logs change.
Pricing and Accuracy¶
Prices are calculated per 1,000,000 tokens. The README notes the data cutoff date is 2026-11-11, sourced from official pages of various vendors; machine-readable source is in docs/pricing-source.json in the repo. Requests executed during off-peak hours permanently retain that tier’s price.
The badge indicates telemetry: none, with no extra telemetry collected.
Installation and Enabling¶
CostOps Hub is a DeepSeek Harness bundle plugin: the package includes a patch manifest ( dsh.bundle.patch in package.json points to ./cordis.patch.yml ), injecting Host rows and browser modules; no npm dependencies, no build steps.
The installation process follows the README; choose one:
- Open Plugins → Add plugin in DeepSeek Harness, select the plugin directory; or use the
plugin_managertool and pass the absolute path. - When using the repository URL, use the same installation flow via
plugin_manager, replacing the path with the repository URL (do not manually splice CLI commands not appearing in the docs).
Then enable CostOps Hub / 省流中台 in the plugin list. After enabling, a capsule appears in the Composer dock area; the left sidebar 省流中台 opens the full page.
On the Host side, each plugin process loads only once. If index.js is modified, you must disable and then enable that plugin row in Plugins—refreshing the browser alone is not enough.
Typical Usage¶
- Install and enable the plugin, wait for the first history backfill to complete (pay attention to the reading progress prompt on the page).
- In 省流中台, select a time window (e.g., Today or Last 7 days), view the net amount, saved, and spent from the summary bar, then locate the main consumption sources in the trend graph and model table.
- Open a model row, drill down to the session contributing the amount; when comparing with the current conversation, switch to This session.
- In the Route rules tab, mark providers actually taking the local route as local (or use auto/model exceptions as per docs), confirming the “Saved” statistics match the actual routing.
- For table analysis, use Export CSV in the current window and retrieve the generated file from the plugin data directory.
For daily use, you can rely on the Composer capsule to observe the current session’s saved / spent, then enter the full page for cross-session comparison.
Use Cases and Considerations¶
Who is it for: Developers who mix local inference and cloud APIs in DSH long-term, want to compare “cost saving” effects using unified pricing, and need to trace Token costs by model and session.
Runtime and Trust Boundaries: The plugin reads local session logs and runs Host logic under the current DSH process permissions. Before installing, you should review the source code and the MIT license yourself. The README explicitly states no proxy is used, no external network traffic, and amounts are calculated locally using the built-in price list and rules; price changes require repository updates or understanding the deviation yourself.
Compatibility: The README has a dedicated Compatibility section; this article does not expand on truncated parts. If the interface is abnormal after upgrading DSH or the plugin, refer to the repository README and issues.
Relationship with Community Directory: The DSH ecosystem advocates “everything is a plugin”; SkillHub is a community directory, has no official affiliation with DeepSeek / 幻方, and is not an official app store.
Conclusion¶
CostOps Hub turns Harness’s existing session logs into an auditable Token ledger: official list prices are charged based on the time of request, routing rules distinguish local savings from cloud spending, and it supports session drill-down and CSV export. To install or follow version updates, you can enter the description from the Directory Page or check the README on GitHub (including 简体中文 README.zh.md).