The cheapest way to run a Claude Code-style coding agent
The harness can be free; the model is the bill. An agent session is mostly input tokens, so a model with cheap cached input — DeepSeek V4 Flash at about $0.12 for the session below — costs a fraction of a frontier model, and a local model costs nothing per token.
Updated
Ta strona jest napisana po angielsku. Terminy, które wyjaśnia, są tymi, których szuka się po angielsku, a przetłumaczony termin fachowy to już inny termin.
Where the money goes in an agent session
A coding agent re-sends the conversation on every turn: the system prompt, the files it read, every tool result. So a session reads millions of input tokens and writes comparatively few. Two prices decide the bill — cache-read input and output — and the headline input price matters less than it looks.
One session, priced on each model
An illustrative session: 3M input tokens, of which 2.5M are cache hits, and 60K output tokens. Roughly an hour of steady work on a mid-sized repository.
| Model | Input / cached / output ($/M) | This session |
|---|---|---|
| Ollama or LM Studio, local | 0 / 0 / 0 | $0 (your hardware) |
| DeepSeek V4 Flash | 0.15 / 0.003 / 0.60 | ≈ $0.12 |
| GLM-5.3 Flash (Z.ai) | 0.15 / 0.03 / 0.50 | ≈ $0.18 |
| DeepSeek V4 Pro | 0.435 / 0.0036 / 0.87 | ≈ $0.28 |
| Gemini 3.6 Flash | 0.75 / 0.075 / 3.75 | ≈ $0.79 |
| GPT-5.4 mini | 0.75 / 0.075 / 4.50 | ≈ $0.83 |
| Kimi K2.7 Code | 0.95 / 0.19 / 4.00 | ≈ $1.19 |
| GLM-5.3 (Z.ai) | 1.40 / 0.26 / 4.40 | ≈ $1.61 |
| Claude Sonnet 5 | 2.00 / 0.20 / 10.00 | ≈ $2.35 (incl. cache writes at $2.50/M) |
| GPT-5.5 | 5.00 / 0.50 / 30.00 | ≈ $5.55 |
Source: List prices in USD per million tokens, from the models.dev snapshot shipped with OHarness (fetched 2026-09-19). Vendors change prices; check theirs before relying on a number.
Cheap per token is not cheap per task
A model that fumbles tool calls or loops on a failing test spends more turns, and turns are what cost money. The cheapest setup that works is usually two models in one session: a cheap one for reading, searching and small edits, and a stronger one switched in with /model for the change that needs it. In OHarness that switch converts nothing, so there is no penalty for doing it often.
Set it up
npm install -g oharnessexport DEEPSEEK_API_KEY="..."oharness -m deepseek/deepseek-v4-flashThen, mid-session, /model deepseek/deepseek-v4-pro or /model anthropic/claude-sonnet-5 when a harder step comes up, and /cost to see what the session has spent so far.
Flat-rate plans
Several vendors sell coding subscriptions with their own endpoints, and OHarness has an entry for each: Z.ai GLM Coding Plan, Kimi Code, Alibaba Coding Plan, and a ChatGPT plan through openai-codex. A plan key only works on the plan's endpoint, which is why each is a separate provider with its own key variable.
Common questions
What is the cheapest alternative to Claude Code?
Running a free harness such as OHarness against a local model through Ollama costs nothing per token. Among hosted models, DeepSeek V4 Flash is among the cheapest that handle tool calling well: about $0.12 for a session of 3M input and 60K output tokens at list price.
Why is cached input price more important than input price for coding agents?
A coding agent re-sends most of the conversation on every turn, so the bulk of its input tokens are repeats the provider can serve from cache. In a typical session most input is cache hits, which is why a model with a very low cache-read price can be many times cheaper than its headline input price suggests.
Can I use Claude models and cheaper models in the same session?
Yes. OHarness stores history in a vendor-neutral format, so /model can switch from DeepSeek to Claude and back mid-session without converting or losing the conversation.
Does OHarness itself cost anything?
No. The harness is free to use with your own provider key or a local model. The optional hosted plan bills model usage in credits; it is a convenience, not a requirement.