The core philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” In agent development, managing multiple API providers simultaneously is a common requirement. When the balances of DeepSeek and OpenRouter run low, developers may need to switch between sessions frequently to check them. The dsh-account-balance plugin provides a persistent balance chip in the session header, solving this pain point.

The plugin is maintained by 305037991x-pixel and aims to provide the DSH Web client with a way to monitor DeepSeek and OpenRouter account balances simultaneously in the conversation header.

Core Features

  • Dual-source display: A single chip displays balances from both accounts, in the format ¥xx.xx · $xx.xx.
  • Hover details: Hovering with the mouse shows detailed breakdowns for both accounts:
  • DeepSeek: total balance, top-up amount, and bonus amount.
  • OpenRouter: available balance (top-up − used), top-up amount, and used amount.
  • Fault tolerance: If one source fails, only that source shows an error marker; the other is unaffected.
  • Auto refresh: Balance data refreshes automatically every 3 minutes and includes a manual refresh button.
  • Session cache: Balance data and timers use a module-level shared cache, so data is not fetched repeatedly when switching sessions.
  • Security isolation: Keys exist only in the host process (.credentials.yaml) and are never accessed by the browser.

Installation and Enablement

1、Install the plugin using the official command:

dsh plugin --profile web add github:305037991x-pixel/dsh-account-balance

2、Restart dsh web and perform a hard refresh in the browser (Ctrl+Shift+R).

3、For local development, use the bundled install-into-dsh.ps1 to register the local source directory with link:, so changes take effect after restarting.

Configuration

Configure API keys in $DSH_HOME/.credentials.yaml (or via environment variables with the same names):

DEEPSEEK_API_KEY: sk-xxx
OPENROUTER1_API_KEY: sk-or-v1-xxx

How It Works

The plugin is split into a host-side and a client-side, each handling its own responsibilities:

  • Host (lib/index.js):
  • Registers two GET endpoints: /dsh-account-balance (DeepSeek) and /dsh-account-balance/openrouter.
  • Resolves keys from the credential service, calls upstream APIs to retrieve balances, and passes through the response as-is.

  • Client (lib/client.js):

  • Registers the chip component in the conversation.session.header.utilities slot.
  • Manages module-level shared data caches and the 3-minute timer for both accounts.

Balance data sources are:
- DeepSeek API: Get User Balance
- OpenRouter API: Get Credits (total_credits − total_usage = available)

Compatibility and Notes

  • Core decoupling: The plugin declares all @deepseek-ai/dsh-* core packages as optional peerDependencies, does not bundle copies of the core packages, and uses the core instance currently running in the host at runtime. Upgrading the DSH core does not require reinstalling this plugin.
  • Version requirements: The core version range relied on by the plugin must satisfy >=0.1.0-rc.6 <0.2.0.
  • Security notes: The plugin runs with DSH process privileges, and keys are not exposed to the browser. Do not add core packages to dependencies and pin their versions, to avoid shadowing the host’s core packages and causing load failures.

Summary

dsh-account-balance is a lightweight plugin, suitable for developers who need to monitor DeepSeek and OpenRouter balances simultaneously in DeepSeek Harness. It uses a persistent chip and automatic refresh to reduce the operational cost caused by context switching.