Introduction

If you are building Web-based agent workflows using DeepSeek Harness (DSH) and using multiple OpenCode Go API keys simultaneously, a specific issue is: the rolling, weekly, and monthly quota consumption and reset times for these keys are usually scattered in the API responses and are not easy to compare directly on the page.

The DSH plugin dsh-opencode-go-usage solves this viewing problem: as a web plugin, it displays the subscription usage of each OpenCode Go API key on the DSH web page, providing progress, percentages, reset countdowns, and rate limit flags via a floating widget and expandable panel. Below, we first introduce its positioning, followed by installation, configuration, and running check steps.

Project Positioning

This is a DeepSeek Harness web plugin for real-time display of subscription usage for each OpenCode Go API key.

  • Package name: @xiaweiliang060035/dsh-opencode-go-usage
  • Version: 0.3.0
  • License: MIT
  • GitHub Repository: https://github.com/xiaweiliang060035/dsh-opencode-go-usage

It is aimed at developers who are already using a DSH web profile and need to observe OpenCode Go quota status.

Core Features

Floating Widget

The widget is fixed on the right side of the page. The button badge displays the worst window status among all keys, using green, orange, and red to indicate proximity to the quota limit.

Expandable Panel

After clicking the floating button to open the panel, each key is displayed on a card. The currently active key is marked with . The card displays:

  • rolling / weekly / monthly progress bars
  • percentages
  • reset countdowns
  • rate limit window markers

Real-time Refresh

The Host polls the official usage endpoint every 60 seconds, and the polling interval is configurable. The panel refreshes automatically and also supports manual refresh.

Automatic Key Pool Discovery

The plugin reads OPENCODE_GO_KEY_<name> entries from $DSH_HOME/.credentials.yaml, without hardcoding the number or names of keys. If there is no key pool, it falls back to OPENCODE_GO_API_KEY.

Internationalization and Theming

The plugin supports Chinese and English and automatically selects based on the browser language. It uses DSH theme tokens and is compatible with both light and dark themes.

How It Works

The plugin contains both Host half and Client half.

The Host is responsible for:

  1. Discovering the key pool from configuration or .credentials.yaml.
  2. Parsing keys via DSH credentials capability.
  3. Calling the official usage endpoint:
GET https://opencode.ai/zen/go/v1/usage
Authorization: Bearer <API_KEY>

The Client is responsible for:

  • Registering to the shell.overlay slot
  • Polling the Host route /plugins/dsh-opencode-go-usage/snapshot
  • Rendering the floating widget and panel in the page

API keys do not leave the Host.

The README notes that this usage endpoint is not yet listed in the OpenCode public documentation, so the plugin uses a defensive approach for response parsing.

Installation and Enablement

Prerequisites

Node.js and a DeepSeek Harness web profile are required. The default dsh web profile mounts webServer, credentials, and timer, which are the capabilities this plugin requires.

peerDependencies include:

{
  "react": "^18.2.0",
  "@deepseek-ai/cordis": "^4.0.1",
  "@deepseek-ai/dsh-credentials": "^0.1.0-rc.6",
  "@deepseek-ai/dsh-home-paths": "^0.1.0-rc.6"
}

npm Installation

First, enter your DSH web profile directory, then install the package:

cd $DSH_HOME/profiles/web
pnpm add @xiaweiliang060035/dsh-opencode-go-usage

Then add "@xiaweiliang060035/dsh-opencode-go-usage" to the profile’s dsh.profile.bundles list and restart dsh web.

Local Package Installation

If you are using a package from a local directory, you can first copy it to the disk:

D:/tools/dsh-opencode-go-usage

Then add it to the dependencies in the profile’s package.json:

"@xiaweiliang060035/dsh-opencode-go-usage": "file:D:/tools/dsh-opencode-go-usage"

Next, add "dsh-opencode-go-usage" to dsh.profile.bundles, run the installation, and restart:

cd $DSH_HOME/profiles/web
pnpm install

Finally, restart dsh web.

Note: The plugin contains both Host half and Client half. Simply copying it to plugins/ and only loading the Host half is not enough to render the floating widget.

Configuration

In the plugin’s config row in the profile’s cordis.patch.yml, you can configure the following fields:

- id: opencode-go-usage
  config:
    keyNames: [go1, go2]
    baseUrl: https://opencode.ai/zen/go/v1/usage
    refreshMs: 60000
    timeoutMs: 15000
    dshHome: ~
    hideCordisPanel: true

These configuration items are used for:

  • keyNames: Specifies the key pool names, corresponding to OPENCODE_GO_KEY_<name> in .credentials.yaml
  • baseUrl: Specifies the usage endpoint
  • refreshMs: Host polling interval, in milliseconds
  • timeoutMs: Request timeout, in milliseconds
  • dshHome: Specifies the DSH home directory containing .credentials.yaml
  • hideCordisPanel: Hides the built-in Cordis plugins panel entry

Key Pool Configuration

Keys are read from $DSH_HOME/.credentials.yaml. A key pool can be written as:

OPENCODE_GO_API_KEY: sk-opencode-...
OPENCODE_GO_KEY_ACTIVE: go2
OPENCODE_GO_KEY_go1: sk-opencode-...
OPENCODE_GO_KEY_go2: sk-opencode-...
OPENCODE_GO_KEY_go3: sk-opencode-...

Any OPENCODE_GO_KEY_<name> entry will be discovered automatically; the number and names of keys do not need to be fixed. If only one key is configured, you can only set OPENCODE_GO_API_KEY, and the component will display this single key.

Runtime Check

After running dsh web, the client retrieves the snapshot via the following route:

/plugins/dsh-opencode-go-usage/snapshot

If the widget displays !, first confirm two things:

  1. dsh web is running.
  2. The above /plugins/dsh-opencode-go-usage/snapshot route is accessible.

Use Cases and Notes

This plugin is suitable for developers who are already using OpenCode Go in a DSH web profile and need to view the quota status of multiple API keys simultaneously. It works around the OpenCode Go usage endpoint and the DSH credentials file.

The DSH plugin ecosystem emphasizes “everything is a plugin”. The relevant plugin directory is an independent site and should not be understood as the official app store of DeepSeek or Fantom.

The plugin runs with the permissions of the current dsh process, will read the credentials specified in the configuration and access network endpoints. Before installation, it is recommended to check the source code, license, and peerDependencies to confirm they are compatible with your DSH environment.

Links

  • GitHub Repository: https://github.com/xiaweiliang060035/dsh-opencode-go-usage