In Web-side development or debugging scenarios for DeepSeek Harness (DSH), monitoring the plan usage of OpenCode GO and CommandCode often relies on external tools or manual page switching. This adds context-switching overhead. The dsh-opencode-go plugin is designed to address this issue. It directly provides a persistent usage status chip in the conversation header, integrating usage monitoring with the conversation process.
Core Features¶
The plugin mainly implements the following capabilities:
- Persistent display in the conversation header: Register a chip in the
utilitiesslot of the conversation header to display the weekly usage percentage for each account. Color coding follows these rules: ≥90% is red (restricted), ≥70% is orange, and otherwise it is green. - Hover to view details: Hovering the mouse over the chip displays a tooltip showing the rolling 5-hour, weekly, and monthly usage data, as well as the remaining time in the current rolling window.
- Automatic and manual refresh: Data refreshes automatically every 3 minutes, and a manual refresh button is also provided.
- Smart caching: When switching sessions, the plugin reuses a module-level shared cache to avoid repeated network requests.
- Independent fault tolerance: An API call failure for one account does not affect other accounts; the row for a failed account displays “Failed to fetch”.
- Security: API keys are stored only on the host side (
.credentials.yaml); the browser client never directly touches these keys.
Installation and Enablement¶
Install it via the DSH plugin manager:
dsh plugin --profile web add github:305037991x-pixel/dsh-opencode-go
After installation, you need to restart the dsh web service and perform a hard refresh in the browser (Ctrl+Shift+R) to load the new component.
Configuration¶
The plugin requires host-side API keys to work properly. Configure the following in the $DSH_HOME/.credentials.yaml file:
# OpenCode GO 账号 A(必填)
OPENCODE_GO_API_KEY: sk-xxx
# OpenCode GO 账号 B(可选,不配置则只显示一个账号)
OPENCODE_GO_API_KEY_B: sk-yyy
# CommandCode(可选,不配置则不显示该行)
COMMANDCODE_API_KEY: cmd-zzz
- OpenCode GO Key: Create it at opencode.ai/auth.
- CommandCode Key: Create it in its Studio (i.e., the
CMD_API_KEYused by the Provider API).
How It Works¶
The plugin uses a separated host-side and client-side architecture:
- Host side: Responsible for registering the
GET /dsh-opencode-go/usageendpoint. This endpoint resolves the credentials for each account in parallel, calls the official endpoints to fetch usage data, and returns the result. - Client side: Registers a chip component in the
conversation.session.header.utilitiesslot. It maintains a module-level shared cache and timers, and handles data retrieval, rendering, and interaction logic.
The data source mainly comes from two official endpoints:
* OpenCode GO: Uses the https://opencode.ai/zen/go/v1/usage endpoint, where the official response directly returns percent and resetsAt for the rolling/weekly/monthly windows.
* CommandCode: Uses non-public /alpha series endpoints such as https://api.commandcode.ai/alpha/billing/credits (the same endpoints used by the official CLI), and calculates percentages via windowLimits.
Compatibility and Dependencies¶
This plugin is decoupled from DSH core versions. All @deepseek-ai/dsh-* core packages are declared as optional peerDependencies (range >=0.1.0-rc.6 <0.2.0).
The plugin itself does not install or bundle any copies of core packages; at runtime, it always uses the core instance running on the host. Therefore, upgrading DSH core packages does not require reinstalling this plugin.
The main dependencies include:
* dsh-credentials: for retrieving credentials.
* dsh-launch-environment: for retrieving the runtime environment.
* On the browser side, dependencies are provided by the host’s client module table via dsh.client.inject.
Use Cases¶
This plugin is suitable for users who need to continuously monitor API plan quotas during long conversations or development sessions and want to reduce the overhead of manual queries. It is recommended to check the plugin source code and license (MIT) before installing.