Your first API call
For engineers
Getting a key, installing an official SDK, sending messages with roles and reading the response, including its stop reason and token usage
110 questions across four stages: Understand, Apply, Solve and Judge.
Try 5 questions
Practice items, not counted towards your mastery. No account needed.
Check yourself · 1 of 5
Where should an API key live in a small server-side project?
Check yourself · 2 of 5
Why does a chat app built on a raw LLM API send the earlier turns with every new request?
Check yourself · 3 of 5
A Claude response has stop_reason "max_tokens". What does that tell you?
Check yourself · 4 of 5
In the Gemini generateContent API, which role name marks the model's earlier replies?
Check yourself · 5 of 5
Which of these errors is worth retrying after a short pause?
Topics
- Setting up keys and official SDKs4 min read · Creating a project key, keeping it in an environment variable and installing the official Python or TypeScript SDK
- Building a request from messages and roles5 min read · System instructions, alternating user and assistant turns, model id and max tokens, and why the API is stateless
- Reading content blocks, stop reason and usage5 min read · Where the text lives, what the stop or finish reason says, the token usage fields and the request id to log
- Comparing Claude, OpenAI and Gemini request shapes5 min read · The same call in the Messages, Responses and generateContent APIs, plus model aliases versus pinned snapshots
- First-call mistakes that leak keys or truncate answers5 min read · Hard-coded keys, missing output limits, ignored stop reasons, unpinned model aliases and no error handling
Start here
- Claude API overview (opens in a new tab)DocsFree
Authentication headers, the Messages endpoint and the official SDK list in one place.
- Working with messages (Claude docs) (opens in a new tab)DocsFree
Roles, multi-turn requests, response fields and stop reasons with runnable examples.
- OpenAI developer quickstart (opens in a new tab)DocsFree
The same first call in the Responses API, with its SDK setup and key handling.
110 questions · last verified 2026-12