UsageButtons

module
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2026 License: MIT

README

UsageButtons

Stream Deck plugin that turns every AI-coding-assistant usage stat into a live button — session % remaining, weekly %, credits, reset countdowns, per-model quotas, and more. Each button renders a dynamic icon whose background fills (or de-fills) in proportion to the current value, so you can tell at a glance how much runway you have left.

Usage Buttons in Stream Deck

Inspired by CodexBar for macOS. Runs on Windows and macOS.

Settings

Each provider is its own action — drag Claude, Codex, Copilot, etc. onto a key and configure the metric, colors, and thresholds from the Property Inspector.

Per-button settings Plugin-wide defaults
Button settings Plugin settings

Runtime

Written in Go. Compiles to a single static binary per platform — no runtime dependencies. End users just install the plugin; the Stream Deck software launches the binary directly.

  • Single binary, no runtime dependencies
  • Low memory footprint
  • Only external dep: coder/websocket

Repo layout

UsageButtons/
├── io.github.anthonybaldwin.UsageButtons.sdPlugin/  # Stream Deck plugin bundle
│   ├── manifest.json
│   ├── ui/                               # Property Inspector HTML
│   ├── assets/                           # icons shipped with the plugin
│   └── bin/                              # compiled binaries (gitignored)
├── cmd/
│   ├── plugin/                           # Go entry point
│   └── native-host/                      # Chrome native-messaging bridge
├── chrome-extension/                     # MV3 companion extension (fetch-proxy)
├── internal/
│   ├── streamdeck/                       # SD WebSocket protocol
│   ├── render/                           # SVG button renderer + bbox
│   ├── cookies/                          # browser fetch-proxy client + bridge
│   ├── providers/                        # provider interface, cache, mock
│   │   ├── claude/                       # Claude (OAuth + browser web API)
│   │   ├── codex/                        # Codex (OAuth)
│   │   ├── cookieaux/                    # cookie-gated provider messaging helpers
│   │   ├── copilot/                      # GitHub Copilot
│   │   ├── cursor/                       # Cursor (browser)
│   │   ├── ollama/                       # Ollama (browser)
│   │   ├── openrouter/                   # OpenRouter (API key)
│   │   ├── warp/                         # Warp (GraphQL)
│   │   ├── zai/                          # z.ai (API token)
│   │   └── kimik2/                       # Kimi K2 (API key)
│   ├── settings/                         # global + per-key settings
│   ├── icons/                            # provider SVG glyph paths
│   ├── update/                           # GitHub Releases update checker
│   └── httputil/                         # shared HTTP+JSON helpers
├── scripts/                              # build, release, icon generation
├── tmp/CodexBar/                         # upstream reference (gitignored)
├── CLAUDE.md                             # Claude-specific agent notes
├── AGENTS.md                             # shared agent instructions
└── README.md

Install

The full step-by-step lives on the landing page. Short version:

  1. Download the .streamDeckPlugin bundle for your OS from the latest release and double-click to install in Stream Deck.
  2. (Optional, for Claude extras / Cursor / Ollama) Grab UsageButtons-Helper-unpacked.zip from the same release, unzip it, and Load unpacked in chrome://extensions. The plugin auto-registers — nothing to configure.
  3. Drag a provider (Claude, Codex, Copilot, etc.) onto a Stream Deck key and pick a metric from the Property Inspector.

Build from source

git clone https://github.com/anthonybaldwin/UsageButtons.git
cd UsageButtons
go build -o io.github.anthonybaldwin.UsageButtons.sdPlugin/bin/plugin-win.exe ./cmd/plugin/
go build -o io.github.anthonybaldwin.UsageButtons.sdPlugin/bin/usagebuttons-native-host-win.exe ./cmd/native-host/
./scripts/install-dev.sh --restart

install-dev.sh junctions the .sdPlugin folder into Stream Deck's plugin directory so rebuilds take effect without reinstalling. Cross-compile with GOOS=darwin GOARCH=arm64 go build ... for macOS (and the same for the native host — releases build both arches via the release workflow).

Full dev workflow lives in AGENTS.md.

Releases

Cut via the manual release GitHub Action — no local git work:

gh workflow run release.yml --field bump=patch
gh workflow run release.yml --field bump=minor
gh workflow run release.yml --field bump=custom --field custom_version=0.4.0
gh workflow run release.yml --field bump=patch --field draft=true  # draft release

The workflow bumps both manifests, tags, builds plugin + native host for Windows + macOS (both arches), packages the Helper zip, and publishes the release with all three artifacts attached.

Usage Buttons Helper (required for Claude extras, Cursor, Ollama)

Claude's web extras (balance / overage), Cursor, and Ollama sit behind Cloudflare and need a logged-in browser session. Usage Buttons ships a small Chrome extension — Usage Buttons Helper — in chrome-extension/ that proxies fetch() for those three sites. Your usage reads happen through your real browser session; cookies never leave Chrome.

  • No credentials in the plugin. credentials: "include" + Chrome's native cookie jar. The plugin only sees API response bodies.
  • Narrow by design. Hardcoded to fetch only claude.ai, cursor.com, and ollama.com — enforced in the manifest's host_permissions AND again in the service worker at request time. No cookies permission, no broad host scope.
  • One-click install. The extension's ID is pinned by its public key, so the plugin auto-registers the native-messaging bridge on launch — download the release zip, Load Unpacked in chrome://extensions, done.
  • Providers that don't need it keep working unchanged — Claude OAuth, Codex, Copilot, OpenRouter, Warp, z.ai, Kimi K2 never touch the extension path.
  • Waits patiently on cold start. Cookie-gated buttons stay in a quiet "needs browser extension" state until the extension handshakes — so launching Stream Deck before Chrome doesn't trigger a 403 loop.

Install steps live in the Helper README. Works in any Chromium-based browser (Chrome, Edge, Brave, Chromium); a Firefox port is on the roadmap.

License

MIT · Third-party licenses


CodeRabbit Pull Request Reviews

Directories

Path Synopsis
cmd
genkeys command
native-host command
Command native-host is the Chrome native-messaging bridge for the Usage Buttons Stream Deck plugin.
Command native-host is the Chrome native-messaging bridge for the Usage Buttons Stream Deck plugin.
plugin command
Usage Buttons — Stream Deck plugin entry point (Go).
Usage Buttons — Stream Deck plugin entry point (Go).
internal
cookies
Package cookies gives cookie-gated providers (Claude web extras, Cursor, Ollama) a way to call their Cloudflare-protected APIs through Chrome's actual network stack — without ever handling the user's cookies in-process.
Package cookies gives cookie-gated providers (Claude web extras, Cursor, Ollama) a way to call their Cloudflare-protected APIs through Chrome's actual network stack — without ever handling the user's cookies in-process.
httputil
Package httputil provides a thin HTTP+JSON helper for providers.
Package httputil provides a thin HTTP+JSON helper for providers.
icons
Package icons holds the SVG glyph data used to render provider logos on button faces.
Package icons holds the SVG glyph data used to render provider logos on button faces.
providers
Package providers defines the provider interface, snapshot types, and the provider registry.
Package providers defines the provider interface, snapshot types, and the provider registry.
providers/claude
Package claude implements the Claude OAuth API usage provider.
Package claude implements the Claude OAuth API usage provider.
providers/codex
Package codex implements the Codex OAuth API usage provider.
Package codex implements the Codex OAuth API usage provider.
providers/cookieaux
Package cookieaux holds provider-facing helpers for the browser fetch-proxy path.
Package cookieaux holds provider-facing helpers for the browser fetch-proxy path.
providers/copilot
Package copilot implements the GitHub Copilot usage provider.
Package copilot implements the GitHub Copilot usage provider.
providers/cursor
Package cursor implements the Cursor usage provider.
Package cursor implements the Cursor usage provider.
providers/kimik2
Package kimik2 implements the Kimi K2 credits provider.
Package kimik2 implements the Kimi K2 credits provider.
providers/ollama
Package ollama implements the Ollama usage provider.
Package ollama implements the Ollama usage provider.
providers/openrouter
Package openrouter implements the OpenRouter API usage provider.
Package openrouter implements the OpenRouter API usage provider.
providers/warp
Package warp implements the Warp AI usage provider.
Package warp implements the Warp AI usage provider.
providers/zai
Package zai implements the z.ai usage provider.
Package zai implements the z.ai usage provider.
render
Package render produces SVG button faces for Stream Deck keys.
Package render produces SVG button faces for Stream Deck keys.
settings
Package settings manages global and per-key plugin settings.
Package settings manages global and per-key plugin settings.
streamdeck
Package streamdeck implements the Stream Deck SDK v2 WebSocket protocol.
Package streamdeck implements the Stream Deck SDK v2 WebSocket protocol.
update
Package update checks GitHub Releases for newer plugin versions.
Package update checks GitHub Releases for newer plugin versions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL