Introduction¶
When running OpenCode Go in DeepSeek Harness (DSH), the quota balance, token consumption, and spending are scattered across official pages or session logs, making it difficult to compare the usage of the current conversation after switching sessions. To continuously see the quota and consumption next to the composer input box, one typically needs to manually check the usage API or scroll through logs.
dsh-ocgo-lite, maintained by OK-wx, is a client-side plugin for DSH: it persistently displays the OpenCode Go quota balance ring, token and spending statistics in the composer dock below the chat input box, and supports one-click API Key copying. Data is directly read from DSH session events and official usage APIs, with zero external dependencies.
What This Is¶
dsh-ocgo-lite is designed for developers who use the DSH web interface and are logged into OpenCode Go locally. The plugin fixes a status bar in the composer dock, summarizing account quota, token details, and model-based spending estimates; clicking each area expands a detail card. It is classified as a client-side plugin, with its GitHub repository OK-wx/dsh-ocgo-lite currently having about 10 stars and an MIT license.
Core Features¶
Account and Quota¶
The left side of the status bar is the GO account entry. Clicking it brings up an account card: login status, package, quota overview, and masked API Key display with one-click copy (a toast notification appears on successful copy).
The quota area displays the official quota percentage ring, with health colors in blue, yellow, and red tiers. Clicking it reveals progress bars and reset countdowns for three windows: daily, weekly, and monthly. Quota data comes from the official API https://opencode.ai/zen/go/v1/usage, using the Bearer key from ~/.local/share/opencode/auth.json. The scope is account-level (including other devices or software) and is unaffected by the range switch below.
Statistical Scope¶
Clicking the range control allows switching between three scopes:
- All — Total across all DSH sessions
- Current Session — Only the current chat
- Recent Conversation — The last task execution consumption of the most recently active session, broken down by turn, including sub-agents and background tasks
When switching to a limited session, if only one model has been used, it will automatically select that model. Each session’s “range + model” selection is remembered independently, and switching to another session and back will restore the previous state.
Model-Based Linkage¶
The model selector only lists models used in the current session when the range is set to “Current Session.” Once selected, the token and spending on the status bar display are linked based on “range + model.”
Token and Spending Details¶
The token area displays complete numbers; clicking expands a detail card containing input, output, reasoning, cache read, write, and groupings by model. The title reflects the scope as “Total Token Consumption” or “Current Session Total Consumption”; when a model is selected, it shows only that model’s scope.
The spending area shows cumulative amounts and a spending ranking by model (proportion bar + official pricing per model), linked with range and model. Amounts are estimated based on the official pricing table (per 1M tokens); models without official pricing are excluded from the cumulative total and display “Pricing Unknown.” The built-in pricing table is automatically fetched and updated from opencode.ai/docs/go at startup and every 24 hours; if fetching fails, it silently falls back to the built-in table.
Real-time Performance and Interaction¶
Token and spending data are derived from the assistant/message usage in DSH session events, grouped by provider, covering all providers in DSH sessions (opencode-go, deepseek-official, and other packages, with automatic identification and switching).
When the client polling carries ?live=<sessionId>, the host incrementally reads session log files directly (multi-frame zstd decompression + JSONL line parsing), only re-reading active sessions with mtime changes and using cache for unchanged entries. Regular polling typically processes only 1–2 files, taking tens to hundreds of milliseconds; the “All” scope covers all sessions without truncation based on count. Cold start full scan takes about 5 seconds, followed by a 5-minute cache with an in-flight lock to prevent duplicate scans.
Other interactions: clicking blank areas closes detail cards; 30-second auto-refresh without loading flicker; switching sessions displays immediately (frontend shared cache).
Installation and Enablement¶
It is recommended to install via the official DSH bundle, loading automatically with dsh web startup:
# GitHub direct installation (recommended)
dsh plugin --profile web add github:OK-wx/dsh-ocgo-lite
# Or install from source directory
dsh plugin --profile web add <this directory>
dsh --profile web
Equivalent manual operations: Add dsh-ocgo-lite to the profile package.json dependencies (link:<this directory>) and dsh.profile.bundles, create a node_modules junction, and apply cordis.patch.yml.
Runtime hot-assembly (without restart) can use the injector in DSH sessions:
dev_install_package {"dir": "<this directory>", "profile": "web"}
Alternatively, it can be installed from the plugin marketplace: dsh.aitreez.com, YELEBAI Plugin Marketplace, or dsh-market (once listed, it can be installed with one click in Settings → Plugin Marketplace). Community directory page: SkillHub.
Typical Usage¶
Daily Viewing¶
After starting dsh --profile web, the persistent bar below the composer input box appears automatically. No additional configuration is needed to view the quota ring, total tokens, and spending; click each block to expand details, and click blank areas to close.
Switching Scope and Model¶
Click the range and model controls on the status bar in sequence to compare “All / Current Session / Recent Conversation” and single-model scopes. Switching to another chat and back remembers the previous selection for that session.
Copying API Key¶
Click the GO account area and copy the full API Key with one click in the card (via the local same-origin API GET /ocgo-lite/key).
In-conversation Query¶
The plugin registers the model tool opencode_go_usage, allowing direct querying of aggregated usage data in conversations.
HTTP interfaces provided by the host:
GET /ocgo-lite/api— Aggregated JSON (quota + DSH token/spending + by model/by session + account mask)GET /ocgo-lite/api?live=<sessionId>— Real-time channel, incrementally reads changed session logsGET /ocgo-lite/key— Full API Key (local same-origin only)
During development, after modifying lib/, you can execute dev_reload_package {"packageName": "dsh-ocgo-lite"} for hot reload, or restart dsh web.
Use Cases and Considerations¶
Suitable for developers who frequently use OpenCode Go in DSH web and need to continuously compare quota and token/spending next to the composer. The plugin runs with the current dsh process permissions; before installation, you should check the source code and MIT license yourself.
Environment requirements:
- DeepSeek Harness (
dsh web) - Locally logged into OpenCode Go (
~/.local/share/opencode/auth.jsoncontains theopencode-gokey) - Node.js ≥ 22.5 (depends on
fetch,node:sqlite)
The DSH ecosystem philosophy is “everything is a plugin”; community directories like SkillHub are independent sites, not officially affiliated with DeepSeek / High-Flyer, and not an official app store.
Conclusion¶
dsh-ocgo-lite consolidates OpenCode Go quota balance, token consumption, and spending estimates into a persistent bar in the composer dock, supporting range and model linkage, session-level configuration memory, and second-level incremental log updates. Directory page: SkillHub, source code and installation instructions: GitHub.