2 · Talking to Models › Phase 3 › Lesson 1 of 4
Your first real API call
What this lesson covers
The shape you’ll type a thousand times. One call to a modern chat API — the request, the response, and every non-obvious field.
The outline
- The canonical request. Model, messages, sampling parameters, max tokens. Which fields matter for your first call and which you can skip.
- The response object. Content, finish reason, usage — and why
usageis the field you actually care about most. - Timeouts and retries. Why the SDK default is wrong for most workloads and what to set instead.
- System prompts. Where they go in each provider’s shape, why they behave subtly differently, and what “system” is doing under the hood.
- Rate limits and the error you’ll hit first. 429, 529, and the backoff that keeps you inside the free tier.
- Anthropic vs. OpenAI, minimally. The shape differences that matter, the ones that don’t, and one adapter that unifies both in ~30 lines.
Coming soon
In outline.