# Token usage in Claude Code, Codex, pi and others, on one model

- Author: Eishan Lawrence
- Published: 2026-11-21
- URL: https://www.eishanlawrence.com/blog/harness-efficiency-bench-v2
- Code: https://github.com/eishan05/harness-efficiency-bench/tree/v2
- Results (CSV): https://www.eishanlawrence.com/blog/harness-bench-v2/results.csv (Per harness configuration (19), pooled over 3 runs of 12 tasks: tokens per solved task (median and range), cache-discounted tokens, startup overhead, calls, peak context, input and output per task, cached share, prefix reuse, seconds per task, lines added, and an illustrative cost per 1,000 solved tasks.)

> Tokens per solved task for Claude Code, Codex, Antigravity CLI, Opencode, pi and DeepSeek Harness on the same model (DeepSeek V4.1 Flash) and the same 12 tasks, 3 runs each, measured through one usage proxy: 17,000 to 97,000. Most of the gap is each harness's own system prompt and tool list, resent on every call. Plus 13 more harness configurations in the full table.

In June I [measured how many tokens 12 coding harnesses use](https://www.eishanlawrence.com/blog/harness-efficiency-bench) for the same small tasks. This is the second run: one model, three runs each, and every call measured in the same place.

I ran 19 harness configs. This post focuses on the ones most people use: Claude Code, Codex, Antigravity CLI, Opencode, pi and DeepSeek Harness. The rest are in [the full table](#all-19) and the CSV.

## TL;DR

- All six solved almost every task. Tokens per solved task went from about 17,000 (pi) to 97,000 (Antigravity CLI), a 5.6x spread.
- The model wrote 700 to 2,600 tokens per task under each of them. What changed was how much it read: 16,000 to 97,000.
- For Opencode, Codex and Antigravity CLI, over 80% of what the model read was the harness's own system prompt and tool list, sent again on every call. For Claude Code it was under half.
- Caching narrows the gap to about 4x.
- DeepSeek Harness used 6.6x more tokens in its default mode than in its minimal one.

## What changed from v1

- **One model.** DeepSeek V4.1 Flash, served by OpenCode Go. v1 used two models through OpenRouter.
- **One place to measure.** Every harness talks to a small proxy I wrote, and the proxy talks to Go. It records the usage of every call, including cache reads, the same way for every harness. In v1 the numbers came from OpenRouter, and its Anthropic-format endpoint was losing Claude Code's cache hits.
- **Three runs** of every harness instead of one.
- **New harnesses**, including pi, Antigravity CLI and DeepSeek Harness.

Same 12 small Python tasks as v1. Each harness ran in its own Docker container with its shipped defaults and a 240 s limit per task. Across all 19 configs that's 684 task runs, and they cost $1.68 at Go's list prices.

## Results

Of these six, Codex and Antigravity CLI each timed out on one task run. Everything else passed. No harness edited a test file in any run. I checked every diff. So these tasks don't separate the harnesses on ability. This is about what they cost.

![Animated bar chart: tokens per solved task on the same model and tasks. pi 17.3k, Claude Code 21.1k, Opencode 50.7k, DeepSeek Harness 68.1k, Codex 69.5k, Antigravity CLI 97.4k. A 5.6x spread.](https://www.eishanlawrence.com/blog/harness-bench-v2/anim-gap.gif)

| Harness | Tokens per solved task | Range (3 runs) | Cache-adjusted | Startup overhead | Calls per task | Seconds per task |
| --- | --- | --- | --- | --- | --- | --- |
| pi | 17,290 | 16.4k-18.4k | 5,982 | 1,474 | 6 | 27 |
| Claude Code | 21,058 | 19.3k-22.1k | 7,176 | 1,161 | 8 | 37 |
| Opencode | 50,744 | 50.1k-52.4k | 11,425 | 7,412 | 6 | 40 |
| DeepSeek Harness (default) | 68,086 | 61.7k-68.8k | 14,720 | 5,874 | 9 | 34 |
| Codex | 69,532 | 68.3k-71.2k | 17,973 | 8,716 | 5 | 39 |
| Antigravity CLI | 97,399 | 95.1k-105.4k | 23,815 | 9,373 | 8.5 | 48 |

*Median of 3 runs. Cache-adjusted counts cache reads at a tenth. Startup overhead is the tokens a harness sends before your prompt: system prompt plus tool definitions.*

Antigravity CLI only accepts Google's models. I set it to a Gemini model and the proxy rewrote each request to DeepSeek V4.1 Flash, so its numbers are the furthest from normal use.

The runs agreed with each other. These six stayed within 4-13% between their best and worst run.

## The model writes the same, the harness decides what it reads

Output per task was 700 to 2,600 tokens under every harness. Input was 16,000 to 97,000.

![Animated bar chart on one scale: output per task was 1,496 for Claude Code, 730 for Opencode and 2,578 for Antigravity CLI; input was 19,014, 50,056 and 96,903.](https://www.eishanlawrence.com/blog/harness-bench-v2/anim-read-write.gif)

*Three harnesses on one scale. The output bars barely show.*

![Per-task tokens for six harnesses split into the harness's fixed prompt, other input, and output. Fixed prompt dominates for Antigravity CLI, Codex and Opencode; output is a thin sliver everywhere](https://www.eishanlawrence.com/blog/harness-bench-v2/fig_read_write.png)

*Fixed prompt is estimated as startup overhead × the number of calls. Medians per task.*

- **Opencode** is the clearest case. About 730 tokens out, 50,000 in. 89% of what it read was its own fixed prompt, resent on each of its six calls.
- **Codex** read about as much as Opencode, but the model wrote three times as much under it.
- **Claude Code and pi** send small fixed prompts, 1,200-1,500 tokens. Most of what they read is the task itself: files and tool results.

Turn counts didn't explain the gap. All six made 5 to 9 calls per task. None of them won by finishing in fewer steps. The cost is what each step carries.

## Caching

All six got 96-100% of their previous prompt back as a cache hit on the next call. The start of the prompt never changes, so they all cache about equally well. A high cached share mostly tells you the harness has a big fixed prompt. It doesn't mean it caches better.

![Animated bar chart: pi vs Antigravity CLI. Raw tokens per solved task 17.3k vs 97.4k, a 5.6x gap. With cache reads priced at a tenth, 6.0k vs 23.8k, a 4.0x gap.](https://www.eishanlawrence.com/blog/harness-bench-v2/anim-cache.gif)

How much the harness matters depends on how you pay for cache reads:

| Cache reads cost | Gap between the six |
| --- | --- |
| Full price (no prefix caching) | 5.6x |
| A tenth of input (Anthropic-style) | 4.0x |
| About 2% of input (DeepSeek on Go) | 3.5x |

If you run one of these against your own model server, prefix caching matters. Without it the server processes Antigravity CLI's 9,400-token preamble again on every call.

## What it costs in money

On DeepSeek V4.1 Flash, almost nothing. All 684 runs were $1.68. The harness choice is a rounding error at that price.

At frontier-style prices it isn't. With illustrative prices of $3 per million input tokens, $0.30 per million cache reads and $15 per million output (not any one model's price list), per 1,000 solved tasks:

- pi: $32
- Claude Code: $41
- Opencode: $44
- DeepSeek Harness: $72
- Codex: $90
- Antigravity CLI: $105

That assumes the same model writes about the same code under each harness, which held here.

## Time and context

All six took 27-48 s per task. pi was the fastest and Antigravity CLI the slowest. That's a 1.8x spread, much smaller than the 5.6x in tokens. Cached input is fast to process on a hosted API.

pi and Claude Code finished these tasks with 3,300-3,800 tokens of context at the peak. Codex and Antigravity CLI peaked at 12,000-13,000, most of it there before reading a single file. On a small local model, or one with limited memory for the KV cache, that's space the task doesn't get.

## Six months of changes

Three of these were also in v1:

- **Claude Code**: startup overhead went from about 4,500 to 1,160 tokens. Tokens per solved task went from about 52k to 21k.
- **Opencode**: startup overhead about 8,400 to 7,400. Per task, about 80k to 51k.
- **Codex**: startup overhead went up a little, about 8,000 to 8,700. Per task, about 85k to 70k.

The model changed too (V4 Flash to V4.1 Flash), so the per-task drops aren't all the harness. The startup overhead changes are.

## DeepSeek Harness

DeepSeek's own harness has a minimal SDK profile and a full product mode. I ran both.

- **Minimal**: about a 700-token first prompt, 5 calls per task, 10.3k tokens per solved task. Leaner than pi.
- **Headless** (the product defaults): a 5,900-token first prompt plus an extra call to title the session, 9 calls per task, 68k tokens per solved task. Next to Codex.

![Animated bar chart: DeepSeek Harness minimal profile vs headless default. Tokens per solved task 10.3k vs 68.1k (6.6x); first prompt 697 vs 5,906 tokens (8.5x).](https://www.eishanlawrence.com/blog/harness-bench-v2/anim-deepseek-harness.gif)

That's 6.6x between two modes of the same harness, about 3x after caching. The mode you pick can matter as much as which harness you pick.

One caveat. On DeepSeek's own API it switches on some DeepSeek-only cache features. Those only turn on for its own model id, so through Go it ran as a plain Anthropic-format client.

The other configs, for completeness. Aider is the floor at about 4,000 tokens: for tasks like these it makes one call with the file and the request, with no agent loop. OpenClaw, a general personal agent rather than a coding tool, used the most at 125,000.

| Harness | Tokens per solved task | Range (3 runs) | Cache-adjusted | Startup overhead |
| --- | --- | --- | --- | --- |
| Aider | 3,971 | 3.8k-4.6k | 3,846 | 3,056 |
| Aider (architect) | 4,201 | 3.3k-4.3k | 4,137 | 735 |
| DeepSeek Harness (minimal) | 10,289 | 10.1k-12.7k | 4,784 | 1,244 |
| pi | 17,290 | 16.4k-18.4k | 5,982 | 1,474 |
| Claude Code | 21,058 | 19.3k-22.1k | 7,176 | 1,161 |
| mini-swe-agent | 24,088 | 23.3k-24.3k | 9,491 | 1,012 |
| Hermes | 26,363 | 25.1k-26.8k | 8,719 | 3,656 |
| Goose | 33,442 | 33.3k-35.3k | 10,373 | 4,320 |
| Opencode | 50,744 | 50.1k-52.4k | 11,425 | 7,412 |
| Nanobot | 66,755 | 59.9k-70.5k | 17,623 | 5,540 |
| DeepSeek Harness (default) | 68,086 | 61.7k-68.8k | 14,720 | 5,874 |
| Codex | 69,532 | 68.3k-71.2k | 17,973 | 8,716 |
| Antigravity CLI | 97,399 | 95.1k-105.4k | 23,815 | 9,373 |
| Grok Build | 99,330 | 97.9k-115.9k | 23,461 | 11,826 |
| Kimi Code | 100,649 | 98.9k-110.9k | 25,003 | 13,570 |
| Kilo | 105,356 | 104.0k-110.4k | 20,823 | 15,579 |
| Qwen Code | 107,747 | 107.3k-112.7k | 28,317 | 13,062 |
| Crush | 118,634 | 111.1k-125.3k | 28,250 | 15,065 |
| OpenClaw | 124,800 | 119.2k-130.6k | 24,250 | 14,360 |

![Tokens per solved task for all 19 harness configurations, raw and cache-adjusted, from about 4k for Aider to 125k for OpenClaw](https://www.eishanlawrence.com/blog/harness-bench-v2/fig_tokens.png)

Two side notes. OpenClaw wrote `AGENTS.md`, `IDENTITY.md`, `USER.md` and `SOUL.md` into the project on all 36 of its runs. `SOUL.md` starts with "You're not a chatbot. You're becoming someone." Nanobot leaves a `.nanobot/workspace-id` file in every repo. The tests still passed, so no score catches this.

## Takeaways

- Same model, same tasks: 5.6x in tokens between the popular harnesses.
- The harness decides how much the model reads, not how much it writes.
- Most of the gap is the harness's own prompt, sent again every call. Claude Code and pi keep theirs small.
- Compare cache-adjusted numbers, and know how your provider prices cache reads.
- Check the mode, not only the harness.

## Details

- Runs on 2026-11-20 on a DigitalOcean droplet (8 vCPU, 16 GB), a few harnesses at a time.
- Model: `deepseek-v4.1-flash` on OpenCode Go, through its OpenAI, Anthropic and Gemini endpoints. The proxy added one session id per task run and recorded usage per call.
- Versions: Aider 0.86.2, Antigravity CLI 1.5.13, Claude Code 2.1.329, Codex 0.171.0, Crush 0.102.0, DeepSeek Harness SDK 0.2.2rc2, Goose 1.60.2, Grok Build 1.0.89, Hermes 0.19.0, Kilo 7.8.32, Kimi Code 2.7.2, mini-swe-agent 2.4.6, Nanobot 0.4.1, OpenClaw 2026.11.6, Opencode 1.19.6, pi 1.6.0, Qwen Code 0.28.0.
- DeepSeek Harness ran with its session-log upload, plugin inventory and telemetry turned off. None of those are model input.
- Startup overhead is the input of a task's first real model call. Crush's first call titles the session, so its overhead comes from the first agent call.
- Code and harness setup: [github.com/eishan05/harness-efficiency-bench](https://github.com/eishan05/harness-efficiency-bench/tree/v2), branch v2. Numbers per harness in [results.csv](https://www.eishanlawrence.com/blog/harness-bench-v2/results.csv).

## Limits

One model. 12 small, clear tasks that every harness can solve, so this shows what harnesses cost, not whether the extra tokens buy anything on hard problems. That needs harder tasks, like SWE-bench. Shipped defaults only; most harnesses can be configured leaner. The graders run tests the agent could have edited. None did, but the setup doesn't prevent it.
