Introduction

When running sessions with OpenCode Go in DeepSeek Harness (DSH), it’s often necessary to switch to the opencode.ai usage page in a browser to see details like remaining quota, cost per request, and breakdown by model. DSH’s own event stream can reflect local session activity, but it doesn’t provide the same view as the official account-level details or rolling quotas.

Here we introduce the community plugin xenia0922/dsh-opencode-go-usage: a draggable, resizable floating panel that sits in the bottom-right corner of the DSH desktop, combining the official usage.list data and DSH session analysis in one place.

What It Is

dsh-opencode-go-usage is published by maintainer Xenia0922, categorized as a client-side plugin. Its current version is v1.7.1, licensed under MIT, and supports Windows, macOS, and Linux.

The core problem it solves is providing direct access within the DSH workspace to OpenCode Go’s account-level usage, quota, cost per request, and local statistics aggregated by DSH session, model, and date. Data is processed locally; network requests are only sent to opencode.ai and to a public GitHub package.json for version checks. No API keys, cookies, or usage data are sent to third parties.

Core Features

Official Account-Level Usage

Reads the official usage.list, uses official per-request costs, and supports cross-device data. Credentials are provided via authCookie and workspaceId in the local configuration.

DSH Session Analysis

Only counts events where source.provider == "opencode-go"; other providers like direct deepseek connections are excluded. The plugin calculates cache token increments from adjacent events to avoid double-counting. Costs are first estimated using built-in model prices and then matched against official per-request records when possible.

Quota Monitoring

Displays rolling 5-hour, weekly, and monthly quotas, reset times, and consumption speed predictions. Supports automatic discovery of OPENCODE_GO_KEY_* from $DSH_HOME/.credentials.yaml, allowing key switching and rate limit status prompts.

Interactive Panel & Data Analysis

The FAB (Floating Action Button) is draggable. The panel supports title bar dragging, edge resizing, and maximization, with position and size saved to browser localStorage. You can view trends (7/14/30 days) by model ranking and cost breakdown, see recent sessions, and export to CSV. The interface supports Chinese and English, switchable manually or following DSH’s global language setting.

Installation & Enablement

The plugin runs with the current DSH process permissions. It’s recommended to review the source code and MIT License before installation.

Execute in the parent directory of the plugin repository:

git clone https://github.com/Xenia0922/dsh-opencode-go-usage.git
dsh plugin --profile my-profile add ./dsh-opencode-go-usage
dsh --profile my-profile

In bundle mode, the plugin starts with the DSH profile and registers routes /ocgo-usage/fetch, /ocgo-usage/config, /ocgo-usage/retry via a local webServer. If the plugin directory path contains spaces causing dsh plugin add to fail, move it to a path without spaces or use a junction/link to a space-free directory.

Quick Try: Dynamic Loading

Dynamic loading doesn’t require a build but only works for the current DSH session:

  1. In a DSH session, have the Agent execute cordis_define with kind: new and idPrefix: zenus.
  2. Paste the content of src/host.js into code.host.
  3. Paste the content of src/client.js into code.client.
  4. Execute cordis_run and authorize.

Dynamic definitions disappear after DSH restarts; for long-term use, use bundle mode.

Typical Usage

First-Time Official View Configuration

After installation, an OpenCode Go FAB appears in the bottom-right corner. The official view requires a one-time manual credential setup:

  1. Open the usage page on opencode.ai in a regular browser and confirm you’re logged in.
  2. Press F12 (or Ctrl+Shift+I) to open Developer Tools, go to Application → Storage → Cookies → https://opencode.ai.
  3. Find the cookie named auth, copy only the Value (without the auth= prefix or the entire Cookie: header).
  4. From the URL in the address bar, like https://opencode.ai/workspace/wrk_123/usage, copy only wrk_123 as the workspaceId.
  5. Enter these two items into the respective input boxes in the panel and click “Save and Refresh”.

Configuration is saved locally:

~/.config/dsh-opencode-go-usage.json

Once saved, subsequent refreshes don’t require logging in again and don’t depend on launching the browser in debug mode.

Panel Areas and Common Operations

Area Description
Official View Account-level official details, costs from official usage.list
DSH View Current DSH session’s model, costs, trends, and recent sessions
Quota Area Rolling, weekly, monthly quotas, and reset countdown
Model Ranking Sorted by cost; click a row to view token and cost breakdown
Spending Trend Daily costs for the last 7, 14, or 30 days
Recent Sessions DSH session titles, update times, and backfilled official costs

Click the FAB to open or close the panel; drag the title bar to move the panel, drag the right, bottom, or bottom-right edge to resize; double-click the title bar to maximize or restore; buttons on the title bar allow language switching, CSV export, and manual refresh. The initial full fetch of official details usually takes 15–60 seconds, with subsequent incremental updates faster; clicking “Retry Extraction” bypasses the cache and re-fetches.

Use Cases & Notes

Who It’s For: Developers who regularly use OpenCode Go in DSH and need to cross-reference official account details with local session spending.

Data Scope: Official quotas are calculated in usage units; some models may be billed at 2x, which is not the same as the dollar breakdown; the “Official Window vs. Local Details” in the panel is for reference only and not suitable for direct bill reconciliation. Quota APIs use the OpenCode CLI key, while official details rely on cookies and workspace ID—so it’s possible for the quota to load normally but official details to fail. Ensure you’re logged in before clicking “Retry Extraction.”

Current Limitations (listed in README): From v1.7.0 onward, the main flow no longer automatically launches the browser or detects the CDP port; the first use requires manual credential entry. DSH typically takes 10–60 seconds to scan session events for the first time. The official usage.list is an internal API; if the upstream format changes, the plugin may report errors without guaranteeing permanent compatibility.

Troubleshooting: If the official view shows NEED_CONFIG, credentials haven’t been configured. If the plugin disappears after restart, it’s likely due to using dynamic loading without adding it to a profile—confirm you’ve run dsh plugin add. Diagnostic logs can be found at ~/.config/dsh-opencode-go-usage.log (approximately the last 200 lines are retained).

Conclusion

dsh-opencode-go-usage consolidates OpenCode Go’s quota, per-request costs, and DSH session statistics into a draggable floating panel, with data processed locally. If you’re already using DSH’s OpenCode Go integration, you can install it using the bundle method described above and configure official credentials once.