What an API actually is
The cleanest way to think about an is as a menu of requests one program offers to another.
A restaurant doesn't let you walk into the kitchen and cook. It hands you a menu: here are the things you can order, here's how to order them, here's what you'll get back. You don't need to know how the kitchen works. You just need the menu. An API is exactly that — a company says "here are the requests you're allowed to make of our service, and here's what each one returns."
When the AI writes code that "calls the weather API," it's placing an order off that menu: give me the forecast for this city. The weather company's servers do the work and hand back an answer. Your app never sees their or their code. It just gets the dish.
┌────────────┐ request: GET /forecast?city=London ┌────────────┐
│ YOUR APP │ ─────────────────────────────────────▶ │ API │
│ (client) │ │ endpoint │
│ │ ◀───────────────────────────────────── │ (server) │
└────────────┘ response: { "temp": 14, ... } (JSON) └────────────┘
orders off does the work,
the menu sends the dish
The important mindset shift: an API is a contract. The other company promises that if you ask in a specific way, you'll get an answer in a specific shape. Your job — and the AI's — is to ask correctly and read the answer correctly. Most API bugs are one side breaking that contract.