Skip to content

vinyumao/dsh-opencode-usage

30Last commit Aug 15, 2026

dsh-opencode-usage DSH plugin

This plugin adds a persistent badge under the DSH composer showing rolling, weekly, and monthly usage percentages for OpenCode Go plans. Clicking the badge expands a card with progress bars, reset countdowns, and a config form. It also registers the `opencode_go_usage` tool for agents to query usage directly.

How to install the dsh-opencode-usage DSH plugin

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

This source command needs manual review. Copying does not run it.

dsh-opencode-usage DSH plugin data source

dsh-opencode-usage DSH plugin snapshot date: Aug 16, 2026

discovered

What the dsh-opencode-usage DSH plugin can do

  • Persistent badge under composer showing rolling/weekly/monthly usage percentages
  • Click to expand card with progress bars and per-second reset countdowns
  • Config form to set API key, base URL, refresh interval, and web usage URL
  • Bilingual UI (English/Chinese) following global DSH locale
  • Key reuse: defaults to OPENCODE_GO_API_KEY environment variable for zero configuration
  • Agent tool `opencode_go_usage` returns usage and reset times for all three windows
  • API key never enters browser; proxied via host process loopback routes

Where the dsh-opencode-usage DSH plugin fits

  • Monitor OpenCode Go plan usage directly from the DSH chat interface
  • Quickly check remaining quota before running large model tasks
  • Configure API key and refresh interval without leaving the web GUI
  • Let agents automatically check usage and inform the user about plan limits
  • Track usage trends across rolling, weekly, and monthly windows

Who the dsh-opencode-usage DSH plugin is for

  • DSH users with an OpenCode Go subscription plan
  • Developers who want to monitor OpenCode quota usage inside their DSH workspace

dsh-opencode-usage DSH plugin limitations

  • Only works with OpenCode Go plans; does not support OpenCode Zen (pay-as-you-go) balance
  • Badge is visible only when a session is open; hidden when no session is active
  • Usage endpoint is not officially documented and may change shape (parsed defensively)
  • Config form key input has append/overwrite semantics: empty key keeps current key, cannot fall back to env var via form alone
  • Requires an OpenCode API key (either from env var or config file)

dsh-opencode-usage DSH plugin: from the repository README

Quoted from the vinyumao/dsh-opencode-usage README, the upstream source of the dsh-opencode-usage DSH plugin. Copyright remains with the original authors.

Official DSH bundle plugin. Install with one command: ``` dsh plugin --profile web add github:vinyumao/dsh-opencode-usage#<ref> ``` **English** | [中文](README.zh.md) ## Capability surface | Tool | Description | | --- | --- | | `opencode_go_usage` | Query OpenCode Go plan balance in chat: used percent + reset countdown for the three windows (no arguments) | | UI capability | Description | | --- | --- | | Persistent badge | One line under the composer input: `OpenCode Go:滚动用量 0% · 每周用量 0% · 每月用量 0%`, auto-refreshing on a configurable interval | | Usage card | Click the badge to expand: progress bars for the three windows + used percent + per-second reset countdown + instant refresh + an `opencode` link that opens the web usage dashboard in a new tab | | Config form | Fill in API key / Base URL / refresh interval / web usage URL right in the card; saved immediately | | Bilingual UI | 中文 / English — every string follows the global DSH locale (Settings → General → Language), and the card footer has a built-in 中文 / English toggle that switches the whole GUI | | Key reuse | API key defaults to the `OPENCODE_GO_API_KEY` environment variable — the same one the DSH opencode-go model prov

Read the full READMERepository license: MIT

dsh-opencode-usage DSH plugin questions

How do I install the OpenCode usage plugin?

Run the command `dsh plugin --profile web add github:vinyumao/dsh-opencode-usage#<ref>` from your terminal, where `<ref>` is a commit SHA or tag. Then restart the `dsh web` process. The badge will appear under the composer. For detailed steps, see the Installation section in the README.

Why does the badge show 'query failed'?

This usually means the API key is missing or invalid. First, check that the `OPENCODE_GO_API_KEY` environment variable is set correctly. You can also click the badge to open the config card and manually enter the API key. The key is stored in `~/.dsh/dsh-opencode-usage.json`. If the problem persists, verify that your OpenCode Go subscription is active and that the endpoint is reachable.

Does this plugin work with OpenCode Zen?

No, this plugin is specifically for OpenCode Go plans. OpenCode Zen uses a different pay-as-you-go billing model and does not have a public API endpoint for balance queries. The plugin's README mentions that if a Zen balance API becomes available, support could be added via a `plan` option.

How do I uninstall the plugin?

Use the command `dsh plugin --profile web remove @chen-001/dsh-opencode-usage`. Then restart `dsh web`. The badge and agent tool will be removed. Optionally, delete the config file `~/.dsh/dsh-opencode-usage.json` if you no longer need it. For manual removal, see the Uninstall section in the README.

Can I configure the refresh interval for the badge?

Yes, you can set the `refreshSeconds` option in the config card or in the `~/.dsh/dsh-opencode-usage.json` file. The default is 300 seconds (5 minutes), with a minimum of 10 seconds. Changes take effect immediately after saving.