Native macOS widget to display Claude usage (session, weekly all models, weekly Sonnet).
- macOS 14 (Sonoma) or later
- Xcode 15+ installed from the Mac App Store (Xcode 16.4 recommended for validating SwiftUI/Release changes, see
AGENTS.mdfor why) - Homebrew (for XcodeGen)
- Claude Code installed and authenticated (
claudethen/login)
# After installing Xcode.app:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developergit clone https://github.com/AThevon/TokenEater.git
cd TokenEater
# Install XcodeGen
brew install xcodegen
# Generate Xcode project
xcodegen generate
# Fix widget Info.plist (XcodeGen strips NSExtension)
plutil -insert NSExtension -json '{"NSExtensionPointIdentifier":"com.apple.widgetkit-extension"}' \
TokenEaterWidget/Info.plist 2>/dev/null || true
# Build
xcodebuild -project TokenEater.xcodeproj \
-scheme TokenEaterApp \
-configuration Release \
-derivedDataPath build buildcp -R "build/Build/Products/Release/TokenEater.app" /Applications/Note - this section covers building from source for local development. The build above is signed with your Apple Development cert (or ad-hoc) and is not notarized, so Gatekeeper will block the first launch:
- Double-click TokenEater.app in Applications - macOS will block it
- Open System Settings -> Privacy & Security -> scroll to the TokenEater entry -> click Open Anyway
If you want a frictionless install, download the official notarized DMG from Releases instead - it opens directly without any Gatekeeper prompt.
- Open TokenEater.app — the onboarding wizard guides you through setup
- It reads the OAuth token from Claude Code's Keychain entry automatically
- Add the widget: right-click desktop > Edit Widgets > search "TokenEater"
TokenEaterApp/ App host (menu bar, popover, main window, overlay, onboarding)
├── TokenEaterApp.swift # @main + AppDelegate, store wiring
├── StatusBarController.swift # AppKit menu bar item + popover hosting
├── MainAppView.swift # Main floating window (sidebar + sections)
├── Popover/ # Popover dashboard layouts (Classic / Compact / Focus)
├── Onboarding/ # Onboarding wizard + cards
├── OverlayWindowController.swift, OverlayView.swift # Agent Watchers overlay
├── Resources/ # Sparkle public key + installer applet
└── TokenEaterApp.entitlements
TokenEaterWidget/ Widget Extension (sandboxed, read-only)
├── TokenEaterWidget.swift # @main WidgetBundle (usage + pacing widgets)
├── Provider.swift # TimelineProvider
├── *WidgetView.swift # SwiftUI widget views
├── Info.plist
└── TokenEaterWidget.entitlements
Shared/ Shared code (compiled into all targets)
├── Models/ Pure Codable structs
├── Services/ Protocol-based I/O (+ Protocols/)
├── Repositories/ UsageRepository (API -> shared file)
├── Stores/ ObservableObject state containers
├── Helpers/ Pure functions
├── Components/ Reusable SwiftUI views (app + widget)
├── Design/ Design tokens
└── en.lproj / fr.lproj Localization (EN / FR)
- Endpoint:
GET https://api.anthropic.com/api/oauth/usage - Auth:
Authorization: Bearer <oauth-token> - Response:
five_hour.utilization— Session (5h sliding window)seven_day.utilization— Weekly all modelsseven_day_sonnet.utilization— Weekly Sonnet only
The OAuth token is managed by Claude Code and refreshes automatically.
| Problem | Solution |
|---|---|
| Widget shows error | Reopen the app and check connection in Settings |
| Widget shows "Open app" | Launch the app and complete onboarding |
| Build fails | Verify sudo xcode-select -s /Applications/Xcode.app/Contents/Developer points to Xcode.app |
| Widget flagged as malware | You're running an ad-hoc local build that stripped its quarantine attrs. Either reinstall via the official notarized DMG from Releases, or rebuild + approve via System Settings -> Privacy & Security -> Open Anyway |
| Widget not visible | Disconnect/reconnect your session or restart |