- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .gitignore | ||
| opencode_usage_indicator.py | ||
| README.md | ||
OpenCode Go Usage Indicator
A small GNOME top-bar (AppIndicator / KStatusNotifierItem) app that shows your OpenCode Go or Go Plus plan usage at a glance.
It displays the plan's own meters — 5-hour, weekly and monthly usage plus your credit balance — and updates automatically. Clicking the indicator opens a menu with per-window percentages, spend vs. limit, reset countdowns, and shortcuts to refresh or open the OpenCode Console.
Unofficial and not affiliated with OpenCode.
Requirements
- GNOME Shell with AppIndicator support. On Ubuntu this is the
ubuntu-appindicators@ubuntu.comextension (enable withgnome-extensions enable ubuntu-appindicators@ubuntu.com). /usr/bin/python3with:python3-gi(GTK 3) andgir1.2-ayatanaappindicator3-0.1python3-requests
On Debian/Ubuntu:
sudo apt install python3-gi gir1.2-ayatanaappindicator3-0.1 python3-requests
Run
/usr/bin/python3 opencode_usage_indicator.py
To start it automatically at login, copy a launcher into ~/.config/autostart:
# ~/.config/autostart/opencode-usage-indicator.desktop
[Desktop Entry]
Type=Application
Name=OpenCode Usage Indicator
Exec=/usr/bin/python3 /absolute/path/to/opencode_usage_indicator.py
Terminal=false
X-GNOME-Autostart-enabled=true
Connecting it to your subscription
The indicator talks to the OpenCode Console API
(https://opencode.ai/console/api) using the same browser session you use for
the dashboard. Authentication is the __Host-console_session cookie.
The easiest path is Firefox:
- Log in to https://opencode.ai/console in Firefox and open your workspace.
- Start the indicator. It automatically reads the
__Host-console_sessioncookie from your local Firefox profile and detects the workspace (org_id) for you — nothing to configure.
Alternative ways to provide the session:
- Environment variable — set
OPENCODE_CONSOLE_SESSIONto the cookie value before launching. - Menu — right-click the indicator and choose Set credentials…, then
either click Read from Firefox or paste the cookie value manually
(DevTools → Storage → Cookies →
__Host-console_session).
The session is never written to disk by the indicator; it is re-read from the browser on each refresh. If it expires, log in again in your browser (or paste a fresh value) and the next refresh picks it up.
Files
| Purpose | Path |
|---|---|
| Config | ~/.config/opencode-usage-indicator/config.json (mode 0600) |
| Log | ~/.local/state/opencode-usage-indicator/indicator.log |
| Icons | ~/.cache/opencode-usage-indicator/icons/ |
Verify the connection without the GUI:
/usr/bin/python3 opencode_usage_indicator.py --check
Notes
- Limits and reset times come straight from the API, so Go and Go Plus are detected automatically.
- Poll interval defaults to 180 seconds; edit
poll_secondsinconfig.json.
License
MIT