L050 · Under the hood · 2 min
What is an API?
An API is a set of agreed rules that lets one program ask another program for something and get a reply, with no person clicking buttons in between.
01 · The idea
When you use a chatbot, you type into a website or app. Programs cannot do that easily, so services also offer an API: a fixed way for software to send a request and receive an answer.
The request is a small, structured message. For an AI model it says which model to use, the instructions, and the text to answer. The reply comes back in the same tidy format, ready for the program to use.
This is how AI ends up inside other apps. A shopping site's help bot, a writing tool in your email, or a translation feature might all send your text to a model's API behind the scenes.
APIs usually need a secret key that identifies the account and is used for billing. Treat it like a password: never post it online or paste it into a public file, because anyone with it can spend money on that account.
02 · Think of it like this
It is like ordering at a counter with a numbered menu. You don't walk into the kitchen. You say "number 12, no onions", and the kitchen sends back exactly that dish in a box.
03 · Do it now
04 · Quick check
Words in this lesson
See also
L160Under the hood · 2 min
What tools and plugins let AI do
On its own a language model can only write text; tools give it hands, like search, a calculator, code or your calendar.
L162Under the hood · 3 min
Inside MCP: servers, tools and resources
An MCP server is a small program that describes what it can do, and the assistant reads that description to decide which tool to call.
L180Under the hood · 2 min
App safety basics: keys and data
If you build anything with AI, guard two things above all: your secret keys and other people's data.
L184Under the hood · 3 min
The cost of each AI question
Every question sent to a paid AI model has a small cost, set mostly by how much text goes in and comes out, and those small costs add up fast.