Skip to content
mentoor

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

See where you stand

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?

Choose one answer

Check yourself · 2 of 5

Why does a chat app built on a raw LLM API send the earlier turns with every new request?

Choose one answer

Check yourself · 3 of 5

A Claude response has stop_reason "max_tokens". What does that tell you?

Choose one answer

Check yourself · 4 of 5

In the Gemini generateContent API, which role name marks the model's earlier replies?

Choose one answer

Check yourself · 5 of 5

Which of these errors is worth retrying after a short pause?

Choose one answer

Topics

  1. 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
  2. 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
  3. 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
  4. 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
  5. 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

110 questions · last verified 2026-12