What Is an API: The Restaurant Menu Analogy

~10 min read

An API is a defined way for two pieces of software to talk to each other — like a restaurant menu, it lists exactly what you can ask for and what you'll get back, without you needing to know how the kitchen works.

What Is an API: The Restaurant Menu Analogy is a Pro topic

Sign in, then upgrade to Pro or Power to unlock this topic and the full AI Engineering curriculum.

Key points

  • An API is a defined way for two pieces of software to talk to each other, like a restaurant menu defines what you can order and what you'll get
  • Your code (the customer) sends a REQUEST; the API provider's system (the kitchen) does the internal work and sends back a RESPONSE
  • Abstraction means you only need to know the 'menu' (valid requests and response shapes) — not how the provider implements anything internally
  • This request/response pattern lets software built by different teams, in different languages, on different machines, work together seamlessly
  • Every LLM you access through code (GPT-4, Claude, Gemini) works exactly this way: you send a prompt as a request, get generated text back as a response