Insights ยท 2026-07-30

AI Gateway architecture: The control points before the first model call

The functions an enterprise AI Gateway should provide: identity, routing, budgets, fallbacks, logging, data rules, and evaluation.

Attnora

AI Gateway architecture: The control points before the first model call | Attnora

An AI Gateway is not another API endpoint for its own sake. It is where an organisation standardises access to models and enforces rules before data reaches a provider. Without this layer, direct integrations emerge with different keys, logging formats, fallbacks, and cost models.

On 24 July 2026, Cloudflare announced the availability of another Anthropic model through its AI Gateway. Announcements like this show how quickly the provider landscape changes. The architectural question is therefore not which model is best today. What matters is whether new models can be introduced and removed again in a controlled way.

What belongs before the model call?

A gateway should make at least the following decisions:

  • Who or which service is making the request?
  • Which workflow and customer is it for?
  • What data class does the request contain?
  • Which models and regions are permitted?
  • Which budget and rate limits apply?
  • Which logs may be stored?

This information must be available before routing. Retrospective cost allocation cannot easily repair missing identity or data classification.

One common interface, but no false equivalence

A standard API format reduces integration effort. Models still differ. Tool calling, structured outputs, context windows, caching, safety filters, and error messages vary.

The gateway should make provider differences visible rather than hiding them completely. Define a common core and treat provider-specific capabilities as explicit options. Otherwise, portability is merely asserted.

Separate routing from policy

Routing determines which model receives a task. Policy determines which choices are permitted at all. A low-cost model may, for example, be allowed for a public summary but not for confidential personal data or a workflow with a prescribed region.

This separation makes audits easier. You can show that a route did not merely work technically, but also complied with the approved rules.

Fallbacks need boundaries

Automatic fallbacks improve availability, but they can change cost, data path, and quality. Switching to another provider is not a neutral technical retry.

Define for each route:

  • which providers are allowed as fallbacks,
  • whether the same data region is maintained,
  • which quality threshold must be met,
  • how many retries are allowed,
  • when the workflow should fail in a controlled manner.

Some processes should stop rather than silently use a different data path.

Observability from the first request

Every request needs a trace ID and attribution to a workflow, model, provider, and outcome status. Record latency, tokens, cache status, retries, and cost. For agents, include tool calls and stop conditions.

The goal is not the densest possible dashboard. It is a traceable answer to the question of which workflow produced which costs at what level of quality.

Plan for gateway failure and exit

The gateway becomes critical infrastructure. Plan for high availability, configuration versions, rollback, and a safe degraded mode. Exit is equally important: routes, prompts, evaluation sets, and logs should be exportable.

A gateway reduces dependence on model providers, but it can create a new dependency on the gateway provider. Assess both layers.

Sources

Next step

Document all direct model integrations, API keys, and fallback rules. Then select one workflow for the gateway pilot and define identity, data class, permitted providers, budget, logging, and failure behaviour before the technical integration.

Related services

More on this topic

Back to Insights