The Cheapest AI Call Is the One You Don't Make
By Kris Bahar · October 24, 2026
At 4:12 in the morning on October 3rd, I typed one paragraph into an AI coding agent. Typos and all, this is what it said:
II have a game, Rogue LEgend running in google play games on this PC in a the left half window of the screen. I want to build an app that I can put on the right half that will help me automate actions. Ideally, we get really detailed if we can and you read the images and what I'm clicking and get to know whats happening in the game. Then you can help me make optimal decisions and play on your own.
Twenty-three minutes later there was a working app on the right half of my screen. By mid-afternoon it was playing the game. By half past three I had told the agent to stop worrying about tokens and just play faster: "ok to use the tokens for this."
Four days later I looked at the usage numbers and changed my mind completely.
This article is about what happened over the next three weeks. On the surface it's a story about a game bot. Underneath, it's about two AI agents: the one I built, which plays the game, and the one that built it, which wrote roughly 7,000 lines of Python while I wrote none. Both of them ended up teaching me the same lesson, which is the title of this piece.
This Is Not a Clicker Game
A quick word about the game, because it matters for everything that follows.
There is a whole category of games where the right automation is dumb. Idle games, clicker games, anything where progress means tapping the same spot a thousand times. I know this category well, because I built a tool for it. Pixel Triggers records click patterns, watches for colors on screen, and runs conditional flows in the background while you use your PC for something else. For a clicker game it's the right tool, and it is exactly as intelligent as it needs to be, which is not at all. (It's one of the products on my software page, so consider this a self-interested plug.)
Rogue Legend is not that kind of game. Each run is a board: you roll dice, land on tiles, and battles play out on their own. After each fight you choose one of three upgrades. Between fights there are shops, events with gambles attached, campfires, and a boss waiting at the end. The store listing calls it "idle-friendly," and that's fair: the battles are automatic, which is exactly why a pixel bot gets you almost there.
The gap is the decisions.
Which stage do you attempt? Higher stages pay more, but a run that dies halfway returns almost nothing, so pushing too high is the fastest way to waste your energy. Which of the three skills fits the build you've assembled so far? A poison build wants different things from a fire build, and the three cards on offer are random every time. Do you take the cursed vendor's deal? Do you use the one free revive now, or save it for the boss? Do you push to a harder stage because the last ten runs went well, or stay where you are because the last three didn't?
The same screen needs a different answer on different runs. That is the one thing a pixel bot cannot do.
To make it concrete, here is what one skill pick actually involves in the app today. There's a tiered priority list for the poison build, maintained in a text file I can edit. There's a running score that tracks how much of the build so far is damage and how much is survivability. There's a target balance between the two, and that target shifts toward survivability after recent defeats. The model reads the three cards, scores each against all of that, and picks. Sometimes none of the three fit, and the question becomes which is least bad.
So the first version did the obvious thing: it asked Claude everything.
Version 1: One Prompt Does Everything
The first loop was as simple as it sounds. Take a screenshot. Send it to Claude with the goal ("farm this stage, play a poison build, use the free revive once") and a short description of the last few actions. Get back one action: tap here, swipe there, wait, or done. Do it. Repeat.
That meant every single decision went to the most capable, most expensive model available. Every dice roll. Every "Tap to continue." Every loading screen. Every one of the twenty-odd seconds of a battle it couldn't influence anyway.
It worked on day one, and I want to be clear that this was the right way to start. If I had begun by building clever automation for every screen, I would have spent a week guessing which screens needed cleverness. Instead the expensive model told me, one decision at a time, what a competent player does in this game. That record turned out to be the most valuable thing the first version produced.
Lesson: start with the simplest thing that works, then optimize what you can measure. The wasteful first version isn't a mistake. It's the map.
Behind the build. The pattern that made the first version possible, and every version after it, was the same: describe the goal, let the agent write a plan, read the plan, then say "implement it." The 4:12 prompt became a plan by 4:16 and a running app at 4:35. I never opened the code editor that night. I spent the time explaining the game instead.
Measure Before You Optimize
On October 7th, after a few days of letting it play, I asked the coding agent to put together a plan for cutting costs. Before writing any optimization, it did something I should have asked for on day one: it went through the logs and worked out what a run actually cost. The answer was about 230 model calls per run, roughly 12,000 a day.
So the first thing we built was not an optimization. It was two spreadsheets.
The first logs every model call: which tool it used, what kind of screen it was looking at, how many tokens went in, how many came from cache, how many came out, what it cost, and how long it took. The second logs every run: the stage, win or loss, which skills were picked, and a score for how balanced the build was.
Every decision for the next two weeks came from those two files. Two small report tools sat on top of them. One compared a trial period against a baseline: wins, build quality, cost, time per run. The other, which came later, measured how often a cheaper model agreed with the expensive one.
I keep returning to this because it is the step most people skip. Cost numbers on their own are a trap. It is very easy to make an AI system cheaper by making it worse, and if you aren't measuring the outcome, you will not notice until the outcome is bad enough to see without measuring.
Lesson: measure per call and per outcome before you touch anything. If you can't say what quality looks like in a number, you can't tell optimization from degradation.
Behind the build. From here on, my prompts fell into a rhythm. Play for a few hours. Come back: "OK, I should have more data now, can you take a look and optimize again?" I sent some version of that message three times in one 24-hour stretch. The agent read the CSVs, proposed changes, implemented them, and I went back to playing. My job was to generate the data and decide which trade-offs I'd accept.
Make Each Call Cheaper
The first round of optimization kept the model in charge of everything but made every call cost less.
Prompt caching. Most of what the model needs to know doesn't change from step to step: the rules of the game, the skill priority list, the accumulated notes about screens and events. That part went into cached system blocks, and only the screenshot, the recent history and the current strategy changed each call. After this, about 90% of input tokens were cache reads, which are a fraction of the price of fresh tokens.
Smaller screenshots. The game renders tall and narrow. Shrinking the longest side to 1000 pixels cut image tokens by about 40%, with coordinates scaled back to the real screen afterward. Tap accuracy on small buttons had to be checked before keeping this, and it held.
Short context. Only the last eight actions plus a running strategy summary, instead of the whole history. The summary is refreshed every hundred steps by a separate review call, which is itself cheaper than carrying the full history on every step.
Structured output. The model answers through a tool schema, not free text. No parsing failures, no retries, and answers that are as short as they can be.
These were straightforward, and together they made each call substantially cheaper. But the model was still being asked about every dice roll. The call count was the real problem.
The Cheapest Call Is the One You Don't Make
Here is the chapter that gives the article its name.
A roguelike run is mostly repetition punctuated by decisions. The dice button is always the dice button. "Tap to continue" always means tap to continue. A battle plays out on its own for twenty seconds and there is nothing to decide until it ends. If the expensive model is answering those, you are paying for judgment where no judgment is needed.
Three things removed most of those calls.
A settle gate. Before asking anything, wait until the screen stops changing. Dice are rolling, the character is walking, a screen is loading: none of those are decisions, and asking the model what to do during them produced a confident "wait" that cost the same as a real answer.
Watch waits. For long automatic phases like battles, the model names a static element on screen to watch, and the app waits locally until that element changes. One call at the start of a battle instead of one every few seconds for its whole duration.
Reflexes learned from the model. This is the one I like most. When the expensive model taps the same kind of button repeatedly, the app cuts a small template from the screenshot and taps it itself next time, with a two-step confirmation and a check that the screen actually reacted. If the screen doesn't change, the reflex stops itself and hands the step back to the model. Choices that are only right on one stage live in that stage's own profile.
Which brings the pixel bot back into the story. The reflex layer is the same class of automation as Pixel Triggers: match a region of the screen, click it, verify. The difference is who configured it. Nobody sat down and defined these triggers. The reasoning model's own decisions taught the app which taps were safe to automate. The expensive model became a teacher for the cheap one.
A fourth, smaller trick: scrolling a long list to find the right stage is now local. The model is only asked for the final START tap, and the app checks the stage number digit by digit, because "46" and "49" look alike to plain template matching.
After this round, calls per run fell from about 230 to about 58. Three quarters of the model's work had turned out not to need a model at all.
Lesson: deterministic automation handles the repetitive majority. The expensive model's own behavior tells you what to automate. Watch what it does repeatedly, and stop asking.
Behind the build. The same principle was running in my chat window. The coding agent handled the repetitive engineering: the template matching, the CSV plumbing, the retry logic, the Windows window-handling code I had no interest in writing. My attention went to the places where a wrong decision was expensive: what to measure, what counted as good enough, and when the agent's picture of the game was wrong. On October 6th I spent the better part of two hours correcting its understanding of the game's damage types, because the skill priority it had researched online was out of date and I knew it from playing. No amount of agent capability replaces being the one who actually knows the domain.
Bringing the Model Home
On October 9th I asked a question I'd been circling for a while: this PC has a serious GPU in it, so what would it take to run the model locally and pay nothing per token?
The honest answer was: a lot of care. The first attempt, two days later, was a failure. I switched the whole play loop to a local vision model on a Sunday evening, and within an hour it was "recording" victories on battle screens that were nothing of the kind. My message to the agent that night was "these are all false victory screens," followed forty minutes later by "it's not working well, let's go back to Claude." Three local candidates were tried in that first round. None of them were good enough.
What that failure produced was the method that eventually worked.
Shadow mode. The expensive model keeps playing. A local model answers the same prompt in the background, and the app logs whether the two agree. Nothing the local model says affects the game. You get a direct measurement of how good it is on real screens, at no risk to the win rate.
An eval set from production. Every step the expensive model plays is saved as a test case: the exact screenshot, the exact prompt, and the answer it gave. Those cases are grouped by category: routine screens, skill picks, decisions like events and shops, and stage selection. A benchmark tool replays them against any candidate model and reports agreement per category.
This is where it got interesting. The model that eventually won, a 27-billion-parameter vision model with reasoning enabled, matched the expensive model on 85% of routine screens and 85% of skill picks, and 70% of event and shop decisions. A second candidate ran 1.7 times faster and looked attractive for that reason alone. On skill picks it got 1 out of 20 right. Had I chosen on speed, the win rate would have told me about it a few hundred runs later.
Route by risk, not by screen type. This was the decision that made local mode viable, and it was mine, not the agent's. Looking at where the local model was weak, I asked for a specific split: the local model plays, but the expensive model is called when the local answer is invalid or low-confidence, when the screen is unfamiliar, when a run result needs confirming, and whenever the next run's stage is being chosen. The reasoning is about cost of error, not difficulty. A wrong tap in the middle of a run is cheap: the next step fixes it. Starting the wrong stage wastes energy and a whole run. Those are the calls worth paying for.
Today, roughly 43 decisions per run go to the local model, plus all the reflex taps and waits. About five and a half go to the expensive one.
Lesson: use the strong model as teacher and judge. Its answers become your eval set. Shadow mode proves a cheaper model before it acts. And when you route, route by what a mistake costs, not by how hard the question looks.
Behind the build. The agent wrote the shadow mode, the eval capture and the benchmark harness. I decided what passing meant. On October 16th a benchmark run was taking too long and I told the agent to stop it and move on, because the numbers I already had were enough to make the decision. Knowing when the measurement is good enough is a judgment call, and it was always mine.
What the Cheaper Model Exposed
Switching models surfaced a set of problems the expensive model had been quietly absorbing.
Coordinate systems. The local model answers positions on a 0-to-1000 grid. The prompt talked about pixels. Sometimes it answered in a third, transposed space that was neither. The fix was to show grid-based models exactly one coordinate system and to convert every stored position, in notes, history and strategy, at the boundary. Different models follow different conventions, and nothing tells you until a tap lands in the wrong place.
False victories. Covered above. Run results now require the expensive model's confirmation, about one call per run.
The wrong stage. A learned note sent runs to the wrong chapter. There is now a wrong-stage guard, a warning carried into the following steps, and a mismatch check before the Play button.
Missed clicks. Sometimes the tap simply didn't register, and the model would see the same screen again and repeat itself. Every tap is now verified: did the whole screen change, or did the region around the tap change? If not, click once more. Two dead taps in a row hand the next step to the expensive model.
Unreadable answers. A reasoning model that thinks for too long sometimes ends without producing the structured answer. Retry once without reasoning, then escalate.
Background jobs that didn't fit. A periodic job that rewrote the notes file overflowed the local model's context and failed every ten minutes for hours before anyone noticed. That job now goes to the expensive model, and only once ten notes are waiting.
The pattern across all of these is the same. The old system trusted answers. The new one verifies actions. Did the tap change the screen? Is this the stage we meant? Does the result screen agree with what the model claims? Those checks cost nothing and they caught every one of the failures above.
Lesson: verify actions instead of trusting answers. A cheaper model doesn't just make more mistakes, it makes different ones, and the only defense is checking the world rather than the output.
Behind the build. Almost none of these bugs were found by reading code. They were found by watching the game. "Why do I get this note about chapter 47 when running the level 39 farm?" "Sometimes the mouse doesn't actually click the point." "The app stopped running overnight." Each one was a sentence from me describing what I saw, and a fix from the agent an hour later. The human in this loop was a pair of eyes on the outcome, which turns out to be exactly what the system itself was missing.
Plumbing Beats Model Swaps
The first night of local play had one more problem. Each step took about eleven seconds, and my message to the agent at two in the morning was, verbatim, "do the calls just take this much longer to run?!"
Half of those eleven seconds were the local model re-reading the same twelve thousand tokens of game knowledge on every step. Prompt caching should have fixed that, and in a sense it was working, but the model's attention design only keeps a resume point near the end of the prompt, right after the screenshot, and the screenshot changes every step. So the cache was effectively useless.
The fix was almost embarrassingly small. After each full read, the app sends a tiny text-only request with the same system prompt and no image. That leaves a resume point inside the fixed part of the prompt. The next real step then only has to read about 2,800 new tokens instead of twelve thousand. Step time dropped from about eleven seconds to about five. Minutes per run went from 22 to 18. No model change, no quality change, just a detail about how the inference server caches.
A second piece of plumbing fixed the thing that had been bothering me since day one: the app used my actual mouse, so I couldn't use the PC while it played. Background mode captures the game window directly and sends taps and swipes as window messages to the emulator, so the game can sit behind other windows and the cursor never moves. Pixel Triggers has had that feature for a while. It was a strange pleasure to port the idea over.
Lesson: inference plumbing matters. A cache detail doubled local throughput with no model change. Benchmark the system, not just the model.
The Results, in Percentages
Here is where things landed, comparing the last five Claude-only days against the most recent five days in local mode.
Daily cost per run tells the story in one picture. The Claude-only days are indexed at 100%; the switch to local mode on October 15th is obvious.
A few honest caveats.
The 90% reduction in calls is measured from the first logged baseline, which was already after the first optimization round. Measured from the very beginning, the reduction in calls per run is closer to 98%. I'm using the smaller number because it's the one I can back with a spreadsheet.
Runs got slower. Local inference on a single GPU is not as fast as a hosted API, even after the caching fix. For a system that plays while I sleep, 14% slower is a trade I'll take for an 81% cost reduction. For a system with a user waiting on the other end, it might not be.
The win rate went up, but not because the local model plays better than the expensive one. It doesn't. It went up because the verification layer, the reflexes and the risk-based routing removed a class of errors that had nothing to do with model quality, and because the expensive model now spends its calls on the decisions that decide runs. The first day of local play, before most of that was in place, had a 71% win rate. It took a week of fixes to get above the old baseline.
Over the eighteen days the results log covers, the app played 1,096 runs and won 989 of them.
What My Job Became
I said at the start that this was a story about two agents. Here is the second one.
Over three weeks, an AI coding agent wrote about 7,000 lines of Python across 36 files: a desktop app, two model backends, a template-matching vision layer, a background input system for Windows, an eval harness, three report tools, and the play loop that ties it together. I wrote none of it. I sent about a hundred messages across four long chat sessions, nearly all of them between ten at night and five in the morning, because this was a side project and that's when side projects happen.
Reading those messages back, I can see my job change.
In the first days, I was explaining the game. What the screens meant, what the goal was, how a poison build works, which skills the agent's online research had gotten wrong. I was the domain expert and the agent was a very fast engineer with no idea what it was looking at.
In the middle, I was the measurement loop. Play, collect data, come back, ask for the next round. I made the trade-off calls: yes to smaller screenshots if tap accuracy holds, no to the faster model that couldn't pick skills, yes to a slower run if it costs a fifth as much.
By the end, I was the escalation path. The agent handled anything routine. I stepped in when the stakes were high: which model to trust, which decisions the expensive model should keep, when a benchmark had run long enough, whether an overnight failure was a bug or a bad night.
That is exactly the arc the game agent went through. Claude started by making every decision. It ended as the teacher, the judge, and the thing you call when a mistake would be expensive. I started by directing every line of the build. I ended as the one who sets the goal, reads the numbers, and gets called when it matters.
There's a version of this story where that sounds like a demotion. I don't experience it that way. Three weeks ago I could not have built this system in three months, not because any single piece was beyond me, but because the pieces I'd have had to learn from scratch, the Windows message plumbing, the inference server's cache behavior, the template-matching edge cases, would have eaten every evening. Instead I spent those evenings on the parts only I could do: knowing the game, choosing what to measure, and deciding what good enough meant.
The agent was wrong often enough to keep me honest. Its research was out of date. Its first local-model rollout fell over in an hour. It built a background job that failed silently for hours. Every one of those was caught by a human watching the outcome, not by the agent checking its own work. If I take one thing from the build side of this project, it's that the human's job in an AI loop is not to do the work and not to supervise the work. It's to own the outcome and to be looking at it.
Lessons for Any AI Application
The game was a test bed with a scoreboard. The techniques are general. These are the ones I'd carry into any system that puts a language model in a loop, whether that loop is playing a game, processing documents, or answering customers.
Measure per call and per outcome. Cost without quality is a trap. Decide what quality looks like as a number before you optimize anything.
The cheapest call is the one you don't make. Most of what a model does in a loop is repetition. Deterministic automation should handle the repetitive majority, and the model's own behavior will tell you what that majority is.
Use the strong model as teacher and judge. Its decisions are your eval set. Shadow mode proves a cheaper model before it acts. Nothing cheaper goes live until it has been measured against the thing it's replacing.
Route by risk, not by difficulty. Keep the expensive model on the decisions that are costly to get wrong, not on the ones that look hard. A cheap mistake that the next step corrects is fine. A wasted run is not.
Verify actions instead of trusting answers. Did the thing happen? Is the state what the model thinks it is? Those checks are nearly free and they catch failures no model is going to confess to.
Different models, different conventions. Coordinate grids, confidence scales, output formats, context limits. Normalize at the boundary and assume nothing carries over.
Plumbing matters. A cache detail doubled throughput with no model change. Benchmark the system you're actually running.
Match the tool to the decision. Pixel matching for repetition, reasoning models for judgment. Most real systems need both, and the interesting engineering is in deciding where one hands off to the other.
The human owns the outcome. Whether the agent is playing a game or writing the code, the person in the loop earns their place by watching what actually happens and stepping in where it's expensive to be wrong.
Closing
In an earlier piece I argued that the future I want from AI isn't one where a machine makes our decisions for us, but one where AI removes the friction between people and their goals. This project was a small, concrete version of that. Nothing about it was autonomous in the grand sense. A reasoning model made a few hundred judgment calls a day, a local model made a few thousand, a pixel matcher made tens of thousands, and a person set the goal and watched the scoreboard.
The point was never to remove the AI. It was to put it only where it earned its cost, and to put me only where I added the most. Both of those turned out to be the same discipline.
A note on fair use: this is a personal, educational project. The app operates under hard rules in every prompt: never tap a purchase or offer, never spend premium currency, never touch account settings. It uses only the game's free features. Automating a game may conflict with its terms of service, and anyone considering something similar should read them first. This article is about the engineering, and I've deliberately left out anything that would serve as a guide to replicating it.