LESSON · 1 OF 6

Why call an LLM over an API

Why call an LLM over an API

So far you've probably pictured AI as a chat window: you type, it replies. That works for one question at a time. But most real AI work doesn't happen in a chat window - it happens in code, through an API.

An API (application programming interface) is just a way for one program to talk to another. An LLM API lets your program send text to a model and get the reply back, with no human typing in a box. That one capability is what turns a model from a novelty into a tool you can build on.

What the API unlocks

Three things become possible the moment you can call a model from code:

  • Automation. Run the same task across a thousand items instead of pasting them one by one. Summarize every support ticket from yesterday, classify a folder of log files, rewrite a hundred product descriptions - one loop, not a hundred copy-pastes.
  • Integration. Put the model inside your own scripts, apps, and pipelines. A deployment script that writes its own release notes, a monitor that explains an alert in plain English, a form that tags itself.
  • Control. In code you set exactly which model answers, how long the reply can run, and how the request is shaped - the same way every time, so the behavior is repeatable.

The chat app is just another API client

Here's the part worth sitting with: every AI product you've ever used - the chat assistants, the coding tools, the "summarize this" buttons - is a program making these same API calls under the hood. The chat window is one client. Once you know how the call works, you can write your own.

That's what this topic is about. Next you'll send a real API call yourself, with nothing but curl.


Your lab setup

This VM comes preconfigured with your AI keys - just type claude to get started. Your key and URL are already set as $OPENAI_BASE_URL and $OPENAI_API_KEY.

Spin up a fresh environment and practice live.
linux-basic-ai · fresh machine · ready in under a minute