Skip to content
3 min read

How to add an AI chatbot to your app, without leaking your API key

Reading progress: 3 min remaining

Add an AI chatbot to your web or mobile app with the key kept server-side. With Vibely AI, no OpenAI or Gemini key: Albert builds it from one prompt.

Short answer

To add an AI chatbot to your app safely, call the model from server code, never from the browser or the phone, so the API key stays secret. In Vibely you ask for the chatbot in the chat: Albert, Vibely’s AI agent, builds it on Vibely AI, which needs no OpenAI, Anthropic or Gemini key, with the call in a server function or Edge Function.

How to add an AI chatbot to your app safely

  1. Keep the key on the server. The browser and the phone can’t keep a secret; a key in the bundle can be read by anyone.
  2. Call the model from server code. A server function on the web, an Edge Function on mobile.
  3. Stream the reply. Replies appear as they’re generated.
  4. Watch usage. Know what the feature costs before your users find out.

Add an AI chatbot with Vibely AI

Ask for it in the project chat, for example “Add a chat assistant to the help page that answers questions from our help articles.” Albert writes the server-side code that calls Vibely AI and wires your app to it, and never asks you for a provider key. Chat streams on the web; on mobile, which has no built-in streaming client, it uses the non-streaming endpoint.

Web apps call it from their own server. Mobile apps call it from a Supabase Edge Function, so link Supabase first; see do I need a backend for my app.

Frequently asked questions

Can I call an AI API from the frontend?

You shouldn’t: anything in the browser or the app bundle can be read, including an API key. Call the model from server code.

Do I need an OpenAI key to add AI in Vibely?

No. Vibely AI creates and manages a key for each project and injects it into the app’s server environment; you never handle it.

Does it work in mobile apps?

Yes. A mobile app calls Vibely AI from a Supabase Edge Function, so the project needs a linked Supabase project first.