Introduction

The plugin architecture of DSH allows for extending persistent capabilities within dsh web. For developers using the DeepSeek API and OpenCodeGo (opencode.ai Go plan), balance and quota are daily metrics that need verification. dsh-balance integrates these two pieces of information into the dsh web GUI: a persistent badge in the bottom-left corner, clickable to view details, with Key management available in the settings page.

What is This

  • Repository: linshule/dsh-balance
  • Maintainer: linshule
  • License: MIT
  • Purpose: A persistent plugin for the dsh web GUI that simultaneously displays the DeepSeek API account balance and the OpenCodeGo plan quota.

Core Features

Persistent Badge

A floating, draggable, dual-segment badge in the bottom-left corner that simultaneously displays the DeepSeek account balance and the OpenCodeGo plan quota. Its position is remembered after being moved and saved in the browser’s localStorage as dsh-balance.pos.

Details Layer

Clicking the badge expands a layer to view the DeepSeek balance details, OpenCodeGo three-window progress bars, and reset time. Within this layer, you can save or clear Keys on the spot and refresh the data immediately.

Settings Page

Provides two independent settings pages:

  • Settings → DeepSeek Balance
  • Settings → OpenCodeGo Quota

Key Management

The DeepSeek API Key is persisted to ~/.dsh/ds-balance.json with 0600 permissions, readable only by the local machine.

The OpenCodeGo Key can be left blank; by default, it reads the DSH credentials automatically. You can also specify a separate Key in the settings page to override it.

Auto-Refresh

The plugin automatically refreshes the balance and quota at set intervals during its lifetime. The default interval is 1 minute, and the refresh interval is remembered across restarts. This state is saved in the browser’s local storage as dsh-balance.intervalMs.

Network Retry

In case of network instability, it uses curl with HTTP/1.1 and automatically retries.

Installation and Enablement

First, install the plugin, then restart dsh web for it to take effect.

Install from the GitHub repository:

dsh plugin --profile web add github:linshule/dsh-balance

Install via local link, suitable for development mode:

git clone https://github.com/linshule/dsh-balance.git <profile>/plugins/ds-balance
dsh plugin --profile web add link:./plugins/dsh-balance

The documentation also lists an npm package installation command:

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

This method is noted in the documentation as “available after release” and no confirmed release is provided; therefore, this article does not consider it a definitive installation method.

Typical Usage

  1. After restarting dsh web, click the badge in the bottom-left corner, or go to Settings → DeepSeek Balance.

  2. Paste your DeepSeek API Key (in the format sk-...) and save it. This Key will be persisted to ~/.dsh/ds-balance.json and does not need to be re-entered after a restart.

  3. If you are using OpenCodeGo and the default provider is opencode-go, you can leave the OpenCodeGo Key blank; the plugin will by default read the OPENCODE_GO_API_KEY from ~/.dsh/.credentials.yaml. You can also specify a separate Key in the settings page to override it.

  4. Drag the badge to adjust its position; it will be automatically remembered when you release it.

  5. Click “Refresh Now” within the badge’s layer to re-query the current balance and quota.

Security and Notes

The plugin runs with the permissions of the current dsh process. Before installation, you should review the source code and the MIT license.

Verified security restrictions from the documentation include:

  • All /api/ds-balance/* routes are only accessible via loopback addresses, i.e., 127.0.0.1 / localhost.
  • Non-loopback addresses receive a 403 response.
  • Request bodies are ≤ 16 KiB.
  • Requests with sec-fetch-site: cross-site are rejected.
  • The DeepSeek API Key is persisted with 0600 permissions at ~/.dsh/ds-balance.json, readable only locally.

The browser’s local state includes the badge position dsh-balance.pos and the refresh interval dsh-balance.intervalMs. Clearing localStorage will lose this state.

Conclusion

dsh-balance brings the DeepSeek balance and OpenCodeGo quota into the persistent interface of dsh web, reducing the need to switch between the settings page and external pages. The documentation does not provide a directory page URL, and this article does not speculate; the repository address is:

https://github.com/linshule/dsh-balance