ccusage: Track Claude Code and Codex Token Cost
ccusage is a free open-source CLI that shows what your Claude Code and Codex sessions cost at API rates. It ranks sessions so you can find the expensive ones.
The main idea
If you use a coding agent such as Claude Code or Codex, ccusage shows where your tokens go. It is free and open source, and one command installs it.
Running ccusage claude daily lists my cost at API rates for each day. The total looks like thousands of dollars, but I pay for a $200 plan. The session command is the more useful one. I saved the output to sessions.txt, and the list starts with the most expensive session. My top session cost about $824, and I used Fable 5 and Sonnet 5 models in it. It ran over a couple of days.
Long sessions get expensive because of the cache. If you take a break longer than 1 hour, the cache expires. The whole context is sent again, and you pay to read it and write it to the cache. My fix is to save progress in a handover document and continue in a new session. Plain ccusage reads Claude, Codex, Gemini, Hermes, Open Claw, Open Code, Pi Agent and Qwen sessions.
Key points
- ccusage is a free, open-source CLI that installs with one command.
- ccusage claude daily shows cost at API rates for each day, including the most and least expensive days.
- The session subcommand ranks sessions from most expensive down; save the output to a file because the list is long.
- A break longer than 1 hour expires the cache, and the whole context is resent and paid for again.
- Save progress in a handover document and continue in a new session after a long break.
- Plain ccusage reads sessions from Claude, Codex, Gemini, Hermes, Open Claw, Open Code, Pi Agent and Qwen.
Chapters
- 0:12Install and daily cost
- 1:16Most expensive sessions
- 2:16Why long sessions cost more
- 3:26Supported agents
Save my free seat →