How to see Codex token usage by session

Codex records the token counts for every reply in log files on your Mac. Adding them up per session shows which one used the most.

Where the numbers are

Codex writes its sessions under ~/.codex/sessions/, in folders by year, month and day. Each file is one session. Inside, every model reply has a usage record holding input tokens, cached input tokens and output tokens.

One difference from Claude Code

In Codex's records, the input figure already includes the cached part. In Claude Code's records the fresh, cache-written and cache-read amounts are listed separately and have to be added. If you are combining the two tools in one report, treat them differently or one of them will be counted wrong.

What the same ideas look like in Codex

A week on one machine

On the author's Mac, Codex was used on five of seven days, between 9 and 523 replies a day, for a total between 0.6 million and 46 million tokens a day. Claude Code on the same machine used many times that, so the two need to be seen side by side to know where to look first.

The figures on this page come from real session logs on the author's Mac, read with Cost Doctor. Your numbers will differ; the pattern usually does not.

Seeing both tools together

Cost Doctor reads Codex and Claude Code logs into one list. Each session is labelled with its tool, and the daily total covers both. Its figures for Codex were checked against a separate count of the same log files and matched exactly.

See it on your own sessions

Cost Doctor is a Mac menu bar app that reads the logs Claude Code and Codex already write. It names the session that is using your tokens, says why, and turns your screen red when a check fails while an agent sits waiting. Nothing leaves your Mac.

Download the free trialHow it works

14 days free, no account. Then $19 once, plus tax where it applies. For Apple silicon and Intel Macs on macOS 13 or later.