Skip to content
Faeez Shabbir
WorkServicesAboutCVBlogContact
← BlogNov 9, 20264 min readAI Development

AI Demos Lie

AI demos lie.

They work on stage. They fall apart with real users.

The demo works because you picked the perfect prompt, the perfect input, and a quiet network. Real users do not do any of that. They paste messy text, they retry, they lose their connection, and they ask questions you did not plan for.

I have built AI features in PathWise AI, Postlin and Latent. The gap is always the same. The model is slow. The bill adds up. The output is wrong in ways you did not plan for. And edge cases show up on day one.

If you only design for the happy path, you will ship something that looks smart and feels broken.

The demo hides four problems

Latency. A model can take several seconds to finish. In a demo, everyone waits politely. In a product, that silence feels like a crash. If you hold the whole answer back until the end, the app feels stuck.

Cost. The demo is one call. Real use is many calls, including retries, long inputs and people who click twice. Input tokens cost money too. A feature that looks cheap in a walkthrough can get expensive once it is in the main path.

Bad output. Models sound confident when they are wrong. They invent details, ignore instructions, or return a shape your UI cannot render. In a demo you can skip those moments. In production, someone has to live with them.

Edge cases. Empty input. A file that is too long. A language you did not test. A user who asks the same thing five times. A provider that times out. These are not rare. They are the first week.

Design for the messy version

I now design the feature as if the model will be slow, expensive and occasionally wrong. That sounds pessimistic. It is how you keep the product usable.

Show that work is happening, then stream the result. A spinner with no other signal feels stuck. Streaming the first words makes the wait feel shorter, even when the full answer takes a while. For a short, one-shot job, a clear progress state is enough. For anything a person sits and watches, I stream.

Give people a way out of a bad answer. Let them retry, edit, or discard what the model produced. The output is a draft, not a decision. In Postlin, the point was never to publish the first draft blindly. You get a draft back, you fix it, and then you decide when it goes out. If an image upload to LinkedIn failed, the post still went out as text instead of failing completely. A fallback beats a confident wrong answer.

Cap what you send and what you get back. Trim the input. Cap the output. Do not send a whole document when a short extract will do. This keeps both cost and latency under control, and it reduces the amount of junk the model can return.

Validate anything your app will use. If the model returns data, check it before it touches the rest of the system. If it does not match the shape you expect, reject it or ask again. Never let a free-form reply drive a payment, a delete, or a write you cannot undo.

Decide who pays, on purpose. In Postlin, each person added their own Gemini key, stored encrypted. The app had no AI bill to pass on. In Latent, image tools run on credits added only from a signed Stripe webhook. Both are ways of making cost visible instead of hoping usage stays small.

Keep the model off the critical path when you can. If a job does not need to finish before the page responds, do it after save. Generate tags later. Write a summary in the background. The fastest AI call is the one the person does not wait for.

A simple shape I keep using

For a streamed feature in a Next.js app, the route handler does three things first: check auth, apply a rate limit, then call the model. In that order. An AI endpoint without a rate limit is an open tab on your card.

A short version looks like this:

ts
export async function POST(req: Request) {
  const user = await requireUser(req);
  if (!(await rateLimit(user.id))) {
    return new Response("Too many requests", { status: 429 });
  }

  const { input } = await req.json();
  const result = streamText({
    model,
    prompt: input.slice(0, 4000),
    maxOutputTokens: 800,
  });

  return result.toUIMessageStreamResponse();
}

The slice and maxOutputTokens are not polish. They are how you stop one request from becoming a large bill. The rate limit is how you stop a bug, or a script, from doing it over and over.

On the page, I assume the call might fail. There is a loading state that does not feel frozen, an error state with a retry, and a place for the person to edit the result. If the feature cannot survive a bad answer, it is not ready.

What I take from this

The demo is the best the feature will ever look. Real use is slower, messier and less polite.

Design for that version. Show a loading state that does not feel stuck. Have a fallback when the answer is bad. Cap your costs. Let people retry or edit instead of staring at a confident wrong answer.

If you are putting an AI feature in front of real users and want a second look at the messy path, get in touch.

Keep reading

  1. Nov 18, 2026

    Stop Adding a Vector Database to Everything

    Software Development
  2. Nov 12, 2026

    How X.509 Certificates Work, Using the One on This Site

    Software Development

Have somethingto build?

Email

usually back within 24h

Click to copy, or use Email. Usually replies within 24h.

30 min call on Calendly

Hire me on Upwork
Prefer a form? Open the classic form

Project inquiry

Timeline
Budget range
Your range for this project. Not a price from me.

  • Work
  • Services
  • About
  • CV
  • Blog
  • GitHub ↗
  • LinkedIn ↗
  • Instagram ↗
  • Back to top ↑
© 2026 Faeez ShabbirLahore --:-- PKTOpen to new projects