One request, three ways
Swipe to change step
Step 1 of 8. A blocking call sends one request and waits. For about 2 seconds the model generates tokens and your program sits idle. Your code (blocking call), highlighted. Model API (about 2 s per reply), highlighted. User (waiting…). arrow from Your code to Model API, labelled POST /v1/messages. arrow from Model API to Your code, labelled 200 + JSON. arrow from Your code to User, labelled answer. a request moving along POST /v1/messages.
In this chapter
- 1.1Python async and await for concurrent calls7 min read
- 1.2Pydantic models and runtime validation7 min read
- 1.3Environments and packages: venv, uv and poetry6 min read
- 1.4HTTP APIs: methods, status codes and JSON Schema7 min read
- 1.5Authentication: API keys and bearer tokens6 min read
- 1.6Streaming with server-sent events7 min read
- 1.7Retries with exponential backoff and jitter6 min read
Chapter check
Already know this? Score 80% or more and you can skip ahead. Each attempt draws 4 questions from 12.
Loading check…