Why Codex Token Usage Spikes—and How to Reduce It Without Changing Models
A practical guide to reducing Codex token usage by controlling context growth, tool output, global instructions, compaction, and task length.
If Codex quota seems to disappear faster after moving to a stronger model, the model name may not be the whole story. A long-running agent task can carry conversation history, tool results, project instructions, skills, plugins, and reasoning context into every new turn. The visible prompt may be one sentence; the actual request can be hundreds of thousands of tokens.
That is the practical reason to learn how to reduce Codex token usage before changing your subscription or abandoning a model you like. OpenAI describes the same pressure in its guidance on GPT-5.6: agents with more tools, skills, plugins, and conversation history can quickly accumulate a large context, and an agent loop may resend earlier instructions and results repeatedly (OpenAI).
The real cost is often context, not the last sentence
A Codex turn contains more than the message you just typed. Depending on the task, the model may receive:
- earlier conversation turns and steering messages;
- tool definitions and the outputs returned by those tools;
- project-level instructions such as
AGENTS.md; - skill descriptions and reference files;
- plugin or MCP instructions;
- files, diffs, logs, screenshots, and test output from the current task.
As a task continues, that bundle can grow. A small edit near the end of a long debugging session may still be processed beside the entire working history. If the agent calls tools repeatedly, the same context can be sent again and again. Prompt caching can reduce inference work in some systems, but it does not make an oversized working context free or easy to reason about.
OpenAI’s GPT-6 Astra announcement describes a related improvement: Codex can preserve and retrieve context across windows instead of compressing everything into one summary. That can protect important details, but it also makes it more important to keep the active task focused and the instruction surface intentional (OpenAI).
What one usage audit can reveal
A useful audit starts with evidence rather than a model swap. In one recent seven-day review, two GPT-5.6 Sol tasks at medium reasoning accumulated approximately 15.99 million and 15.82 million input tokens. Near the end, individual calls carried about 228,000 to 254,000 tokens. Those figures are an individual usage record, not a universal benchmark, but they show how quickly a long task can become expensive.
The same review counted 274 installed skill definitions and a global AGENTS.md file measuring 5,284 bytes. Many of those rules were useful. The problem was repetition and scope: instructions that mattered to one workflow could still be available to every task.
This is why a dashboard showing “model usage” does not automatically identify the cause of a quota spike. If you are comparing AI access costs as well as agent behavior, keep a separate view of model API prices so a context problem is not confused with a provider price change. The model, reasoning setting, task length, tool volume, and context assembly all contribute to the request that reaches the service.
Three changes that reduce Codex token usage
1. Keep global instructions short
Global instructions should contain rules that genuinely apply to almost every task: safety boundaries, repository conventions, important naming decisions, and durable preferences. Move workflow-specific details into the skill or project where they belong.
A practical compression pass can remove repeated explanations, examples that are never needed at runtime, and instructions that merely restate the product UI. Preserve the rule itself, its exceptions, and any required file paths. Do not delete a constraint simply because it is long.
In the audit above, shortening AGENTS.md from 5,284 to 1,705 bytes kept the important publishing and operating rules while reducing the amount of global text available to every task.
2. Bound compaction and tool output
The exact numbers depend on your workload, but explicit ceilings prevent one task from expanding indefinitely. The configuration used in this audit was:
model_auto_compact_token_limit = 160000
model_auto_compact_token_limit_scope = "total"
tool_output_token_limit = 8000
[skills]
max_context_tokens = 4000
These values are guardrails, not universal defaults. A repository that needs large generated files may require a different tool limit. The key idea is to compact a long task before it becomes unwieldy and to stop tools from returning entire logs when a summary or tail is enough.
OpenAI’s API documentation describes compaction as a way to summarize earlier context as a session approaches its limit (OpenAI compaction guide). The setting should be validated against the configuration version you actually run; an unsupported field should be removed or corrected rather than silently ignored.
3. Split work at natural boundaries
A task should have a useful stopping point. For a Codex workflow, the related Codex merger guide provides useful context on model and tool changes. After the plan is settled, the implementation is complete, or the tests pass, start a new task with the final files, decisions, and remaining risks. Do not make the next task reconstruct dozens of failed attempts.
This is particularly effective for writing and software work. A research task can hand off a short evidence summary. A coding task can hand off the changed files and test result. A publishing task can hand off the final copy and metadata. The new task keeps the decision record without carrying every intermediate tool response.
Do not solve a context problem by changing the model blindly
Switching from GPT-6 Astra to GPT-5.6 Sol may change quality, latency, and quota behavior, but it does not remove a large conversation or an oversized tool result. If the same task and tool surface remain in place, the context can still grow.
OpenAI recommends choosing the default model and reasoning level for ordinary work, then increasing effort when the task actually needs deeper planning or analysis (model guidance). Higher reasoning effort can be useful for a difficult refactor or a multi-step investigation. It is unnecessary overhead for a small rename, a short translation, or a routine test run.
Also check whether a third-party proxy or custom model catalog changed the model shown in the interface. A model appearing as “custom” is a configuration diagnosis, not proof that the model is consuming more tokens. Do not uninstall a shared proxy or rewrite the model catalog just to chase a quota symptom.
A safe audit prompt for Codex
You can ask Codex to inspect the environment with a prompt like this:
Audit my Codex token usage without changing project code. Inspect
~/.codex/config.toml,~/.codex/AGENTS.md, installed skills and plugins, recent usage information, and any custom model catalog or API base URL. Identify whether long tasks, growing context, large tool output, or broad instructions are the main contributors. Before editing a file, create a timestamped backup. Keep my current model unless I ask to change it. Validate the TOML, check for duplicate fields, report before-and-after file sizes, list every backup, and tell me whether Codex needs a restart. Do not disable plugins, uninstall skills, stop a proxy, or replace a model without asking first.
The prompt is a checklist, not a license to rewrite the machine. A good audit reports what it found, makes reversible changes, and leaves shared tooling alone unless there is a clear authorization to change it.
What to measure after the change
Run the same type of task after the adjustment and compare more than the model label:
- total input tokens and the largest single call;
- number of tool calls and average tool-output size;
- how often automatic compaction occurs;
- time to a completed result;
- retries, failed tool calls, and quality regressions.
A lower token count is useful only if the task still finishes correctly. An overly aggressive limit can hide a needed log, truncate a file, or force the agent to repeat work. Keep a backup of every local configuration change and revert one setting at a time when a workflow becomes less reliable.
The takeaway
Codex quota is shaped by the full agent loop. Model choice matters, but so do task length, global instructions, skills, plugins, reasoning effort, and tool output. If usage suddenly feels faster, first measure the context that each turn carries.
Shorter global rules, bounded tool output, sensible compaction, and clean task handoffs usually offer a safer first response than changing models. They preserve the capabilities you need while keeping the working context small enough for the agent—and your quota—to stay focused.
FAQ
Why does Codex use so many tokens on a short prompt?
The service may also receive conversation history, tool definitions, tool output, project instructions, skills, and files. The visible message is only one part of the request.
Should I switch models to reduce Codex token usage?
Not as a first step. Audit task length, context growth, reasoning effort, and tool output first. A different model can change quality and speed without fixing an oversized context.
Is 160,000 tokens the correct compaction limit for everyone?
No. It is an example guardrail from one audit. Choose a limit that fits your tasks, verify that your Codex version supports the field, and watch for truncated output or repeated work.
Should I uninstall plugins or skills?
Only when you know they are unnecessary and have authorization to remove them. First determine whether they are actually injected into the task context; availability alone does not prove they are causing the cost.
Sources: OpenAI GPT-5.6 efficiency guidance, GPT-6 Astra announcement, OpenAI compaction guide, and OpenAI model guidance. Usage figures are from the author’s own audit and are not a universal benchmark.
Continue exploring
More decisions worth reading
Follow the thread from this article to the next practical buying question.
Buying advice
01GPT-5.6 Sol: The Codex Merger Has Arrived
Open guideBuying advice
02Slack Code, Cursor Origin, Warp Factories: The Week AI Coding Became an Orchestration Problem
Open guideBuying advice
03'Stop Watching YouTube': The Claude Code Meme That Accidentally Explains AI Agents
Open guideBuying advice
04