MØNTAN1ACADEMY MØNTAN1
[ SECTION 08 :: PART II :: BUILD THINGS ]

Build an App with AI Features.

The section where it stops being a website and starts being a product: wire a chat interface to an AI API and give it a personality.

Time ~75 min Tools Replit, Claude API Cost API credits, pay as you go
Tools Replit Claude

You will learn

your-chatbot.com
AIHey, I'm shaped by a system prompt. What can I help build?
Explain APIs in one line.You
AIA menu of things another computer will do for you.
Type a message...Send
Lesson 1 of 4

How AI APIs Work

You've been using Claude through the website. Now you're going to call Claude (or OpenAI) directly from your own code :: so your app can generate text, answer questions, and respond to users in real time.

Your app talks to Claude's API
User types
In your app
→
Your Code
Sends to Claude API
→
Claude API
Generates response
→
Response
Shown to user
Getting your Claude API key

Go to platform.claude.com → create account → API Keys → Create Key. Copy it somewhere safe. This is different from your claude.ai login :: it's specifically for calling Claude from code.

Treat the key like a password. Never paste it into a chat (including Claude), a screenshot, or a file you push to GitHub. The API is pay-as-you-go: add a small amount of credit, then set a monthly spend limit in the Console's billing settings so a bug can never run up a bill. This is the one section of the primer that is not $0.

Lesson 2 of 4

Building the Chat Interface

A chat interface is just: a text input, a send button, and a message list that updates. The AI call is just a fetch() request :: you learned this last section.

Use Replit this section

AI API calls need to happen server-side to keep your key safe. Open replit.com (you set this up in Section 00) → New Repl → Node.js. This gives you a free server environment in your browser.

Build me a chatbot app using the Anthropic Claude API in Replit (Node.js). My API key is already stored as a Replit secret named ANTHROPIC_API_KEY. (Do not ask me for the key, and never print it.) The chatbot should have this personality: [describe your bot :: e.g., "a sarcastic movie critic"] System prompt: [describe the bot's rules and personality in detail] Build: a clean chat UI (HTML/CSS), a Node.js server that calls the Claude API, message history so context is maintained. I'm a beginner :: explain each file's purpose with comments.

Lesson 3 of 4

System Prompts: Give Your AI a Personality

A system prompt is a set of instructions you give Claude before the conversation starts. It defines the AI's role, knowledge, tone, and rules. This is what turns a generic chatbot into something unique.

system-prompt examples
// A cooking assistant
"You are Chef Marco, an enthusiastic Italian chef. You only talk about food,
recipes, and cooking techniques. Always suggest an Italian dish as an example.
Keep responses under 150 words. End every message with a relevant food emoji."

// A study buddy
"You are a patient tutor helping a high school student. Ask questions back
to check understanding rather than just giving answers. Use simple language.
Never do homework for them :: guide them to the answer instead."

Write a detailed system prompt for a [type] chatbot that: - Has this personality: [describe] - Knows about: [topics] - Should NOT: [limitations] - Responds in this style: [tone/format] Make it specific enough that the AI has a clear, consistent character.

Lesson 4 of 4

Environment Variables: Keeping Keys Safe

Replit has a "Secrets" feature :: environment variables that your code can read but that don't appear in your code files. This is how you keep API keys private.

1

In Replit: open the Secrets panel

Find Secrets in Replit's Tools list (or search for "Secrets"). This is your encrypted secrets store.

2

Add your API key as a secret

Key: ANTHROPIC_API_KEY · Value: your actual API key. Use exactly that name: it is the one the official Anthropic SDK looks for automatically.

3

Access it in code with process.env

const key = process.env.ANTHROPIC_API_KEY :: reads the secret without it ever appearing in your code. Safe to share the code now.

Section 08 Project

Your Custom AI Chatbot :: Live & Shareable

Build This

A themed AI chatbot, built on Claude API, deployed on Replit

Make it something you'd actually use or show off :: give it a strong personality and a clear purpose.

  • A well-crafted system prompt with a clear personality
  • A chat interface that looks polished
  • Maintains conversation history (context across messages)
  • API key stored safely in Replit Secrets
  • The Replit URL is live and shareable with anyone (Replit's free Starter plan includes one published app, which expires after 30 days; re-publish it to keep it up)