Forward-deployed / Learning zone
APIs & integrationsa Generative AI module
Lesson 01

The request/response contract

TL;DR

Every call to a model follows the same basic shape: you send a request — the prompt, some parameters, sometimes your own data — and you get back a response — the generated content, plus metadata like how many tokens it used. That shape is a contract: a promise about what one side sends and what the other side returns, the same idea behind any API your engineering team has ever integrated with. What makes a model's version of this contract distinctive is what sits inside it. The request carries a prompt whose wording changes the outcome, not just a fixed set of parameters. The response is generated, not retrieved, so its content varies in ways an ordinary database lookup never would. Understanding the contract's exact shape is the first, cheapest thing a product leader can do to stop treating an AI feature's engineering as invisible — because everything downstream, cost, latency, and reliability, is a consequence of what's actually inside that one request and that one response.

🎯 For the product leader

Why it matters — "We call the model's API" hides a real, structured exchange with parts a product leader should be able to name: what goes in, what comes back, and what each part costs or risks.

What it changes in your decisions — You can read an API's documentation well enough to ask a sharp question — "what happens if we omit this parameter," "what's actually in the response object" — instead of treating the integration as entirely opaque to you.

Ask yourself — "Could I sketch, on a whiteboard, what our product actually sends to the model and what it gets back?"

Risk if ignored — A team makes a scoping or cost decision without knowing that a parameter they never touch is quietly shaping the response, or that the response carries usage data that should be feeding their cost tracking and isn't.

The mental model: an order form and a receipt

A request is an order form: what you're asking for, filled out in a specific format the other side expects. A response is the receipt: what you got, plus a record of what it cost. An API contract is the agreement about exactly what fields that order form has, and exactly what the receipt will contain — so both sides can build around it reliably.

The contract

Request & response · the shape of every LLM API call

Both sides are contracts. Both sides have parts a product decision hides inside.

Request · what you send
Three parts
The prompt

Instructions + your data — most direct quality lever

Parameters

Temperature · max length · which model

Conversation history

If any — what you've already said

The model's API
Response · what comes back
Three parts
Generated content

The actual answer

Token usage

Input + output count — your bill

Metadata

Which model · why it stopped

What's inside the request

What's inside the response

Why this is a contract, not just a format

Calling it a contract, not just a data format, matters because contracts have the properties a product leader already reasons about in other systems: they can be versioned (a vendor changes the shape of the response over time, and your integration has to handle that), they can break (a field renamed or removed stops your code working, the same as any API), and they carry implicit promises about what's guaranteed and what isn't. The full discipline of thinking about contracts this way — versioning, breaking changes, what a promise actually covers — is developed in APIs & contracts, and it applies to a model's API exactly the way it applies to any other one your product depends on.

Failure modes

Practitioner checklist