markzhang12345/dsh-opencode-go-usage ↗★ 1

dsh-opencode-go-usage

DeepSeek Harness web plugin: live OpenCode Go usage readout in the chat composer dock band 核心用途是在聊天输入框底部区域实时显示 OpenCode Go 的周/月用量百分比及滚动时间,每 60 秒刷新。适合使用 OpenCode Go 供应商并需要密切关注额度消耗的用户。

Package
dsh-opencode-go-usage
Compatibility
Unverified
Harness peer range
^0.1.0-rc.6
Cordis peer range
^4.0.1
Version
0.1.0
License
MIT
Last updated
Aug 17, 2026

Other repositories with this package name

Install

This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗

dsh-opencode-go-usage

English | 中文

A DeepSeek Harness web plugin that shows your OpenCode Go coding-plan usage as a live, number-only readout in the chat composer dock — OpenCode Go 5h 39% Weekly 15% Monthly 13% — refreshed every 60 seconds. It auto-enables only while the current default model provider is opencode-go, and hides otherwise.

Features

  • Live readout in the chat composer dock band (conversation.composer.dock): 5h rolling / weekly / monthly percentages with reset times on hover
  • Refreshes every 60s
  • Auto-enabled only when the current model provider is opencode-go
  • Also usable in conversation: ask "查一下 opencode go 用量" to get the numbers directly
  • No progress bars, plain numbers only

Install

In your dsh profile (here web):

dsh plugin --profile web add 

Add the plugin row to your profile's patch layer ($DSH_HOME/profiles/web/cordis.patch.yml):

- insert:
    - id: opencode-go-usage
      name: 'dsh-opencode-go-usage'

Restart dsh web so the host half and the served client bundle are picked up.

Configuration

Host-side tunables live on the plugin row in cordis.yml:

- id: opencode-go-usage
  name: dsh-opencode-go-usage
  config:
    baseUrl: https://opencode.ai/zen/go/v1/usage   # default
    timeoutMs: 15000                                # default
KeyDefaultMeaning
baseUrlhttps://opencode.ai/zen/go/v1/usageThe usage endpoint.
timeoutMs15000Fetch timeout in milliseconds.

The usage endpoint

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

`` is the Anthropic-compatible OpenCode Go key (sk-opencode-…). The endpoint returns:

{
  "usage": {
    "rolling": { "status": "ok", "percent": 39, "resetsAt": "2026-08-17T12:30:33.430Z" },
    "weekly":  { "status": "ok", "percent": 15, "resetsAt": "2026-08-24T00:00:00.430Z" },
    "monthly": { "status": "ok", "percent": 13, "resetsAt": "2026-09-01T04:14:25.430Z" }
  }
}

percent is 0–100; resetsAt is ISO-8601. The endpoint is not yet in OpenCode's public docs.

API key resolution order

  1. DSH credentials seam / environment OPENCODE_GO_API_KEY — also what the models page fills in (deriveKeyRef("opencode-go")), so no extra setup is needed when opencode-go is added under Settings → Models.
  2. OpenCode ~/.local/share/opencode/auth.json → the opencode-go entry (fallback opencode) with type: "api".

How it works

A dual-face plugin. The host half publishes the opencodeUsage Typert Remote service; the client bundle mounts it and renders the dock readout over the /api RPC carrier.

FileRole
index.jsHost half — OpencodeUsageGateway (TypertRemoteService, service key opencodeUsage)
typert.host.jsHand-written Typert host manifest, registered via exports["./typert"]
client.jsBrowser bundle in window.__ModuleLoader__.load format — mounts the Remote, registers the dock entry, renders the readout

Development

The plugin is plain ESM, no build step. Host files import @deepseek-ai/* peers; the client bundle is hand-written in the lazy-CJS format the harness client loader serves under /plugins.

Known limitations

  • The usage endpoint is undocumented and may change; parsing is defensive and non-200 responses surface as a friendly status rather than a crash.
  • Quota limits / reset times come from the response; endpoint drift is handled gracefully.
  • The dock widget is hidden entirely while the current provider is not opencode-go (no placeholder line).

License

MIT

Configuration

Host-side tunables live on the plugin row in cordis.yml:

- id: opencode-go-usage
  name: dsh-opencode-go-usage
  config:
    baseUrl: https://opencode.ai/zen/go/v1/usage   # default
    timeoutMs: 15000                                # default
KeyDefaultMeaning
baseUrlhttps://opencode.ai/zen/go/v1/usageThe usage endpoint.
timeoutMs15000Fetch timeout in milliseconds.

The usage endpoint

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

`` is the Anthropic-compatible OpenCode Go key (sk-opencode-…). The endpoint returns:

{
  "usage": {
    "rolling": { "status": "ok", "percent": 39, "resetsAt": "2026-08-17T12:30:33.430Z" },
    "weekly":  { "status": "ok", "percent": 15, "resetsAt": "2026-08-24T00:00:00.430Z" },
    "monthly": { "status": "ok", "percent": 13, "resetsAt": "2026-09-01T04:14:25.430Z" }
  }
}

percent is 0–100; resetsAt is ISO-8601. The endpoint is not yet in OpenCode's public docs.