Why a gateway exists
What it is
An LLM gateway is a service of your own that every feature calls, and which in turn calls the model providers. It handles, in one place:
- which model and provider a request goes to;
- who is allowed to call, and how much;
- retries, time limits and fallbacks when a provider fails;
- counting tokens and cost per team and feature;
- logging every request for debugging and evaluation.
Why it matters
Without it, each team calls providers directly and solves those five problems separately, each a little differently and none completely.
- Provider keys end up scattered through many codebases, nobody can say what the company spends on AI, and switching model means changing every application.
- A gateway turns five problems solved badly ten times into five problems solved well once.
In the real world: A company with nine teams calling models discovers it holds forty provider keys and cannot attribute a rising bill to any team; a gateway is the first item on the next quarter's plan.
Visual example
GatewayEvery feature's request takes the same path. None of this is rebuilt per team.
Building a gateway before there is a second feature. For one small application, calling the provider directly is fine. The gateway earns its keep when several teams, several models or real cost and reliability pressure appear.