What is a Harness?
Claude Code and Codex are harnesses, not models. Here is what a harness does, why it changes your bill, and which one you should use.
When people talk about AI coding tools, they often say things like “I use Claude” or “I switched to Codex.” However, that isn’t quite accurate. Claude and GPT are model families. Anthropic’s include Opus, Sonnet, and Haiku. OpenAI’s include GPT-5.x in full, mini, and nano sizes, plus Codex-tuned versions. Claude Code and Codex, on the other hand, are harnesses. These are programs that sit between you and the model, deciding what the model sees and what it is allowed to do. You can usually swap one without touching the other.
A key source of confusion is Anthropic. Since early 2026, it has blocked people from using a Claude Pro or Max subscription in any harness other than its own. In January, it tightened safeguards against third-party tools that pretended to be Claude Code, and in April it began blocking third-party harnesses from subscription billing entirely (VentureBeat). You can still use Claude models elsewhere with an API key, but your subscription only works in Claude Code. Since Anthropic arguably has the best models, this made alternative harnesses less appealing for a time. Some alternative harnesses have workarounds for using Claude subscriptions (plugins, etc.), but in general, these violate the TOS and can result in your account being banned.
Luckily, Anthropic is the exception. Most models can use any harness you prefer. Popular harnesses fall into two groups: those that ship with a model provider (Claude Code, Codex) and independent ones such as OpenCode and pi.
What Is a Harness?
To understand a harness, you need to remember what an LLM does. As I said in my AI FAQ, broadly speaking, an LLM predicts the next token in a sequence. That’s it. A model by itself can’t search the web, open a file, or run a command. It can only produce text.
A harness gives the model a list of tools, along with descriptions of how to call them. When the model wants to use one, it writes out a tool call (a tool name and some arguments) and stops. The harness reads the call and sends the result back to the model in the next request. The model then reads the result and continues.
Let’s look at an example. Imagine you want an LLM to look online. You ask, “What’s the weather in Austin tomorrow?” The model can’t know the answer from its training data, so it writes a tool call that might look like this:
{"tool": "web_search", "arguments": {"query": "Austin weather forecast tomorrow"}}
The harness sees the call, runs the search, and pastes the results into the conversation. It then sends everything back to the model, which uses the results to write its response. The model never touched the internet. It only wrote text in a format the harness knew how to act on. Every “agentic” thing you have seen an AI do is this loop, repeated.
Most models are trained on specific tool formats and perform better when the harness uses the format they expect. OpenAI’s GPT-5 models were trained to edit files with a tool called apply_patch, which takes structured diffs. Claude was trained on Anthropic’s str_replace_based_edit_tool, which swaps an exact block of old text for new text. A harness built for one model family may feel clumsy with another. That gap, however, has narrowed. Mario Zechner, who wrote pi, points out that frontier models “have been RL-trained up the wazoo, so they inherently understand what a coding agent is” (Zechner). So most people will likely see little, if any, degradation.
So, Does the Harness Matter?
Yes, especially when it comes to costs.
Arena, the group behind the Chatbot Arena model leaderboard, worked with Berkeley’s Sky Lab to test coding harnesses and found that the same model often solved about the same share of tasks while costing as much as five times more. Claude Code cost about twice as much as pi on SWE-bench Lite. One paper held the model fixed across twelve harness setups and found that tokens per solved task varied 46-fold on one model and 83-fold on another (Lawrence). Another found that running the same models through Claude Code multiplied cost per run five to eight times compared to calling the model directly (The Harness Tax). With prices going up and subscription limits tightening, that’s the part I’d pay attention to.
The harness can also determine whether the model gets the job done at all. On the Terminal-Bench leaderboard, Claude Opus 4.6 solved 58.0% of tasks in Claude Code and 79.8% in a third-party harness called ForgeCode (Gorinova et al.). Reddit users have found the same in their own tests. One user ran Kimi K3 through eight harnesses on 25 tasks and saw pass rates range from 68% in Codex to 88% in Oh My Pi, a harness built on pi (r/kimi). The same user ran DeepSeek V4 Flash through eight harnesses. Pi passed 66.7% of the tasks, and OpenCode passed 46.7%. Each successful task cost $0.028 in pi and $0.195 in Claude Code (r/DeepSeek).
Much of this comes down to what the harness sends with every request, so let’s look at one.
The Making of a Request
When you type a prompt, much more than just your prompt gets sent. The model has no memory of you between calls, so it needs to be told who it is, what it can do, and what has happened so far.
The first thing sent is the system prompt, a block of instructions from the harness that tells the model how to behave. Every provider and harness has its own, and most harnesses let you append to it.
Next come the tools and their descriptions. You might expect the system prompt to be the main expense, but the tool definitions usually cost more. In the Arena and Berkeley study, the first request each harness sent before doing any work looked like this (AINews):
| Harness | Tools | First-call input tokens |
|---|---|---|
| pi | 4 | 1,972 |
| Codex | about 7 | 11,308 |
| Claude Code | 23 | 27,011 |
I’m going to set aside MCP servers for now. They add extra tools to a harness, and Claude calls them “connectors” in its apps. For our purposes, think of them as additional tool calls. Connecting one sends each tool’s name, description, and input schema to the model (MCP spec). The code that runs the tool stays on your machine or the server, but the descriptions alone add up. Zechner notes, for instance, that the Playwright MCP server adds 21 tools and about 13,700 tokens to every session.
All of this is sent with every request. The model’s API is stateless, so each call includes the tools, the system prompt, and the entire conversation up to that point, including every tool result (Ivanov). If you type “hi” into Claude Code, the model reads tens of thousands of tokens before it reaches your one word. It must process all of that before it can respond, which is part of why the first response in a session is usually the slowest.
All of it also takes up space in the context window. Models now advertise windows of a million tokens, but they don’t use all of that space equally well. Chroma tested 18 models and found that performance declined as the input length increased, even on simple tasks where only the length changed (Chroma). Every token the harness adds pushes your actual work further toward the part of the window where the model performs worse.
What Is a Cache?
Now you might be thinking: if Anthropic chooses what Claude Code sends, they must not be charging for those initial tokens, especially since many might be redundant. The answer is that, of course, they do. On the API, you pay for every token. On a subscription, they count against your usage limits.
This is where the cache comes in. When a model processes a prompt, it computes intermediate values for every token. A prompt cache saves those values for the beginning of the prompt (the prefix) so the next request with the same prefix can skip that work (OpenAI). Since the tools, system prompt, and earlier conversation sit at the front of every request, most of each request can come from the cache.
Cached tokens are much cheaper. On Anthropic’s API, reading from the cache costs significantly less than the normal input price (Anthropic). The cache doesn’t last forever, though. Anthropic’s default lifetime is five minutes, reset each time the cache is used, and you can pay more for an hour. OpenAI keeps in-memory caches for about five to ten minutes of inactivity, with longer retention on some models.
The cache only works if the prefix matches exactly. Anthropic builds it in a fixed order (tools, then system prompt, then messages), and any change invalidates everything that follows. In practice, these things break the cache:
- Stepping away for longer than the cache lifetime, usually five minutes
- Adding or removing an MCP server or tool mid-session
- Editing the system prompt or your
CLAUDE.md/AGENTS.mdfile mid-session - Switching models, since each model keeps its own cache
- Editing or deleting earlier messages, or compacting the conversation
After a break, the next request will cost full price or more because Anthropic charges extra to write to the cache. So try to avoid these when you can. Finish a thought before you get coffee, and set up your tools before you start, not halfway through.
So What Harness Should You Use?
That is likely a lot to keep up with, but it brings us back to the question of which harness to use, since each creates different contextual challenges. In general, I think you can roughly categorize them into three levels, with the later ones providing not only more control but usually also better performance with less overhead and cost.
Beginner: The Provider’s Own Harness
The easiest option is, of course, to use the one that comes with your model: Codex for OpenAI models and Claude Code for Claude. These harnesses are specifically built and tested to work with the models they are designed for. They work with your existing subscription, and you don’t have to configure anything. If you have a Claude subscription, Claude Code is also your only option. Be aware that both have been steadily adding features, and in Claude Code’s case, those features show up in the token counts above.
Intermediate: OpenCode
If you want to try something else, I’d recommend OpenCode. It connects to many providers and often offers a few models to get started with. Its creators also run OpenCode Go, a $10/month subscription (or $40 for Go Plus) that gives you access to a rotating set of models, mostly open ones such as Kimi, GLM, Qwen, and DeepSeek. It also works with other harnesses, not just OpenCode. It’s a cost-effective way to test different models and see which ones you like.
You can also run local models through Ollama and connect them to OpenCode (Ollama). Ollama has a cloud service as well that does much of what OpenCode Go does. Either option works with the OpenCode harness.
Advanced: pi
If you’re comfortable configuring your own tools, try pi. Like OpenCode, you’ll need to bring your own model provider. Pi takes a minimal approach: by default, it gives the model four tools (read, write, edit, and bash) and a very short system prompt. MCP support only arrived recently, as a built-in extension (pi changelog). Anything else comes from extensions. Because it is so easy to extend, features that show up in other harnesses tend to appear as pi extensions and packages quickly, and you decide which ones you want. Thus, you control what goes into the context. Zechner’s argument is that “context engineering is paramount” and that existing harnesses make it hard by “injecting stuff behind your back that isn’t even surfaced in the UI.” A smaller harness keeps more of the context window free for your actual work, which also keeps the model in the range where it performs well for longer.