How much does Codex cost per test suite?
Writing tests for existing code: lots of output tokens and repeated test runs with long logs. Here is what that costs at list prices, how much of it is usually avoidable, and real numbers from itemized receipts as they come in.
Short answer
A tidy Codex test suite of about 44 model calls costs around $0.99 on GPT-5.1 Codex and $1.39 on GPT-5.3 Codex. One coffee break that expires the cache plus one fix-and-test loop takes that to $1.18 and $1.66.
Billed per token on the OpenAI API, or included in a ChatGPT plan.
Real medians from receipts
Not enough receipts yet to publish a real median (0 of the 30 we wait for). Until then, the numbers below are worked examples, clearly modelled. Save a receipt to contribute; only aggregate medians are ever shown.
Worked example: one test suite
Worked example · modelled, not measured| Model | Tidy session | +1 idle miss, +1 loop | Cache hit |
|---|---|---|---|
| GPT-5.1 Codex Mini | $0.20 | $0.24 | 97% |
| GPT-5.1 Codex | $0.99 | $1.18 | 97% |
| GPT-5.3 Codex | $1.39 | $1.66 | 97% |
44 model calls, 21k tokens of starting context growing about 1.7k per call, 900 output tokens per call, list prices. The second column adds a 9-minute pause that expires the cache and a 3-attempt fix-and-test loop.
Where the money goes
In the GPT-5.1 Codex example, cache reads are $0.46, cache writes $0.14 and output $0.40. Because the whole context is re-sent on every call, the bill grows with the square of the session length: a test suite that takes twice as many calls costs roughly three to four times as much.
In the messy version, the expired cache alone adds $0.11 for one turn, and AgentReceipt marks $0.19 of the session as avoidable.
How to make a test suite cheaper
- Keep one test suite per session and /clear between tasks, so the context stays small.
- Do not leave a session idle for more than 5 minutes in the middle of the work; the cache expires.
- Stop retry loops after two failed attempts and give the agent the exact error.
- Trim tool output (head, grep, line ranges): every token stays in context for the rest of the session.
- Use a smaller model or a subagent for exploration; save GPT-5.3 Codex for the hard edits.
Itemize your own session
Drop a Claude Code or Codex log. It is parsed in your browser, and you get your real numbers instead of a model.
Drop a session log here
Claude Code ~/.claude/projects/…/*.jsonl, a Codex rollout ~/.codex/sessions/…/rollout-*.jsonl, or the claude-code-action execution file.
Parsed in your browser. Your prompts and code never leave this tab.