Skip to content

Repository files navigation

claude-pulse

A tiny macOS menu bar app that shows your live Claude usage. It reads the model from your local Claude Code session logs and fetches the 5-hour session utilization directly from claude.ai, so the number matches what claude.ai/settings/usage shows.

Opus 27%

Click the menu bar item to see:

  • Session (5-hour window, from claude.ai)
  • Weekly (7-day window, from claude.ai)
  • Today / This Week / All Time token counts and cost estimates (computed locally from ~/.claude/projects/*.jsonl)
  • Reset times for the session and weekly windows
  • When the data was last fetched

Polls claude.ai every 65 seconds.

Requirements

  • macOS 11 (Big Sur) or later
  • A Claude subscription (Pro / Max / Team) signed in at claude.ai
  • Xcode command-line tools (xcode-select --install) for swiftc

Build

git clone https://github.com/SwagatDas/claude-pulse.git
cd claude-pulse
swiftc main.swift -framework Cocoa -framework WebKit -o ClaudeUsageBar
cp ClaudeUsageBar ClaudeUsageBar.app/Contents/MacOS/ClaudeUsageBar

That produces a standalone ClaudeUsageBar.app in the repo root.

Run

Double-click ClaudeUsageBar.app, or:

open ClaudeUsageBar.app

On first launch a sign-in window opens pointing at claude.ai. Log in as you normally would (email, Google, etc.). The window auto-closes once the app successfully fetches your usage. The session cookie is stored in the app's private WKWebView data store (not in the system Keychain), so you won't need to sign in again on subsequent launches.

If the menu ever shows unavailable or a Status error, use Sign in to claude.ai... in the menu to re-open the login window.

Install to /Applications (optional)

cp -R ClaudeUsageBar.app /Applications/

Run at login (optional)

A launchd plist is included as a template. Update the path to wherever you installed the app, then load it.

# Copy and edit the template
cp com.local.ClaudeUsageBar.plist ~/Library/LaunchAgents/
# Edit the ProgramArguments path inside the copied file to point at your install location
# (default template assumes /Applications/ClaudeUsageBar.app)
open -e ~/Library/LaunchAgents/com.local.ClaudeUsageBar.plist

# Load it
launchctl load ~/Library/LaunchAgents/com.local.ClaudeUsageBar.plist

To unload:

launchctl unload ~/Library/LaunchAgents/com.local.ClaudeUsageBar.plist

How it works

  • Model: scans ~/.claude/projects/**/*.jsonl, takes the message.model field of the assistant message with the latest timestamp, and strips the version (so claude-opus-4-7 renders as Opus).
  • Session / weekly percent: hits https://claude.ai/api/organizations/<org_id>/usage from inside a persistent WKWebView that holds your login cookies. The org id is read from the lastActiveOrg cookie that claude.ai sets.
  • Today / week / all-time token counts: summed from the usage blocks in the local JSONL logs.

Caveats

  • The claude.ai usage endpoint is undocumented. Anthropic can change or remove it without notice, in which case the session/weekly rows will break until the app is updated.
  • Cookie-based auth to claude.ai from a non-browser client may bump into Cloudflare challenges; the bundled WKWebView presents itself as Safari, which clears the checkbox challenge the current rollout uses. If that changes, you may need to re-sign-in more often.
  • Token costs are estimated at Sonnet 4.x public prices and are a rough lower bound, not a bill.

License

MIT

About

A macOS menu bar app that shows live Claude usage (current model and 5-hour session percent).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages