How to reduce Codex token usage: 7 habits that work
Short chats, compaction, fewer files and fewer MCP servers, checked against a week of your own numbers.
By ClaudeGPT Si Newsroom · Editorial team
· 3 min read
The fastest way to reduce Codex token usage is to keep each chat short and focused: start a new chat for each task, compact long ones, and give Codex only the files it needs. Before you change anything, measure where your tokens go, because you cannot tell which habit helped without a before and after.
Most of these tips come from OpenAI's own Codex pricing page, which lists ways to make a usage allowance last longer. The rest follow from how an agent spends tokens.
Why Codex burns tokens
Everything Codex reads or writes costs tokens: your prompt, the files it opens, the chat history, tool results and its reply. An agent sends the whole conversation back to the model on each turn. So the longer a chat runs, the more each new message costs, even if the message itself is one line.
7 habits that cut Codex token usage
1. Measure first with UsageAtlas
Pick a normal week and record it. UsageAtlas, a free and open-source desktop app, reads your local Codex activity and shows tokens, requests, models and estimated cost by day. It also splits input, output and cached tokens, so you can see whether a heavy day came from long context or from a lot of output. Run the same check after you change your habits.
2. One task, one chat
Type /new to start a fresh chat in the same CLI session when you switch tasks. The old conversation stops riding along with every turn. /clear does the same and also clears the terminal.
3. Compact long runs
/compact summarizes the visible chat to free tokens. OpenAI suggests it after long runs so Codex keeps the key points without filling the context window. Codex also compacts on its own once a chat passes a threshold, which you can tune with model_auto_compact_token_limit in config.toml.
4. Point at files instead of the whole repo
Use /mention to attach the files Codex should look at. OpenAI's advice is to give only relevant sources and narrow them where you can. A pasted log or a large generated file can cost more than the rest of the task.
5. Trim AGENTS.md
Codex adds your AGENTS.md files to the prompt, joining them from the repository root down until it reaches a size cap (32 KiB by default). Keep the root file short and move folder-specific notes into nested AGENTS.md files.
6. Turn off MCP servers you do not use
OpenAI notes that every MCP server adds context to your messages and uses more of your limit. Run /mcp to see what is connected and disable the ones this project does not need.
7. Ask for the output you need
Say what format and length you want, and separate required work from nice-to-have extras. Output tokens are priced higher than input in OpenAI's Codex rate table, so a tighter answer is a cheaper one.
Quick reference
| Habit | Command or setting | What it saves |
|---|---|---|
| Measure | UsageAtlas | Tells you what to fix |
| Fresh chat per task | /new or /clear | Resent history |
| Compact | /compact | Long chat history |
| Narrow files | /mention | Unneeded input |
| Short AGENTS.md | Nested AGENTS.md files | Repeated instructions |
| Fewer tools | /mcp | Tool definitions in every message |
| Tight output | Clear format and length | Output tokens |
When not to bother
If Codex rarely stops you and your bill looks fine, a fresh chat per task is probably all you need. The other habits matter most on long agent runs, big repositories and plans where you hit the limit most weeks.
Check that it worked
Compare a week before and a week after in the UsageAtlas desktop app. Cost figures there are estimates; your OpenAI account is the real bill. It also shows your Codex session and weekly windows where Codex reports them, so you can see whether the limit lasts longer.