Netcraft

// 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 →

Gabriel Cazaciuc

By , 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.

ProductTaskModelWhy
FișaEduWrite, review and edit worksheetsClaude Sonnet 5.5Good enough on Romanian school content
FișaEduLast review round, blind solverClaude Opus 5.5Only for the hard cases, where errors cost the most
FișaEduHints while a child solvesA small, cheap modelShort answers, many calls
FișaEduExercise picturesMuse (Meta), Gemini as fallbackCheaper and fewer wrong pictures in our test
JoylistSearch and read shop pagesGemini FlashMany pages per search; reading is the bulk of the work
JoylistPick the products to proposeClaude Sonnet 5.5One decision per search, where quality shows
Netcraft StudioScreenshot review of a pageClaude Sonnet 5.5The first look must not miss problems
Netcraft StudioRe-check of repaired sectionsClaude Haiku 5.5About 1/15 of the cost, measured on 14 pages
Model routing in our products, November 2026

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:

LimitValue
Searches per gift list8 per day, one at a time
Searches per person15 per day
Searches across the whole site150 per day
Generated backgrounds2 per list per day, 40 site-wide
Assistant messages30 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.

// FAQ

Frequently asked questions

Another question? Write to us; you get an answer from the developer within one working day.

Which model should I use for my AI feature?

Test a few models on a set of your real inputs with the same checker (we used 60 real exercises for pictures), then compare errors and cost. The best model on benchmarks is often not the best value for one task.

How do I stop bots from using my AI feature?

Put a bot check such as Cloudflare Turnstile in front of costly actions, and add limits per IP, per user and site-wide, so a bot that changes cookies still hits a cap.

Should a free plan include AI?

A small, one-time allowance works well. Renewing free AI usage invites abuse, while free access to content that is already generated costs almost nothing.

Should users get credits back when generation fails?

Yes, once per failed job, with a daily cap per user. The model call may already have cost money, and unlimited refunds can be abused.

What is an AI gateway?

A single endpoint in front of many model providers. We use Vercel AI Gateway for one bill, provider fallbacks, cost per call and spend reports by tag.

// How production AI apps are built

Keep reading

// Start here

What does a production-ready AI app need?

A production-ready AI app needs ten things beyond working screens: accounts and roles, payments confirmed by Stripe webhooks, access rules on every table, automatic checks on AI output, cost limits per user and overall, background jobs that survive failures, error alerts, pages search engines can read, tested backups, and code, domain and data in the owner's name.

Read the guide

// How production AI apps are built

How do you stop an AI app from showing wrong content?

You never show a model's output unchecked. Force it into a strict schema, have a second model review it (ideally from another model family), re-solve questions with one right answer without the key, let a human approve anything published under their name, and re-check stored content on a schedule. Each layer catches errors the others miss.

Read the guide

// How production AI apps are built

How do you run long AI jobs that don't fail halfway?

Split the job into durable steps whose results are saved, so a failed step is retried alone and the finished ones are kept. Mark errors a retry cannot fix as final. Run independent parts in parallel, within rate limits. Let optional steps fail without failing the job. Hold the user's credits until the end and return them once on failure.

Read the guide

// How production AI apps are built

How do you make your product usable from Claude and ChatGPT?

You add a remote MCP server: an endpoint on your app that exposes a few actions as tools Claude and ChatGPT can call. Public read-only data needs no login. Anything touching a user's account needs OAuth with read and write scopes, a confirmation step before deletes, rate limits, and the same permission checks as your app.

Read the guide

AI Integration, at a fixed price

Assistants, generation with checks, document processing and MCP connectors. From €2,500, 5–10 days. Written scope and price within 24 hours.