dsh-opencode-go-multi-quota
A DeepSeek Harness plugin that shows OpenCode Go quota for every configured account under the composer, and follows the provider selected in the current session.

中文简介
在 DeepSeek Harness 输入框下方显示所有已配置 OpenCode Go 账号的剩余额度(5 小时 / 每周 / 每月),并跟随当前会话的 provider 自动切换。
- 从
llm-pi-ai.providers自动识别账号,不在插件里写死数量。 - 按账号数自适应:1 个账号用 320px 紧凑卡,2 个账号用 360px 双列矩阵,3 个以上用「当前账号 + 其他账号」可展开列表,不横向滚动。
- 当前账号列(或当前账号卡)高亮,
限流标红,每格带剩余、已用和↻重置时间。 - 凭据只在 Host 进程解析,页面只拿到百分比;不会下发 key。
- 完整中文说明见 README.zh.md。
Features
- Multi-account, auto-detected. Reads
llm-pi-ai.providersand picks every provider that looks like OpenCode Go. No account count in the plugin code. - Follows the session provider. Uses the session-scoped
modelDirectoriesstore; switching models swaps the pill immediately. - Adaptive layout. One account uses a 320px compact card; two accounts use a 360px two-column matrix; three or more use a current-account card plus expandable rows for the others, with no horizontal scrolling. The active account is highlighted;
rate-limitedcells are marked in red. - All the facts, compactly. Each cell shows remaining %, used %, and reset time (
↻). Same-day resets show onlyHH:mm; other days showMM/DD HH:mm. - Per-account cache. The host caches each provider separately for 60 seconds, and one failing account does not break the others.
- No keys in the browser. The host resolves credential refs and calls the usage API; the client only receives percentages.
How accounts are discovered
On every request the host reads the loaded @deepseek-ai/dsh-llm-pi-ai entry and its config.providers. A provider is included when it has an apiKeyEnv and any of these is true:
- the provider id starts with
opencode; - its
baseURLcontainsopencode.ai; - its
apiKeyEnvcontainsOPENCODE.
The apiKeyEnv value is the credential ref to resolve. Providers with only a stored credential record and no apiKeyEnv are not shown.
If the loader config cannot be read, the host falls back to the two conventional refs OPENCODE_GO_API_KEY and OPENCODE_API_KEY. A config with no matching provider shows “No OpenCode accounts found” instead of an endless spinner.
Requirements
- DeepSeek Harness
0.2.1-rc.5(or a compatible0.2.x; seeengines.dsh). - At least one OpenCode Go provider in
llm-pi-ai.providerswith anapiKeyEnvthat resolves through DSH credentials or the environment. - The standard web client with
@deepseek-ai/dsh-client-ui-model-selection; the plugin uses it to follow the session provider.
Install
This package is distributed from GitHub only; no npm release is published. Use the GitHub spec below.
Recommended: open Plugins → Install in the DSH web UI and install from the GitHub spec:
github:jackgucarbon/dsh-opencode-go-multi-quota
The Plugin Manager adds the bundle to the profile and reloads it.
CLI installs only add the package dependency; add the bundle to dsh.profile.bundles yourself:
dsh plugin --profile desktop add github:jackgucarbon/dsh-opencode-go-multi-quota
{
"dsh": {
"profile": {
"bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-opencode-go-multi-quota"]
}
}
}
After installation, restart DSH if the host half does not reload, then refresh the page.
Host API
The host registers a same-origin read-only route:
| Request | Response |
|---|---|
GET /plugin/opencode-go-multi-quota |
Default provider (first discovered, or opencode-go) |
GET /plugin/opencode-go-multi-quota?provider=opencode |
One named provider |
GET /plugin/opencode-go-multi-quota?provider=all |
Every discovered account, plus a detected flag |
...&refresh=1 |
Bypass the 60-second cache |
The upstream endpoint is GET https://opencode.ai/zen/go/v1/usage with a Bearer token. It is read-only and does not consume plan quota.
Security and privacy
- Credential values stay in the host process. They are never logged, returned by the route, or sent to the page.
- The only network request is the usage call to
opencode.ai; the plugin has no telemetry. - The quota route is same-origin and read-only, but it is not authenticated and
refresh=1bypasses the cache. Do not expose the DSH web server to untrusted networks without adding a proxy or auth layer in front of it. - The auto-discovery rule is intentionally broad. If you have a non-Go OpenCode provider with an
OPENCODEref, it may appear and fail; narrow the rule or remove that provider fromllm-pi-ai.providers.
Development
npm test
The tests use fake API keys and a mocked fetch; no real credentials are needed. test/client.test.mjs runs the client module against a tiny hook runtime and a fake model directory, so it checks provider switching and the popover without a browser.
Compatibility
Built and tested against DeepSeek Harness 0.2.1-rc.5. The plugin uses the client modelDirectories service and the host loader, credentials, and webServer services; breaking changes to those services will need a plugin update.
License
MIT. Not affiliated with OpenCode or DeepSeek; “OpenCode” and “DeepSeek” are used descriptively.
No comments yet. Be the first to write one.