lesson 5 · block 3
WHAT IS AN API?
Application Programming Interface
How software talks to other software —
and how YOU will talk to AI models.
press NEXT to start ▮
the metaphor
THE RESTAURANT ANALOGY
YOU
(client app)
→
WAITER
(API)
→
KITCHEN
(server)
→
YOUR
FOOD
(response)
You don't go into the kitchen yourself.
The waiter carries your request and brings back the result.
An API works exactly the same way.
the model you already know
INPUT → PROCESSING → OUTPUT
Your prompt
The message you type
→ sent in the REQUEST
The AI model
Runs on a remote server
→ thinks, generates a reply
The response
The model's answer
→ returned as JSON
the format
JSON — THE LANGUAGE OF APIS
APIs don't send plain text — they send structured data.
The format is called JSON: JavaScript Object Notation.
REQUEST (what you send)
"model": "llama-3.1-8b",
"messages": [
{
"role": "user",
"content": "What is RAM?"
}
]
RESPONSE (what comes back)
"choices": [
{
"message": {
"role": "assistant",
"content": "RAM is temporary..."
}
}
]
Key–value pairs. Curly braces. Square brackets for lists. That's it.
authentication
THE API KEY
Every API call needs a key — a unique token that identifies you.
The server checks it on every request. No key → access denied.
Your key looks like this:
sk-or-v1-a7f3c91d2e8b...
It is secret — treat it like a password.
Never paste it in a public chat, forum, or GitHub repo.
the platform
OPENROUTER — ONE KEY, MANY MODELS
OpenRouter is a gateway to hundreds of AI models.
One API key → send your request → OpenRouter routes it to the right model.
DEFAULT MODEL
💎 Gemma 3n E2B
google/gemma-3n-e2b-it:free
✓ free · fast · good for class
WANT TO EXPLORE?
Visit openrouter.ai/models
Filter by free
Copy the model ID → paste in the tester
→ Browse all models
getting started
HOW TO GET YOUR API KEY
-
[1]
Go to openrouter.ai → click Sign In → create a free account
-
[2]
In the top-right menu open Keys (or go to openrouter.ai/keys)
-
[3]
Click + Create Key → give it any name → click Create
-
[4]
Copy the key — it starts with sk-or-v1-
-
[5]
Save it now. OpenRouter shows it only once.
→ openrouter.ai/keys
hands-on time
NOW YOU TRY IT▮
Open the AI LLM Tester in Google Colab.
Paste your key. The default model is Gemma 3n.
Type a prompt → click SEND → watch INPUT → PROCESSING → OUTPUT live.
Want a different model? Go to openrouter.ai/models, filter by free, copy the ID.