Module 2 · State, access and delivery · Lesson 7
AI gateways
One control point between your agents and every model provider. What Vercel AI Gateway, OpenRouter, LiteLLM and Portkey do (routing, fallbacks, keys, budgets, logging, data controls), the arithmetic of fallbacks, and the ways a gateway can mislead you.
By the end of this lesson you can
- Describe the functions of an AI gateway and decide which ones your fleet needs
- Compare Vercel AI Gateway, OpenRouter, LiteLLM and Portkey on hosting, pricing, routing, keys and budgets
- Compute the availability gain from fallbacks, and explain why correlated failures and changed behaviour reduce it
- Configure per-tenant keys, budgets and model fallbacks from Python, and handle budget rejections in an agent
- Explain the data-handling implications of adding a gateway to the request path