dsh-client-ui-usage-hud: Always-Visible Account Balance and Token Usage in DSH Sidebar

Introduction

When running agents or conversations in DeepSeek Harness (DSH), you often care more about “how much money is left, how much has been spent in total, and how many tokens have been used” rather than just occasionally checking a settings page. DSH’s built-in account service requests the platform interface GET /api/v0/users/get_user_summary, but the parsing result only retains normal_wallets and bonus_wallets; fields like total_costs are discarded during the projection phase, so cumulative consumption is usually not visible in the official UI. If you want this information to be constantly visible at the bottom of the Web client’s sidebar, you can install the community plugin dsh-client-ui-usage-hud (Maintainer: bjpd6, Category: Client). It provides a HUD in the sidebar footer area, reads the complete summary from the platform independently, and aggregates token data from DSH’s local session projection cache.

What is this

dsh-client-ui-usage-hud is a DSH Client (Web) plugin bundle: it displays account balance, bonus balance, cumulative consumption, total token usage, and details of the most recent request at the bottom of the browser sidebar. The visual style references the community skin “Deep Sea Maid Workshop” (@smalltailqwq/dsh-client-ui-skin-maid-atelier): navy blue, gold, and porcelain white; Georgia serif font; lace-edged glass panels. It reads CSS variables published by that skin and uses identical fallbacks when the skin is not enabled, working in both light and dark themes.

The plugin has no third-party runtime dependencies and no build steps; lib/*.js are directly executable JavaScript files. The current package version is 0.1.0, licensed under MIT, requiring Node >=18.

What is displayed in the sidebar and where the data comes from

When collapsed, the trigger shrinks into a circular whale button of approximately 34px; when expanded, the panel title is “Deep Sea Account · Token Usage”, providing refresh and jump-to-official-usage links.

Display Item Data Source
Account Balance Platform GET /api/v0/users/get_user_summary → normal_wallets (by currency)
Bonus Balance Same as above → bonus_wallets
Cumulative Consumption Same as above → total_costs (The DSH account service does not project this field to the UI; this plugin parses it independently on the host side)
Total Token Usage & Session Count record.rows.tokenUsage.totals in <dshHome>/storages/session_projcache/sessions/*.json
Last Usage (Miss / Hit / Output etc.) Same cache as above → tokenUsage.last

Amount fields are decimal strings returned by the platform. They are kept as-is before formatting to avoid floating-point precision loss; the panel notes “Amounts come from the DeepSeek platform account interface” and does not perform valuation or price list inference.

Why request the platform separately

Although DSH’s deepseek-account calls the same summary interface, its parse logic only outputs balance and bonus wallets, discarding total_costs here; platform documentation also states that host projects usually only consume normal_wallets / bonus_wallets. Therefore, the host half of this plugin, after obtaining platform credentials, independently requests get_user_summary on https://platform.deepseek.com and parses cumulative consumption.

Regarding credentials: deepseekAccount.resolveToken(url) is only valid when matching the inference domain https://api.deepseek.com; for the platform domain, getPlatformSession() should be used. It returns { origin, token, userId, requestHeaders } and exports stored grants when the issuer matches platformOrigin. This plugin adopts the latter.

Data flow overview:

client.js ──GET /api/dsh/usage-hud──► lib/index.js
                                        ├─ deepseekAccount.getPlatformSession()
                                        │    └─ GET platform .../get_user_summary
                                        └─ session_projcache/sessions/*.json
                                             → Token aggregation & last usage

Token statistics come from the persistent projection cache, not just the currently active session, so cold starts and archived sessions are also included. The route response wrapper is consistent with the account service (code / data.biz_code / data.biz_data), handling invalid paths like 401 and 40003. Tokens exist only in the host process; the browser obtains aggregated results via the same-origin API, and the route rejects cross-site calls.

Installation and Activation

Prerequisites: DSH has deepseek-account platform plugin enabled, and official account login is used. In pure API Key mode, there is no platform grant; amount-related rows will state this truthfully rather than displaying fictitious zeros.

DSH bundles are declared via dsh.bundle.patch in package.json; after installing to a profile directory, DSH merges the patch into that profile.

Method A: Plugin Manager (Requires pnpm and git)

Replace <this-repo-url> with the repository address (e.g., https://github.com/bjpd6/dsh-client-ui-usage-hud on GitHub):

dsh plugin --profile desktop add <this-repo-url>

Newly installed bundles are enabled by default. Restart DSH once after installation.

Method B: Manual Installation (No pnpm, no git required)

  1. Copy the entire plugin directory to the profile’s node_modules:
   <dshHome>/profiles/<profile>/node_modules/dsh-client-ui-usage-hud/
  1. Append the package name to dsh.profile.bundles in that profile’s package.json:
   {
     "dsh": {
       "profile": {
         "bundles": [
           "@deepseek-ai/dsh-base",
           "@deepseek-ai/dsh-web-app",
           "dsh-client-ui-usage-hud"
         ]
       }
     }
   }
  1. Restart DSH. The loader will apply this package’s cordis.patch.yml (inserting the ui-usage-hud line) and serve lib/client.js to the browser.

  2. Refresh the page.

If you need to iterate on the host half (lib/index.js) without restarting DSH, you can add this plugin directory as config.root for the hmr plugin in the profile’s cordis.patch.yml; lib/client.js can be polled by dsh-client-hmr, so just refresh the page after making changes.

Typical Usage

After installing, restarting, and refreshing the Web client, find the HUD trigger at the bottom of the left sidebar (a circular whale button when collapsed). Click to expand the panel to view balance, bonus balance, total token usage and session count, token breakdown of the last request, and cumulative consumption; use the Refresh button on the panel to re-fetch data, or jump to the DeepSeek platform usage page via View Official Usage.

For local development or acceptance, the repository provides scripts (Node >=18 required):

node tests/client-test.mjs lib/client.js
node tests/host-e2e.mjs ./lib/index.js

The former renders the client component under a minimal React hooks shim; the latter drives the real route and calls the platform (e2e scenarios require a valid login environment).

Scenarios and Notes

Suitable for: Developers or users who already use the DSH Web client daily and have logged into a DeepSeek official account; those who want to see balance, cumulative consumption, and token summaries at a glance in the sidebar, and accept that the HUD visually matches the “Deep Sea Maid Workshop” skin or uses an independent fallback style.

Not suitable for or not covered: In API Key-only mode without a platform session, real account amount rows cannot be displayed (the plugin will explain this rather than fabricating data).

Security and Trust: The plugin runs with the current DSH process privileges; the host half holds the platform session and accesses the local session_projcache. Please read the source code and MIT license of the GitHub repository yourself before installation to ensure it complies with your environment policy. The DeepSeek Harness ecosystem emphasizes “Everything is a plugin”; the SkillHub Plugin Directory is a community site and has no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-client-ui-usage-hud fills the gap of cumulative consumption not projected by DSH’s default UI, and pins token usage and session statistics to the sidebar footer, with data paths clearly explained via tables and flow diagrams in the README. If your profile has deepseek-account configured and uses official account login, you can install it into the profile using the commands or manual steps above, then restart and refresh the page to use it.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye