Keys, Budgets and Fallbacks - Ganapathy Lakshmanaperumal

Keys, Budgets and Fallbacks

By Ganapathy Lakshmanaperumal

  • Release Date: 2026-11-25
  • Genre: Computers & Internet

Description

An independent, practical guide to LiteLLM, the open-source Python SDK and self-hosted proxy server from BerriAI that puts many language model providers behind one OpenAI-format interface. The book follows a fictional college, Brackenhurst College, as its central IT team builds Turnstile, a shared proxy for the student help desk, the library, admissions, research computing and a teaching sandbox. You will learn how the MIT and enterprise licenses divide the code, how to call models with the SDK and test without any provider account, how errors are mapped and cost is computed per call, and how the Router spreads load with retries, cooldowns and fallbacks. You will then build the proxy step by step: configuration, virtual keys, teams and users, budgets and rate limits, spend tracking, logging callbacks and metrics, privacy settings that keep prompts out of logs, and guardrail hooks including your own. Production chapters cover containers, Kubernetes, health probes, a shared cache, security, upgrades and daily operations, and a final chapter helps you choose between the open-source edition, the enterprise edition and other options. Code was run locally against a stand-in server. Includes a cheat sheet, a hands-on lab, a troubleshooting table, review questions with answers and a glossary.