Day 3 of 14 35 minSDKsMessagesTokens & cost
Make your first API call from Python. API keys, the request and response, choosing a model, what a call costs, and handling errors and retries.
By the end of today you can
- Set up an API key safely and install an SDK
- Send a request with a model, a system prompt and messages
- Read a response, including its content blocks, stop reason and token usage
- Estimate what calls cost and choose a model for a task
- Handle errors and retry safely
What's inside
- 6 sections
- 3 diagrams and mind maps
- 3 code examples you can run
- 5-question quiz
- 1How an API call works
- 2Step 1: get and protect an API key
- 3Step 2: your first call
- 4Step 3: read the response
- 5What a call costs
- 6Errors and retries
Sign in free to read this lesson
Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.
Sign in free