Back to home

xiaomao66666

dsh-deepview

DeepSeek Harness plugin: watch your OpenCode Go plan quota (5h rolling / weekly / monthly) right in the web GUI settings

Stars
0
Language
JavaScript
Created
Aug 15, 2026
Updated
Aug 15, 2026

Introduction

dsh-deepview

License: MIT

中文

A DeepSeek Harness web-GUI plugin that adds OpenCode Go and DeepSeek API entries to the Settings sidebar:

  • OpenCode Go — your subscription's three usage windows (5-hour rolling / weekly / monthly) with percent used, spend limit, and reset time.
  • DeepSeek API — your official platform balance (total / topped-up / granted) and availability.

No more tab-hopping to opencode.ai or platform.deepseek.com to check your quota.

Screenshots

OpenCode Go usage page

DeepSeek API balance

Features

  • Settings sidebar sections "OpenCode Go" and "DeepSeek API" (settings.section contributions)
  • Host-side Typert Remote opencodeUsage/usage + opencodeUsage/deepseekBalance read the API keys and call the official endpoints
  • Client pages: usage per-window percent, progress bar, limit, and reset time; balance card per currency with availability badge
  • Precondition checks: if opencode-go is missing from Settings → Models, or an API key is missing, the page shows guidance instead of an error
  • API keys resolved from the DSH credentials seam (OPENCODE_GO_API_KEY / DEEPSEEK_API_KEY) with a fallback to OpenCode's auth.json for the Go key

Install

dsh plugin --profile web add github:xiaomao66666/dsh-deepview

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

- insert:
    - id: deepview
      name: 'dsh-deepview'

Restart dsh web so the host half and the served client bundle pick up the plugin. The plugin needs the standard web bundle composition (the api-gateway client Remote and the settings.section slot) — the default dsh web profile has both.

Configuration

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

- id: deepview
  name: dsh-deepview
  config:
    baseUrl: https://opencode.ai/zen/go/v1/usage          # default
    deepseekBaseUrl: https://api.deepseek.com/user/balance # default
    timeoutMs: 15000                                       # default
KeyDefaultMeaning
baseUrlhttps://opencode.ai/zen/go/v1/usageThe OpenCode Go usage endpoint.
deepseekBaseUrlhttps://api.deepseek.com/user/balanceThe DeepSeek balance endpoint.
timeoutMs15000Fetch timeout in milliseconds.

The usage endpoints

OpenCode Go quota

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

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

{
  "usage": {
    "rolling": { "status": "ok", "percent": 9,  "resetsAt": "2026-08-14T07:20:04.810Z" },
    "weekly":  { "status": "ok", "percent": 12, "resetsAt": "2026-08-17T00:00:00.810Z" },
    "monthly": { "status": "ok", "percent": 6,  "resetsAt": "2026-09-09T00:41:03.810Z" }
  }
}

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

DeepSeek platform balance

GET https://api.deepseek.com/user/balance
Authorization: Bearer <API_KEY>

<API_KEY> is your DeepSeek platform key (sk-…). This is an official, documented endpoint (Get User Balance). It returns:

{
  "is_available": true,
  "balance_infos": [
    {
      "currency": "CNY",
      "total_balance": "110.00",
      "granted_balance": "10.00",
      "topped_up_balance": "100.00"
    }
  ]
}

API key resolution order

  1. DSH credentials seam / environment OPENCODE_GO_API_KEY ($DSH_HOME/.credentials.yaml)
  2. OpenCode ~/.local/share/opencode/auth.json → the opencode-go entry (fallback opencode) with type: "api"

For the DeepSeek panel: DSH credentials seam / environment DEEPSEEK_API_KEY ($DSH_HOME/.credentials.yaml).

Platform support

Works on macOS, Linux, and Windows. The plugin is plain ESM with no native binaries or build step, and both halves (Host and Client) are platform-independent.

PlatformAPI key resolution
macOS / Linux~/.local/share/opencode/auth.json is exactly where the OpenCode CLI stores it — works out of the box
WindowsUse OPENCODE_GO_API_KEY (credentials seam or environment) for best results; an auth.json in the same relative location is also read

Requirements on any platform: Node.js + DeepSeek Harness, and the API keys. The OpenCode Go panel additionally needs the opencode-go model configured in Settings → Models.

How it works

A dual-face (Host + Client) plugin. The Host publishes the opencodeUsage Typert Remote service (methods usage and deepseekBalance); the Client mounts it, registers the settings.section entries, and renders the pages. Communication rides the harness /api RPC carrier.

FileRole
index.jsHost half — OpencodeUsageGateway (TypertRemoteService, service key opencodeUsage; methods usage() + deepseekBalance())
typert.host.jsHand-written Typert host manifest, registered via exports["./typert"]
client.jsBrowser bundle in window.__ModuleLoader__.load format — mounts the Remote, registers the section, renders the page
package.jsonDual-face declaration: main + exports["./client"] + exports["./typert"] + dsh.client

Development

The plugin is plain ESM and needs 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.

Local iteration: dsh plugin --profile web add file:<this-folder> copies the package into the profile (file: is copied, not linked) — re-run the command after editing source files, then restart dsh web.

Known limitations

  • The OpenCode Go 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 ($12 / $30 / $60) are shown for context only and are not part of the response; they follow the OpenCode Go plan and can drift.
  • The DeepSeek panel shows the platform balance only; DeepSeek does not expose a public API for token-usage statistics (those live in the web console).

License

MIT