How to Track Claude Code and Codex Usage and Cost (2026)
The fastest Claude Code usage tracker is already installed: run /usage (with /cost and /stats as aliases) to see your plan usage bars and a session cost estimate, and run /status in the Codex CLI to see your remaining limits. For a number that stays on screen, put Claude Code's documented rate_limits fields in its status line. For history by day, model, or project, use ccusage in a terminal or Agentastic's Usage & Cost panel on a Mac; for limits in the menu bar, use CodexBar.
Everything below was reviewed against first-party documentation and each tool's GitHub repository on October 5, 2026.
Pick the right tracker#
| Tool | What it answers | Data source | Claude Code | Codex | Runs on | Price / license |
|---|---|---|---|---|---|---|
/usage in Claude Code | How much of my plan is used, and by what? | Your Anthropic account and local session history | Yes | No | Wherever Claude Code runs | Included |
| Claude Code status line | What's left right now? | Session data Claude Code sends your script | Yes | No | Your terminal | Included |
Codex /status and /usage | What's left, and how many tokens did I use? | Your OpenAI account | No | Yes | Codex CLI | Included |
| ccusage | What did each day, month, or session cost? | Local agent logs | Yes | Yes, plus other CLIs | Terminal via npx, bunx, or Nix | Free, MIT |
| Claude Code Usage Monitor | Will I hit the limit before it resets? | Local logs, optional status-line capture | Yes | No | Terminal (Python) | Free, MIT |
| CodexBar | When does each window reset? | Your existing provider sign-ins | Yes | Yes, plus others | macOS 14+, Linux | Free, MIT |
| Agentastic Usage & Cost | Quota per login, plus cost by model and project | Provider APIs for quota, local logs for history | Yes | Yes | macOS 14+ | Free app |
Quota and cost are different numbers#
Most confusion about "usage" comes from mixing two measurements.
Subscription quota is what Pro, Max, and ChatGPT plans meter. Anthropic says Pro and Max limits are shared across Claude and Claude Code, so chat in the browser and agent work in the terminal draw from the same allowance. Claude Code reports a rolling five-hour window and a weekly window, each as a percentage used plus a reset time, not as a token balance you can count down. OpenAI's Codex pricing page describes five-hour usage periods on some plans, says weekly limits may also apply, and notes that local messages and cloud chats share one allowance.
API cost is what you pay per token when you sign in with an API key or a Console account. Local tools compute dollar figures from token counts at list prices, so they are estimates. The authoritative numbers are on the Claude Console usage page and OpenAI's Platform Usage page.
Cost still matters on a subscription. An API-price estimate of a month's work is the clearest way to judge whether a bigger plan, a smaller one, or pay-as-you-go fits how you work.
Check Claude Code usage from inside a session#
| Command | What it shows |
|---|---|
/usage | Session cost and token estimate; on Pro, Max, Team, and Enterprise plans, plan usage bars, activity stats, and a breakdown of what counted against your limits |
/cost, /stats | Aliases for /usage; /stats opens on the Stats tab |
/context | How full the current context window is, as a colored grid with suggestions |
/status | Version, model, account, and connectivity: confirm which login you are spending |
/insights | An HTML report on how you use Claude Code; generating it spends tokens |
/rate-limit-options, /usage-credits | What you can do when a plan limit blocks a request |
The breakdown in /usage attributes recent usage to skills, subagents, plugins, and individual MCP servers, and flags behaviors such as long context or cache misses when they account for 10% or more. Press d or w to switch between the last 24 hours and the last 7 days. Anthropic notes these figures are approximate and computed from local history on this machine, so usage from claude.ai or another computer isn't included.
For subscribers, the Session block's dollar figure is not a bill. It is what the session would cost at list price, which is useful mainly for comparison.
Show remaining limits in the status line#
Claude Code's status line runs a script of your choice and passes it session data as JSON. The documented fields include rate_limits.five_hour.used_percentage, rate_limits.seven_day.used_percentage, context_window.used_percentage, and cost.total_cost_usd. That is enough to answer "how much do I have left" without opening anything.
-
Save this script as
~/.claude/statusline.sh. It needsjq.bash#!/bin/bash # Model | context used | 5-hour and 7-day plan usage | session cost estimate input=$(cat) model=$(jq -r '.model.display_name' <<<"$input") ctx=$(jq -r '.context_window.used_percentage // 0' <<<"$input") five=$(jq -r '.rate_limits.five_hour.used_percentage // empty' <<<"$input") week=$(jq -r '.rate_limits.seven_day.used_percentage // empty' <<<"$input") cost=$(jq -r '.cost.total_cost_usd // 0' <<<"$input") line="$model | ctx ${ctx%.*}%" [ -n "$five" ] && line="$line | 5h ${five%.*}%" [ -n "$week" ] && line="$line | 7d ${week%.*}%" printf '%s | $%.2f\n' "$line" "$cost" -
Make it executable:
bashchmod +x ~/.claude/statusline.sh -
Point your user settings at it in
~/.claude/settings.json:json{ "statusLine": { "type": "command", "command": "~/.claude/statusline.sh" } }
The rate_limits object appears only for claude.ai Pro and Max subscribers, and only after the first response in a session, so the script prints the plan segments only when they exist. The status line runs locally and doesn't consume tokens. If you prefer not to write a script, /statusline can generate one from a plain-language description.
If you keep several logins with CLAUDE_CONFIG_DIR, each profile has its own settings.json, so add the status line to each one. Using multiple Claude Code and Codex accounts covers that setup.
Codex has a built-in equivalent. Type /statusline in the Codex CLI and pick footer items; the choices include rate limits, token counters, and context stats, and Codex saves them to tui.status_line in config.toml.
Check Codex usage#
/statusin the Codex CLI shows the active model, approval policy, and token usage. OpenAI's pricing page names it as the way to see remaining limits during a session./usageopens account usage./usage daily,/usage weekly, and/usage cumulativejump straight to your ChatGPT token activity; without a supported sign-in, Codex asks you to sign in instead.- The usage dashboard at chatgpt.com/codex/settings/usage shows current limits and reset times.
- With an API key, Codex bills at standard API rates, so check the Platform Usage page instead.
Track history and cost with ccusage#
ccusage reads the logs agent CLIs already write and summarizes them. It started as a Claude Code tool and now reads Codex, OpenCode, Gemini CLI, GitHub Copilot CLI, and more than a dozen other sources. No install is needed:
npx ccusage@latest # every detected agent, by day
npx ccusage@latest claude monthly # Claude Code only, by month
npx ccusage@latest codex daily # Codex only, by day
npx ccusage@latest daily --since 2026-09-01 --breakdown # per-model costs since September 1
npx ccusage@latest blocks # Claude Code five-hour windows
npx ccusage@latest daily --json # machine-readable outputIf you split accounts across config directories, ccusage accepts comma-separated lists in the same variables:
CLAUDE_CONFIG_DIR="$HOME/.claude,$HOME/.claude-work" npx ccusage@latest claude monthly
CODEX_HOME="$HOME/.codex,$HOME/.codex-work" npx ccusage@latest codex dailyThe comma-separated form is a ccusage feature. Don't export it for Claude Code or Codex themselves, which expect a single directory.
Three caveats. Costs are estimates from a public pricing table, not your invoice. The old blocks --live monitor was removed in ccusage v18, so use the status line or a monitor for a live view. And ccusage can only count logs that still exist, which brings up retention.
Why history stops after 30 days#
Claude Code deletes session transcripts older than its cleanupPeriodDays setting, which defaults to 30 days. Every log-based tracker, including ccusage, Agentastic, and your own scripts, sees only what is left. To keep a longer history, raise the setting in ~/.claude/settings.json:
{
"cleanupPeriodDays": 90
}Weigh that against privacy. Anthropic notes that transcripts are plaintext and can contain anything a tool read, including the contents of a .env file.
Live monitors and menu bar apps#
Claude Code Usage Monitor is a Python terminal dashboard with burn-rate predictions and warnings. Install it with uv tool install claude-monitor and run claude-monitor. Its v4 release can capture Claude Code's official rate_limits through a status-line mode and falls back to clearly labeled local estimates when that data is stale. See the project on GitHub.
CodexBar is a small menu bar app for macOS 14 and later, installed with brew install --cask codexbar. It shows each provider's session, weekly, and monthly windows with a countdown to reset, using the sign-ins you already have. A Linux desktop version exists too. See the project on GitHub.
Team dashboards: OpenTelemetry and admin consoles#
Tools that read one laptop's logs only show one person's usage. For a team, Claude Code can export metrics through OpenTelemetry:
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317The claude_code.token.usage and claude_code.cost.usage metrics can be broken down by user, model, and more in your own dashboards. Anthropic's cost guide maps each setup to its official spend view: org analytics for Team and Enterprise, the Console for API organizations, and your cloud console for Bedrock and similar providers.
Agentastic's Usage & Cost view#
Agentastic is a native macOS workspace for running Claude Code, Codex, and other agents in parallel. Its Usage & Cost panel puts both measurements in one editor tab. Open it with View → Usage (Cmd+Opt+U) and split it beside a chat if you want to watch the numbers move.
Quota, per login. The top half shows one card per login for Claude, Codex, and Grok. Each card shows the provider's own rate-limit windows, such as the five-hour and weekly windows, with a countdown to reset, refreshed every five minutes. Separate work and personal logins get separate cards. When a token needs renewing, the card shows the exact sign-in command.
History, from logs already on disk. The bottom half reads Claude Code's JSONL transcripts and Codex's rollout logs. Nothing is uploaded, and history includes work you did before installing Agentastic. You can switch between cost and tokens; choose a week, month, or quarter; hide a provider; or pin a single day.
| Panel element | What it shows |
|---|---|
| Stat strip | Processed tokens, cached input, uncached input, output, and dollars saved by prompt caching |
| By model | Cost, share, and tokens per model |
| By workspace | Cost per project directory |
Summing these logs naively overcounts. Claude Code writes a growing usage snapshot per content block, and resume, fork, and compaction can copy the same API call into several files; Codex logs both running totals and per-turn deltas, and repeats the same delta on UI refreshes. Agentastic gives every event a dedup key, keeps only the largest Claude snapshot, and reads the Codex fields that don't double count. Whatever tracker you use, compare its totals with /usage or your provider's dashboard once before you rely on them.
Costs are estimates at published pay-as-you-go rates from a versioned rate table with a visible freshness stamp. On a subscription, read them as "what this would cost on the API."
To see quota while you work, turn on Show Subscription Usage for an agent in Settings → Agents. The Inspector's Agents card then shows a compact bar such as 58% 5h · 41% wk.
The tradeoffs: Agentastic runs on macOS 14 or later only. The panel covers this Mac: agents on remote hosts or cloud VMs aren't included yet. And like every log-based tracker, its history ends where the CLIs' retention ends.
Which tracker should you use?#
- "Will I hit the limit today?" Use
/usagein Claude Code or/statusin Codex, or add the status line above. - "What did last month cost, and on which model?" Run ccusage, or open Agentastic's panel and switch to the month view.
- "Show me every login's limits without asking." Use CodexBar in the menu bar, or Agentastic's quota cards and Inspector.
- "I manage a team." Use OpenTelemetry plus the admin console for your plan.
Download Agentastic if you want quota, history, and your agents in one window, or start with the built-in commands; they cost nothing to try.
Sources and further reading#
- Manage costs effectively (
/usage, plan breakdown,/insights) — Claude Code docs - Commands reference — Claude Code docs
- Customize your status line (
rate_limitsfields) — Claude Code docs - Monitoring with OpenTelemetry — Claude Code docs
- The
.claudedirectory and retention — Claude Code docs - Use Claude Code with your Pro or Max plan — Claude Help Center
- Codex pricing and usage limits — Codex docs
- Codex CLI slash commands — Codex docs
- ccusage on GitHub
- Claude Code Usage Monitor on GitHub
- CodexBar on GitHub
- Usage & Cost — Agentastic docs
- IDE overview: agent subscription usage — Agentastic docs
- Supported Providers — Agentastic docs
- Run multiple Claude Code agents in parallel
- Best IDE for Claude Code on Mac
Frequently asked questions#
How do I check my Claude Code usage?#
Run /usage inside Claude Code. It shows a session cost estimate and, on Pro, Max, Team, and Enterprise plans, plan usage bars and a breakdown of what counted against your limits. /cost and /stats are aliases for the same screen.
How many tokens do I have left in Claude Code?#
It depends on which limit you mean. Plan usage is reported as a percentage of a rolling five-hour window and a weekly window, in /usage or in the status line's rate_limits fields. The context window is separate: /context shows how full the current conversation is.
Does /cost work on a Claude Pro or Max plan?#
Yes, but /cost is now an alias for /usage, and its session dollar figure is an estimate at API list prices. Subscribers aren't billed that amount; the plan usage bars on the same screen are the numbers that matter for your limits.
How do I check Codex usage limits?#
Type /status in the Codex CLI to see your remaining limits, or open the usage dashboard at chatgpt.com/codex/settings/usage. In the CLI, /usage daily, /usage weekly, and /usage cumulative show your token activity.
What is ccusage?#
ccusage is a free, MIT-licensed command-line tool that reads the logs Claude Code, Codex, and other agent CLIs write to your disk and turns them into daily, weekly, monthly, and session reports with estimated costs. You can try it without installing anything by running it through npx.
Is there a Claude Code usage tracker for Mac?#
Yes. CodexBar is a free menu bar app for macOS 14 and later that shows provider limits and reset times, and Agentastic's Usage & Cost panel combines per-login quota with token and cost history. Terminal tools such as ccusage also run on a Mac.
Why does my Claude Code usage history only go back 30 days?#
Claude Code deletes session transcripts older than its cleanupPeriodDays setting, which defaults to 30 days, and log-based trackers can only count what is still on disk. Raise cleanupPeriodDays in your settings if you want a longer history.