DeepSeek Harness Plugin: Sidebar Balance Monitoring

When developing or testing with the DeepSeek API locally, checking the remaining balance is a common requirement. Opening a webpage or using the command line to check is not intuitive enough. The dsh-balance plugin adds an entry point at the bottom of the DeepSeek Harness (DSH) sidebar, displaying balance information directly in the interface, right next to the “Settings” button.

Plugin Introduction

dsh-balance is a micro-plugin maintained by etony668. It utilizes the sidebar.footer.action registration slot provided by DSH to display the balance at the bottom of the sidebar, alongside the settings button. The plugin automatically reads the locally stored API key, queries the official endpoint, and displays the cached results on the frontend.

Core Features

  • Location & Layout: Registers sidebar.footer.action, placing it immediately next to the settings button. When the sidebar is collapsed to 56px, only a dot icon is displayed to maintain a clean layout.
  • Real-time Data: Reads DEEPSEEK_API_KEY from DSH local credentials (~/.dsh/.credentials.yaml) and sends requests to api.deepseek.com/user/balance. Data is cached for 60 seconds to reduce unnecessary network requests.
  • Balance Alerts: When the available balance falls below a threshold (default ¥2), it displays with a red style and a warning marker.
  • Interaction Details: Hovering over the icon allows you to view recharge/gift details, currency units, and the last update time; clicking the icon manually refreshes the data.
  • Theme Adaptation: Supports Chinese/English switching and automatically adjusts the display based on DSH’s theme configuration (light/dark).
  • Local-First: The API key is read only locally, and balance data is transferred only between the frontend and the DSH backend. It is not written to disk or uploaded elsewhere.

Installation & Enablement

Installation Steps

It is recommended to install via the DSH plugin manager. Do not manually edit the profile’s package.json to add dependencies, as this may cause the plugin manager to refuse updates.

Method 1: Install via Command Line (Recommended)

dsh plugin --profile web add @etony668/dsh-balance

Method 2: Install by Cloning from GitHub

git clone https://github.com/etony668/dsh-balance.git
cd dsh-balance
./install.sh

Enablement & Configuration

After installation, refresh the DSH page (or restart DSH), and the balance entry will appear at the bottom of the sidebar. Ensure that DEEPSEEK_API_KEY is configured in Settings → Models, otherwise it will display “Balance unavailable — API key not found”.

Notes

  • Do Not Manually Edit Dependencies: If you have previously added this plugin by manually editing package.json, please delete the handwritten entry first and then reinstall via the command above. The plugin manager will automatically write the correct dependency configuration.
  • Key Security: The key is read by DSH from the local machine, and the balance is transmitted only between the DSH backend and the browser; it is not recorded on disk.

Summary

dsh-balance is a lightweight, local-first balance monitoring tool. By viewing the balance directly in the sidebar, you can manage API usage more efficiently.

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

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

Xiaoye