In this categoryNo-Code · 24
- How to Build Your First App with LovableStart
- How to Build a Landing Page with v0 by Vercel
- How to Build a Full-Stack App with Bolt.new
- How to Write Better Prompts for AI App Builders
- How to Add User Login and Signup in a Lovable App
- How to Add Stripe Payments to a No-Code App
- How to Add an AI Chat Feature to a No-Code App
- How to Connect a Custom Domain to a Lovable or v0 App
- How to Build a Working Form App with No Code
- How to Export a Lovable App to GitHub and Run It Locally
- How to Turn a No-Code Web App into an Installable Mobile App
- How to Debug and Fix a Broken AI-Generated App
- How to Connect a Webhook to a No-Code App
- How to Train a Chatbase Bot on Your Website Content
- How to Build an FAQ Chatbot in Voiceflow From Scratch
- How to Embed a Chatbase Chat Widget on Your Website
- How to Auto-Reply to Instagram Comments With ManyChat Keywords
- How to Collect Leads With a Chatbase Chatbot
- How to Connect Voiceflow to a Custom AI Model and System Prompt
- How to Connect a Chatbase Bot to WhatsApp
- How to Add Human Handoff to a ManyChat Bot
- How to Improve a No-Code Chatbot Using Its Conversation Logs
- How to Send Voiceflow Chat Data to a Spreadsheet With an API Step
- How to Build a Quiz-Style Lead-Gen Bot in ManyChat
How to Add an AI Chat Feature to a No-Code App
Call a language model from a Lovable or Bolt app through a secure server function so users can chat with AI in your product.
Adding an AI feature, like a chat assistant or a text summarizer, is a popular way to make a no-code app feel modern. The key rule is the same as with payments: the API key lives on the server, never in the browser. This guide adds a simple AI chat backed by a secure function.
What you need
- A Lovable or Bolt project with backend support (Supabase Edge Functions or a Node server)
- An API key from your chosen model provider
- A place to store the key as a server secret
- About 20 minutes
Step 1: Store the API key as a server secret
Save your provider key as a backend secret so it is never shipped to the browser. With Supabase you set it as a function secret; in a Node app you put it in the server environment.
Step 2: Ask the tool for a secure proxy function
Prompt your builder to create a server function that takes the user's message, calls the model with the secret key, and returns the reply. The browser only ever talks to your function, not the provider directly.
Create a secure server function called 'ask' that accepts a 'message' field, calls the Anthropic API using the ANTHROPIC_API_KEY secret with model claude-haiku-4-5, and returns the model's text reply as JSON.Step 3: Review the generated function
Open the function and confirm the key is read from the environment and the request shape matches the provider's API. The example below uses Anthropic's Messages API.
const res = await fetch("https://api.anthropic.com/v1/messages", {
method: "POST",
headers: {
"x-api-key": Deno.env.get("ANTHROPIC_API_KEY")!,
"anthropic-version": "2023-06-01",
"content-type": "application/json",
},
body: JSON.stringify({
model: "claude-haiku-4-5",
max_tokens: 1024,
messages: [{ role: "user", content: message }],
}),
});
const data = await res.json();
return new Response(JSON.stringify({ reply: data.content[0].text }));Step 4: Wire up the chat UI
Ask the tool to add a chat box that sends the typed message to your function and shows the reply. Test it in the preview with a few prompts.
Result
Your no-code app now has a real AI feature, with the API key safely on the server and the model called through your own function. Swap the model name or provider later without touching the front end.
Watch related tutorials
30:00
24:16
26:00
15:50
14:05
18:00New guides in your inbox
Fresh step-by-step how-to guides as we publish them. One email a week, no more.