APIs for AIFastAPI 0.141 · httpx2 2.13 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
20 small wins to finish your pathNext lesson

Installation and setup

Every lesson in this course runs from one project folder with four packages installed. This lesson installs them and checks the version.

FastAPI, httpx2, uvicorn and pytest

Make a folder for the course and install the packages. FastAPI builds APIs. httpx2 sends HTTP requests from Python. uvicorn is the server that runs a FastAPI app so other programs can reach it, and pytest runs the tests in lesson 18. Pinning the versions means your output matches the lessons.

pip install "fastapi==0.141.1" "httpx2==2.13.0" "uvicorn==0.53.0" pytest
Example
from importlib.metadata import version

print(version("fastapi"))

Where API keys live

Model APIs identify you with a key sent in a request header. Your code reads the key from an environment variable rather than containing it. Lesson 11 builds that check on both sides, using MODEL_API_KEY for the course's own model API; a hosted provider works the same way with its own variable, such as OPENAI_API_KEY.

bash
export MODEL_API_KEY=sk-local-123

Lesson 11 reads it with os.environ. Keep real keys in a .env file that is listed in .gitignore, never in the code itself. The model API in this course is one you build in lesson 10, so no provider account is needed.

Try it yourself
  • Run pip list and find the four packages.

Little by little, you're building something great.