← blog

· INIT Labs

How I cut my Claude Code token bill by 18%

Every call to the model costs about the same, so the lever is the number of calls. nonhuman is a 700-token skill that makes an agent make fewer of them.

The skill in this post is nonhuman, open source at github.com/nagisanzenin/nonhuman. It is a separate project from INIT Agent. It ships as a plugin or rules file for Claude Code, Codex, Gemini CLI, Cursor and others, but I have only measured it in Claude Code.

Every time a coding agent calls the model, it pays to read the whole conversation again.

I didn't start there. I started with a question that sounds more clever than it is: which programming language is cheapest for a model to write? If agents write most of the code and agents read it, maybe the code should be dense, typeless and free of comments. Maybe we had been paying for human readability all along.

So I had my agents take the bills apart. On real repositories, the code an agent writes turned out to be a small slice of what it pays for. The bill is mostly made of something else, and once I saw what, I stopped caring which language was densest.

Picture a writer who, before each new sentence, has to read the manuscript again from page one. Reading a page they have seen before is cheap, but the book keeps getting longer. Then they write the sentence down, which costs more, and think about it first, which costs the most. That writer is an agent, and each sentence is one call to the model.

On Anthropic's prices for Claude Opus 5.5, reading something the model has seen before (a cache hit) costs 5% of a fresh input token. Writing new context into the cache costs a quarter more than fresh input. Every token the model writes, thinking included, costs five times as much.

I measured what one call costs on 48 runs of real SWE-Bench Pro tasks with Opus 5.5. After the first call, an average call cost about 13,300 units, where one unit is the price of one fresh input token. It is made of four parts of nearly the same size.

The price of one call, the average of every call after the first in 48 Opus 5.5 runs: re-reading the cached conversation 3,700 units, writing new context 3,700, visible output 3,700, thinking 2,200. Total 13,300 units. The first call, which writes the 48,500-token prefix, cost 38,300 on average.

The chart breaks one call into those parts. Look at the first bar. The re-reading is cheap per token, but a call re-reads about 74,000 tokens on average, so it comes to as much as everything the model writes. The visible output is where the code lives, and it is a quarter of the call. Even code half as long would leave three quarters of every call untouched.

So the bill of a run is roughly a fixed first call plus 13,300 units for every call after it. The exact version is a sum over calls. Call i writes Δᵢ new tokens to the cache at 1.25, re-reads everything before it at 0.05, and writes oᵢ + hᵢ tokens of output and thinking at 5. Because the context grows by Δ at every call, the re-reading term grows with the square of the number of calls, and the rest grows in a straight line.

Billed cost against the number of calls for all 48 Opus 5.5 runs, with the cost equation and a least-squares line. Each extra call adds about 13,400 units, 6.7% of an average run.

The dots are the 48 runs and the dashed line is a straight-line fit through them. Runs scatter around it, because some calls read a large file and some think for a long time. The slope is what matters. Each extra call added about 13,400 units, close to 7% of an average run, and the number of calls is the biggest single thing that moves the bill.

That changed what I was trying to build. The skill came out of it: a rule file of about 700 tokens that any agent can load. Most of it is about calls. Put independent tool calls in the same turn, find the failing line before reading the file, edit each file once, run the tests once. A smaller part trims what a human would want and the next agent does not, like narration, recaps and re-printed code. One section lists what it may never cut: validation, authorisation, escaping, bounds checks.

The same arithmetic told me what not to do, and I had to learn that the hard way. An early version pushed the model to make even fewer calls: read everything at once, think the whole change through before the first edit, fix every failure in one go. Calls per run fell from 7.4 to 6.4. Thinking rose from 3,200 to 5,200 tokens per run, and the bill went up.

The equation says why. A call costs about 13,300 units, and a thinking token costs 5, so a rule that saves one call breaks even at about 2,700 extra thinking tokens, less whatever extra reading it causes. This one added 2,000 thinking tokens and 1,900 tokens of reading per call saved, which re-read at every later call. I threw it away and kept the lesson: a rule may remove repeated work, like re-runs and one-at-a-time reads, but it may never ask the model to think more.

Small test services tell you little about real repositories, so I moved to SWE-Bench Pro, a public set of issues from large open-source projects, graded by hidden tests. My agents ran each task in Claude Code, inside a container with no network and the hidden tests removed, once in each of three setups: no skill, my skill, and Ponytail, a popular skill that asks for the smallest change that works.

The first pilot, on four tasks, looked good on cost and bad on quality. My skill lost two runs that no skill won.

Both failures were the same mistake. In one, the agent renamed an identifier the spec had named. In the other, it cleaned up most of the callers but not all of them. My rules said "be terse" and "smallest diff", and the model had applied them to the one place they do not belong: the contract. The output a human never needs to see is fair game. The names the spec uses, and every case a requirement lists, are not.

I could have patched the two tasks. That would have taught the skill the benchmark. Instead I added one principle against the whole class: terseness applies only to throwaway output, and the smallest diff never means the smallest behaviour. I also added a step before the final reply, to check every requirement against the diff in the model's head without another call.

Then I wrote the test down before running it. The task list, the skill's hash and the pass criteria went into a file first: a bill at or under 0.95 times the baseline, and at most two more lost runs than won. The tasks were every Python task in the public hard split that I had not touched while building the skill, six from Ansible, six from Open Library and four from qutebrowser.

The new version passed both criteria. At Opus 5.5 prices its bill was 0.82 times the baseline, with a 95% interval of 0.76 to 0.88 over tasks. All three setups resolved all sixteen tasks, so there was no run that one won and another lost. Calls per run went from 13.7 to 11.2. Ponytail, which aims at small diffs rather than fewer calls, came out at 0.96 times.

Billed cost on 16 held-out SWE-Bench Pro tasks with Opus 5.5 at its list prices, each task relative to no skill, sorted by the saving. nonhuman: 0.82 overall, below 1.0 on 15 of 16 tasks. Ponytail: 0.96 overall. All three setups resolved 16 of 16.

Each row in the chart is one task, sorted from the biggest saving at the top. Look at the filled dots, the skill under test: fifteen of sixteen sit left of the line. This is still one run per task and setup, so I read the equal resolve rates as ruling out a large regression. A small one could still hide in there.

A note for anyone who runs this benchmark locally. The official evaluator, in local Docker mode, shared one workspace between patches graded in parallel, so patches could grade each other's code. Fixing it changed individual grades but not the totals. A second problem turned up later, and it is the better story.

A result on one model says little about a skill that I claim works for any agent. So I had my agents run the same sixteen tasks on DeepSeek V4.1 Flash, still in Claude Code but pointed at DeepSeek's API, for $4.21 in total.

In the first smoke run, the model solved a task in a way I had not planned for. The container images keep the project's git history, and that includes branches from after the fix. DeepSeek found the upstream commit that added the missing module, extracted it and installed it. My agents now delete every ref except the task's own commit before each run. I had them check all 96 Opus transcripts afterwards, and none had done this.

On the cleaned harness, the bill moved the same way. The skill cut it to 0.84 times (0.70 to 0.97), and calls per run fell from 52.7 to 39.2. DeepSeek calls the model about four times as often as Opus on the same task, and in 84% of its turns it asks for a single tool, so there was more for me to cut.

The bill of a baseline run on each model, by part. Opus 5.5 at its list prices: writing context 39%, re-reading the cache 23%, output and thinking 38%. DeepSeek V4.1 Flash: new input 13%, re-reading 18%, output and thinking 69%. nonhuman cut the first to 0.82 times and the second to 0.84 times.

What it saved was different, though. The chart puts the two bills side by side. DeepSeek charges about 2% of the input price for a cache hit, so re-reading costs almost nothing, and two thirds of the bill is the model writing and thinking. Fewer calls still paid off there, through less output and about 13% less thinking. The lever works on both price lists, for different reasons.

Quality did not hold. Without the skill DeepSeek resolved 14 of 16 tasks, and with it 12. Two tasks were lost that no skill had won. With one run each I could not tell noise from a real effect, so before running more I wrote down what would count as real: the skill fails a task in all three runs while no skill passes at least two.

Two tasks run three times in each setup on DeepSeek V4.1 Flash. openlibrary 3: no skill 3 of 3, Ponytail 3 of 3, nonhuman 2 of 3. openlibrary 4: no skill 2 of 3, Ponytail 0 of 3, nonhuman 0 of 3.

One task was noise, and the skill passed it twice on the rerun. The other was real, and the chart shows how clearly. Every failure on that task, in every setup, is the same hidden test and the same trap. The site returns language records as nested objects that look like dictionaries but are not, and the code read them as dictionaries.

Both small-diff skills failed it every time. Without a skill, the model wrote the extra defensive handling in two runs out of three. I think the same pressure that cuts a bill also cuts the code you would write "just in case", and on a weaker model that code is sometimes the fix. The rule I would add is to verify against the codebase's own fixtures, never against a stand-in you built yourself. I haven't added it, because it was learned on this task and has to be tested on tasks it has not seen.

Conclusion

A call to the model costs about the same every time: a re-read of everything so far, the new context, the reply and the thinking. Making the code shorter trims one of those four. Making the agent go back to the model less often removes all four at once, as long as the calls are not traded for thinking, which costs five times as much. On Opus 5.5 that came to 18% of the bill on real repositories, with nothing lost that I could measure. On a cheaper model it came to 16%, and it cost one task.

I think most of what is left is not in the prompt. Parallel tool calls the harness enforces, code that runs tools in a batch, a cheaper model for exploring: those cut calls without asking the model to think harder, and a rule file can't do them.

Back to the writer who re-reads the manuscript before every sentence. The rules I kept make them write more between readings. The rule I threw away made them stare at the page longer before each one. If you have measured where your own agent's bill goes, I would like to know whether the number of calls drives it for you too.

nonhuman is open source: github.com/nagisanzenin/nonhuman. The pre-registration, the per-call billing data, the harness and the three fixes to the official evaluator are in results/real/, results/real_deepseek/ and bench/real/. SWE-Bench Pro: arXiv 2509.16941. Opus 5.5 prices as listed on 25 November 2026.