On one product we are building this year, the models behind it have changed several times. The hosted service we started on changed what it offered. A newer open-weight release fixed our timeouts. The client asked for a model that can run in-country. And for one step, a cheaper model turned out to be good enough.
Through all of it, the product's permissions, approvals and audit trail did not change once. That was the design goal, and this post describes the design.
Why the model will change, whether you plan for it or not
- Providers move on their own schedule. They retire models and change prices and terms, and your roadmap is not consulted.
- No single lab leads everywhere. Vercel's review of its gateway traffic concluded that "Running the leading model in every modality requires routing across at least three labs."
- Teams are already switching. On that same gateway, open-weight models went from 11% of tokens in April to 29% in June.
- Requirements arrive late. A client in a regulated industry asks for a model in their own cloud. A government client asks for one in their own country.
So treat the model as a replaceable part, and put the things that must not change somewhere else.
One LLM gateway, any model
Every model call in the product goes through one internal interface, the gateway. Product code never names a vendor. It asks for a capability, such as "draft", "classify" or "judge against policy", and configuration decides which model serves it. A hosted frontier model and an open-weight model on the client's own servers sit behind the same interface.
Should you build or buy? There are good gateways, including LiteLLM, OpenRouter, Vercel AI Gateway and Portkey, and the major clouds offer multi-model APIs of their own. For most products we use one of these and add a thin layer of our own on top that holds the product's rules.
What the gateway layer does besides routing
Routing is the visible part. The layer earns its place through four other jobs.
- Routing by sensitivity. A step that handles sensitive data can go to a private model while the rest of the product uses a hosted one. The step does not know the difference.
- Fallback. When a provider is down or rate-limited, the call moves to a second model that has passed the same tests.
- Cost per unit of work. The gateway is the one place that sees every call, so it is where you measure what a finished document, slide or ticket costs. Per-token prices tell you very little.
- One configuration per deployment. The same product can run on hosted models for one client and on in-country models for another. Our current agent platform is built this way: hosted models today, local open-weight models next, through the same interface.
Controls live outside the model
Here is the rule that makes swapping safe: nothing the platform must enforce may depend on a model's judgment.
Who may ask for work. Which work may touch which data. Who receives the result. Which actions need a person's approval. All of these are enforced by code and configuration, never by a sentence in a prompt. A model can be talked out of an instruction. It cannot talk its way past a permission check.
Some work does rest on judgment. Deciding whether a request breaks a written company policy is a judgment, and a model makes it. For those cases we record three things on every run: the judgment, the reason given, and the model and version that made it. After a swap, you can compare the new model's judgments with the old one's on the same cases.
The result is that changing the model can change the quality of the work, but it cannot change who is allowed to do what.
A test set is the contract
A gateway makes a swap possible. A test set tells you whether it is a good idea.
On one agent platform, ours is a set of 37 scenarios taken from the client's real workflows, including the policy judgments. Every candidate model runs the same scenarios before it is trusted with a role. Models are chosen per role on that evidence, so a role that drafts text may run on a cheaper model than a role that judges policy. Caching responses cut the cost of running the suite by about 40%, which matters when you run it often.
Without a test set, swapping a model is a leap of faith. With one, it is an afternoon's work. Our piece on observability, evals and cost control covers how to build one.
What does not transfer between models
- Prompts. Guidance tuned for one model underperforms on another. Keep business rules in one place and model-specific phrasing in another, so a swap touches only the second.
- Providers. The same open-weight model can behave differently at two hosting providers. Treat the provider plus the exact version as the unit you test and pin.
- Features. Tool calling, structured output, caching and context size all differ. Design to the common core and put the extras behind a switch.
- Languages. A model that is strong in English may be weaker in Arabic, or in a formal institutional register. Test in the languages the product ships in.
What this design costs
It is not free. The gateway adds a hop and a dependency. Designing to the common core means giving up some vendor-specific features, at least at first. And the test set takes real effort to build and to maintain.
For a prototype, skip it. Build it when the product will live for more than a year, when it has compliance requirements, or when model cost at volume is a number someone will ask about.
And run two models from the start, even if one carries 95% of the traffic. An abstraction that has only ever served one model has not been tested as an abstraction.
Five questions to test your own product
- Can you change the model for one step by changing configuration, without a release?
- If a model ignored its instructions completely, which of your controls would still hold?
- Can you say which model and version produced a given output last month?
- Do you have a test set that would tell you within a day whether a new model is good enough?
- Does any provider key live outside the gateway?
If the answer to the first four is not yes, or the answer to the last one is not no, the product is tied to a model more tightly than it looks.
Where this fits
This design is what lets the rest of our open-model work happen. It is how a product moves between the options in Private LLMs for regulated teams, how a hosted model gives way to an in-country one in Sovereign AI in practice, and how we ran the comparisons in our field report on open-weight models.
It also matches something our CEO, Vadim Peskov, has said about coding tools: it is not the model, it is the harness. The same holds for products. The model is the part you should expect to replace. The harness around it is the part you own.
If you want a second opinion on how tightly your product is tied to one model, start with a free 30-minute architecture review. We will walk through the five questions with you and tell you what it would take to change the answers.

