HomeAboutProjectsServicesCubieTecBlogContact
AI

Putting an AI assistant into a product people pay for

Where the API key lives, what each request really costs, and how to stop the model answering questions it has no business answering.

The demo is easy. Wire a model to a text box and it looks like magic. The product is harder, and almost all of the difficulty is in three places.

First, the key. It belongs on your server, always. If the browser can see it, someone will find it and spend your money. Every request from the client goes to your backend, which adds the key and forwards it.

Second, the cost. Work out the price per request before you launch, not after the first invoice. For ChatCubie's assistant I capped context length and cached common answers, which cut spend by roughly 60%.

Third, the boundaries. A model will happily answer questions about anything. Give it a system prompt that says what it is for, and reject the rest politely. Users trust a tool that admits limits more than one that guesses.

The assistant now handles about half of all support messages, and the ones it passes on arrive with a summary attached.

Written by Mr Mehedi Work with me →
KEEP READING

More posts

All posts →
ENGINEERING

Why instant digital delivery is harder than it looks

An order that completes in two seconds needs a queue, a retry policy and a refund path. Here is the architecture that finally held under load.

Read post →
DESIGN

Dark interfaces people can actually read

Pure black is a trap. Contrast ratios, glass surfaces, and the three mistakes I made before this site looked right.

Read post →
PAYMENTS

Building escrow that survives real disputes

Holding money is the easy part. Deciding who gets it when two people disagree is where the design work is.

Read post →
© 2026 Mr Mehedi. All rights reserved.