aiengineering.guideaiengineering.guide

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

  1. The canonical request. Model, messages, sampling parameters, max tokens. Which fields matter for your first call and which you can skip.
  2. The response object. Content, finish reason, usage — and why usage is the field you actually care about most.
  3. Timeouts and retries. Why the SDK default is wrong for most workloads and what to set instead.
  4. System prompts. Where they go in each provider’s shape, why they behave subtly differently, and what “system” is doing under the hood.
  5. Rate limits and the error you’ll hit first. 429, 529, and the backoff that keeps you inside the free tier.
  6. 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.

Outline

Enter to go · Esc to close