Environment setup

Welcome! I'm Param, and in this course we are going to build a streaming AI application from scratch with FastAPI. By the end, you will have a running server that streams LLM responses in real-time, with structured prompts, parameter control, and safety guardrails.

We will build a bedtime story generator that takes a character name, age, theme, and length, then streams a personalized story back to the client in real-time. It sounds simple, but it touches every fundamental you need: API calls, prompt engineering, parameter tuning, streaming, and guardrails.

terminal
bash
# Clone the workshop repository
git clone https://github.com/learnwithparam/streaming-llm-fastapi.git
cd streaming-llm-fastapi

# One command to set up everything
make dev

This clones the repo, creates a virtual environment with uv, installs dependencies, and starts the FastAPI server.

.env
bash
# Copy the example and add your API key
cp .env.example .env

# Then edit .env with your preferred provider:
LLM_PROVIDER=openrouter
OPENROUTER_API_KEY=your_key_here
OPENROUTER_MODEL=google/gemma-3-12b-it

The project supports Fireworks, OpenRouter, Gemini, and OpenAI. You only need one provider. OpenRouter has a free tier to get started.

Validation checklist: Environment setup checklist

Loading practice…