AI costs · October 2026
We cut our AI bill per task by about a third, and the work still gets done.
Every time our agent works on a task, we pay the AI provider for how much text it reads and writes. We ran five everyday coding tasks 154 times, counted exactly what each one cost, and compared the same job on Devin.
- 36%less AI usage per task after our changes (35% lower cost)
- 17 of 20tasks done correctly after, 16 of 20 before, so no loss in quality
- $0.017our cost to investigate a bug report. Devin: $0.22, about 13 times more
- $3.47total cost of all 154 test runs
What we found
- The cost-saving tool we had added (Layman) was saving nothing on a new install, because it only shortened something that starts out empty.
- Most of the cost was the same background text being resent to the AI on every step, such as a long list of every skill the agent has.
- Shortening that list and the standing instructions made every step cheaper, and the two biggest tasks used about half as much.
- Telling the AI to "write less" backfired: it got sloppier and took more steps. We switched it off.
Where we still fall short
- Devin ran the bug-report task once; its answer was more complete (it also spotted a second bug).
- We tested one AI model on one small codebase. On large codebases the saving will be smaller.
- Scheduled automations get only part of the saving so far.
Bottom line: the same work now costs about a third less, and we are far cheaper per task than Devin, partly because we use a cheaper AI model.
Full technical write-up, for engineers
Module 04 · Token costs · three rounds, 2026-10-13
We counted every token our agent spends, found the Layman integration saving nothing, and fixed it.
NeoDevEx ships a vendored copy of Layman, a prompt-compression and brevity toolkit, to keep model costs down. We ran five real coding tasks 154 times on Gemini 2.5 Flash and read the token counts the model provider reported. On a fresh install the integration as shipped saved 0 tokens: it only compressed workspace memory, which starts empty, while every model call resent a fixed 15,600-token prefix. We moved Layman to where the tokens actually go. The same tasks now use 36% fewer tokens and cost 35% less (median per task), with the same pass rate. On an identical triage task, Devin charged $0.22 and NeoDevEx $0.017.
Where the tokens go
An agent run is a loop of model calls, 3 to 20 per task here, and every call resends the whole context: a fixed prefix plus the conversation so far. Before our changes the fixed prefix was 15,582 tokens. Input was 98% of all tokens; output (including the model's thinking) was 2%, but at Flash's prices it was about a fifth of the cost.
The first call of a run, by part (before)
Estimated from the character share of each part of the logged request against the provider's 15,423-token count for that call. The skills index lists the name and description of every bundled skill (69 of them) on every call; the SDK system prompt holds safety and security rules we chose not to touch. Automation runs add the delivery contract (about 1,200 tokens) to their first message, which is also resent on every call.
Layman, as it was integrated
What we found
- foundLayman ran in one place only: the workspace-memory snippets attached to chat messages. A fresh install has no workspace memory, so it saved 0 tokens per task.
- foundThe vendored compressor is deterministic and only removes filler words. On our already-terse prose it saved 0% of the delivery contract, 5% of the runtime notes and under 1% of the skill descriptions.
- foundIts plain prose pass broke a file name ("AGENTS.md" became "AGENTS. md"). Layman's protected pass, which keeps paths, code and commands byte for byte, does not; we use only that one now.
What Layman is good at
- useRewriting long Markdown once, keeping every fact, command and heading (its
/layman:compress). We did this to the automation delivery contract and checked the result with Layman's own validator. - use"Ultra" short descriptions: what a thing does and when to use it, no examples or filler. We applied it to the skills index.
- triedBrief mode for the agent's own messages. Measured in rounds 1 and 2, it made agents skip instructions and did not lower total tokens, so it is off (see Rounds).
What we changed
- shippedLean skills index. 46 of the bundled skills have trigger keywords and are injected in full whenever your message mentions one. They no longer also sit in the index sent on every call; the 8 skills without keywords stay listed and invocable. About −3,000 tokens per call. Trade-off: the agent cannot pull in a keyword skill on its own if no keyword appears in the conversation.
- shippedLayman skill descriptions. Every description cut to what the skill does and when to use it, at most 140 characters, through Layman's protected compressor (13,649 → 6,574 characters). The skill's full content still loads when it is used.
- shippedDelivery contract v6. The rules every automation run carries, rewritten Layman-style: 5,028 → 3,707 characters (−26%), with every command, code block, section name, signature and RESULT line unchanged. Layman's validator passes it against v5.
- shippedShorter runtime notes. The block that tells the agent which local services exist, same URLs, commands and JSON, fewer words.
- droppedBrief-mode output directive. Measured twice, removed (below).
Results: before and after, 4 runs per task
Round 3, runs interleaved so provider-side caching and load could not favour either side. "Before" is the app as it was this morning; "After" is the app with the four shipped changes. Medians per task; total tokens = input + output.
| Task | Passed before | Passed after | Tokens before | Tokens after | Change | Cost before | Cost after |
|---|---|---|---|---|---|---|---|
| T1 · Fix the failing tests | 4/4 | 4/4 | 207,417 | 97,452 | −53% | $0.0302 | $0.0187 |
| T2 · Answer a code question | 1/4 | 1/4 | 47,821 | 36,346 | −24% | $0.0124 | $0.0081 |
| T3 · Review a pull request (automation) | 4/4 | 4/4 | 86,487 | 76,364 | −12% | $0.0128 | $0.0150 |
| T4 · Triage a bug report (automation) | 4/4 | 4/4 | 161,430 | 147,580 | −9% | $0.0179 | $0.0174 |
| T5 · Add a feature with a test | 3/4 | 4/4 | 319,726 | 169,866 | −47% | $0.0445 | $0.0178 |
| All five tasks | 16/20 | 17/20 | 822,882 | 527,609 | −36% | $0.118 | $0.077 |
Every model call got cheaper: input per call fell 14% (20,562 → 17,663 tokens) and cost per call 17% ($0.00301 → $0.00251). How much a whole task saves also depends on how many steps the agent happens to take, which varies run to run: using means instead of medians, the saving is 16% of tokens and 19% of cost. T2 fails on both sides for the same reason: Gemini 2.5 Flash names only one of the two bugs.
We also measured the app as it stands after another change landed the same day (a <WORKING_RULES> block from separate work on chat quality): 29% fewer tokens than before, but 13/20 passed, mostly because T5 dropped to 1/4 (the test went into the wrong file and unrelated bugs got fixed). That block is under review separately; the numbers above isolate the token changes.
The same task on Devin
Devin does not show token counts; it bills each session in dollars (ACU-based credits), which its usage page lists. We ran T4 (triage the discount bug report, no posting) on Devin with the identical bug report and repository.
Devin
- devin$0.22, about 16 minutes. Correct root cause, P0, a fix, and it also flagged the second (shipping) bug.
- devinOther sessions in the same account cost $1.20 to $5.20 each (a review $3.14, test coverage $5.20, a security scan $5.02).
NeoDevEx
- neo$0.017 median, about 40 seconds, 4 of 4 correct (root cause, priority, fix). Before our changes: $0.023.
- neoAll 154 benchmark runs in this study, three rounds, cost $3.47 in total.
Most of that gap is the model: Devin uses its own frontier models, NeoDevEx ran Gemini 2.5 Flash. The Layman work is what we control on top of any model, and it applies to every model, including stronger ones that cost more per token.
How we got there: three rounds
| Round · variant | Runs | Passed | Tokens vs before | Cost vs before | Verdict |
|---|---|---|---|---|---|
| 1 · Layman compression + brief-mode output directive | 15 | 10/15 (before 12/15) | +10% | +1% | Rejected: agents skipped instructions |
| 2 · Layman compression only | 15 | 13/15 (before 12/15) | −9% first call | −17% (mean) | Kept; saving too small |
| 2 · Compression + narration-only directive | 15 | 12/15 | +26% | +20% | Rejected |
| 3 · Compression + lean skills index | 20 | 17/20 (before 16/20) | −36% | −35% | Shipped |
The brief-mode directive is what Layman is best known for, and it reads well in a chat. On an agent it backfired: told to write less, Gemini 2.5 Flash also read less carefully, put a requested test in the wrong file, fixed things it was not asked to, and took more steps. Output was only about 2% of tokens anyway.
What is left
- Tool schemas (~4k tokens per call). The task-tracker tool alone is about 1,300 tokens on every call and was used in none of the 154 runs. Dropping it would save roughly another 7%, but it is the agent's planning tool on long tasks, so we left it in.
- Automation runs. Real automation runs build their agent inside the automation service, not from the app's chat settings, so in production they get the shorter contract but not the lean skills index. T3 and T4 here ran with the app's settings plus the contract.
- Prompt caching. Gemini already serves about 70% of input tokens from its cache at a quarter of the price, which is why cost falls less than tokens on some tasks.
How we measured
- The harness (
run_bench.py) runs each task with OpenHands SDK 1.42.1, the version the agent-server ships, and builds the agent from the exact settings the app sends (dump-app-context.test.tscalls the app's ownbuildStartConversationRequest): same tools, skills and system-prompt additions. The browser tool was off for every variant. - Model: Gemini 2.5 Flash. Token counts and costs are what the provider reported for each call, summed by the SDK; nothing is estimated except the per-part breakdown of the first call.
- Tasks ran on a fresh copy of a small cart service with two planted bugs. Each task has a mechanical pass check: tests pass, the answer names both bugs, the review flags the wrong divisor, the triage names
totalWithDiscountand the divide-by-100 fix, the new test file exists and the function returns the right value. - Variants were interleaved run by run. With 4 runs per task the step count still varies a lot, which is why we report medians and means.
What could skew this
- One model and one small repository. On a large repository the conversation part grows and the fixed prefix becomes a smaller share, so the percentage saving will be smaller.
- Devin was run once on one task; its other costs come from unrelated sessions in the same account.
Raw data
- round3-results.jsonlAll 60 round-3 runs: tokens, cost, steps, pass, final message.
- round2-results.jsonlRound 2, 45 runs.
- round1-results.jsonlRound 1, 30 runs.
- summary-round3.jsonPer-task medians and totals.
- devin.jsonDevin session costs read from its usage page.
- run_bench.pyThe harness.
- dump-app-context.test.tsDumps the exact agent settings the app sends.
- contract-validation.jsonLayman's validator on contract v6 vs v5.