The short tally
A gateway is a trade. At low volume you pay the costs immediately and collect the benefits only when certain conditions arrive. The earlier posts on solo founders and build versus buy cover who should run one and who should write one. This brief answers a narrower question: for a small app with one provider and modest spend, what does a model-agnostic gateway actually add, and what does it take away?
"Model-agnostic" here means the app sends one request shape and the gateway maps it to whichever provider and model serves it. INFRO's text endpoint, for example, is wire-compatible with OpenAI's, so an SDK that speaks that protocol works by changing the base URL.1
What a gateway adds
- Failover, but only with somewhere to fail over to. When a connection fails before the first token, INFRO moves to the next one and the client sees a slightly higher time to first token. With a single connection there is nothing to fail over to.2 On one provider and one key, this benefit is zero.
- One budget and one record across providers. Once you have two providers you have two spend limits that cannot see each other. A gateway puts one budget and one record across both.3
- Per-customer caps. If each user can trigger model calls, one heavy user can spend what many light ones pay you. A cap checked before the call is awkward to build correctly in application code, especially under concurrency.3
- Model swaps without code changes. The
modelfield takes a route slug or avendor/model-nameid, so changing models is a string, not an integration.1 - Per-request cost and attribution. Every request is recorded with its model, latency and estimated provider cost, which answers "which feature spent that?" without your own logging.
Only the last two help a one-provider app on day one, and the last one you can approximate with a few lines of logging.3
What it costs a small app
- An extra hop. Going through a gateway adds a network leg. The added time is a paired difference between direct and gateway requests, not a single dashboard number, so measure it against your own budget.4
- A new dependency in the request path. If the gateway is down, your feature is down unless you have decided what happens next. See gateway down: fail open or fail closed.
- Abstraction leakage. Providers differ. INFRO's docs note that some models refuse
temperature,top_por penalty parameters, so the gateway drops them and lists what it dropped in anX-INFRO-Params-Droppedheader.1 A "model-agnostic" call still behaves differently per model, and you will want tests that watch for it. - Another vendor and another subscription. With a BYOK gateway your providers still bill you directly and the gateway charges a subscription; INFRO takes 0% of model spend.5 That is a fixed cost your app carries from the first request, whatever its volume.
- One more place credentials live. Provider keys move into the gateway, so its security posture becomes part of yours. Check how keys are stored and scoped before you connect them.
Signs it is time
Use these as triggers, not a calendar:
- You are adding, or about to add, a second provider.
- Customers can trigger model calls and you need a cap per customer.
- The provider bill grew and you cannot say which feature or customer caused it.3
- A model retirement notice has cost you a scramble more than once.
- An agent loop could spend through two accounts with no limit that sees both.3
- Someone outside engineering, such as finance, asks for spend by project.
If none apply, set a hard limit on the provider account, tag each request with its feature in your own logs, and write down what the app does when the provider is down.3
A cheap way to keep the option open
You do not have to choose now. Wrap the model call in one function, use an OpenAI-compatible client, and keep provider accounts in your own name. The base URL and key become configuration:
import os
from openai import OpenAI
# Direct to the provider today; a gateway later is two environment variables.
client = OpenAI(
base_url=os.environ.get("LLM_BASE_URL", "https://api.openai.com/v1"),
api_key=os.environ["LLM_API_KEY"],
)
def ask(feature: str, messages: list[dict], model: str = "gpt-example"):
# `gpt-example` is a placeholder model id.
return client.chat.completions.create(model=model, messages=messages)With that in place, trying a gateway means pointing LLM_BASE_URL at it and running your own tests, including streaming and tool calls, which is where gateways differ most.6 Moving back is the same change in reverse.
