Codex CLI Token Limit: Plans, Resets & Fixes [2026]
Codex CLI runs GPT models in the terminal for code generation and execution. Your token usage limit comes from your ChatGPT subscription (Plus, Pro, Teams). Limits reset weekly. The config option model_auto_compact_token_limit lets you trigger compression automatically when context reaches a threshold. But manual compression in Codex is limited—install Token Limits MCP for 60-90% compression on every command and tool output.
Codex CLI is a terminal interface to OpenAI models, typically GPT-4o or GPT-4.1. Your token usage is tied to your ChatGPT subscription plan, not your Codex subscription. Higher ChatGPT plans get higher usage limits. Codex resets usage weekly, usually on Monday UTC. When you hit your limit, Codex stops accepting new commands until the reset.
Token limits by ChatGPT plan
| Plan | Model Access | Usage Limit | Reset Frequency |
|---|---|---|---|
| Free | GPT-3.5-turbo | Limited (1M tokens/month) | Monthly |
| ChatGPT Plus | GPT-4o | Higher (see OpenAI docs) | Weekly |
| ChatGPT Pro | GPT-4o, o1 | Even higher | Weekly |
| ChatGPT Teams | Shared pool | Varies | Weekly |
| Enterprise | Custom | Custom | Custom |
What consumes your Codex CLI limit?
- ✓Your command prompt: 50-500 tokens depending on length
- ✓File reads: 1,000-20,000 tokens per file read
- ✓Terminal output: Command results, logs, errors returned to context
- ✓Conversation history: Codex keeps messages for the session
- ✓Response generation: Claude's code suggestions and explanations
Understanding model_auto_compact_token_limit
Codex has a config option: model_auto_compact_token_limit. Set this to a percentage (e.g., 80) and Codex automatically compresses your conversation history when context reaches 80% of the limit. This is a basic compression—it condenses your messages but does not handle tool output noise the way Token Limits does.
To enable it, add to your Codex config file (~/.codex/config.json or similar):
Why model_auto_compact_token_limit is not enough
model_auto_compact_token_limit compresses your conversation history, but it does not fix tool output noise. When you run a command that returns 10,000 tokens of output, most of that is timestamps, blank lines, and status messages—not actual information. The built-in compression does not target this. Token Limits MCP does.
Fix: Install Token Limits MCP for Codex
Token Limits provides MCP tools that compress command output, file reads, and search results 60-90% before they enter Codex context. Install once and every command is more efficient.
- npm install -g token-limits
- Add Token Limits to your Codex MCP config (usually ~/.codex/mcp.json)
- Config: "token-limits": {"command": "token-limits", "args": ["mcp-server"]}
- Restart Codex
- All command output and tool calls are now compressed automatically.
Combining model_auto_compact_token_limit (for conversation history) with Token Limits MCP (for tool output noise) gives you the best compression on both fronts.
Real example: Codex session with compression
You run Codex in a terminal for 30 minutes, executing 20 commands. Without compression: 150k-250k tokens consumed. With Token Limits: 30k-60k tokens (80% reduction). Same session, same work, 3-5x more runway before hitting your weekly limit.
When to upgrade vs compress
| Scenario | Action |
|---|---|
| Hit limit mid-week regularly | Install Token Limits MCP ($5/month) |
| Still hit limit after compression | Upgrade ChatGPT plan |
| Occasional limit hits | Use model_auto_compact_token_limit first |
| Team usage | Consider ChatGPT Teams with shared quota |
Stop wasting Codex tokens on noise
Token Limits MCP compresses every Codex command output 60-90%. Install once in mcp.json, get 3-5x more tokens per week automatically.
FAQ
Does Codex CLI have the same token limit as ChatGPT web?
Yes. Your Codex CLI token usage counts toward your ChatGPT plan limit. Exceeding your plan limit stops both Codex and ChatGPT.
What happens when I hit my Codex token limit?
Codex returns an error saying you have exceeded usage limits. You can wait for the weekly reset (Monday UTC) or upgrade your ChatGPT plan.
Can I use Token Limits MCP with other Codex MCP servers?
Yes. Token Limits can coexist with other MCP servers in your Codex config. You can use both.
Does model_auto_compact_token_limit work with Token Limits?
Yes. Use both. model_auto_compact_token_limit handles conversation history, Token Limits handles tool output noise.
Is $5/month Token Limits worth it for Codex?
If you hit limits weekly, yes. You save money by not upgrading your ChatGPT plan and get 3-5x more work per week.