DeepSeek Harness Plugin: dsh-opencode-usage

Introduction

When developing agents using the DeepSeek Harness (DSH) Web composer with the OpenCode Go service connected, quota exhaustion often occurs without the user’s knowledge. Adding a status indicator to the statistics row below the input box is an effective means of cost management. The dsh-opencode-usage plugin aims to solve this problem by embedding the OpenCode Go quota status into the DSH interface in the lightest way possible.

Plugin Overview

This is a plugin for the DeepSeek Harness Web composer, maintained by ColorlessBoy. Its core function is to display the remaining quota percentage of OpenCode Go in the statistics row below the input box. The plugin requires no configuration; it directly reads the provider settings in llm-pi-ai, fetches quota data via browser same-origin requests, and displays it.

Core Features

The plugin provides the following capabilities:

  1. Quota Display: Shows the remaining percentage in the statistics row below the input box, covering three dimensions: Rolling (5-hour), Weekly, and Monthly.
  2. Zero Configuration: Automatically follows the providers configured in llm-pi-ai, without requiring users to copy keys or manually add settings.
  3. Zero Build: The repository includes the lib/ directory. It runs immediately upon installation via the dsh plugin command, with no build authorization required.
  4. Key Security: Keys are resolved and used only on the host side. The browser only accesses same-origin endpoints, ensuring keys are never exposed to the frontend page.
  5. Smart Display: Display is determined by the provider’s URL. It only appears when the baseURL of the provider associated with the current model points to OpenCode Go. It automatically hides when switching to other providers (e.g., official DeepSeek).
  6. Interaction Details: Clicking the pill expands a detail panel to view the remaining percentage and reset countdown for each tier.

Installation and Activation

The installation process requires no build steps. Using the official plugin command is recommended:

dsh plugin --profile web add github:ColorlessBoy/dsh-opencode-usage

After installation, you must restart the dsh web process and refresh the browser page for the plugin layer to take effect. You can verify that the plugin layer has been merged into the configuration using the following command:

dsh --profile web --dump-config   # A "# == dsh-opencode-usage" layer should appear

Usage

After installation and restart, a new pill will appear in the statistics row below the input box in the Web composer, following the built-in “Context Used” pill. It displays the current OpenCode Go battery icon and remaining percentage.

The interface example is as follows:

10 turns 89 steps · 42 tok/s  │  1.2M · 45% cache hit  │  24%  │  🔋 5h 80% remaining │ Wk 84% │ Mo 42%

Clicking this pill expands a detail panel to view more specific quota information.

Notes

  1. Installation Methods: The plugin supports both bundle installation (recommended) and manual mounting. Do not use both methods simultaneously, as two entries with the same opencode-usage ID will cause composition errors.
  2. Restart Requirement: lib/index.js is held by the Node ESM module cache. You must restart dsh web after modifying host-side code. The browser side supports hot reloading; simply refresh the page after changes.
  3. License: Released under the MIT License.
  4. Behavioral Limitations: The plugin does not take over routing, creates no floating windows, and does not participate in request billing; it is strictly for read-only display.

Technical Details

The plugin adopts a separated Host/Client architecture. The Host side (lib/index.js) is responsible for parsing the provider’s baseURL and apiKeyEnv, sending authenticated requests to the official OpenCode Go API, normalizing the returned “used” percentage to “remaining” percentage, and caching the results (30s on success, 10s on failure). The Client side (lib/client.js) reads the provider corresponding to the current model from the session, polls the same-origin endpoint, and renders the quota as a pill in the dock.

The plugin flattens its own content using display: contents, arranged with flex order: 1 after the “Context Used” pill, ensuring the UI layout remains consistent with native components.

Conclusion

dsh-opencode-usage is a restrained yet practical tool. By reusing existing DSH UI components, it solves the problem of OpenCode Go quota monitoring without adding extra distractions.

  • GitHub Repository: https://github.com/ColorlessBoy/dsh-opencode-usage
  • Official Directory: https://www.skillhub.cn/plugins/ColorlessBoy/dsh-opencode-usage
羽毛球分组比赛记分
小程序二维码

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

Xiaoye