dsh-opencode-quota: View OpenCode Go Quota in the DSH Right Sidebar

Introduction

DeepSeek Harness (DSH) displays the monthly cap and shared quota remaining for each OpenCode Go model in the right sidebar, and allows querying via the opencode_quota tool in chat. Existing approaches either require checking a separate OpenCode console or switching between multiple pages; this plugin integrates quota information into the DSH right sidebar for continuous monitoring.

What It Is

  • Plugin name: dsh-opencode-quota
  • Maintainer: HScoffeeK
  • Category: Client-side
  • Purpose: Displays the monthly cap and shared quota remaining for OpenCode Go in the DSH right sidebar, and provides the opencode_quota tool.

Core Features

  1. Right sidebar “OpenCode Quota” tab: Lists each Go model’s monthly cap, remaining this month, remaining this week, remaining in the current 5-hour window, and input/output/cache pricing (USD/1M tokens). It also registers a card in the right sidebar guide.

  2. Multiple quota entry points:
    - The Quota X% button on the right side of the session title bar opens the right sidebar page;
    - A clickable quota entry displayed below the composer;
    - A quota entry at the bottom of the sidebar. All entry points open the “OpenCode Quota” page in the right sidebar.

  3. opencode_quota tool: Directly ask in chat “how much quota is left” or “which models still have headroom,” and the plugin will return quota information.

  4. Display toggles (Settings → OpenCode Quota Display):
    - Session header entry
    - Below-composer entry
    - Sidebar bottom entry
    - Price rows in the model price table
    Each toggle is saved instantly on the Host. The preferences file is located at $DSH_HOME/cache/dsh-opencode-quota/prefs.json.

  5. Data sources and key handling:
    - Model catalog and monthly caps: GET https://opencode.ai/inference/go/v1/models
    - Shared quota percentage and reset time: GET https://opencode.ai/inference/go/v1/usage
    Keys are auto-discovered in the following order:

  6. apiKeyEnv in the plugin configuration (via the DSH credential service)
  7. Environment variable OPENCODE_API_KEY or OPENCODE_GO_API_KEY
  8. Credential reference from an installed OpenCode Go provider row (e.g., dsh-opencode-go)
  9. Matching credential reference in the combined configuration
  10. OpenCode CLI’s auth.json
    Keys remain on the Host only and are never sent to the browser. Remote error text is redacted.

Installation & Enablement

Install using the official command:

dsh plugin --profile <profile> add github:HScoffeeK/dsh-opencode-quota

Or install from a local directory via “Settings → Plugins → Add plugin.”

After installation, restart the Host or reload the window once (DSH loads client plugins at page startup).

Configuration (Optional)

Add the following YAML to the DSH plugin configuration:

- id: opencode-quota
  name: dsh-opencode-quota
  config:
    apiKeyEnv: DSH_OPENCODE_GO_ACCOUNT_EXAMPLE
    plan: go
    cacheTTLSeconds: 60
Field Default Description
apiKeyEnv unset Credential reference to use when auto-discovery is not desired
baseURL https://opencode.ai/inference/go/v1 Gateway for both read endpoints
plan go Starting plan (Go / Go Plus / Go Teams); a selector is also available on the page
cacheTTLSeconds 60 Snapshot freshness
timeoutMs 8000 Per-request timeout

Typical Usage

  1. View each model’s monthly cap and shared quota remaining in the right sidebar: Click the “OpenCode Quota” tab or any quota entry point.

  2. Ask about quota in chat:

  • Ask: “How much quota is left?”
  • Ask: “Which models still have headroom?”

The plugin will return quota information via the opencode_quota tool.

  1. Adjust display: Go to Settings → OpenCode Quota Display, and toggle the switches to control the visibility of each entry point and price rows.

Use Cases & Notes

  • Suitable for developers and agent developers who need to continuously monitor OpenCode Go quotas within DSH.
  • This plugin only supports viewing OpenCode Go quotas; OpenCode Models (pay-as-you-go credits) do not have a corresponding quota read capability.
  • Shared quota is calculated based on each model’s monthly cap; the 5-hour limit is 20% of the monthly quota, and the weekly limit is 50%, consistent with official OpenCode documentation.
  • The snapshot route is a read-only localhost endpoint, protected by the Host’s request admission mechanism: unauthenticated requests return 401, untrusted origins return 403, and the payload contains only caps and percentages, never keys.
  • The plugin runs with the current DSH process permissions. It is recommended to review the source code and license (MIT) before installing.

In Short

This plugin integrates OpenCode Go’s monthly caps and shared quota remaining into the DSH right sidebar, and provides the opencode_quota tool for continuous quota monitoring during development. For more details and source code, visit:

  • Plugin directory page: https://www.skillhub.cn/plugins/HScoffeeK/dsh-opencode-quota
  • GitHub repository: https://github.com/HScoffeeK/dsh-opencode-quota
羽毛球分组比赛记分
小程序二维码

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

Xiaoye