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.

Terminal
npm run check:harness
Output, 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. 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 openai/codex 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.

The script 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.

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.

Only Claude Code is installed on the machine this was written on. Codex CLI is 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.

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. 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 — run npm run check:harness against your own repository and read 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. The script in this article checks all five against your repository and exits non-zero until they pass. On ours, zero of five were met.

Muhammad Kashif

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