Codex CLI Token Limit: Check Usage, Plan Limits & Fixes [2026]
Codex CLI usage comes out of your ChatGPT plan, metered in tokens and credits across a weekly window (and, on some plans, a rolling 5-hour window). Run /status inside Codex to see exactly where you stand. This guide covers checking usage, the limits per plan as of October 2026, what happens when Codex stops mid task, the model_auto_compact_token_limit setting, and how to make a weekly allowance last 3-5x longer.
How to check your Codex CLI usage
Inside any Codex session, type /status. It shows the model you are on, how much of the context window the current session has used, the percentage of your weekly limit consumed, your 5-hour window if your plan has one, remaining purchased credits, and when each window resets. This is the only number that matters when you are wondering whether to start a big task.
- ✓/status in the Codex CLI: live percentages for the weekly and 5-hour windows, plus reset times and context usage.
- ✓Usage dashboard: chatgpt.com/codex/settings/usage shows the same allowance across the CLI, IDE extension, the Codex desktop app, and cloud tasks, because they all share one pool.
- ✓API-key sign-in: there is no plan limit. Usage is billed per token at API prices and shows up in your OpenAI platform usage page instead.
- ✓Third-party trackers (for example the ccusage codex package) read local session logs. They are handy for history but /status is the source of truth for what OpenAI will actually enforce.
Codex token limits by ChatGPT plan (October 2026)
Codex is included in every ChatGPT tier: Free, Go, Plus, Pro, Business, Education, and Enterprise, and it also works with a pay-as-you-go API key. Limits are not a fixed message count. OpenAI meters tokens and credits, so a long reasoning turn or a task that reads many files burns more of the window than a quick question. The figures below are from OpenAI's own Codex pricing docs and are estimates, not guarantees.
| Plan | Windows enforced | Approximate local messages per 5-hour window | Extra usage |
|---|---|---|---|
| Free / Go | Weekly, small allowance | Not published | Upgrade plan |
| Plus | Weekly, plus a rolling 5-hour window (temporarily lifted since July 2026) | GPT-6 Luna: 350-3,000. GPT-6.1 Sol: 15-160. GPT-6 Astra: 5-45 | Buy credits |
| Pro | Weekly only. OpenAI states Pro currently has no five-hour limit | Several times Plus | Buy credits |
| Business (standard) | Same shape as Plus, per seat | Same estimates as Plus | Workspace credits |
| Enterprise / Edu | Set by your admin | Varies | Workspace credits (flexible pricing) |
| API key | None (billed per token) | Unlimited, you pay the bill | n/a |
Two things changed in 2026 that older guides miss. First, since April 2 OpenAI meters Codex in credits and tokens rather than counting messages, which is why the same prompt can cost very different amounts depending on how long the model thinks. Second, on July 12 OpenAI temporarily removed the 5-hour limit for Plus, Pro, and Business and reset everyone's usage. The weekly limit still applies, and OpenAI has not said when the 5-hour window returns, so treat /status as the authority rather than any table, including this one.
The model you pick matters more than the plan. On Plus, the docs estimate roughly 350-3,000 messages per window on GPT-6 Luna but only 5-45 on GPT-6 Astra. Running Astra for routine edits is the fastest way to drain a week in a day.
What happens when Codex runs out of tokens mid task
Codex stops the current turn and prints a message along the lines of "You've hit your usage limit. Try again in 4 days 2 hours 46 minutes." The countdown tells you which window you hit: hours means the 5-hour window, days means the weekly one. Nothing is lost. Edits Codex already applied are still in your working tree, and the session transcript is saved, so you can pick the thread back up with codex resume once the window resets.
You have four options at that point:
- Wait for the reset shown in the message. Weekly windows reset seven days after they started, not on a fixed weekday.
- Buy credits. Plus and Pro users can purchase additional credits from the usage dashboard and keep working without changing plans. Business and Enterprise workspaces on flexible pricing can add workspace credits.
- Sign in with an API key instead. Usage then bills at API token prices with no plan window, which is often cheaper than a plan upgrade for a one-off crunch.
- Cut consumption so the next window lasts. The rest of this guide is about that.
What model_auto_compact_token_limit actually does
Codex keeps the whole conversation (your prompts, its replies, every file it read, every command result) in the context window and resends it on each turn. When that history approaches the model's limit, Codex compacts it: it summarizes the older history into a short recap and continues from there. model_auto_compact_token_limit is the token count at which that compaction triggers. It is a number of tokens, not a percentage, and when it is unset Codex uses the default for the active model.
It lives in ~/.codex/config.toml (Codex uses TOML, not JSON). For example:
Two related keys: model_context_window tells Codex how many tokens the active model can hold, and model_auto_compact_token_limit_scope controls whether the threshold counts the whole context ("total", the default) or only growth since the last compaction. You can also force a compaction at any time with /compact.
Why this matters for your weekly limit: Codex bills the tokens it sends, and it sends the full context every turn. A session sitting at 180k tokens of history costs several times more per message than one at 40k. Setting a lower compaction threshold keeps each turn cheaper at the price of losing older detail in the summary.
Why compaction alone does not fix the burn
Compaction runs after the damage is done. A 12,000-token build log or a 20,000-token file read has already been billed on the turn it arrived, and billed again on every turn until compaction summarizes it away. In a typical Codex session, tool output (file reads, grep results, command output) is the bulk of the context, and most of it is noise: timestamps, blank lines, progress bars, repeated boilerplate.
The fix is to shrink tool output before it enters the context. That is what the Token Limits MCP server does. It gives Codex eight tools (local_read, local_search, local_exec, local_ls, local_json, local_diff, local_map, local_expand) that return compressed results, typically 60-90% smaller, with a local_expand tool to pull the full original when Codex actually needs it.
Install Token Limits for Codex (about 2 minutes)
On macOS or Linux:
- curl -fsSL https://tokenlimits.app/api/install | bash
- token-limits setup (paste your license key; the free trial key comes with signup, no card needed)
- token-limits setup-codex (writes a [mcp_servers.token-limits] entry into ~/.codex/config.toml and leaves your other settings alone)
- Restart Codex, then type /mcp. You should see token-limits with its eight tools listed.
On Windows, run this in PowerShell. It downloads the native MCP binary, asks for your key, and writes the Codex config for you:
Codex then prefers the compressed tools for reads, searches, and shell commands. Pairing this with a sensible model_auto_compact_token_limit covers both sides: less noise enters the context, and what does enter gets summarized sooner.
Seven habits that stretch a weekly allowance
- ✓Run /status before any large refactor so you are not surprised halfway through.
- ✓Match the model to the task. Use the lighter model for routine edits and reserve the heavy reasoning model for the hard problems.
- ✓Start a fresh session for each unrelated task instead of carrying 100k tokens of old context into the next one.
- ✓Never paste or cat whole logs. Ask for the failing lines, or let a compressed local_exec return the summary.
- ✓Use /compact when a long investigation is over and you are moving to implementation.
- ✓Keep AGENTS.md short. It is loaded into every session, so every line costs tokens on every turn.
- ✓Install Token Limits so file reads, searches, and command output arrive 60-90% smaller by default.
When to upgrade and when to compress
| Situation | Best move |
|---|---|
| Weekly limit gone by Wednesday most weeks | Install Token Limits ($5/month) and check /status before big tasks |
| Still out of allowance after compression | Buy credits for the crunch, or move to Pro |
| One-off heavy week | Sign in with an API key for that week |
| Occasional limit hits only | Lower model_auto_compact_token_limit and use /compact |
| Whole team hitting limits | Business or Enterprise with workspace credits |
Stop paying for noise in every Codex turn
Token Limits compresses Codex file reads, searches, and command output 60-90% before they hit the context window. Free trial, 100 requests, no card. $5/month after.
FAQ
Does Codex CLI share its limit with ChatGPT?
Codex usage in the CLI, IDE extension, desktop app, and cloud all draw from one Codex allowance on your plan, and ChatGPT Work usage inside ChatGPT uses the same credits and limits. Ordinary ChatGPT chat messages are governed separately.
Does the 5-hour limit still exist in Codex?
Pro has no five-hour limit according to OpenAI's docs. For Plus and Business it was temporarily removed on July 12, 2026 and OpenAI has not announced its return. The weekly limit applies on every plan. /status shows whichever windows are active for your account.
Is model_auto_compact_token_limit a percentage?
No. It is a token count in ~/.codex/config.toml, for example model_auto_compact_token_limit = 150000. Leave it unset to use the model default.
How do I check how many tokens I have used in Codex CLI?
Type /status in the session. It reports context used, weekly and 5-hour percentages, credits, and reset times. The usage dashboard at chatgpt.com/codex/settings/usage shows the same data across all Codex surfaces.
Can I buy more Codex tokens?
Yes. Plus and Pro users can purchase additional credits from the usage dashboard, and Business or Enterprise workspaces on flexible pricing can buy workspace credits. Signing in with an API key is the other route: no plan window, billed per token.
Does Token Limits work alongside other Codex MCP servers?
Yes. It is one more [mcp_servers] entry in config.toml. The setup command preserves everything else in the file.