Build an AI chatbotusing AI.
You'll understand how AI apps really work, then use ChatGPT as your developer to build your own chatbot, with your idea, in one class.
“I don't know how to code an AI chatbot.”
“I built an AI chatbot.”
Here's how today works.
First you understand. Then you watch. Then you build. By the time your timer starts, you'll know every single step.
Understand
LLM, API, and how they connect, with diagrams.
Our approach
Who does what: you, ChatGPT, and the AI.
Watch me build
I build a full chatbot live, in seven steps.
Your challenge
30 minutes to build your own.
Every AI chatbot has three parts.
ChatGPT, Gemini, every AI app you've used: underneath, they all work like this.
Your chatbot
The screen you see. Chat bubbles, a box to type in, a Send button.
API
Carries your message to the AI, and carries the answer back.
LLM
The AI model that reads your message and writes the reply.
An LLM predicts the next word.
LLM means Large Language Model. It has read a huge amount of text, so it's very good at guessing what word comes next. Press the button and watch it build an answer.
The LLM isn't on your laptop.
It's far too big. It lives on powerful computers in data centers, run by companies like Google and Groq. Your app has to send it a message over the internet.
An API is the bridge.
API means Application Programming Interface. In simple words: a fixed way for one program to ask another program for something. Your app sends a request. The AI sends back a response.
// what your chatbot sends { "key": "AIzaSy••••••••", "system": "You are a friendly physics tutor...", "message": "What is gravity?" }
// what comes back { "reply": "Gravity is the force that pulls..." }
The keyProves your app is allowed to use the AI. Like showing your ID card.
The system promptYour RTCC instructions. Tells the AI who to be.
The messageWhatever the user typed in the chat box.
The replyThe LLM's answer. Your app shows it as a chat bubble.
The API key is your pass.
A long secret code that Google or Groq gives you. Every request carries it, so the AI knows the request is from you, and that you're allowed in.
What happens when you press Send.
All of this takes about one second. Press play and follow the message on its journey.
Same brain. Different instructions. Different chatbot.
You know RTCC. Inside a chatbot, your RTCC becomes the SYSTEM_PROMPT: hidden instructions sent with every message. Pick a chatbot below and see how the same question gets a different answer.
What is speed?
Gemini / GPT-OSS
You won't write code. You'll direct an AI developer.
Real developers now build software this way: they describe what they want clearly, and AI writes the code. Your job is to be the person with the idea, and to test that it works.
The founder
Your idea, your RTCC, your testing. You're in charge.
The developer
Turns your prompt into a complete index.html file.
The brain
Powers your chatbot every time someone presses Send.
Get your free API key first.
We do this first because it's the step most likely to need help. Pick one brain. Both are free.
- Open aistudio.google.com/apikey and sign in with a personal Google account.
- Click Create API key. Accept the terms if asked.
- Click Copy. The key starts with
AIza.
- Open console.groq.com/keys and sign up free.
- Click Create API Key, give it any name.
- Copy it right away. It starts with
gsk_and is shown only once.
Decide your chatbot.
Before any code, get the idea right. One clear sentence: who does it help, with what?
- Pick a problem you or your friends actually have.
- Name the user: "Class 9 students", not just "people".
- Name the topic: physics, maths, English, careers…
“An AI that helps students.”
“An AI that helps Class 9 students learn physics with simple examples.”
Give ChatGPT the master prompt.
The challenge page writes it for you: your idea, your RTCC, your extras, and the exact API code that's tested to work.
- Open chatgpt.com and start a new chat.
- Paste the master prompt and press Enter.
- Wait for one long code block that starts with
<!DOCTYPE html>.
<!DOCTYPE html> <html lang="en"> <head> <!-- STEP 1: PASTE YOUR API KEY BELOW --> <script> const API_KEY = "PASTE_YOUR_API_KEY_HERE"; const MODEL = "gemini-3.5-flash-lite"; </script>
Save it as index.html.
HTML, CSS and JavaScript all live in this one file. This file is your app.
- Click Copy code in ChatGPT.
- Open Notepad (Windows) or TextEdit (Mac → Format → Make Plain Text).
- Paste, then Save As →
index.html, type All files, on the Desktop.
Paste your key at the top.
The key's spot is always near the very top, on line 6. You never need to scroll.
- Right-click index.html → Open with → Notepad.
- On line 6, replace
PASTE_YOUR_API_KEY_HEREwith your key. Keep the quotes. - Press Ctrl + S (Mac: Cmd + S) to save.
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <!-- STEP 1: PASTE YOUR API KEY BELOW --> 5 <script> 6 const API_KEY = "AIzaSy••••••••••••••"; 7 const MODEL = "gemini-3.5-flash-lite"; 8 </script>
API_KEY = "AIza…"; with quotes on both sides.Double-click index.html.
It opens in Chrome or Edge. No installing, no server. Just your file.
- Type Hello! Who are you? and press Send.
- Watch the typing indicator.
- Read the reply. Does it sound like your RTCC?
Make it yours.
Go back to ChatGPT and ask for changes in plain English. Click each request to see it applied:
Your turn. Build your AI chatbot.
Eight short steps. Do them in order, press Next after each one.
Get your free API key and test it
Do this first. If the key works here, it will work in your chatbot.
Advanced: change the model
🔒 Your key is only kept on this page while it's open. It's never saved, and only goes to Google or Groq for the test.
Describe your chatbot
Who does it help, with what? Start from an example or write your own.
Write its RTCC
This becomes the hidden SYSTEM_PROMPT. It decides how your chatbot talks.
Add more to your master prompt
Tick any features you want. They all get added to the prompt. Pick 2 or 3 for your first version.
Copy the master prompt into ChatGPT
Check the summary, copy, then paste it into a new ChatGPT chat.
Open ChatGPT ↗- In ChatGPT, paste with Ctrl + V and press Enter.
- Wait until the code block finishes.
- Cut off? Type continue.
Preview the full prompt
Save the code as index.html
Pick your computer:
index.html, not index.html.txt. Its icon should look like a browser.Paste your key at the top of the file
Your key goes on line 6, right at the start of the file.
- Right-click index.html → Open with → Notepad (Mac: TextEdit).
- Find the line
const API_KEY = "PASTE_YOUR_API_KEY_HERE"; - Replace that whole line with the line below, then save (Ctrl + S).
Can't find the line? Press Ctrl + F and search for API_KEY.
Open it and talk to your chatbot
- Double-click index.html. It opens in Chrome or Edge.
- Type Hello! Who are you? and press Send.
- A real reply means you did it. Now make it better with one more request below.
Red error bubble? Find your error
Make it yours
Tap to copy, paste into the same ChatGPT chat. Then replace your file and paste your key on line 6 again.
“I don't know how to code an AI chatbot.”
I built an
AI chatbot.
You used AI to build AI-powered software. That's the skill that matters now.