Codex

Codex tokens per task: benchmarks by task type

How many tokens common Codex tasks consume, why the range is wide, and how to build your own benchmark instead of trusting a generic number.

Quick answer

There is no fixed token count per task. The same bug fix can cost 8,000 tokens or 80,000 depending on context size, model, and how many tool calls it takes. Measure a task type once in your own repository, then use that as your benchmark rather than a generic table.

Illustrative ranges

The numbers below are order-of-magnitude illustrations for a mid-sized repository, not guarantees. Use them to sanity-check a measurement, not to plan a budget.

Task typeOrder of magnitudeMain driver
Explain one functionThousandsFile size
Fix a failing testTens of thousandsIterations
Add a small featureTens of thousandsFiles touched
Refactor a moduleHundreds of thousandsContext of every file
Migrate a dependencyHundreds of thousands to millionsRepeated builds and errors

What moves the number

  • Context size per turn, which multiplies by the number of turns.
  • Tool output: test logs and directory listings are expensive.
  • Model choice: reasoning tokens are billed as output.
  • Retry loops: each repeat resends the same context.
  • Whether the agent writes a diff or a whole file.

Benchmark your own repository

  1. Pick three tasks you repeat weekly.
  2. Run each in a fresh session with the same prompt.
  3. Record input, cached, output, and wall-clock time.
  4. Repeat once on a different day to see variance.
  5. Use the median as your planning number.

The Codex cost per project guide turns those token medians into a budget.

Measure per task, not per prompt

A prompt is not a unit of work. One prompt can start forty model calls; ten prompts can solve one tiny bug. Counting per task is what makes two weeks comparable.

  1. Write down the tasks you repeat weekly.
  2. After a session, tag it with the task type in your notes or in the tracker.
  3. Total tokens for that task across a week.
  4. Divide by completed tasks to get a per-task cost.
  5. Compare the same task type month over month.

The cost per project guide uses the same method at repository level, and AI tokens per day covers what normal volume looks like.

Questions, answered

How many tokens does one Codex request use?

It varies with the context sent. A short prompt in a small session can be a few thousand tokens; a turn late in a long agent run can be over a hundred thousand.

Are reasoning tokens counted in output?

They are billed as output. Some views show them separately, so check whether your total already includes them.

Is there a public Codex benchmark?

Not one that matches your repository. Published averages hide the context and retry behaviour that dominate real consumption.

Browse by topic