dsh-opencode-go-usage: OpenCode Go Usage Observability Plugin for DeepSeek Harness

Preface

After integrating OpenCode Go into DeepSeek Harness (DSH), users need to view more than just individual model call results—they also need quota windows, session token usage, cache hit status, and model-level consumption distribution. dsh-opencode-go-usage is a DSH Web-GUI plugin that provides comprehensive usage observability for users integrating OpenCode Go models.

What This Is

dsh-opencode-go-usage is maintained by yascitom and is licensed under MIT. It provides usage observability for DSH users after integrating OpenCode Go models: it adds an OpenCode Go section to the settings sidebar, containing two tabs: “Quota” and “DSH Session Details”.

The Host side provides a Typert Remote opencodeUsage with three methods: usage, dshUsage, and dshSessionMessages. The plugin relies on the standard web bundle combination: api-gateway Client Remote and the settings.section slot.

Core Features

Quota Window

The quota page displays three windows: 5-hour rolling, weekly, and monthly:

  • Used percentage
  • Plan reference limit
  • Reset time

The $12 / $30 / $60 limits are for display reference only and are not returned by the API; they depend on the OpenCode Go plan and may drift.

DSH Session Details

DSH Session Details displays token usage for each session in DeepSeek Harness that uses the opencode-go model, with the ability to drill down to individual model calls.

Single-session drill-down shows the time, model, and token count for each model call; long sessions retain the most recent 400 calls.

Cache Statistics

Cache statistics are displayed at three levels:

  • Session cumulative
  • Single session
  • Single call

The display includes cache reads, cache writes, and calculates the cache hit rate.

Model Filtering

The plugin supports filtering sessions by model group, allowing users to view usage and cache status for each model, along with a model-level summary comparison table.

Bilingual Interface

Built-in Chinese/English text, with one-click language switching that is persisted.

Bottom Bar Persistent Widget

Below the input box, there is a persistent widget line that displays quota in real-time and automatically changes color based on thresholds.

Data Freshness

The quota page and bottom bar widget indicate the last successful update time; on polling failure, the last successful data is retained with an “not updated” indicator.

Diagnostic Section

The diagnostic section displays:

  • HTTP status codes
  • Parsing version
  • Credential source and masked key
  • Snapshots of the last 3 requests

The DSH details will note that “local statistics are for reference only.”

Installation and Enablement

The plugin runs with the current dsh process permissions. Before installation, review the source code and the MIT license.

Install from GitHub:

dsh plugin --profile web add github:yascitom/dsh-opencode-go-box

Install from a local source directory:

dsh plugin --profile web add file:/path/to/dsh-opencode-go-usage

This package declares dsh.bundle.patch; dsh plugin add will automatically reconcile it into dsh.profile.bundles, no need to manually modify cordis.patch.yml.

After installation, restart dsh web for both the Host half and the managed Client bundle to take effect.

Configuration

Host-side tunable items are located at plugin row id: opencode-go-usage. Override in $DSH_HOME/profiles/web/cordis.patch.yml:

- id: opencode-go-usage
  config:
    baseUrl: https://opencode.ai/zen/go/v1/usage
    timeoutMs: 15000
    warnPercent: 60
    dangerPercent: 85
    maxSessions: 30

The overridable configuration items are as follows:

  • baseUrl: Default https://opencode.ai/zen/go/v1/usage
  • timeoutMs: Default 15000
  • warnPercent: Default 60, the widget turns orange when this percentage is reached
  • dangerPercent: Default 85, the widget turns red when this percentage is reached
  • maxSessions: Default 30, the upper limit for the number of recent sessions scanned in DSH session details

Usage API

The usage query API is:

GET https://opencode.ai/zen/go/v1/usage
Authorization: Bearer <API_KEY>

This API returns status, percent, and resetsAt for three windows: rolling, weekly, and monthly.

The usage API has no public documentation and may change; the parsing is defensively handled, and non-200 responses will prompt a friendly status instead of crashing.

Applicable Scenarios and Notes

This plugin is suitable for users who use the opencode-go model in DSH and wish to view quota and session usage within the Web-GUI.

Notes before use:

  • If opencode-go is not added in settings, or if an API key is not found, the plugin will display guidance instructions.
  • The API key resolution chain is: credential references declared in the opencode-go provider configuration, regular references in the DSH credential layer, and OpenCode’s auth.json.
  • DSH session details track token accounting from DSH session logs; they do not include cost amounts and only cover conversations within DeepSeek Harness.
  • Local token statistics may differ from server-side billing; official billing statements take precedence.

Conclusion

dsh-opencode-go-usage brings OpenCode Go’s quota windows, DSH session tokens, cache hit rates, and model-level summaries into a single observability view. GitHub repository: https://github.com/yascitom/dsh-opencode-go-box.

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

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

Xiaoye