Skip to content

COMPARISONS

Claude vs GPT for Coding: The Harness Decides First

Claude vs GPT for coding is a harness question before it is a model question. We measured what reaches the model on a real repository: 99.99% of it was not the prompt.

Claude vs GPT for coding is asked as a question about two models and almost always answered by two people running two different tools. On this repository, measured on 2026-08-15, 2 of the 32,005 input tokens that reached the model were typed by a person — the other 32,003 were assembled by the harness before the model saw anything. This article puts numbers on what the tool decides, prices the identical request on both vendors' published cards, and gives you the five-point check that says whether your own comparison would mean anything.

Key takeaways

  • The harness wrote 99.9938% of the request. Two tokens typed, 32,005 delivered. Whichever model you choose is mostly reading its own tool.
  • The same repository produces different briefs. Claude Code hands its model 8,189 bytes of project instructions; Codex CLI hands its model 0, because it reads a different filename — and silently truncates past 32,768 bytes when it does read one.
  • On list price for an identical request, GPT is about 5x cheaper: $0.092567 on claude-opus-5 against roughly $0.018336 on gpt-5.3-codex. That is a floor for one turn, not a total for one job.
  • A single Claude Code turn billed two different models, so even "which model" is the wrong unit of comparison.
  • This machine meets 0 of 5 preconditions for a valid head-to-head, and the article says so instead of ranking anyway.

The short answer

Choose the harness, not the model. If your configuration is a team asset and you want a committed permission allowlist and no cap on project instructions, that points at Claude Code; if per-token cost dominates and your work is well-scoped single turns, the OpenAI side is materially cheaper per request. Both statements are measurable. "Which model writes better code" is not measurable from here, and this article does not pretend otherwise.

For the whole-category decision, the best AI coding assistants comparison is the pillar this sits under. For the configuration-level difference between the two terminal agents specifically, what actually ports between Claude Code and Codex CLI has the audit.

Claude vs GPT for coding: what the question usually measures

A model comparison is only a model comparison if everything except the model is held still. In practice, four things vary between any two agent runs, and all four are chosen by the tool:

  • The system prompt, which you do not write and generally cannot read.
  • The tool schemas — how many tools, described how well, and whether the agent can search, run tests, or only edit.
  • The project brief, which depends on which filename the tool reads and how much of it survives.
  • The model itself, which the tool may switch mid-turn.

That last one is not hypothetical. A single headless Claude Code turn on a five-word prompt billed two models — claude-opus-5[1m] and claude-haiku-4-5 — which is covered in full in what model Claude Code actually uses. If one side of your comparison quietly routes part of the work to a cheaper model and the other does not, you are not comparing two models. You are comparing two products, which is a fine thing to do and a different thing to claim.

What actually reached the model

The measurement is one headless run with JSON output, which reports usage broken down by cache state. No proxy, no instrumentation. We summarise it with an internal check script:

Our verification run, 2026-08-15
What reached the model on one five-word prompt  (measured 2026-08-15)

  Typed by a person             2 tokens
  Delivered to the model        32,005 tokens
  Decided by the harness        99.9938%
  Models billed for the turn    2

The breakdown matters as much as the ratio: 23,955 tokens arrived as cache reads and 8,048 as cache writes, against 2 uncached input tokens. That shape is the agent's standing context — instructions, tool definitions, prior turns — re-presented on every request and billed at cache rates rather than input rates.

Two consequences follow, and they cut against the usual advice.

Prompt quality is a smaller lever inside an agent than inside a chat window. When your text is 0.006% of the request, phrasing it better moves very little. What moves the number is what the harness puts around it — which is why this site keeps measuring instruction files rather than prompts. The clearest demonstration is the same model run with its tool list emptied: it answered a question about its own repository wrong every time, and the tool definitions alone accounted for 71.9% of the context it was reading.

Cache pricing, not input pricing, sets the bill. Both vendors charge roughly a tenth of the input rate for cache reads (as detailed in Claude Code's costs documentation). A comparison built on headline input prices is pricing the wrong 0.006%.

Bring a third vendor in and it gets worse rather than better: Google does not charge for a cache write at all, it rents the cached tokens by the hour, and the two billing shapes cross at 53 minutes. The harness decides what fills the request, and measuring what a file actually costs is how you find out how much of it there is.

Same repository, different brief

The clearest evidence that the tool decides more than the model is that the same commit produces different inputs.

Output, 2026-08-15
  HARNESS         PROVIDER    READS         DELIVERS    CAP           MCP
  Claude Code     Anthropic   CLAUDE.md     8,189 B     none          284 B
  Codex CLI       OpenAI      AGENTS.md     0 B         32,768 B      0 B

  The two DELIVERS figures are the finding. Same repository, same commit, and the
  brief is 8,189 B apart before either model has read a word.

Codex CLI reads AGENTS.md. This repository has CLAUDE.md. Neither tool reports the gap, so an unwary comparison runs one model with a full project brief and the other with none, then attributes the difference to the model.

The cap is the sharper half. Codex CLI truncates project instructions at 32,768 bytes and does so silently — the value is stated in the OpenAI Codex repository source rather than in the published configuration reference. This repository's brief is 8,189 bytes, so nothing truncates here today; a monorepo with a 40 KB instruction file would lose a quarter of it with no warning on one side of the comparison and none of it on the other.

The same request, priced on both cards

Output quality cannot be compared from this machine. A price card can, and honestly: take the exact token shape the probe measured and run it through each vendor's published rates. The request is held constant; only the price varies.

Output, 2026-08-15
  Token shape held constant: 2 in, 8,048 cache write, 23,955 cache read, 4 out
  MODEL             VENDOR      IN /MTok   OUT /MTok   CACHE RD   COST
  claude-opus-5     Anthropic   $5         $25         $0.5       $0.092567
  gpt-5.3-codex     OpenAI      $1.75      $14         $0.175     $0.018336  (approx)

  Ratio 5.0x on list price for an identical request.
  Arithmetic check: the card reproduces claude-opus-5's own reported cost of $0.092567 to $0.000000.
  The turn as billed was $0.093148 — the difference is the second model.

The arithmetic check is why this table is worth publishing rather than estimating: the Anthropic card reproduces the CLI's own reported figure exactly, to six decimal places, which means the rates and the reading of the usage payload are both right.

Three caveats, all load-bearing:

  • (approx) is doing real work. OpenAI's pricing page publishes input, cached input and output for gpt-5.3-codex and no separate cache-write rate, so cache-written tokens are priced at the full input rate here. If writes are cheaper or free, the gap widens.
  • This prices one turn, not one job. A model that needs three turns where another needs one is more expensive at any rate card, and nothing here measures turns.
  • Both figures are list prices read on 2026-08-15. This category re-prices several times a year; treat any dollar figure in a comparison without a date on it as decoration.

What a fair comparison would need

Five conditions. All five are checkable from a repository, which is the point — the disagreement about model quality is genuine, the disagreement about whether you controlled for the harness is not.

Output, 2026-08-15
  UNMET   Both harnesses installed            Claude Code present; Codex CLI absent
  UNMET   Same brief reaches both             Claude Code 8,189 B, Codex CLI 0 B
  UNMET   Same tool surface reaches both      Claude Code 284 B of MCP config, Codex CLI 0 B
  UNMET   Task set fixed and committed        a shared, versioned task list neither tool has seen
  UNMET   Grader independent of both vendors  no grader exists in this repository

  0 of 5 met.

Our check exits non-zero on that, deliberately. The honest output of a comparison you cannot run is a failing check, not a ranking — and we would expect most published head-to-heads in this category to fail the same five rows if they ran them first.

If you want to run your own, the cheapest order is: rename the instruction file so both sides read it, port the MCP config, then fix the task set. The first two are the ones that silently invalidate everything downstream.

What is actually safe to conclude

Stripping out everything unmeasurable from here, this is what survives:

QuestionAnswerBasis
Which is cheaper per turnGPT, ~5x on listPublished cards, identical token shape
Which reads more of your repoClaude Code, by 8,189 BMeasured on this commit
Which caps your instructionsCodex CLI, at 32,768 Bopenai/codex source, silent
Which writes better codeNot established hereNo installation, no task set, no grader

The last row is the one most articles fill in anyway. Both vendors publish 1M-token context windows on their flagship models, both charge about a tenth of input rate for cache reads, and both ship a terminal agent that will edit your repository — the remaining differences that are firmly measurable are configuration, licensing and price, which is where our terminal agent field survey and what AI coding assistants actually cost put them. The price half of that has since been done across all three vendors: one measured turn priced on nine cards spans 10.5x, and it also found the cache-write gap flagged below now closed for part of OpenAI's lineup.

The shelf moved: what Codex CLI offers now

Thirty-six days after this was published, Codex CLI was installed on the machine it was written on, and the argument above survived the test in an unexpected way: the harness question outlives the model names it was asked about. Codex CLI 0.152.1 caches its catalogue on disk at ~/.codex/models_cache.json — 162,908 bytes, stamped with the time it was fetched — and the copy fetched at 09:17 UTC on 2026-09-20 held six entries:

ModelVisibleContext window
GPT-5.6-Solselectable272,000
GPT-5.6-Terraselectable272,000
GPT-5.6-Lunaselectable272,000
GPT-5.5selectable272,000
GPT-Reservehidden272,000
Codex Auto Reviewhidden272,000

Four are selectable; gpt-reserve and codex-auto-review carry visibility: "hide", so they exist in the catalogue and not in the picker. The oldest entry, GPT-5.5, describes itself as "previous-generation", and no entry carries a bare major-version name. What a CLI offers is account state rather than a product catalogue — a different ChatGPT plan may be shown something else, and none of this says a model was withdrawn from OpenAI's API.

The windows do not match either. Every model in the cache reports the same 272,000-token default and the same 95% effective share of it, and five of the six can be pushed to 872,000. The one with no headroom is GPT-5.5, whose maximum equals its default.

Codex CLIClaude Code
Default window272,0001,000,000
Maximum window872,0001,000,000
Smallest on the shelf272,000200,000

Claude Code's flagship window — 1,000,000 for Opus 5, Sonnet 5 and Fable 5.1 — is larger than the largest window Codex offers at all, and 3.68x its default; Haiku 4.5 is the 200,000 entry. The effort ladders differ in the opposite direction: Claude Code exposes five levels through --effort, while two of Codex's models expose six, adding ultra above max, set through model_reasoning_effort in config.toml rather than a flag.

The head-to-head that did not run

With both agents installed, the plan was to point them at the same small task six Claude arms answered the day before and grade the answers. Codex returned this on 2026-09-20:

Terminal
codex exec --json --skip-git-repo-check -s read-only "…the task prompt…"
# → thread.started
# → turn.started
# → error   You've hit your usage limit.
# → turn.failed
# exit 1

Four events, no turn. codex doctor reported auth is configured, a chatgpt auth mode, and an HTTP 101 handshake against the inference endpoint — installed, authenticated and reachable, and still unable to work, because the account was out of credit until later the same day. We did not wait it out or retry, and no result is claimed from that attempt. It says nothing about GPT's ability to find an off-by-one error; it says that on a ChatGPT plan that had been driving this CLI for eighteen days, the comparison was not available at any price already paid.

The brief gap from earlier in this article had not closed either. On 2026-09-20 this repository's CLAUDE.md was 10,132 bytes, read in full by Claude Code, and there was still no AGENTS.md, so Codex would read 0 bytes. Codex needs project_doc_fallback_filenames to look at a CLAUDE.md, and it ships empty. The fix is one git mv and a one-line @AGENTS.md import; we have deliberately not made it, because the precondition ledger is more useful unmet and honest than met and quietly arranged.

33.6x more written per session

Both agents keep a session log on disk, and the two are not remotely the same size:

Codex CLIClaude Code
Session files61613
Total on disk1,332,363,798 B398,472,021 B
Mean per session21,842,029 B650,036 B

Ten times fewer sessions, 3.34x more bytes in total, and 33.6x more written per session. Codex's corpus spans 2026-09-02 to the day of measurement; Claude Code's spans 2026-08-20 to the same day. Every figure is a file size and a modification time — no prompt, response or file content was opened on either side. Why the ratio is so large is genuinely unclear: it could be verbosity, a different event granularity, embedded tool output, or images. codex doctor flags the volume itself — "60 active files · 1.24 GB on disk" — so the tool considers it notable too. If you run both, one of them will want an order of magnitude more disk per session, and it is not the one with more sessions.

What we are not claiming

No output-quality ranking appears in this article, and the omission is the article's main finding rather than a gap in it.

When this was first written, only Claude Code was installed on the machine. Codex CLI was not, there is no committed task set, and there is no grader. Producing a winner from that position would require inventing at least three of the five things the check above says are missing — and once Codex was installed, the one head-to-head attempt above ended in a usage limit rather than an answer.

One more limit worth stating: the harness share was measured on a deliberately trivial prompt, which maximises the ratio. A long agentic session with large file reads shifts real content into the request and the percentage falls. The direction of the finding holds — the standing context is paid for on every turn — but 99.9938% is a ceiling, not an average, and we have not measured the average.

Common mistakes comparing coding models

  • Comparing two tools and reporting it as two models. The system prompt, tool set and brief all differ, and all three are invisible in the output.
  • Assuming both sides read your instruction file. One reads CLAUDE.md, the other AGENTS.md. The gap is silent on both sides.
  • Pricing on headline input rates. On the measured turn, 23,955 of 32,005 input tokens billed at cache-read rates.
  • Reading a benchmark score as a model property. A score is a model plus a scaffold plus a task set; you can buy the model and not the scaffold. The SWE-bench benchmark platform tests agents across real repository issues, and What SWE-bench actually measures walks the construction filter that decides which work a score describes.
  • Quoting a price without a date. Both cards here moved within the last year.

Conclusion

Pick the harness first: Claude Code where configuration is a team asset and the instruction file must arrive intact, the OpenAI side where per-turn cost dominates and the work is well-scoped. Then, before you believe any comparison — including one you run yourself — check your own setup against the five preconditions. On this one it printed zero of five met, and that is a more useful result than a ranking built on the other configuration.

Frequently asked questions

Is Claude or GPT better for coding?
Nobody who has not held the harness constant can tell you, and most published comparisons have not. On the repository measured here, 32,003 of the 32,005 input tokens that reached the model were written by the tool rather than the user, and the two tools deliver briefs that differ by 8,189 bytes before either model reads a word. Pick the harness that fits your workflow first; the model follows it.
How much of a coding agent's request is the model actually reading from me?
On one measured turn, two tokens out of 32,005 — 0.006%. The rest was system prompt, tool schemas and project context assembled by the harness, arriving as 23,955 cache reads and 8,048 cache writes. That ratio is why prompt-quality advice matters less in an agent than it does in a chat window.
Is GPT cheaper than Claude for coding?
On list price for an identical request, yes — about 5x. Pricing the exact token shape measured here gives $0.092567 on claude-opus-5 and roughly $0.018336 on gpt-5.3-codex, both read on August 15, 2026. That is a floor for one turn, not a bill: a model that needs three turns where another needs one erases the gap.
Do benchmarks like SWE-bench answer this?
They answer a narrower question than the one people ask. A benchmark score is a model plus a scaffold plus a task set, and the scaffold is rarely the agent you would actually run. Treat a published score as evidence about a configuration, not about a model you can buy and drop into your repository.
What should I control if I want to run my own comparison?
Five things, and they are checkable: both harnesses installed, the same project brief reaching both, the same tool surface reaching both, a fixed task set neither has seen, and a grader independent of both vendors. Our internal check script tests all five and exits non-zero until they pass. On ours, zero of five were met.
How big is Codex CLI's context window compared with Claude Code's?
All six models in Codex's cache report a 272,000-token default window, with 872,000 available as a maximum on five of them. Claude Code reports 1,000,000 for Opus 5, Sonnet 5 and Fable 5.1, and 200,000 for Haiku 4.5. So Claude Code's flagship window is larger than Codex's maximum, and 3.68x its default.

Muhammad Kashif

Founder and editor of Devventa, covering AI coding assistants, Next.js and the modern AI development stack.