Introduction

The plugin philosophy of DSH is “everything is a plugin”. If you already have an OpenCode GO subscription and wish to see rolling 5h, weekly, and monthly quotas in DSH web sessions, dsh-opencode-go-usage can integrate this information into the sidebar and chat commands.

What is this

dsh-opencode-go-usage is a DSH plugin maintained by yumusb under the MIT license. It provides three things: an OpenCode GO plan quota widget in the DSH web sidebar, a same-origin usage proxy, and a /opencode-go chat command.

It is compatible with DSH 0.1.1-rc.2 and 0.1.2-alpha.2.

Core Features

  1. The sidebar widget is fixed at the bottom of the DSH web sidebar, using the sidebar.footer.action slot to display three usage bars (rolling 5h, weekly, monthly) and the corresponding relative countdown for window resets.

  2. When the sidebar is collapsed, the widget shrinks into a compact percentage badge.

  3. The /opencode-go command can print the same set of usage numbers in text form in any session.

  4. The plugin registers a same-origin proxy route GET /opencode-go/usage, which forwards the API key carried by the host to the official GO gateway; the API key does not enter the browser.

  5. The host side caches upstream usage calls for 30s; the browser side polls the same same-origin route every 60s.

Prerequisites

  • DSH is installed, and the web profile has been started at least once, so ~/.dsh/profiles/web exists.
  • Node.js >= 18 (for fetch).
  • Possess an OpenCode GO subscription and its API key.

Installation and Enabling

First, install to the web profile:

dsh plugin --profile web add dsh-opencode-go-usage

Then, save the GO API key as a DSH credential. You can write it to ~/.dsh/.credentials.yaml:

OPENCODE_GO_API_KEY: <Your API key>

Finally, restart dsh web and force refresh the page in the browser.

Typical Usage

Widget: Read the three progress bars and reset countdown when the sidebar is expanded; look at the percentage badge when the sidebar is collapsed.

Chat command: In any session, enter:

/opencode-go

It will output the textual usage for the three rolling (5h), weekly, and monthly windows.

Configuration Options

Config Default Description
apiKeyEnv OPENCODE_GO_API_KEY Name of the credential / environment variable corresponding to the API key
baseUrl https://opencode.ai/zen/go gateway base URL
cacheMs 30000 TTL for upstream cache on host side

Use Cases and Notes

Suitable for developers who already have an OpenCode GO subscription, use the DSH web plugin ecosystem, and want to view quotas in the sidebar or sessions.

The plugin runs with the permissions of the current dsh process. It is recommended to check the source code and MIT license before installing. Requires Node.js >= 18, the DSH web profile to be available, and a valid OpenCode GO API key.

Related Links

  • Directory: https://www.skillhub.cn/plugins/yumusb/dsh-opencode-go-usage
  • GitHub: https://github.com/yumusb/dsh-opencode-go-usage