Article
AI coding is getting expensive. It does not have to be.
Taming AI costs means looking at context, tools, routing, caching, and measurement together.

By Ahmet Demirbas
Developers get real value from AI coding tools, but the bill can grow fast and become hard to justify. Databricks recently wrote about managing AI coding costs at scale. Their results show more than 30% lower average task cost from routing and fewer generated tokens from better harness and cache tuning.
That is important, but it is only the first layer. Most expensive coding sessions grow before the model call. An agent searches a codebase, opens files, runs commands, and carries the results into the next turn. The original request can be a few words. The context around it can become enormous.
Why the bill grows
The useful unit is a completed task, not a single request. A model can be cheap per token and still make a task expensive if the agent reads too much, repeats the same tool output, loses a prompt cache, or needs extra turns to recover. A lower token count on one call is not a win if the task takes twice as many calls.
That is why the bill needs to be managed at the agent loop. Each loop has three parts: the context assembled before the call, the model chosen for the call, and the result carried into the next step. Mentlio measures and improves all three.
Mentlio works beside Claude Code, Codex, and Cursor. Developers can keep using the tools that make them productive while Mentlio removes context the agent does not need, uses a less expensive model when it can do the job, and shows the team what changed the bill.
The dashboard is where that becomes useful to a team. It turns individual model calls into a clear picture of spend and savings by team, workflow, engineer, tool, provider, and saver. Instead of seeing one monthly number, a manager can see what is driving it and what actually reduced it.

The point is not to make every task cheap. A hard debugging session, incident, or migration may need the strongest model and a lot of context. Mentlio preserves that. It looks for the cost that adds no value.
Most of the cost is created before the model call
A developer may type, “Please investigate and fix this bug.” The agent then decides what files to read, what searches to run, which tools to call, and what results to carry into the next turn. By the time the model sees the request, the original sentence can be a tiny part of the input.
- The agent searches the codebase and opens files.
- It runs tools and collects logs, test output, and command results.
- It carries some or all of that material into the next model call.
A cheap model can still be expensive if it receives a huge context on every turn. Mentlio Lens finds relevant code before the agent opens broad sets of files. Mentlio Logs keeps errors, warnings, and stack traces while removing repetitive output. Mentlio Recall leaves large local results out of the working context until the agent actually needs them.
Routing is more than picking the cheapest price
During a coding session, an agent often returns to the same files and recent tool results. Providers can reuse that context, which makes the next call much less expensive than sending it all again. A naive router can see a lower price from another model, switch, and throw that reuse away. The session then costs more even though the new model has a lower price.
Mentlio Route accounts for the value of the context already in the session. It considers task difficulty, the price difference, and the quality required to finish the work. It changes models when the price difference is large enough to beat the value of the cache and when the work can safely move. It stays with the current model when that familiar context is worth more. The goal is not the lowest price per token. It is the lower cost to finish the task.
An auditable receipt for the savings
A total savings number is not enough. For each intervention, Mentlio keeps three fields: the baseline cost, the actual cost, and the saver that made the change. That lets an engineering leader see whether the reduction came from routing, better retrieval, smaller logs, or a smaller working context.
- Baseline: what the task would have cost without the change.
- Actual: what it cost after the change.
- Mechanism: the saver that changed the task.
The raw prompt, source code, outputs, terminal content, and file paths stay on the device. Teams get the derived cost and savings evidence they need without sending their work away.
What we saw in Terminal-Bench
In our frozen 89-task Terminal-Bench 2.1 replay, Mentlio Route solved 82.92% of tasks at an average cost of $0.933 per task. The Fable 5 baseline solved 83.82% at $1.242 per task. Mentlio delivered 24.9% lower cost while retaining 99% of the Fable baseline's solved-task rate.
That is the standard we care about. Keep the quality that matters. Remove the cost that does not. You do not need to cap AI usage to get the bill under control.
Mentlio
Keep AI coding useful. Cut the waste around it.
Mentlio makes AI coding spend visible, cuts unnecessary context, and routes each task when a lower-cost model is enough.
Get a demoStarting point: Databricks, “Managing AI Coding Costs at Scale”. Mentlio's benchmark figures are documented in our research pages.
