dxxo77/dsh-plugin-quota-balance: Display account balance at the far left of the DSH usage row

Introduction

The DSH desktop version has a row of official usage stats below the input box: Rounds, Steps, Sampling Speed, Token Usage, Cache Hit, and Context Usage. They are all there. Except for how much money is in the account, it is not visible on the interface. To confirm the balance, you have to open the DeepSeek web account page in a separate window, switch windows, check the number, and switch back. This does not match the consumption of the current session.

The plugin dsh-plugin-quota-balance maintained by dxxo77 solves this: it places the balance on the far left of the usage row, on the same line, same font size, and same gray scale as the official numbers, without taking up extra space; clicking it expands the details in place, showing sub-items for Normal Balance and Bonus Credit. Below is its features, installation method, and implementation points.

What is this

One-sentence positioning: DSH’s Host + Client dual-side plugin, adding an HTTP interface to read deepseekAccount’s balance, then stuffing a cell into the client’s input box usage row.

  • Maintainer: dxxo77
  • License: MIT
  • Repository: https://github.com/dxxo77/dsh-plugin-quota-balance
  • Directory Page: https://www.skillhub.cn/plugins/dxxo77/dsh-plugin-quota-balance
  • The category on the directory page is “Client”. Star count: 1 (as of directory page)
  • The market item submitted to awesome-dsh-plugin in the README is categorized as usage

The prerequisite is that the host must possess the deepseekAccount service, meaning DSH desktop version is required, and the current DeepSeek account is logged in. It won’t run in a browser-only plugin environment.

Core Features

Looking at the features description in the README, it covers these things:

  1. Display the current account balance (¥) on the far left of the usage row, same line, same font size, and same gray scale as the official numbers.
  2. Clicking the badge expands the details overlay in place: account balance, normal balance, bonus credit, update time, and “Refresh” and “Go Recharge”.
  3. When not logged in or read failure, hide the entire block, taking up no space.
  4. The badge and overlay read the host’s exposed surface tokens entirely, not using their own color scheme, so they automatically follow the dsh-plugin-wallpaper-engine’s glass parameters, light/dark themes, and wallpaper switching; without the wallpaper engine, it is a normal dark overlay.

Display rule details:

  • Multiple wallets of the same currency (Normal Balance + Bonus Credit) are summed, e.g., ¥10.47; for multiple currencies, they are connected with ·.
  • The badge is order: -10, placed on the far left of conversation.composer.dock.
  • The overlay bottom edge aligns 6px above the badge, directly covering the input box, re-sticking when the window resizes.
  • Collapse method: Esc, click outside the card, click the badge again.
  • Font and color follow the usage row: font: inherit, 12px, --dsw-alias-label-tertiary.
  • Hover has a light rounded bottom, press is darker, focus-visible has an accent color border; the background is implemented with “padding + equal negative margin”, so hover text doesn’t shift.
  • The card is mounted on document.body using a separate stylesheet, because the input box card has built-in clipping and stacking context, and a floating layer in the slot would be covered by it.

Installation and Enablement

The installation method given in the README is not a single command line, but rather getting the code first, then mounting the directory in the plugin management:

git clone https://github.com/dxxo77/dsh-plugin-quota-balance

Then install that directory in DSH’s plugin management, with install_bundle pointing to the repository path. After installation, it takes effect immediately; the balance appears on the far left of the usage row below the input box, click it to expand details.

Uninstall: Simply remove dsh-plugin-quota-balance in the plugin management.

File division of the repository:

File Function
index.js Host side: Register GET /plugin/quota-balance/status, read balance via deepseekAccount.getBalance() with 30s (5s on failure) cache
client.js Client side: Register a cell with order: -10 in conversation.composer.dock, refresh every 60s and when window becomes visible again
cordis.patch.yml Inserts the quota-balance line during installation
locale/*.json Title and description of the plugin in the “Plugins” list
icon.svg Plugin icon, exported by dsh.client.exports in package.json

Related fields in package.json:

"dsh": {
  "bundle": { "patch": "./cordis.patch.yml" },
  "client": {
    "platform": "web",
    "immediately": true,
    "inject": ["@deepseek-ai/dsh-client-ui-conversation"]
  }
}

inject declares the host modules the client depends on. immediately being true means it loads with the client.

Interface and Local Data

Internal plugin interface:

GET /plugin/quota-balance/status
{"ok":true,"wallets":[{"currency":"CNY","balance":"5.40"},...],"normal":[...],"bonus":[...],"links":{"usageUrl":"...","topUpUrl":"..."},"fetchedAt":1793627086526}
{"ok":false,"reason":"unavailable"|"signed-out"|"failed"}

The balance is only exposed on a local loopback address, and the response does not carry CORS headers, so the web page cannot read it cross-origin. You can rest assured with this restriction: the balance won’t be sent to other sites just because you installed this plugin.

Typical Usage: How to make changes take effect

  • Modify client.js: The page will hot update after saving, and the README notes this plugin takes effect immediately upon testing.
  • Modify index.js: Disable and enable this plugin in the plugin management to reload the Host module; no need to restart the app (tested); then click “Refresh” in the card to fetch new data.

Relationship with Wallpaper Engine

The approach here is worth mentioning separately: The wallpaper engine does not provide a set of “overlay styles” for the plugin, but instead locally rewrites the host’s own surface token into a glass recipe, with --dsw-alias-bg-layer-*, --dsw-alias-bg-overlay, and --dsw-alias-border-* all remapped. The official overlays (Token Usage, Session Stats) read these tokens, so this plugin reads the same host token directly, rather than copying the wallpaper plugin’s parameters:

Purpose Value
Panel Background Color var(--dsw-alias-bg-overlay, #26272b)
Glass Effect backdrop-filter: blur(var(--we-blur, 13px)) saturate(var(--we-saturate, 1.3))
Border --dsw-alias-border-l2
Text --dsw-alias-label-primary/secondary/tertiary
Accent Color (Go Recharge) var(--we-accent, var(--dsw-alias-brand-primary, #7db3ff))

The README records two tricky values: --dsw-alias-bg-base is transparent under the wallpaper engine, and the alpha of --dsw-alias-border-l1 is 0, using these two to lay the background won’t get the expected effect; solid colors like --we-panel-color will become opaque boards.

Another idea worth copying: injecting styles into <style id="quota-balance-css">. When hot updating, the old node is still on the page, so injectPanelCss() must override textContent, not return immediately upon finding the node. The stylesheet was previously only injected when the overlay is first expanded, causing the badge to have no style after refreshing the page. Now it is changed to call injectPanelCss() first inside ctx.slots.inject(...).

Applicable Scenarios and Notes

Suitable for these types of people:

  • Developers who run sessions on the desktop version and need to calculate consumption while watching.
  • People with bonus credits in their account who want to see sub-items for Normal Balance and Bonus Credit.
  • People already using dsh-plugin-wallpaper-engine who want the overlay style to automatically follow the theme and wallpaper.

A few notes:

  • The plugin runs with the permissions of the current DSH process and can read the balance of the logged-in account. It is recommended to open index.js and client.js before installing to understand clearly, then enable it after agreeing. The license is MIT, author is dxxo77.
  • Balance data is only exposed locally via loopback and has no CORS headers, so local scripts or browser console can theoretically read it, but cross-origin retrieval outside the page is impossible. If this matters, confirm this boundary fits your expectations before installing.
  • Depends on two host conditions: DSH desktop version (Host has deepseekAccount service) and a logged-in DeepSeek account. When only the client side is installed and these conditions are not met, the plugin will not display anything (if not logged in or read failure, it is hidden entirely, without errors or occupying space).
  • This plugin is not officially produced, and the market item listed in the README is also submitted to the community-maintained awesome-dsh-plugin repository. The site and market will read it in automatically, and there is no official affiliation with DeepSeek / HF.

Finally, a review: It does a very narrow thing, moving the balance from the web account page to the usage row, and incidentally reuses the host’s surface token to let the overlay follow the wallpaper engine. If you have been using the desktop version for a long time, this is a low-cost information completion.

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

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

Xiaoye