HeadlinesBriefing favicon HeadlinesBriefing.com

Track Claude Code Usage on macOS With a SwiftBar Widget

Hacker News •
×

A new macOS widget lets users monitor Claude Code usage directly from the menu bar. Written as a SwiftBar plugin, it displays a colored bar for each account, reflecting the 5‑hour‑window consumption. Green stays below 70 %, orange hits 70 %, and red marks 90 % or more. When the window empties, a countdown appears; a full weekly cap turns the bar black.

The tool pulls the Claude Code OAuth token from the macOS Keychain in read‑only mode, avoiding password reuse or scraping. It queries an internal /usage endpoint that the official Claude Code interface uses, ensuring accurate data. Refreshes occur every five minutes, with a manual “Refresh now” button. A stale token triggers an error until the claude CLI is rerun.

Installing is a one‑liner: curl -fsSL https://raw.githubusercontent.com/grzegorz-raczek-unit8/claude-quota/main/install.sh | bash, which sets up SwiftBar or Homebrew if missing. The plugin autodiscoveries all ~/.claude directories with a Keychain entry, labeling them by suffix. Users can pin, rename, or hide gauges via a config file or the menu. Uninstalling removes the .py script from the SwiftBar folder. The widget remains lightweight and does not alter any user settings.