dsh-opencode-usage: Displaying OpenCode Go Package Usage in the DSH Web GUI

Preface

When using the OpenCode Go plan in the DSH web GUI, rolling, weekly, and monthly usage along with reset times need to be checked frequently. dsh-opencode-usage places this query result below the composer input field: a persistent badge displays the usage percentage and reset countdown for the three windows. Clicking the badge expands a card, and an Agent can also query current plan usage through a parameterless tool.

Below, we introduce its features, installation methods, and important notes based on the repository name vinyumao/dsh-opencode-usage.

What This Is

  • Repository: vinyumao/dsh-opencode-usage
  • Maintainer: vinyumao
  • License: MIT
  • Applicable to: DSH web GUI
  • Purpose: Displays the rolling, weekly, and monthly usage percentages and reset countdown for the OpenCode Go plan
  • Plugin form: Installed as a DSH bundle plugin; package.json declares dsh.bundle.patch, and after installation, it enters the dsh.profile.bundles layer of the profile
  • Source form: Pure source code index.mjs / client.js, no build step; the host-side runtime does not import @deepseek-ai/* packages

It targets only the subscription quota windows of the OpenCode Go plan and does not apply to the OpenCode Zen pay-as-you-go balance.

Core Features

Persistent Badge Below the Input Field

The plugin displays a persistent badge below the composer input field in the DSH web GUI, showing:

  • Rolling usage percentage
  • Weekly usage percentage
  • Monthly usage percentage
  • Reset countdown

The badge auto-refreshes at a configurable interval.

Usage Card

Clicking the badge expands the usage card. The card includes:

  • Progress bars for the rolling, weekly, and monthly windows
  • Percentage used for each window
  • Reset countdown that updates every second
  • Immediate refresh button
  • An opencode link that opens the web usage panel in a new tab when clicked

Configuration Form in the Card

The usage card provides a configuration form where you can fill in:

  • API key
  • Base URL
  • Refresh interval
  • Web usage URL

Saving takes effect immediately.

Agent Tool opencode_go_usage

The plugin provides a parameterless Agent tool:

opencode_go_usage

When the Agent calls it, it can query the current balance or usage information for the three windows of the OpenCode Go plan, including the used percentage and reset countdown for the rolling, weekly, and monthly windows.

Localization

The plugin interface supports Chinese and English:

  • Text follows the DSH global language setting
  • The card footer provides a Chinese/English toggle

Request and Key Handling

The browser does not directly request the upstream. The plugin delegates related requests to the host process, using a same-origin route:

/api/dsh-opencode-usage/*

The API key never enters the browser.

The API key is read from the environment variable by default:

OPENCODE_GO_API_KEY

In most cases, it can be used with zero configuration. It can also be overridden in the card configuration form.

Installation and Enablement

Environment Requirements

The plugin requires a Node version that satisfies:

^22.19.0 || >=24.0.0

Installation Command

Run the following command to install the plugin:

dsh plugin --profile web add github:vinyumao/dsh-opencode-usage#<ref>

Here, <ref> can be pinned to a commit SHA for reproducible installation.

After installation, restart dsh web. Once started, the OpenCode Go usage badge should appear below the composer input field.

pnpm Build Permission Issues

If pnpm refuses to run the prepare script of a git dependency, you need to add the package key printed by pnpm to the allowBuilds section of the profile’s pnpm-workspace.yaml, then retry.

Typical Usage

1. Install and Restart

dsh plugin --profile web add github:vinyumao/dsh-opencode-usage#<ref>

After installation, restart dsh web.

2. View the Badge

Open the DSH web GUI and view the OpenCode Go badge below the composer input field. The badge displays the usage percentage and reset countdown for the three windows.

3. Expand the Card

Click the badge to expand the usage card, view progress bars, used percentages, per-second reset countdowns, and click the immediate refresh button.

4. Have the Agent Query

In a conversation, ask the Agent to run the opencode_go_usage tool to get the used percentages and reset countdowns for the rolling, weekly, and monthly windows.

5. Handle Query Failures

If the badge shows query failed, first check whether the following is set:

OPENCODE_GO_API_KEY

If it is not set, you can also click the badge and fill in the API key in the card configuration form.

6. Uninstall

Run the following command to uninstall the plugin:

dsh plugin --profile web remove @chen-001/dsh-opencode-usage

After uninstalling, restart dsh web.

If you no longer install the plugin and have filled in an API key in the card configuration form, you can delete the local configuration file:

rm ~/.dsh/dsh-opencode-usage.json

This file stores the API key, and its permissions are set to 0600.

Applicable Scenarios and Notes

It is suitable for developers who use the OpenCode Go plan in the DSH web GUI over the long term and want to see usage status directly near the input field. It is also suitable for scenarios where the Agent needs to query plan usage on demand during conversations.

Before using, note the following:

  • The plugin runs with the permissions of the current dsh process; review the repository source code and license before installation.
  • The license is MIT.
  • It targets only the OpenCode Go plan and does not apply to the OpenCode Zen pay-as-you-go balance.
  • The usage endpoint is marked as unverified:
GET https://opencode.ai/zen/go/v1/usage

This endpoint is not part of the official public documentation, and its response structure may change, so its long-term stability cannot be confirmed.
- The API key is read from OPENCODE_GO_API_KEY by default and can also be overridden in the card configuration form.
- If you save an API key in the card, the key is stored in plaintext at:

~/.dsh/dsh-opencode-usage.json

You can delete this file when it is no longer used.

Conclusion

dsh-opencode-usage addresses the visibility issue of OpenCode Go plan usage in the DSH web GUI: a persistent badge display, expandable cards with details, and an Agent-callable opencode_go_usage tool. The current materials do not provide a directory page URL; the GitHub address is:

https://github.com/vinyumao/dsh-opencode-usage

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

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

Xiaoye