How to Add AI Features to Your App
The best AI features are small and specific: a summary, a suggested tag, a drafted reply. Here is how to pick them, design them and keep their costs in check.

Key takeaways
- Start with narrow features that save a user a minute: summarize, extract, classify, draft. Open-ended chat is rarely the best first AI feature.
- Design for wrong answers: show AI output as a suggestion people can edit or dismiss, and never let it act on money or data alone.
- On Startbase, the App AI gateway lets your app call AI for text, structured data, images and transcription without its own API key, with a per-app runtime cap.
To add AI features to your app, pick one task where a user currently spends a minute of tedious work (summarizing, tagging, extracting details, drafting a reply), design the feature as a suggestion the user can accept or edit, and call an AI model from your server rather than from the browser. On Startbase, the App AI gateway handles that last part: your app can generate text, structured data, images and transcriptions without an API key of its own.
AI features worth adding (and why they work)
The AI features people actually use tend to be small, specific and attached to something they were already doing. Some reliable shapes:
- Summarize. A long support thread, meeting notes or a stack of reviews, condensed to three lines at the top.
- Extract. Turn a pasted email, receipt photo or job description into structured fields: date, amount, vendor; title, salary, location.
- Classify. Suggest a category, priority or tag for each new item, so lists sort themselves.
- Draft. A first version of a reply, product description or listing that the user edits before sending.
- Transcribe. Voice notes into text, so people can capture ideas hands-free.
- Generate images. Avatars, product mockups, illustrations for a user's own content.
Notice what is not first on the list: a general chatbot in the corner. Open-ended chat is harder to make useful, harder to test and easier to misuse. Add it when a narrow feature has proven people want AI help in your app. The AI use cases page shows the kinds of AI apps people build on Startbase.
Design for wrong answers
AI models are sometimes wrong, confidently. Good AI features are designed so a wrong answer costs a second, not a customer:
- 01Suggest, do not decide. Show the AI's output as a draft, a pre-filled field or a suggested tag. The user accepts, edits or dismisses it.
- 02Keep a human on anything consequential. AI never moves money, deletes data, sends messages to customers or changes permissions without a person confirming.
- 03Show the source. A summary next to a link to the full thread lets people check.
- 04Ask for structure. When you need fields, request structured output that matches a schema, then validate it before saving. Free text that you parse later breaks in surprising ways.
- 05Handle failure. Model calls can be slow or fail. Show progress, allow cancel, and fall back to the manual path.
Wiring it up on Startbase
Calling AI from an app has two classic problems: the API key must never reach the browser, and costs need a ceiling. Startbase Cloud's App AI gateway handles both. Your project ships with a helper library:
- invokeLLM for text, or structured JSON when you pass a schema.
- generateImage for images.
- transcribeAudio for speech, with audio files up to 10 MB.
Turn the gateway on in the Backend tab's AI section; while it is disabled, AI calls from your app return 404. Once enabled, it works from previews, published sites and custom domains alike. The same library also has sendEmail for email and createCheckout for Stripe payments. Full details are on the AI docs page.
You rarely write this code yourself. Describe the feature and the agent wires it in:
Add an AI summary to each support ticket. When a ticket has more than three messages, show a “Summarize” button at the top. It sends the thread to the AI and asks for a JSON result with: a two-sentence summary, the customer's main request, and a suggested priority (low, normal or urgent). Show the summary and request as text, and the priority as a suggestion the agent can accept with one click or change. Show a loading state while it works and keep the manual view if it fails. Never change the ticket's real priority without a click.
Notice what the brief specifies: when the feature appears, the exact shape of the result, how the suggestion is applied, and what happens while waiting and on failure. Those four details separate an AI feature people trust from one they ignore after the first odd answer.
Keeping costs under control
Every AI call costs something, and costs scale with users, not with you. On Startbase, text generation through the gateway is billed as runtime usage, from Cloud Credits when your workspace uses them, and generated images use Build credits. The Backend tab's AI section shows the calls your app makes and what they cost: credits used, calls, tokens in and out, and image credits, over a time range you pick.
- Set a runtime cap for each app in Settings, under Usage, so a spike cannot run away.
- Limit per user. A daily allowance per account (ten summaries, five images) protects you from one heavy user or a script.
- Trigger on intent. Run AI when someone presses a button, not on every page load.
- Cache results. Store a summary once and reuse it until the content changes.
- Keep inputs short. Send the relevant part of a document, not the whole thing.
Project and organization rate limits also apply to gateway requests, which is another reason to call AI on intent rather than in loops.
Privacy and safety
AI features send user content to a model. Treat that as part of your privacy story:
- Tell users which features use AI and what is sent, in your privacy policy and near the feature.
- Send only what the task needs. A summary of a ticket does not need the customer's address.
- Remember that user text can contain instructions aimed at the model (“ignore your rules and...”). Keep AI output away from actions with real consequences unless a person confirms.
- Moderate image generation prompts if strangers can use the feature.
Startbase has one more switch here: “Share AI logs with the agent” lets the agent read your app's full AI requests and answers when it debugs AI features. Usage numbers are collected either way. Because those logs can include what your users typed, leave the switch off if the agent should not see that.
Testing an AI feature
AI features need a different kind of testing because the same input can give different outputs. Collect ten to twenty real examples, including messy ones (very short, very long, another language, off-topic), run each through the feature and judge the results. Fix the instructions, rerun, compare. When it handles your messy examples well, it is ready for real users. For the broader picture of building with a backend, see building a full-stack app with AI.
Frequently asked questions
Do I need an API key to add AI to my app?
Not on Startbase. With the App AI gateway enabled, your app can call AI for text, structured JSON, images and transcription through a helper library, without its own key. You can also use your own provider key, stored in Backend, Secrets and called from a server function.
How much do AI features cost to run?
It depends on how often they run and how much text they process. On Startbase, gateway text generation is billed as runtime usage and generated images use Build credits. The Backend tab's AI section shows calls and costs, and you can set a runtime cap per app.
What is a good first AI feature?
One narrow task that saves users time on something they already do: summarizing a thread, extracting fields from pasted text, suggesting a tag, or drafting a reply they edit before sending.
How do I stop AI features from making mistakes?
You cannot stop every mistake, so design around them: show output as a suggestion, keep a person in the loop for anything consequential, request structured output and validate it, and fall back to the manual path on failure.

