Get your API key

Beginner · 5 lessons · 44 min

Build your own AI chat app

A chat web app that answers your users with a real model, with the key safe on your server and costs under control.

Who it's for

Beginners who finished First web MVP and want a bot for a coaching class, a shop or a club.

What you'll build

Exam Buddy (or your own bot): streaming chat, a server route that holds the key, model allow-list, rate limits, logins and saved chats with RLS, live on Vercel.

Why this course

"How do I hide my API key in a React app?" is one of the most asked beginner questions, and builders whose apps called the model API straight from the client have found their keys stolen and hundreds of dollars billed in days. Beginners also miss that every turn re-sends the whole chat, so bills grow quietly.

Take first: Prompting for AI coding, Build your first web MVP

Lessons in this course

  1. 1How an AI chat app worksBrowser, your server and the model API; why the key stays on the server; messages and roles; what a chat really costs in tokens. 8 min Free
  2. 2Your first chat, with the key on the serverA key with a spend limit, .env.local, a curl test, a server route plus chat page, and a system prompt with a clear job. 9 min Log in to open
  3. 3Streaming answers and choosing modelsWord-by-word answers with Stop and friendly errors, a server-side model allow-list, and a 5-question eval to pick a model. 9 min Log in to open
  4. 4Limits and costsFour cost walls: max_tokens, trimmed history, per-user rate limits and the key's spend limit; cost per user; prompt injection basics. 9 min Log in to open
  5. 5Save chats and launchSupabase login, chats and messages with RLS, delete and a privacy note, a two-user test, then live on Vercel with a separate key. 9 min Log in to open
Next upChrome extension in an afternoonBuild Job Hunt Helper: save job pages with a note, highlight your keywords, and get it ready for the Chrome Web Store.