Get more from your Claude and Codex subscriptions.

Rate limits, context health, and token usage for Claude Code and OpenAI Codex — always visible in your macOS menu bar.

Download Free — macOS 13+ Open source · MIT License · No account required

Every feature is free and open source. If AI Battery saves you time, consider sponsoring or buying the App Store version when it launches.

Your rate limits, context usage, and token spend — made visible.

Claude Code and the Codex CLI are powerful tools, but neither surfaces much about how you're using them. AI Battery adds the dashboard, context meter, and token breakdown that make every session more productive — for both.

See rate limits in real time

Know where you stand before you start a task. Countdowns, percentages, and time-to-limit predictions help you pace your work and plan around resets.

Monitor context as you work

Watch context fullness grow across sessions so you can compact or start fresh at the right time — before quality slips or auto-compaction kicks in.

Understand your token usage

Millions of tokens flow through your sessions. With per-model breakdowns, per-project tracking, and cost estimates, you can see exactly where your budget goes.

Track rate limits, context health, and token usage in one click.

Rate limit countdowns, context window fullness, per-model token breakdowns, and per-project cost for Claude Code and Codex — in a native macOS menu bar popover.

Two Providers

Claude Code and OpenAI Codex in one battery. Sign in to Codex with ChatGPT, import your Codex CLI login, or paste an OpenAI API key. Every label, link, and cost follows the active account's provider.

Rate Limits

Claude's 5-hour and 7-day windows, Codex's 5-hour and weekly windows, Business credit budgets, and API-key per-minute limits — each with utilization, live reset countdowns, and time-to-limit predictions. Green celebration when a limit resets.

Context Health

Track your 5 most recent sessions with live context fullness — 1M-token windows for current Claude models, ~258K for GPT-5-family models via Codex. Copyable session IDs, relative timestamps, and smart warnings when a conversation gets too long.

Token Usage

Per-model breakdown: input, output, cache read, and cache write — including subagent usage. Click any value to copy it. A persistent ledger keeps Claude totals from dropping when Claude Code rebuilds its cache; Codex totals are a high-water mark since the first scan.

Insights

Unified activity charts with hover tooltips across 5 hours, 7 days, and 12 months. Time-windowed cost breakdowns, cumulative stats, trend arrows, throttle tracking, and your all-time busiest day.

Per-Project Usage

See which projects use the most tokens and cost, for Claude Code and Codex sessions alike. Sort by tokens, cost, or name. Search across projects, expand to see your top 10, and copy any row with one click.

Smart Alerts

Get notified on Anthropic or OpenAI outages and when your usage crosses a threshold you set. Star-shaped glow system shows severity at a glance — from subtle glow to starburst rays when throttled.

Multi-Account

Up to 3 Claude and 3 Codex accounts side by side. Switch from the account chip in the header — each account keeps its own limits, tokens, and identity, and sign-in emails are masked by default.

Your context window is a budget. Spend it wisely.

Claude Code and Codex sessions carry their prior messages, file reads, and tool output as context. As that context grows, each turn has more history to process. Anthropic documents auto-compaction once context exceeds 95% capacity, which replaces earlier detail with a summary instead of the full session history.

Why this matters

  • Larger context usually means more tokens per turn and more history for Claude to process.
  • After auto-compaction, earlier detail is represented by a summary rather than the full original context.
  • Starting fresh or compacting earlier keeps sessions more focused and easier to manage.
  • Under 60% — AI Battery treats this as comfortable headroom.
  • 60–80% — AI Battery uses this as an early warning to compact or start fresh.
  • Over 80% — AI Battery treats this as a strong warning, even though Anthropic documents auto-compaction later.
AI Battery context health view showing session context window fullness

See where your tokens go. Project by project.

AI Battery reads the working directory from each Claude Code or Codex session log and groups token usage by project. You get a ranked breakdown showing which codebases consume the most tokens and their API-equivalent cost — so you can make informed decisions about how you spend your time.

Why this matters

  • Know which projects are token-heavy before you hit a rate limit. Shift work to lighter repos when you're running low.
  • Compare API-equivalent costs across projects to see which ones deliver the most value for your subscription.
  • Sort by tokens, cost, or name. Expand to see all projects or filter by name when you have many repos.
AI Battery per-project token usage breakdown showing ranked projects by tokens and API-equivalent cost

Know your patterns. Not just your totals.

AI Battery tracks your Claude Code and Codex usage across three time windows — 5 hours, 7 days, and 12 months — so you can spot trends before they become problems. See when you're most active, how usage compares to yesterday, and whether you're on track to hit a limit.

What you'll see

  • Interactive area charts with hover tooltips showing exact values, timestamps, and throttle events for each data point.
  • Trend arrows with week-over-week and month-over-month comparisons, plus your busiest day and peak hour.
  • API-equivalent cost breakdown per model and time window — see what your subscription saves you compared to pay-per-token rates.
AI Battery activity chart showing 5-hour token usage trends, throttle tracking, and API-equivalent cost

Your token totals should never go backwards.

Claude Code tracks tokens in a local cache file (~/.claude/stats-cache.json) by scanning your session logs. But that cache gets rebuilt periodically — and when old logs are pruned or archived, the rebuild includes fewer files. Your totals drop, even though your actual usage hasn't changed. A user who accumulated 5 million tokens might suddenly see 3 million after a cache rebuild.

How AI Battery calculates tokens

  • AI Battery reads two local sources: Claude Code's stats cache for historical aggregates, and your raw JSONL session logs for live data. It never sends token data anywhere.
  • Per-model breakdown shows input, output, cache read, and cache write tokens — click any value to copy it. Models are sorted by usage, active first.
  • Optional API cost estimates show what your usage would cost at pay-per-token rates, so you can see whether your subscription tier is worth it.

The persistent ledger

AI Battery maintains a high-water-mark ledger at ~/Library/Application Support/AIBattery/token-ledger.json. On every refresh, it compares the current token counts against the stored maximums and keeps whichever is higher. Totals only ever stay the same or increase — they never drop due to a cache rebuild. It's automatic, per-account, and takes up a few KB.

Codex has no stats cache, so its all-time figures are a high-water mark since AI Battery first scanned ~/.codex/sessions: they survive rollout rotation, but nothing earlier can be recovered.

Local Data Your data stays on your machine
Zero Tracking No analytics, no telemetry
1,385 Tests Across 105 test files
MIT License Free and open source
890 Downloads on GitHub
23 Stars on GitHub

Frequently asked questions

Is AI Battery free?

Yes. AI Battery is free, open source, and MIT-licensed. Every feature is included — no paywalls, no premium tier. An App Store version is coming for convenience (auto-updates, signed & notarized), and you can support development via GitHub Sponsors.

Does it send my data anywhere?

No. AI Battery reads Claude Code's and the Codex CLI's local session logs for token counts and context health — never your message content. It makes minimal network requests to your provider (Anthropic or OpenAI) for rate limits, to the provider's status page for outage alerts, and to GitHub for update checks. There's no analytics, no telemetry, and no third-party tracking. Read the privacy policy →

Does AI Battery support OpenAI Codex?

Yes, since v3.0. Add a Codex account by signing in with ChatGPT (the browser redirects straight back to the app — nothing to paste), by importing your existing Codex CLI login, or with an OpenAI API key. ChatGPT subscriptions show 5-hour and weekly windows plus any purchased-credit balance; Business and Enterprise spend controls show one Credits budget bar; API keys show OpenAI's per-minute request and token limits with real spend at API rates. See how to add accounts →

What macOS versions are supported?

macOS 13 (Ventura) and later. AI Battery is a native Swift app built with SwiftUI, so it runs efficiently on both Apple Silicon and Intel Macs.

How does it track rate limits?

For Claude accounts, a minimal API call reads your 5-hour and 7-day usage (about 3 tokens per refresh). For Codex accounts, it reads the ChatGPT usage endpoint (no tokens spent), falling back to the newest Codex CLI session log if the endpoint is unreachable. API-key accounts send a 16-token probe to read OpenAI's per-minute limit headers. Token counts and context health always come from local session logs. Read the full guide →

What is context health?

Every Claude Code or Codex session has a large context window that fills up with messages, file reads, and tool results. AI Battery shows how full each session's context is, so you know when to compact or start fresh before the session gets heavy. See how it works →

Which plans are supported?

Claude Pro, Max 5×, and Max 20× subscriptions; for Codex, ChatGPT Free, Plus, Pro, and Team subscriptions plus Business and Enterprise spend-control workspaces; and OpenAI API keys. AI Battery reads the plan from your provider and adapts the layout — windows, a Credits bar, or API limits. Compare Claude plans →

How do Claude Code rate limits work?

Claude Code enforces two rate limit windows: a 5-hour burst limit and a 7-day sustained limit. When you hit either limit, Claude pauses your session until the window resets. AI Battery tracks both in real time — showing utilization percentages, reset countdowns, and time-to-limit predictions so you can pace your work and avoid getting blocked mid-task. Read the full guide →

How do Codex rate limits work?

Codex on a ChatGPT subscription has a 5-hour window and a weekly window; AI Battery shows the percentage used that the usage endpoint reports for your plan, with a reset countdown for each. Business and Enterprise workspaces use a credit budget instead of windows. API keys are limited per minute by requests and by tokens, and every request is billed at OpenAI's API rates. Reaching 100% means you are at capacity; AI Battery only shows a throttle when the provider actually reports one. Read the full guide →

What happens when the context window fills up?

Every session has a large context window. As it fills with messages, file reads, tool calls, and responses, each turn gets heavier. Anthropic documents auto-compaction once context exceeds 95% capacity, which replaces earlier detail with a summary. AI Battery monitors context fullness so you can compact or start fresh earlier. Read the full guide →

Can I see how many tokens a session uses?

Yes. AI Battery shows a per-model breakdown of input tokens, output tokens, cache read tokens, and cache write tokens for Claude and GPT models — click any value to copy it. Claude totals persist across Claude Code cache rebuilds via a local ledger. API-equivalent cost is always on, so you can see what your subscription saves you compared to pay-per-token rates. See all features →

Can I see which projects use the most tokens?

Yes. AI Battery reads the working directory from each Claude Code or Codex session and groups token usage by project. You get a ranked breakdown showing which codebases consume the most tokens and their API-equivalent cost. Sort by tokens, cost, or name, and expand to see all projects. See project tracking →

Can I use AI Battery with multiple accounts?

Yes. Up to 3 Claude and 3 Codex accounts, switched from the account chip in the popover header. Each account gets its own rate limits, token stats, and persistent ledger — ideal for separate personal and work orgs, or Claude and Codex side by side. See settings guide →

Does AI Battery work with Claude Desktop or the Anthropic API?

No. AI Battery is built for the Claude Code CLI and the Codex CLI: it reads their local session logs and your subscription's usage endpoints. Claude Desktop, claude.ai, and ChatGPT web usage are not tracked. Direct API usage is supported only through OpenAI API keys.

How do I install AI Battery?

The easiest way is via Homebrew: run brew tap KyleNesium/tap && brew install --cask aibattery. You can also use the one-line curl installer or download the DMG directly from GitHub Releases. AI Battery requires macOS 13 (Ventura) or later, plus Claude Code and/or the Codex CLI, and runs natively on both Apple Silicon and Intel Macs.

Download free from GitHub

Open source, MIT-licensed, every feature included. No account required.

brew tap KyleNesium/tap && brew install --cask aibattery

Requires macOS 13+ and Claude Code and/or the Codex CLI. If it saves you time, consider sponsoring the project or buying the App Store version when it launches.