AWS re:Invent 2026 has put an important AI infrastructure problem in the spotlight.
Amazon Bedrock Gateway and smart routing introduce centralized model-request management, spending controls and model selection based on request complexity.
It raises an interesting engineering question:
Why should every application decide which LLM provider to use?
If you're building an AI platform with multiple model providers, this is an architecture worth exploring.
Let's design a simplified version.
Imagine you have three backend services:
Customer Service
└── OpenAI API
Document Service
└── Anthropic API
Agent Service
└── Gemini API
Each service maintains its own:
Now imagine switching providers or introducing a cheaper model.
You have multiple applications to modify.
This is the same coupling problem that API gateways helped solve in distributed systems.
Instead, applications communicate with one internal service.
Java / Python / Node Applications
|
v
Model Gateway
|
+----------+----------+
| | |
v v v
OpenAI Anthropic Gemini
The application sends a task request.
The gateway determines which provider and model should handle it.
The application doesn't need to know the provider-specific details.
Start with a provider-independent request structure.
from pydantic import BaseModel
from typing import Optional
class ModelRequest(BaseModel):
task_type: str
prompt: str
tenant_id: str
user_id: str
max_budget: Optional[float] = None
quality_requirement: str = "balanced"
The gateway receives a standardized request regardless of which provider eventually handles it.
Start with deterministic routing rules.
def select_model(request):
if request.task_type == "classification":
return "provider_a_small"
if request.task_type == "summarization":
return "provider_b_fast"
if request.task_type == "complex_reasoning":
return "provider_c_reasoning"
return "provider_a_default"
This is not yet intelligent routing.
It is a useful baseline.
A production router can evolve to consider historical performance, estimated cost, latency, provider availability and task quality requirements.
Avoid putting provider-specific API calls inside the routing engine.
Define a common interface:
from abc import ABC, abstractmethod
class LLMProvider(ABC):
@abstractmethod
async def generate(self, prompt: str):
pass
Then implement provider adapters:
class OpenAIProvider(LLMProvider):
async def generate(self, prompt: str):
pass
class AnthropicProvider(LLMProvider):
async def generate(self, prompt: str):
pass
The gateway selects a provider adapter and invokes it through the common interface.
This is an application of the Strategy pattern.
It also makes provider integrations easier to test independently.
Model routing without cost governance is incomplete.
For example, consider a tenant with a monthly inference budget.
Before sending a request to a provider, the gateway should:
A simplified interface:
class BudgetManager:
async def authorize(
self,
tenant_id: str,
estimated_cost: float
) -> bool:
remaining = await self.get_remaining_budget(
tenant_id
)
return estimated_cost <= remaining
This example omits concurrency control, atomic reservations, reconciliation and currency/pricing changes. Those are essential for production.
In a multi-tenant environment, budget checks must also be protected against concurrent requests overspending the same balance.
What happens when a provider is unavailable?
A gateway should distinguish between:
Not every failure should trigger a fallback.
For example, a timeout may justify a controlled retry or alternate provider. An authorization failure should not be bypassed by silently switching providers.
Fallback must preserve the original security, quality and data-handling requirements.
Before calling this a production model gateway, I would add:
| Capability | Why it matters |
|---|---|
| Authentication | Identify calling applications and users |
| Tenant isolation | Prevent cross-tenant access |
| Model registry | Manage model capabilities and configurations |
| Routing policies | Select models using measurable criteria |
| Budget reservations | Prevent concurrent overspending |
| Provider adapters | Avoid vendor coupling |
| Retry and circuit breakers | Handle provider instability |
| Observability | Measure cost, latency and quality |
| Audit records | Explain routing and authorization decisions |
| Evaluation pipeline | Continuously validate routing quality |
One important design decision: never assume that a provider fallback is automatically safe. Data residency, retention, privacy and model capabilities must be checked before switching.
Once the gateway collects enough evaluation data, routing can become more sophisticated.
For example:
Incoming Request
|
v
Task Classification
|
v
Routing Policy
|
v
Candidate Models
|
v
Cost / Latency / Quality Evaluation
|
v
Selected Provider
|
v
Execution
|
v
Outcome Evaluation
|
v
Routing Feedback
The gateway can learn which models perform well for specific task categories.
However, I would keep policy enforcement deterministic and make routing decisions explainable. An adaptive router should not be allowed to ignore budget or security constraints.
I think AI infrastructure is moving toward a model where applications don't need to know which LLM provider is behind every request.
They need a reliable contract.
The infrastructure should manage model selection, provider integrations, cost controls, observability and resilience.
AWS's latest announcements are an interesting validation of this architectural direction.
The opportunity is no longer just building applications that call LLMs. It is building the infrastructure that allows thousands of applications to use LLMs intelligently.
What does your current architecture look like? Do you use a shared model gateway, or does each service integrate directly with its LLM provider?
About the Author
I'm Ashwin Giridharan, a Cloud & Enterprise Solutions Architect focused on building scalable systems and exploring the architecture of AI.
My interests include enterprise architecture, cloud platforms, distributed systems, Generative AI, LLMs, RAG, Agentic AI, and taking AI solutions from experimentation to production.
I share practical insights, technical explorations, and lessons learned while building and understanding modern technology systems.
Connect and explore my work:
Website: https://ashwingiridharan.com/