Introduction

If you run tasks in DSH using an OpenCode Go subscription, the usage quotas for the rolling, weekly, and monthly tiers, along with their respective reset times, are scattered across server-side interfaces. To check how much quota remains and when it resets, you have to interrupt your current work to look it up elsewhere.

dsh-opencode-go-usage turns this information into a floating widget that stays in the bottom-right corner of the DSH Web GUI, refreshing every 60 seconds, allowing you to keep track of your usage without leaving the current page.

What is this

dsh-opencode-go-usage is a DSH Web plugin maintained by kkishapppy, currently version 0.1.0, under the MIT license. Its purpose can be summarized in one sentence: to display the rolling/weekly/monthly usage percentages and reset countdowns for the OpenCode Go subscription in real-time in the bottom-right corner of the DSH Web GUI.

It consists of two parts: the server side, which handles proxying the usage interface and storing the API key, and the browser side, which is responsible for rendering the widget.

Core Features

The implemented capabilities are as follows:

  • A floating capsule in the bottom-right corner displays the three-tier usage and reset countdown, formatted like ⓖ Rolling 0% · Weekly 2% (2d 13h) · Monthly 1% (30d 18h)
  • Automatically refreshes every 60 seconds, and immediately refreshes when the window is brought back to the foreground
  • Styles follow the DSH theme, based on --dsw-alias-* tokens, with automatic adaptation for light/dark themes and skins
  • The API key only exists on the server side (parsed via the dsh credential service) and is not stored in the browser

Installation and Activation

Installation requires only one command:

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

Then, add the configuration in profiles/<profile>/cordis.patch.yml:

- id: opencode-go-usage
  config:
    apiKeyEnv: OPENCODE_GO_API_KEY   # Credential name (default OPENCODE_GO_API_KEY)
    cacheMs: 60000                   # Server-side proxy cache in milliseconds

Meaning of the two configuration items:

  1. apiKeyEnv specifies the credential name, defaulting to OPENCODE_GO_API_KEY. The key is parsed via the dsh credential service and can be configured in .credentials.yaml or the GUI Models page, sharing the same origin as llm-pi-ai.

  2. cacheMs controls the cache duration of the server-side proxy, defaulting to 60000 milliseconds.

How it Works

The plugin’s data flow is divided into two stages:

  1. Server-side proxy. The plugin requests GET https://opencode.ai/zen/go/v1/usage on the server side (Bearer sk- authentication, OpenAI-compatible endpoint) and exposes the result as /plugins/dsh-opencode-go-usage/usage with a 60-second cache. The API key only appears on the server side and is inaccessible to the browser.

  2. Browser rendering. The widget is mounted at the top level of document.body using position: fixed, unaffected by container transforms or backdrop-filters, ensuring it always displays in the bottom-right corner.

Development and Build

If you wish to build it yourself:

npm i
npx -y tsdown@0.22.2 --config ./tsdown.config.ts

Changes take effect differently:

  1. Server-side changes require restarting DSH.

  2. Client-side changes take effect with a hard page refresh.

Regarding dependencies, package.json is marked as private: true, with peerDependencies being cordis ^4.0.0-rc.7 and react ^18.2.0. The client inject dependencies are @deepseek-ai/dsh-client-runtime and @deepseek-ai/dsh-client-ui-slots, with platform set to web.

Use Cases and Considerations

This plugin is suitable for developers who use DSH via an OpenCode Go subscription and need to keep track of usage and reset times at any time. If you only call it in sporadic scenarios, a persistent display refreshing every 60 seconds may not be necessary.

Note before installation: The plugin runs with the permissions of the current DSH process, and the API key will be read via the dsh credential service. It is recommended to check the source code and license before installing to ensure everything is correct before enabling.

Conclusion

dsh-opencode-go-usage solves a very specific problem: putting the usage and reset times of the OpenCode Go subscription right in front of you without extra operations. If you have this specific need, give it a try.

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