In the development workflow of DeepSeek Harness (DSH), frequently checking the account balance is a common practice. This often requires switching tabs or opening the official panel, which interrupts the workflow. dsh-balance embeds this data directly into the web interface.

Plugin Overview

dsh-balance is a client-side plugin maintained by ywleeo that displays the DeepSeek account balance at the bottom of the dsh Web conversation. It does not rely on a complex build process; it reads the API Key from environment variables and directly fetches balance data.

Core Features

  • Position and Style: Displays before the token statistics line (conversation.composer.dock, order: -1). The style matches the token statistics (12px / label-tertiary / centered).
  • Data Refreshing: Automatically fetches on page load, then polls every 5 minutes. Click the ⟳ icon next to the number to refresh manually.
  • Time-Slot Coloring: Determines the billing time slot in real time based on Beijing time. Monday through Friday 09:00–12:00 / 14:00–18:00 are peak periods, and the balance is displayed in orange; other times are off-peak periods and displayed in the normal color. Hover to view the current time-slot description.
  • Interaction: Clicking the balance number opens the official balance/usage panel in a new tab.
  • Security and Architecture: The API Key does not leave the local host; it only requests same-origin JSON endpoints via fetch. It does not write session logs, does not register projections, and poses no contamination risk. It uses pure ESM and requires no build.

Installation and Enablement

  1. Go to the dsh Web plugin directory:
    cd ~/.dsh/profiles/web
  1. Install the plugin with pnpm (supports local paths or GitHub repositories):
    pnpm add file:/path/to/dsh-balance   # 或 pnpm add github:ywleeo/dsh-balance
  1. Append the following configuration to the ~/.dsh/profiles/web/cordis.patch.yml file:
    - insert:
        - id: dsh-balance
          name: dsh-balance
  1. Restart dsh web and refresh the browser page.

How It Works

The plugin uses a “Host shell” mechanism to prevent crashes. index.js acts as the shell and does not directly depend on dsh core modules, ensuring that the boot audit passes. It dynamically loads host.js at runtime; host.js is responsible for parsing DEEPSEEK_API_KEY and calling the official API. client.js is responsible for rendering the information in the UI. If host.js fails to load, the plugin is disabled without causing the dsh process to exit.

Use Cases and Notes

Suitable for developers who need to monitor DeepSeek account costs in real time. The plugin is released under the MIT license. It is recommended to review the source code before installation. The plugin runs with the permissions of the current dsh process, and the API Key is transmitted locally only.

Summary

dsh-balance solves the pain point of frequently switching windows during development to check the balance. It displays key information directly at the bottom of the conversation in concise small text and provides time-slot-based visual cues. For more details, refer to the GitHub repository: https://github.com/ywleeo/dsh-balance.