Most of My App's AI API Cost Was Web Search — Cutting ¥66 to About ¥20 per User — Build Log #5
The AI feature in my iOS app cost ¥66 a month for a user who maxed out their quota. Broken down per call, about ¥1.5 of every ¥2.2 was web search. Switching models, turning search off by default, and zeroing thinking looked like ¥6.8 at the time — but that used a placeholder price. With the official price it's about ¥20, a roughly 70% cut. Here's the math, and the correction.
My iOS task app has a feature that takes whatever you typed and fills it out until it's actually actionable. Write "doctor," and it splits that into what to bring, how long it takes, and the sub-steps.
That feature cost me about ¥66 per month for every paid user who maxed out their quota of 30 runs. Against the subscription price, that's a structure where profit evaporates the moment your users are enthusiastic. Solo project — so the shortfall is entirely mine.
This post breaks a single AI call down into what I was actually paying for, and cuts only the parts that mattered. The result up front: ¥66 → about ¥20, roughly a 70% cut. When this was first published it said "¥6.8, a 90% cut." I later found that number was computed with a placeholder price, so I've redone the math (details in the results section).
First: where was the money going, per call?
The architecture is simple — app → my own server → an LLM API. I was using Anthropic's Claude Haiku 4.5 (small, fast, cheap).
Here's the setup before the switch, with official prices:
| Item | Before |
|---|---|
| Model | Claude Haiku 4.5 (official: $1 input / $5 output per million tokens) |
| Web search | Up to 1 per call (official: $10 per 1,000 searches = $0.01 each, plus tokens for results) |
| Output cap | 1,024 tokens |
| Paid plan quota | 30 runs a month |
| Estimated cost | ¥66/month at the full 30 runs = about ¥2.2 per call |
(tokens = the chunks of text an AI reads and writes; the billing unit)
Convert the $0.01 search at ¥150 to the dollar (the same rate my app's code uses) and it's about ¥1.5. So roughly 70% of each ¥2.2 call was the search, and the model actually reading and writing text was only around 30% (Claude: Pricing, Claude: Web search tool).
To fill in "a place nearby" or "how long this takes" properly, you have to let the model search. So the cost problem was never "the model is expensive." It was "having the model look things up is expensive." Get that backwards and you'll swap in a cheaper model while the 70% search share stays put.
Change 1: switch the model
I moved from Haiku 4.5 to Google's Gemini 3.1 Flash-Lite (release and shutdown dates are listed on Gemini API: Deprecations). Its official price is $0.25 input / $1.50 output per million tokens — a quarter of Haiku 4.5's input price and under a third of its output price (Gemini API: Pricing).
One trap, though. I originally targeted the older gemini-2.5-flash-lite, and it wouldn't run from a freshly created Google account. The error said, in effect, that the model is no longer offered to new users (the docs say access to 2.5 models is limited to past users: Gemini API: Models). A model can be present in the docs and still be unavailable to you depending on when your account was created. Don't treat any model choice as settled until you've made a real API call.
The other quietly valuable change: making the API guarantee the response shape (constraining output with a schema: Gemini API: Structured output). Previously the model returned its result by calling a dedicated tool, and if it stopped after searching without calling that tool, my server nudged it to "return the result" — up to four round trips. Letting the API enforce the type means one round always comes back in the right shape, so the nudging rounds disappeared. Every round trip bills input and output again, so a retry is just cost.
Change 2: turn web search off by default
This was the big one. Search is now off by default, with a setting to flip it back. Per the breakdown above, about 70% of the cost lived here.
With search off, the model has to answer from what it already knows. So I rewrote every prompt (the instruction text you send an AI) accordingly: instead of "look this up and give me the exact figure," they now say "give a reasonable ballpark."
Duration, typical cost, what to bring, travel estimates — none of that actually needs a live lookup. "Bring your insurance card to the doctor" requires no search. The real work was separating the features that genuinely need search from the ones that were searching out of habit.
Change 3: set the thinking budget to zero
I also set the thinking budget to zero. Modern models can deliberate internally before answering. Quality goes up, but Gemini's price list states the output price "includes thinking tokens," so deliberation is billed at the output rate (Gemini API: Pricing) — and output costs six times as much as input. Splitting a task into sub-steps doesn't warrant deep thought, so I turned it off.
Note that on Gemini 3 models the main control is thinking_level, with the thinking budget kept for compatibility, and the docs say even the lowest level does not guarantee thinking is fully off (Gemini API: Thinking, Gemini 3 guide).
The price: restaurant suggestions went quiet
Being honest about this one. With search off, restaurant suggestions basically stopped appearing.
The reason is that the model is being responsible. If it can't verify a place exists, naming one would be inventing it — so it says nothing. That's correct behavior. A model that confidently names restaurants without searching is the dangerous one.
So "dinner tonight" style tasks now come back quiet. Meanwhile, the core — sub-task breakdown, what to bring, when to leave — didn't degrade.
That's the whole lesson: cost reduction isn't thinning every feature evenly, it's deciding which features to drop. Cutting one thing completely leaves a better product than making everything slightly worse.
I kept the option to restore search. As of writing (July 2026), I expected turning it back on would push the total above where I started. I also believed search couldn't be combined with schema-enforced output, which would mean a two-call design. That holds for the 2.5 models; the current docs say Gemini 3 models can combine structured output with Google Search grounding (a preview feature: Gemini 3 guide).
Update (November 2026): The current price list gives Gemini 3 models 5,000 free Google Search requests per month (shared across Gemini 3 and newer models), then $14 per 1,000 (Gemini API: Pricing). My July estimate didn't account for that free allowance. I'll redo the math at these prices before deciding whether to turn search back on.
Results, and a correction from 90% to 70%
| Before | After | |
|---|---|---|
| Model | Claude Haiku 4.5 | Gemini 3.1 Flash-Lite |
| Official price (per million tokens, input / output) | $1 / $5 | $0.25 / $1.50 |
| Web search | up to 1 per call ($0.01 each) | off by default (switchable) |
| Getting the result | nudge until the result tool is called (up to 4 rounds) | schema-guaranteed JSON (1 round) |
| Thinking budget | default | 0 |
| Worst-case monthly cost per quota-maxing user | ¥66 (about ¥2.2 per call) | about ¥20 (originally published as ¥6.8) |
Correction: This post originally put the post-switch cost at "¥6.8 (about a 90% cut)." That figure came from the Gemini unit price I'd put in my server code at the time of the switch — a placeholder ($0.10 input / $0.40 output), with a "needs re-verification" note right next to it. On August 25, 2026, I checked it against the official price list: the real price is $0.25 / $1.50, and I'd been underestimating the AI cost by about 3x. Tripling ¥6.8 gives about ¥20, which makes the cut from ¥66 roughly 70%.
"70%" looks less impressive than "90%," but the conclusion holds: a big cut, and most of it came from stopping search. The thing I most want you to take away might be the mistake itself — I ran on a "needs re-verification" placeholder price for over a month. Cost estimates should be saved together with a link to the official price list and the date you checked it.
The best part: this needed no app update. The AI is called server-side, so the moment I deployed the server, every already-installed user was on the new setup. No review, no update prompt, no waiting.
Choosing early on to "never embed the heavy AI calls in the app, always go through my server" is what paid off here. Had the app called the API directly, every model switch would need to clear app review — and users on old versions would have stayed on the expensive path indefinitely.
If you're doing the same thing
- Break down the cost of a single call first. For me, about 70% was search. Swap the model and leave search on, and you won't save much.
- Check unit prices against the official price list, and record the date. A placeholder price makes your result wrong, too.
- Retries are cost. Constrain the response shape and kill the nudge-and-retry rounds.
- Turn deliberation off by default. Thinking is billed at the output rate. Re-enable it only where it earns its keep.
- Decide what to drop. Thinning everything makes everything mediocre.
- Keep the AI call server-side. The freedom to switch is worth far more than it looks.
FAQ
Did quality drop? Not in the core (task breakdown, what to bring, timing estimates). What dropped is anything that assumed live search — real-world venue suggestions. That's the trade I knowingly made.
Why keep search as a toggle instead of deleting it? Because I might reverse the decision. Leaving it one setting away means I won't have to rebuild it if the revenue picture or the price list changes — and, per the update above, search pricing has already changed since July.
Are those cost figures measured? They're a worst-case estimate from published unit prices and the usage of someone maxing their quota. Real average users land lower. The post-switch "about ¥20" is an approximation, correcting the original ¥6.8 by the roughly 3x underestimate. I'll publish measured averages once enough usage has accumulated.
The app in this post
Everything above is from building THE TASK: AI To-Do Prep (App Store, free), an iOS app I develop solo. The idea is that AI fills a written task out until it's actually actionable. The rest of the series lives in the build log.
Related reading
- My forced update reached nobody — Build Log #6
- The number I hid from the UI was wide open in the API — Build Log #7
Sources
- Claude: Pricing — Claude Haiku 4.5: $1 input / $5 output per million tokens
- Claude: Web search tool — $10 per 1,000 searches plus token costs
- Gemini API: Pricing — Gemini 3.1 Flash-Lite: $0.25 input / $1.50 output (output includes thinking); Google Search: 5,000 free per month, then $14 per 1,000 (checked November 2026)
- Gemini API: Models — 2.5 models limited to users who used them in the past
- Gemini API: Deprecations — gemini-3.1-flash-lite release and shutdown dates
- Gemini API: Structured output — constraining responses with a schema
- Gemini API: Thinking — how thinking is controlled
- Gemini 3 guide — thinking_level, and structured output combined with built-in tools (Gemini 3, preview)
Comments (0)
No comments yet. Be the first to leave one.