Lesson 2 of 8 · Build AI Apps with Real APIs
In this lesson. Call the API without leaking keys or melting a quota.
What you will learn
- Where API keys belong
- Timeouts, retries, and rate limits
- Reading usage from the first response
Walkthrough
The first production bug is often a key in a screenshot or a loop that retries forever. You will store secrets correctly, set timeouts, log request ids, and handle 429s with backoff. Then you will send one successful request and print the token usage so cost is visible from day one.
Work through the ideas in order. After each point, pause and connect it to a task you already do — a document, a workflow, or a feature you own. The goal of Build AI Apps with Real APIs is usable skill, not a pile of notes.
If something is unclear, rewrite it in your own words before you continue. Teaching the step back to yourself is the fastest way to see gaps.
Practice
Make one authenticated request, capture the usage fields, and write the retry rule you would use in production.
Keep the first attempt small. A finished example you can reuse beats a perfect plan you never run.
Check your understanding
- Can you explain the goal of this lesson in one sentence to a teammate?
- Where would you apply “Where API keys belong” in your own work this week?
- What would you change on a second pass of the practice?
Next. Continue to the following lesson when the practice has a real artifact, even a rough one.
