dsh-plugin-usage-cost: Session Usage and Cost HUD

Preface

When running long sessions or agents in DeepSeek Harness (DSH), tokens accumulate continuously, and your account balance changes accordingly. The usage information provided by the client itself is often scattered across the composer area, and may not simultaneously show “this round / entire session” tokens, costs estimated at official price lists, and the actual charge for this round (balance difference). If you want these items always visible near the title bar or input area, with an expandable hover panel showing breakdowns and price sources, the community plugin dsh-plugin-usage-cost (maintained by worldconfig, current package version 1.3.0, MIT license) provides a session header HUD solution.

What Is This

dsh-plugin-usage-cost is a client-side plugin for DSH: it injects a HUD into the Web GUI, displaying real-time token consumption for the current round and the entire session, account balance, costs estimated using DeepSeek’s official price list, actual money spent this round (balance difference), and today’s cumulative charges. The host side (lib/index.js) fetches and parses the official website prices, serving them to the page via the same-origin route /usage-cost-hud/prices; the browser side (lib/client.js) handles HUD rendering, the hover overlay, peak/off-peak time slot determination, and display preferences. The package also declares dsh.bundle.patch, inserting the usage-cost-hud loader into Cordis via cordis.patch.yml.

Directory page: SkillHub - worldconfig/dsh-plugin-usage-cost
Source code and documentation: GitHub - worldconfig/dsh-plugin-usage-cost

Core Features

What You Can See on the HUD

By default, it hangs in the utilities area to the right of the session title bar (can also be moved below the input box or to the bottom-right corner). A one-line example looks like this:

This round 3.0M · est ¥0.72    Session 11.4M · est ¥3.04    Balance ¥12.07 ↓¥0.42    Today ¥0.83    ⟳    ● Running    ▴

Meaning and data source of each segment (excerpted from the README):

Segment Meaning Data Source
This round Tokens in the current round tokenUsage projection delta
This round · est Amount for this round (estimated) Price list or measured average price
Session Cumulative tokens in the entire session log Host replays tokenUsage for the full log
Session · est Session amount (estimated) Same as above
Balance Recharge + bonus credits combined account.getBalance
↓ Actual charge for this round Balance difference
Today Today’s cumulative actual charges Sum of balance drops observed on this machine
● Running Session is executing useSession(s => s.running)
⟳ Re-fetch official website prices Host same-origin route

“This round” is not shown when there is no baseline for the current round: if the page is opened mid-round, it won’t show “This round 0”; it only starts counting when the next round actually begins. The arrow at the end of the line can collapse the HUD; after collapsing, the session token and session amount are still displayed by default.

Hover Overlay and Pricing

Hovering over the HUD with the mouse brings up a floating panel (not a system tooltip), including session model information, TOKEN breakdown (uncached input / cache read / cache write / output and unit prices), amount summary, account details, price source and verification date, as well as plugin version and GitHub Release check. When the floating panel opens, the host route /usage-cost-hud/update-check queries GitHub for a new version at most once per hour (result cached for 10 minutes).

Amount estimation priority: official unit price list (can be priced by bucket) → measured average price (learned per round as balance difference ÷ tokens, stored in localStorage) → if neither is available, only tokens are shown. Prices are calculated via the official route only when the provider starts with deepseek; third-party routes do not show amounts. Prices come from the DeepSeek pricing documentation. Peak hours are Beijing time weekdays 09:00–12:00 and 14:00–18:00 (excluding statutory holidays configured in HOLIDAYS); all other times use off-peak prices (approximately half of peak). Since the official website documentation has no CORS, price fetching must be done on the host side, and the browser retrieves JSON via fetch("/usage-cost-hud/prices").

Position, Color Scheme, and Narrow Screens

At the bottom of the floating panel, you can switch the HUD position (localStorage["dsh-usage-cost:position"]): top conversation.session.header.utilities (default), below the input box conversation.composer.dock, or a fixed pill at the bottom-right corner (draggable, coordinates stored in dsh-usage-cost:spot). Color scheme switches between “follow theme” and “pure black” (dsh-usage-cost:color-mode). When the container width in the title bar is insufficient, CSS container queries automatically hide some fields (such as Today, This round, Balance, etc.); the input box dock and bottom-right corner are not affected by this rule. Expanded / collapsed states each have their own set of display toggles, saved in localStorage["dsh-usage-cost:fields"].

Installation and Activation

The plugin is installed as a bundle, updating the profile’s dependencies and dsh.profile.bundles, and inserting the Loader via the patch inside the package. To install from a GitHub release (the README indicates the latest tag is v1.3.0), you can use either of the following two methods.

Install via plugin management within Harness (plugin_manager’s install_bundle, or Settings → Plugins installing from directory / git spec):

plugin_manager install_bundle   target: github:worldconfig/dsh-plugin-usage-cost#v1.3.0

Or use the CLI (the README requires fully quitting the DSH application first):

dsh plugin --profile desktop add github:worldconfig/dsh-plugin-usage-cost#v1.3.0

The package is pure JavaScript with no prepare build step; refresh the page after installation to load the client portion. If only lib/client.js was changed, a refresh is sufficient; if lib/index.js (host) was changed, you need to fully quit and reopen the application. To uninstall, use remove_bundle or disable it in Settings → Plugins.

Note: The README explicitly advises against manually writing usage-cost-hud insert entries in profiles\desktop\cordis.patch.yml, as this may cause the loader to silently skip when running in the desktop packaged environment.

Typical Usage

After installing and refreshing, open any session on a DeepSeek official route to see token and cost-related fields on the HUD—no additional configuration files are needed.

  1. Verify whether prices are up to date: Click the inline ⟳; on success, a brief message “Prices updated” will appear and write to localStorage["dsh-usage-cost:price-override"]; prices older than 7 days will also trigger a silent refresh once.
  2. See clearly how much this round actually cost: Pay attention to the amount after ↓ (balance difference) and compare it side by side with “est”; “Today” is the sum of balance drops observed on the local machine during the current day in the local timezone, and recharges do not offset today’s statistics.
  3. Adjust the display: Hover to open the floating panel, then configure according to your preferences under “Position”, “Color”, and “Display → Edit”; if the top bar is too narrow, you can rely on automatic degradation or manually turn off unnecessary segments.
  4. Upgrade the plugin: DSH does not auto-update plugins; change the tag in the installation command to the new version and run the installation once more, then refresh the page; host-side changes still require a full application restart.

Developers can run offline tests at the root of the plugin repository:

npm test

The README states there are 118 assertions, covering host-side parsing and client-side behavior fixtures.

Use Cases and Cautions

Suitable for developers who use DeepSeek official models on the DSH desktop client long-term and want to track tokens and costs in a visible position at a glance. The HUD’s “Today” and measured average price depend on local machine, during this plugin’s runtime sampling of the balance; other sessions, sub-agents, or bonus credit changes may pollute the average price learning; when samples are anomalous, the floating panel will label “May include consumption from other sessions”.

The DSH ecosystem adheres to “everything is a plugin”; SkillHub is a community directory, with no official affiliation with DeepSeek / Hithink Royal-Flush (Huanfang). The plugin and host code run under the same DSH process privileges; before installing, please read the source code and MIT license yourself to confirm you accept its network behaviors (e.g., making requests to api-docs.deepseek.com and GitHub).

Conclusion

dsh-plugin-usage-cost consolidates this round and session tokens, balance, estimated costs, and actual charges into the session HUD, and strives to align with official pricing and peak/off-peak rules. If you need such persistent statistics, you can learn about the categories and introductions from the directory page, and install v1.3.0 (or your chosen Release tag) using the git spec in the README.

  • Directory page: https://www.skillhub.cn/plugins/worldconfig/dsh-plugin-usage-cost
  • GitHub: https://github.com/worldconfig/dsh-plugin-usage-cost
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye