Idea · Aug 30, 2026
Build Your Own LLM Router
Students implement a production-quality LLM gateway supporting model selection by cost tier, streaming responses, per-user cost budgeting, retry with backoff, and a live admin dashboard, then benchmark it against an open-source reference implementation.
What it would do
As LLM API calls become standard infrastructure in software products, CS students need hands-on experience with the systems concerns that surround them: latency, cost, fault tolerance, and observability. This four-milestone assignment asks students to build an LLM router from scratch. In the first milestone they implement a FastAPI proxy that routes requests to different providers based on a cost-tier configuration file, validating request schemas and returning unified response objects. In the second milestone they add streaming response support using server-sent events, with a configurable timeout and retry policy. In the third milestone they implement per-user cost budgeting backed by a SQLite ledger: requests are metered by token count, budgets are enforced per user, and the gateway returns a 429 with remaining budget when the limit is hit. In the fourth milestone students build a React admin dashboard showing real-time request volume, cost burn rate by user, provider latency distributions, and error rates. The final deliverable includes a benchmarking report comparing their gateway's throughput and latency tail to OmniRoute on a shared load-test harness. An optional extension adds multi-key rotation and circuit-breaker logic for providers that return 5xx errors.
Key features
- Four milestones: cost-tier routing proxy, streaming SSE support, per-user cost budgeting ledger, and real-time admin dashboard
- Shared benchmark harness measuring requests per second, P95 latency, and budget enforcement accuracy against a reference implementation
- Instructor-provided stub configurations for multiple providers so the assignment works in development without live API keys
- Optional extension: multi-key rotation pool and circuit-breaker state machine for providers returning 5xx errors