// How production AI apps are built
How do you control AI costs in a production app?
Give each task the cheapest model that does it well and keep the expensive one for hard cases. Cap paid calls per user, per day and globally. Put a bot check in front of costly actions. Tie usage to the plan the user pays for. Refund failed jobs once. Tag every call to see what each feature costs.
Want it done for you? AI Integration: from €2,500, fixed quote in 24h →

By Gabriel Cazaciuc, Founder & lead developer, Netcraft Digital
Last updated
Key facts
- AI picture cost after switching models
- $0.01 instead of about $0.05
- Source: FișaEdu, our product, Nov 2026
- Wrong pictures at first draw, same test
- 5% instead of 18% (60 exercises)
- Source: FișaEdu, our product, Nov 2026
- AI searches allowed
- 8 per list, 15 per person, 150 site-wide per day
- Source: Joylist, our product, Nov 2026
- Refunds for failed AI jobs
- At most 3 per user per day
- Source: FișaEdu, our product, Nov 2026
Where does the money go in an AI app?
Into model calls, and there are usually more of them than the founder expects. One FișaEdu worksheet is not one call. The request is checked, the draft is written, reviewed and repaired, the pictures are drawn and looked at again, and the answers are re-solved. Then three things multiply that cost: bots, users who repeat expensive actions, and retries after failures.
All our model calls go through Vercel AI Gateway. That gives us one bill, one place to change a model, a fallback provider when one fails, and a cost figure on every response. This guide is part of our production-ready AI app checklist.
How do you choose a model for each task?
Test the cheaper models on your real data and keep the expensive one only where it measurably wins. Model names live in one file per app, as code, so changing a task's model is a reviewed one-line change.
| Product | Task | Model | Why |
|---|---|---|---|
| FișaEdu | Write, review and edit worksheets | Claude Sonnet 5.5 | Good enough on Romanian school content |
| FișaEdu | Last review round, blind solver | Claude Opus 5.5 | Only for the hard cases, where errors cost the most |
| FișaEdu | Hints while a child solves | A small, cheap model | Short answers, many calls |
| FișaEdu | Exercise pictures | Muse (Meta), Gemini as fallback | Cheaper and fewer wrong pictures in our test |
| Joylist | Search and read shop pages | Gemini Flash | Many pages per search; reading is the bulk of the work |
| Joylist | Pick the products to propose | Claude Sonnet 5.5 | One decision per search, where quality shows |
| Netcraft Studio | Screenshot review of a page | Claude Sonnet 5.5 | The first look must not miss problems |
| Netcraft Studio | Re-check of repaired sections | Claude Haiku 5.5 | About 1/15 of the cost, measured on 14 pages |
The picture model is a good example of measuring before switching. We ran the same prompts and the same checker on 60 real exercises from all primary grades. The model we use now drew a wrong picture at the first try 5% of the time, against 18% for Nano Banana 2.1, at $0.01 a picture instead of about $0.05. Cheaper and better is rare, but you only find it by testing.
What should happen when a model fails?
Fall back to another provider for tasks where any decent answer is better than none, and stop retrying when a retry cannot succeed. On Netcraft Studio, site photos come from one image model, with a model from another provider as fallback, so a page never stays without pictures. FișaEdu falls back from Muse to Gemini when Muse returns nothing.
Some failures should not be retried. When the gateway answers that the account has no credits left, Studio's code treats it as final. Retrying would only fill the logs. Each job also has a limited number of retries per step, so one broken input cannot loop all night.
What are prompt caching and batch calls worth?
Both cut the price of calls you make anyway. FișaEdu's worksheet instructions are about 11,000 tokens and are sent again, unchanged, for every exercise regenerated on the same sheet a few minutes later. Marked for caching, those repeated tokens are billed at a tenth of the input price.
Work that does not need an answer right away goes through the gateway's batch API. FișaEdu's nightly jobs send their calls in batches and check for results every minute. A night has a five-hour budget. After that, whatever is still missing is made with direct calls, so the night never runs into the next day.
How do you stop bots and heavy users from spending your budget?
Put several limits on every paid action, at different levels. A bot that changes its cookie still hits the IP limit and the global cap. These are Joylist's limits for the AI shopping assistant:
| Limit | Value |
|---|---|
| Searches per gift list | 8 per day, one at a time |
| Searches per person | 15 per day |
| Searches across the whole site | 150 per day |
| Generated backgrounds | 2 per list per day, 40 site-wide |
| Assistant messages | 30 per hour and 100 per day per IP; 10 per conversation |
| Bot check (Cloudflare Turnstile) | Valid for 3 hours; asked again when 2 searches are left |
FișaEdu also limits what the browser can send to the chat: at most 30 messages, 4,000 characters per message and 20,000 in total. Its rate limiter keeps counters in Postgres, shared by every server instance. If the database has a problem, the limiter lets requests through, because a limiter outage must not take the site down. The global caps still protect the budget.
How should plans and quotas map to AI cost?
Count what the user understands, and give away what costs you almost nothing. FișaEdu started with credits: 4 for a worksheet, 2 for an AI edit, 1 for an online solve. The price followed the cost, but a parent could not tell how many worksheets 32 credits meant. In October 2026 we replaced credits with a number of custom worksheets per plan.
Free accounts get 2 custom worksheets once and 2 PDF downloads a month. Downloads renew because a catalog PDF is already made and costs almost nothing. Custom worksheets do not renew because each one means many model calls. Netcraft Studio keeps credits, because site work varies too much for a fixed count. A free account can hold at most two unpaid sites and has a daily AI spending limit. Through the MCP connector, reads are free and each write costs one credit.
What happens to the user's credits when a job fails?
Give them back once, and limit how often. On FișaEdu, a failed job is marked as refunded in the same database update that triggers the refund, so the refund cannot run twice. A failure can still happen after the paid model call has run, for example when the output is too long. So refunds for failed AI actions are capped at 3 per user per day, to stop anyone from failing jobs on purpose. Netcraft Studio holds a build's credits until the build ends, as described in long-running AI jobs that don't fail halfway.
How do you see what each feature costs?
Tag every call and store the cost per generation. Every FișaEdu call carries gateway tags for the product, the feature (worksheet generation, quality check, hint, edit) and the flow it belongs to, plus a tag for jobs the system runs by itself. The gateway's spend report then groups cost by feature. Each tracked generation also stores its tokens and price in our database, next to the worksheet it produced.
Joylist logs the cost the gateway returns for every call, by feature and model, without the prompt text. That is how we know which feature to optimize next.
AI cost controls before launch
- Each task has its own model, chosen by a test on real data
- Fallback providers for tasks where any answer beats none
- No retries on errors that cannot succeed
- Limits per user, per IP and site-wide on every paid action
- A bot check in front of the costliest actions
- Plan limits users understand, matched to what each action costs
- Refunds that run once, with a daily cap
- Every call tagged by feature, with the cost stored
What AI usage adds to a budget is covered in AI app development cost. How we check the output we pay for is in how to stop an AI app from showing wrong content. Our fixed prices are on the pricing page.

