GarfieldGCat/dsh-opencode-go-usage ↗★ 0
dsh-opencode-go-usage
DeepSeek Harness 插件:从设置侧边栏查询 OpenCode Go 额度
AI 分析
核心用途是在输入框上下文状态区展示 OpenCode Go 的 5小时滚动、每周及每月额度剩余百分比与重置时间。适合使用 OpenCode Go 渠道并需要监控订阅用量的用户。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:GarfieldGCat/dsh-opencode-go-usage说明文档
阅读完整 README ↗dsh-opencode-go-usage
A DeepSeek Harness web plugin that shows your OpenCode Go quota next to the context status area in the chat composer.
- Hover the icon: shows the 5-hour rolling quota remaining and starts an auto refresh (throttled to once every 15 seconds)
- Click the icon: opens a panel with remaining / used percentages and reset times for 5h, weekly, and monthly windows
- The icon is visible only when the current session's selected provider is
opencode-go - Caches the last successful result globally: reopening the panel shows cached data and last query time immediately, then refreshes in the background
- While a query is in flight, the hover tooltip shows
refreshing…; clicking the icon during that time does not start a duplicate request - Auto refresh is limited to once per 15 seconds; manual refresh always queries
Demo
After installing and restarting dsh web, open a session using opencode-go.
A small icon appears on the right side of the composer. Click it to see:
OpenCode Go quota
5h left 85%
Wk left 71%
Mo left 93%
last query: 14:32:08 · refreshing…
Install
From GitHub (recommended)
dsh plugin --profile web add github:GarfieldGCat/dsh-opencode-go-usage
Then restart:
dsh web
Pin a release tag for stable installs:
dsh plugin --profile web add github:GarfieldGCat/dsh-opencode-go-usage#v0.1.2
Configuration
You can override the plugin config in your web profile's cordis.patch.yml:
- id: opencode-go-usage
name: dsh-opencode-go-usage
config:
baseUrl: https://opencode.ai/zen/go/v1/usage
timeoutMs: 15000
providerId: opencode-go
| Key | Default | Description |
|---|---|---|
baseUrl | https://opencode.ai/zen/go/v1/usage | OpenCode Go usage endpoint |
timeoutMs | 15000 | Request timeout in milliseconds |
providerId | opencode-go | Provider id that must match the current model provider |
API key resolution
- DSH credentials seam / environment variable
OPENCODE_GO_API_KEY ~/.local/share/opencode/auth.json, entryopencode-go(falls back toopencode) withtype: "api"
How it works
Usage endpoint
GET https://opencode.ai/zen/go/v1/usage
Authorization: Bearer
Example response:
{
"usage": {
"rolling": { "status": "ok", "percent": 9, "resetsAt": "..." },
"weekly": { "status": "ok", "percent": 12, "resetsAt": "..." },
"monthly": { "status": "ok", "percent": 6, "resetsAt": "..." }
}
}
The endpoint returns used percentages. The plugin displays remaining = 100 - percent.
Plugin structure
| File | Purpose |
|---|---|
index.js | Host side: provides the opencodeUsage Remote service, resolves the API key, and queries usage |
typert.host.js | Typert host manifest |
client.js | Web side: registers the icon in conversation.input.right and renders the popover |
cordis.patch.yml | Bundle patch that mounts the host plugin automatically |
package.json | Declares dsh.bundle + dsh.client |
Visibility condition
The web client reads the current session's selected provider via modelDirectories:
- current provider is
opencode-go→ show the icon - current provider is not
opencode-go→ hide the icon
Known limitations
- The usage endpoint is undocumented and may change in the future.
- The endpoint only returns percentages, not dollar amounts; the plugin shows percentages and reset times.
- The cache is global: the same OpenCode Go account shares the same quota across sessions.
License
MIT
Configuration
You can override the plugin config in your web profile's cordis.patch.yml:
- id: opencode-go-usage
name: dsh-opencode-go-usage
config:
baseUrl: https://opencode.ai/zen/go/v1/usage
timeoutMs: 15000
providerId: opencode-go
| Key | Default | Description |
|---|---|---|
baseUrl | https://opencode.ai/zen/go/v1/usage | OpenCode Go usage endpoint |
timeoutMs | 15000 | Request timeout in milliseconds |
providerId | opencode-go | Provider id that must match the current model provider |
Usage endpoint
GET https://opencode.ai/zen/go/v1/usage
Authorization: Bearer
Example response:
{
"usage": {
"rolling": { "status": "ok", "percent": 9, "resetsAt": "..." },
"weekly": { "status": "ok", "percent": 12, "resetsAt": "..." },
"monthly": { "status": "ok", "percent": 6, "resetsAt": "..." }
}
}
The endpoint returns used percentages. The plugin displays remaining = 100 - percent.