# Models, gateway and routing

> Agents run on models that change quickly and whose prices vary widely from one to the next. A gateway in front of several providers lets you switch models, split costs and choose the region without touching the agents.

Two kinds of models coexist. Frontier models lead on hard tasks and are served by their maker. Open-weight models can be downloaded and run anywhere, subject to their license. Compare them on capability, cost, license and where they run, for the task at hand rather than in general.

The gateway is a single API in front of several providers. It enforces per-team quotas, logs calls, filters sensitive data and picks the region. It is also where cost per agent gets measured. It lets you switch models, which happens several times a year, without rewriting the agents.

Routing sends simple tasks to a small model and hard ones to a frontier model. Here the gateway makes two separate choices: model routing picks the model that fits the task, and provider routing picks where that model runs, which also serves the need for inference in Europe.

The evaluation set settles it: keep the cheapest model that holds the expected level, since a cheap model that fails often costs more than it saves. An open-weight model is not always cheaper once hosting, operations and the rework caused by weaker output are counted.

The contract matters as much as the technology: request retention, a no-training commitment, zero data retention where available, inference region, the list of subprocessors. Going through a cloud already under contract (Bedrock, Vertex AI, Azure), in a European region, often settles part of this.

An off-the-shelf product often picks the model for you. The option to keep control, by choosing the model or plugging in your own key or inference endpoint, then becomes a buying criterion.

**When**: Worth it as soon as several teams or providers are involved, or model cost becomes an issue. Not needed for an organization that only uses an off-the-shelf product: the vendor handles model choice, and the contract is enough.

**Trade-offs**: A gateway adds a component to run and a point that all data passes through. In return, it avoids depending on a single provider.

## Where to start

- List the models and keys already in use
- Put a gateway in front of direct provider calls
- Set quotas and region per team
- Tune routing on the evaluation set

## Common mistakes

- API keys scattered across teams with no tracking
- Switching models without rerunning evaluations
- Overlooking the retention and training clauses in the contract

## Metrics

- Cost per successful task by model
- Share of calls going through the gateway
- Time needed to swap a model

## Sources

- [FinOps Foundation, Managing AI token costs from direct model provider APIs](https://www.finops.org/wg/token-economics-saas/)
- [McKinsey, The state of AI in 2026: On the road to ROI](https://www.mckinsey.com/capabilities/quantumblack/our-insights/the-state-of-ai)
- [ANSSI, Security recommendations for a generative AI system](https://cyber.gouv.fr/en/publications/security-recommendations-generative-ai-system)
- [OpenRouter, How model routing works](https://openrouter.ai/blog/insights/model-routing/)
