Skip to content

Commit 6ac2030

Browse files
committed
feat(opencode_go_usage): new plugin for OpenCode Go subscription quota
OpenCode Go (opencode.ai/zen/go/v1) ships no public usage endpoint — anomalyco/opencode#10448 and #18648 are still open upstream. The plugin works around that with two modes: 1. Sentinel mode (preferred): when ``quota_sentinel_url`` is set the plugin queries ``/v1/providers/opencode_go`` and lets a shared quota-sentinel instance handle workspace_id + auth_cookie centrally. Registers itself with the sentinel using the user-supplied creds the first time it polls (idempotent — the sentinel deduplicates instances that present the same fingerprint). 2. Direct mode: when no sentinel URL is given the plugin scrapes https://opencode.ai/workspace/<workspace_id>/go itself, parsing the SolidJS SSR hydration payload for rollingUsage / weeklyUsage / monthlyUsage. Regex patterns ported from slkiser/opencode-quota. The UI mirrors cerebras_usage / crof_status: three rolling windows (rolling_5h, weekly, monthly) with a colour-graded utilisation bar, compact and rotate display modes, and a manual-refresh button press. Auth cookie is treated as a password-class secret in the manifest so it doesn't leak into config exports.
1 parent 4604b88 commit 6ac2030

3 files changed

Lines changed: 548 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: OpenCode Go Usage Monitor
2+
version: 1.0.0
3+
description: Shows OpenCode Go subscription utilization (rolling 5h, weekly, monthly) by scraping the workspace dashboard. Can also pull pre-aggregated data from a Quota Sentinel instance instead of scraping directly.
4+
author: StreamDeck UI Community
5+
entry_point: opencode_go_usage_plugin.py
6+
license: MIT
7+
8+
lifecycle_mode: always_running
9+
can_switch_page: false
10+
11+
max_retries: 5
12+
retry_delay: 30
13+
14+
variables:
15+
- name: workspace_id
16+
type: string
17+
description: "OpenCode workspace UUID. Find it in the URL bar after logging in to opencode.ai — the workspace dashboard lives at https://opencode.ai/workspace/<workspace_id>/go. Required for direct-scrape mode; the Quota Sentinel can read it from its own provider_config instead."
18+
required: false
19+
20+
- name: auth_cookie
21+
type: password
22+
description: "Paste the VALUE of the 'auth' cookie from your browser (DevTools → Application/Storage → Cookies → opencode.ai → row 'auth' → copy the 'Value' column). Refresh when the meter reports HTTP 401 'auth cookie expired'."
23+
required: false
24+
25+
- name: poll_interval
26+
type: int
27+
description: Polling interval in seconds (the dashboard updates roughly per-request, so polling much faster than 300s is wasteful).
28+
required: false
29+
default: 300
30+
31+
- name: display_mode
32+
type: string
33+
description: "Display mode: 'compact' shows up to 2 windows, 'rotate' cycles through all three (5h, weekly, monthly)."
34+
required: false
35+
default: compact
36+
37+
- name: rotate_interval
38+
type: int
39+
description: Seconds between view rotation (only used in rotate mode).
40+
required: false
41+
default: 5
42+
43+
- name: quota_sentinel_url
44+
type: url
45+
description: "Optional Quota Sentinel URL (e.g. http://localhost:7878). If set, the plugin queries the sentinel's /v1/providers/opencode_go instead of scraping opencode.ai itself — the sentinel handles workspace_id + auth_cookie centrally via its provider_config."
46+
required: false
47+
48+
icon: opencode_go_icon.png
884 Bytes
Loading

0 commit comments

Comments
 (0)