promptdojo_

Before the API: what the model is doing — step 1 of 1

Before the API: what the model is doing

You're one lesson away from calling a model API for real, so this is the moment to upgrade the chapter-zero mental model into its technical form.

Here's what a model call isn't: a database lookup, a search engine, or a coworker who remembers your last conversation. It's a probability machine generating the next useful tokens from whatever context you hand it. That's the whole trick — and it's also why the same model can feel brilliant in one product and useless in another. The model is only one layer. Around it sits a harness: system instructions, tools, file access, retrieval, safety rules, output formatting, and history.

When you call an LLM API, you're building the smallest possible version of that harness yourself. You choose:

  • the messages you send
  • the role and the task
  • the context window
  • the output format
  • the tool or schema contract
  • the checks that decide whether the response is usable

Training is when the model learned its broad patterns. Inference is this moment: you send context, the model returns output. And when the output is wrong, the fix is rarely "the model is dumb" — satisfying to say, useless to debug with. The fix is usually one layer closer to you:

  • the task was vague
  • the context was missing
  • the format was loose
  • the examples pointed the wrong way
  • the check let a fluent answer pass

That's the bridge from "chat with AI" to "ship an AI feature."