DeepSeek Harness Plugin

verneuil/dsh-opencode-go-usage

Stars ★ 3 Downloads (30d) 1,429 Category Usage & Billing Added 2026-10-20 npm @verneuil/dsh-opencode-go-usage

Floating pill for DeepSeek Harness that shows OpenCode Go usage for the 5-hour, weekly and monthly windows as three rings, works out the remaining model quota automatically and can show the DeepSeek account balance alongside; a minimal mode nests the rings and lets you choose which of the 5-hour / weekly / monthly figures each outer / middle / inner ring shows, with a live preview.

Install

# from npm (prebuilt)

dsh plugin --profile web add @verneuil/dsh-opencode-go-usage

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:verneuil/dsh-opencode-go-usage

Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).

README

OCG Usage

Three OpenCode Go usage windows (5-hour R / weekly W / monthly M) merged into one minimal floating pill

English | 简体中文

Changelog · Feedback


An unofficial DeepSeek Harness plugin: it packs the official DeepSeek balance, the remaining quota of every OpenCode Go model and OpenCode Go usage progress into one floating pill — click to refresh, drag to snap, hover to expand the details popover.

Contents

Features

Floating pill and hover popover

  • OpenCode Go quota calculation + DeepSeek official balance:

    • the balance area on the left of the pill can show either the official DeepSeek balance or the OCG quota left, converted from the selected reference model;
    • the OCG model list and quotas are fetched automatically; when unavailable, the built-in model table and quota data are used.
  • Three rings for window usage:

    • the three OpenCode Go usage windows are drawn as ring progress indicators; click the pill to refresh;
    • the number in the centre is a percentage (by default used; switch it to left in settings). Above 20% left = normal colour, ≤ 20% = warning colour, ≤ 5% = danger colour (customisable in Colour settings).
  • Hover popover:

    • hover the pill to expand a panel with three independent usage bars, each showing its percentage and reset time;
    • it can also show the DeepSeek account balance, the OpenCode Go quota left, and a projected usage chart for the current billing period.
  • Projected usage:

    • extrapolates linearly from used percentage this period ÷ elapsed time ratio to estimate usage by the renewal date;
    • the actual segment is solid and the projection is dashed; beyond 100% the line stops at 100% and the depletion date is marked above the chart;
    • the renewal date comes from OpenCode Go's monthly.resetsAt — no manual input.
  • OCG quota conversion:

    • select up to five reference models in settings (default DeepSeek V4.1 Flash; any official OpenCode Go model is available). For each model the plugin computes used (converted) / left (converted) from Go-tier monthly quota × used percentage this month, shown both in settings and in the hover popover;
    • free models show “Free”; when no quota is left it shows --.
  • Amount currency:

    • all amounts (DeepSeek balance and OCG quota) support ¥ CNY / $ USD / Auto (Chinese UI uses ¥, English UI uses $ by default);
    • exchange rates are fetched automatically, with a built-in fallback; conversion affects display only.
  • Minimal mode:

    • ring data mapping: outer / middle / inner rings can each be bound to 5-hour / weekly / monthly;
    • rings are nested (inner R / middle W / outer M) to make the pill more compact (non-minimal mode shows “balance + three independent rings”);
    • turning off “show balance on the left” gives the most compact form: only the nested rings, with the smallest footprint.
  • Other features: Adaptive popover direction: it opens upwards near the bottom edge and flips inwards near the left/right edges, so the window never clips it; Drag snapping: the position is recorded against the window edges on release, and kept relative to the anchor line when the window is resized.

Other

  • Zero dependencies: plain JavaScript — no build step, no third-party runtime dependencies (only require('react'), provided by the host).
  • Optional sidebar entry: a “Sidebar entry” switch in settings (off by default).
  • Bilingual UI: every interface string goes through the client locale dictionaries and follows the DSH language setting instantly (pill, settings page, menu label and all action messages).

Screenshots

All twelve are rendered illustrations built from the plugin's real stylesheet and the host theme tokens (not machine screenshots).

Pill · light Pill · dark
Pill · light Pill · dark
Settings · Usage data (light) Settings · Usage data (dark)
Settings · Usage data · light Settings · Usage data · dark
Settings · Floating pill (light) Settings · Floating pill (dark)
Settings · Floating pill · light Settings · Floating pill · dark
Settings · Colour settings (light) Settings · Colour settings (dark)
Settings · Colour settings · light Settings · Colour settings · dark
Settings · General settings (light) Settings · General settings (dark)
Settings · General settings · light Settings · General settings · dark
Sidebar entry · full settings page (what the sidebar row opens when the entry is enabled)
Sidebar entry

States and colour grades (refreshing / success / failure / three grade colours / minimal mode / most compact form / narrowed after hiding the balance)

States and colour grades

Installation

Requirements: DeepSeek Harness desktop (the app bundles node / pnpm — nothing else to install). This plugin follows the official DSH plugin conventions: you do not hand-edit the profile's package.json / cordis.patch.yml, and you should not run pnpm inside the profile directory.

In DSH, open the plugin manager → “Install plugin” dialog → paste one of the specs below → install (the dialog drives pnpm and installs one spec at a time):

Method Spec to paste
Direct from GitHub github:verneuil/dsh-opencode-go-usage
From npm @verneuil/dsh-opencode-go-usage

Reload when prompted.

  • Every version's changes are listed in CHANGELOG.md (Chinese and English).

Compatibility

  • Host version gate: the package declares engines.dsh: ">=0.1.7".

  • If the host refuses to load it: add an exact exemption to that profile's compatibility.json — no plugin change is required:

    { "@verneuil/dsh-opencode-go-usage@3.5.0": ["0.2.1-rc.5"] }
    

    The file lives at ~/.dsh/profiles/<profile>/compatibility.json (on desktop: %DSH_HOME%\profiles\<profile>\compatibility.json).

  • After upgrading DSH, if the pill or settings page misbehaves, first check the startup log for plugin tree failed to load, then compare with CHANGELOG.md.

Usage

  • Click the pill = refresh balance + usage + model list + exchange rate immediately (or wait for auto-refresh).
  • Drag the pill = move it; it snaps on release. The “Reset position” button returns it to the default position.
  • The balance row on the left of the pill = choose either DeepSeek official balance or OCG quota left in settings (see Configuration).
  • Settings page = Settings → Plugins → OCG Usage.

Design goal: minimal

  • Blend into the existing DeepSeek Harness UI as much as possible: unobtrusive, never shouting, yet still letting you read your usage at a glance — evolved from a long progress bar into the three rings you see today.
  • Only OpenCode Go is supported for now; other coding plans are not planned.

Data sources

GET https://opencode.ai/zen/go/v1/usage                    # OpenCode Go usage
Authorization: Bearer <OpenCode Go API Key>

GET https://api.deepseek.com/user/balance                  # DeepSeek official balance
Authorization: Bearer <DeepSeek API Key>

GET https://opencode.ai/inference/go/v1/models              # OpenCode Go model list + Go-tier monthly quotas (public JSON)
GET https://open.er-api.com/v6/latest/USD                   # USD/CNY rate (primary, no key)
GET https://api.frankfurter.app/latest?from=USD&to=CNY      # USD/CNY rate (fallback, no key)

The usage endpoint returns { usage: { rolling, weekly, monthly } }, where each window has status / percent (used percentage) / resetsAt; the balance endpoint returns balance_infos[] (the CNY row is preferred). The UI shows “used” by default and can switch to “left”; internally everything is based on “used”. The host half fetches and parses the data (neither key ever leaves the host process); the client only reads the configuration projection written by the host.

The model list and exchange rate follow each refresh: manual refresh (button / clicking the pill) forces a refetch, while auto-refresh reuses caches for 24 hours (models) / 1 hour (FX). If both fail, the plugin falls back to the built-in snapshot (go-data.js) and names the failing source in the UI. Quota conversion uses the Go-tier monthly quota from the model table.

Key sources (independent per side, in priority order):

  1. the “manual key” in the plugin settings page (persisted in this row's config; the client view is masked automatically);
  2. the DSH credential store — OpenCode Go uses OPENCODE_GO_API_KEY (then OPENCODE_API_KEY), DeepSeek uses DEEPSEEK_API_KEY.

Anatomy

Part Location Description
Bundle manifest package.json dsh.bundle.patch + dsh.client (platform web, immediately) + icon + locale/*.json display metadata
Loader patch cordis.patch.yml Inserts one row id: opencode-go-usage (this row id is also the settings form namespace)
Host half index.js export const Config (prefers schemastery, falls back to an inline Standard Schema) + apply(ctx, config); fetching, parsing, snapshot writes, auto-refresh
Client half client.js window.__ModuleLoader__ lazy factory; only require('react'); registers into shell.overlay (pill) and settings.section (settings page)

Configuration

The settings page covers the common options; fields in the table below can also be edited directly in this row's patch config.

Field Description
apiKey Manual OpenCode Go API key (secret). Leave blank to use the DSH credential store
deepseekApiKey Manual DeepSeek API key (secret). Leave blank to use the DSH credential store
refreshMinutes Auto-refresh interval (minutes, default 5); one round refreshes balance and usage together
widgetVisible Show/hide the floating pill
widgetScale Pill size multiplier: 1 default / 0.9 −10% / 0.8 −20% / 1.15 +15% / 1.3 +30% / 1.5 +50% / 1.75 +75% / 2 +100%
showBalance Show the balance row on the left of the pill (default off)
pillBalanceSource Data for the left balance: deepseek DeepSeek balance (default) / quota OCG quota left (converted)
pillQuotaModel Which reference model to show when the left side uses OCG quota (blank = the first selected model)
tipShowBalance, tipShowQuota, tipShowPace Whether the two balance sections and the projected usage chart appear in the hover popover (all on by default; turning all off leaves only the three bars)
sidebarEntry Whether the plugin appears in the sidebar (default off; same as the “Sidebar entry” switch in settings)
ringOuter / ringMiddle / ringInner Window bound to the outer / middle / inner ring in minimal mode: rolling = 5-hour, weekly = this week, monthly = this month (defaults: monthly / weekly / rolling)
colorUnified Unified colours: one three-grade palette covers both rings and bars (default on); when off, each has its own palette
colorFollowHost Follow the host accent: the normal grade uses --dsw-alias-brand-primary; warning/danger keep their defaults; manually changing the normal grade turns this off (default off)
colorAll / colorAllWarn / colorAllDanger Custom three-grade colours under unified colours (CSS values: #RRGGBB, rgb(), hsl(); blank = theme default green / orange / red)
colorRing* / colorBar* (with …Warn / …Danger suffixes) Separate ring/bar palettes when unified colours are off (normal = no suffix, warning = Warn, danger = Danger); the bar normal colour is also used for the actual segment of the projected chart
quotaRefModel Legacy single-model reference ID (default deepseek-v4.1-flash); used as a single-model fallback when quotaRefModels is empty
quotaRefModels Multi-select reference model ID array (up to 5; when empty, falls back to quotaRefModel / DeepSeek V4.1 Flash)
currencyMode Amount currency: auto (default) / cny CNY / usd USD
percentMode Usage percentage mode: used (default) / left
widgetAnchorX/Y, widgetOffsetX/Y Pill anchoring (written by the client while dragging; defaults to the window's bottom-left, 7px from the left and 9.2px from the bottom)
refreshRequest Manual refresh counter (incremented by the client when the pill is clicked)
refreshTick “Refreshing” signal incremented by the host before each fetch (client reads it to animate the border)
minimalMode Minimal mode: nested rings (the balance is rounded and shown beside the rings; default on)
keyStatus, keyHint, usageError, lastUpdated, usage Derived OCG usage snapshot (written by the host, read by the client)
balanceKeyStatus, balanceKeyHint, balanceError, balance Derived DeepSeek balance snapshot (written by the host, read by the client)
goModels, goModelsAt, goModelsSource, goModelsError Derived model-list/quota snapshot (source = live or snapshot)
fxUsdCny, fxAt, fxRateDate, fxSource, fxError Derived USD/CNY rate, rate date and collection time snapshot

Robustness

  • Only uses the official overlay seat shell.overlay (replaceRisk: none, a click-through layer where each entry opts into pointer events); it registers under its own id, so it sits beside existing entries and replaces none.
  • Never covers official UI: it does not register conversation.composer.dock and does not clone official components.
  • Theme tokens only (--dsw-alias-*): a token rename can at worst degrade the look, never crash rendering; no hard-coded colours.
  • No Harness client packages (such as dsh-client-ui-primitives): those can change at any time, and plain JS plugins get no type checking; all pill controls are self-written.
  • Host API contract self-check: at startup the plugin validates the host contracts it actually uses; on mismatch it prints a readable warning and skips safely instead of throwing a TypeError that silently disables the whole entry.
  • Config as the channel: the host writes derived snapshots into this row's volatile Config fields and the client reads them through remote.settings.describe(); writes commit outside HMR transactions (avoiding HMR transactions cannot be nested).
  • Failures never clear data: on fetch failure the last known usage is kept (with 3s / 10s anti-jitter retries), so one network blip never turns the bars into -- or persists empty values.
  • Four data paths, independent fallbacks: usage / balance / model list / FX are independent; a failure in one only affects itself (the others keep rendering), and the UI names the failing source; model-list and FX failures fall back to the built-in snapshot, labelled “built-in snapshot”.
  • Manual refresh = full refetch: manual refresh (button or clicking the pill) bypasses the TTL and refetches the model table and FX, so their timestamps follow your manual refresh.
  • Without a key, retries step through 3/8/20/40/60/120 seconds; when a good snapshot exists it tolerates three misses, avoiding a false “not configured” at startup.

Security & privacy

  • Release assets carry build provenance: every .tgz is built and signed by GitHub Actions, shown as Verified on the Release page; verify it yourself with gh attestation verify <file> --repo verneuil/dsh-opencode-go-usage.
  • Keys stay on this machine: API keys are kept by DSH's settings store; the plugin only sends them in request headers to the official endpoints. They are never written to URLs, logs or usage snapshots, and never sent to the frontend (which only receives “configured?” and a masked form).
  • Only four fixed domains at runtime: api.deepseek.com (account balance), opencode.ai (usage and official model table), open.er-api.com and api.frankfurter.app (FX, only when currency is “Auto”).
  • No telemetry: no usage data is collected or sent to any self-hosted service; there are no third-party runtime dependencies, only one peer dependency: the host package @deepseek-ai/schemastery (for config schema and volatile semantics). It is installed with the profile, so settings behave consistently everywhere.
  • Credential hardening: every request carrying a key disables redirects (redirect: "error"), so credentials cannot be forwarded to another host.
  • Reporting issues: use GitHub Issues; never paste any key into an issue.

Known limitations & disclaimer

  • Unofficial plugin: this project is not affiliated with DeepSeek or OpenCode. Neither API is a frozen long-term public contract; major upstream changes can break it (the parser tolerates common variants such as remaining percentages, used amounts/quotas and seconds-to-reset, and the host exposes a readable message in usageError on failure).
  • Keys are used locally only: the host half calls the two endpoints directly, with no third party; manual keys entered in settings are stored in the local plugin config, and the UI only shows a masked form (e.g. sk-****5590).
  • Network jitter: occasional cross-border HTTPS timeouts are normal; the pill keeps the last known values, the border turns to the warning colour, the host retries at 3/8/20/40 seconds and recovers automatically.
  • UI language: the pill and settings page support Chinese and English, following the DSH language setting; error details returned by the API layer (e.g. 401/403, unexpected payloads) are currently still in Chinese.
  • Quota amounts are estimates: the official API does not expose “how much quota this model has left right now”; the plugin estimates it from that model's Go-tier monthly quota × used percentage this month, for reference only. The monthly percentage is progress for the whole plan, not that model's own consumption share. Go Plus / Go Teams tiers are not included yet (always calculated as Go tier).
  • FX affects display only: DeepSeek balance is denominated in CNY and quota in USD; conversion only affects display (auto = ¥ in Chinese, $ in English) and never changes any actual bill.
  • The model list may lag: the built-in snapshot is official data as of 2026-11-26; it updates with refreshes when online, and offline/fetch failures show the built-in snapshot with a label.
  • Use at your own risk: this software is provided “as is” under the MIT licence, without warranty of any kind.

License

MIT © 2026 verneuil

Feedback

Open an issue for problems or suggestions; PRs are welcome. See CHANGELOG.md for version changes.

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.