Codex

View Codex token usage

View Codex token usage on your machine: tokens, requests, models, and estimated cost from local session activity, with history you can reopen.

Quick answer

In the Codex CLI, type `/status` to see the active model, context usage, and token counts for the current session. For history, read the JSONL files under `~/.codex/sessions` or open UsageAtlas, which parses those files and totals input, cached, output, and reasoning tokens per session.

Check token usage in the Codex CLI

Codex keeps a running tally for the session you are in. The fastest view is the status panel inside the TUI.

  1. Start codex in the project you are working on.
  2. Type /status and press Enter. The panel shows the model, approval mode, working directory, context window usage, and token counts.
  3. Type /context if your build exposes it, to see what is filling the window: system prompt, instructions, conversation, and tool output.
  4. Press Esc to return to the prompt. The numbers refresh as the session grows.

The status panel is per session. It resets when you start a new conversation, which is why the number can look small even after a long day. If you want the total across sessions, you need the session files or a tracker.

codex --version
codex
/status

What each token number means

Codex reports four numbers. They are not additive in the way most people assume, so read the labels before you add anything up.

FieldWhat it countsWhere it shows up
InputEverything sent to the model, including cached contextStatus panel, session log, usage views
Cached inputThe part of the input the provider served from its prompt cacheSession log, token detail views
OutputTokens the model generated, including reasoning tokensStatus panel, session log
ReasoningInternal thinking tokens, billed as output but usually shown separatelySession log, detailed views

If you want billable input, subtract cached input from total input. If you want the full picture, keep all four. The Codex token counting guide walks through a worked example.

See token usage across every session

Codex writes a JSONL file per session under ~/.codex/sessions, or under $CODEX_HOME/sessions if you set that variable. Each file contains the messages and a token count event you can parse.

  • Windows: %USERPROFILE%\.codex\sessions
  • macOS and Linux: ~/.codex/sessions
  • Custom installs: $CODEX_HOME/sessions

Reading those files by hand gets old after a week. UsageAtlas reads the same folder locally and shows tokens per session, per model, and per day, plus the reset time for the current window. Nothing leaves the machine unless you turn on cloud sync.

Questions, answered

Why does my Codex token count not match my provider bill?

Codex counts the tokens it sends and receives. A provider dashboard may bill cached input at a lower rate, include reasoning tokens differently, or round per request. Compare totals over the same date range and expect small differences.

Does the Codex CLI show token usage for past sessions?

Not in the TUI. Past sessions live in JSONL files under ~/.codex/sessions. Open the file or use a tracker that parses the folder.

Where does Codex store token usage on Windows?

Under %USERPROFILE%\.codex\sessions, unless CODEX_HOME points somewhere else.

Browse by topic