Adaptation & Evaluation
Serving Multiple Models Safely
Route model traffic through identity, quotas, scoped caches, policy-aware endpoints, constrained fallbacks and redacted telemetry.
Reference architecture - illustrative, not a client deployment
Route requests under policy constraints rather than price alone.
- Complexity
- Advanced
- Drawing
- Supplied
- Model Serving
- AI Gateway
- Routing
- Security
- Observability
Overview
This reference architecture is illustrative. It is not a record of a client deployment.
Multi-model serving begins at an authenticated boundary. The gateway validates caller scope, quotas and budget before a policy-aware router selects an approved endpoint. The decision can include capability, residency, data classification, availability and version compatibility; price is only one constraint. Hosted and private endpoints remain distinct policy targets.
A cache is safe only when its key and revalidation rules preserve tenant, identity or permission scope, relevant context and model versions. Some requests should never be cached. On a miss, the router calls an authorized endpoint and validates the returned shape before responding. If an endpoint is unavailable, fallback must preserve the same authorization, residency and capability requirements. When no compatible route exists, fail closed and explain the unavailability.
A concrete example
An application sends a summarization request for a document classified "private-only." The router cannot choose a hosted endpoint even if it is cheaper or faster. It checks a tenant- and permission-scoped cache, then calls the private endpoint. During an outage, it uses only a pre-approved compatible private fallback; otherwise it returns a safe failure and records redacted operational metrics.
Common misconception
"A model router simply chooses the cheapest available model." Cost-only routing can violate data handling, authorization or capability requirements. Policy eligibility comes first; optimization happens within the allowed set.
Diagram & Walkthrough
Choose a declared scenario and step, or select a component by pointer, touch or keyboard. Playback starts only when you press Play and pauses when this panel leaves the screen.
Main walkthrough, step 1 of 6: Authenticate and enforce quotas. idle.
Main walkthrough
The primary path through this reference architecture.
Active parts: Application request, Identity + quotas, Policy-aware model router
Text walkthrough
This vertical reference remains readable without the interactive controls.
01Authenticate and enforce quotas
Validate the caller and budget before any cache or model endpoint is considered.
Active parts: Application request, Identity + quotas, Policy-aware model router
02Check a scoped cache
Look up a response using a key that preserves tenant, permissions, context and versions; use only a currently authorized hit.
Active parts: Policy-aware model router, Tenant + permission scoped cache, Checked response or safe failure
03Select an authorized model
Choose hosted or private inference only from endpoints permitted for this request.
Active parts: Policy-aware model router, Approved hosted model, Private model endpoint
04Validate the result
Return the selected endpoint's output through shared response checks.
Active parts: Approved hosted model, Private model endpoint, Checked response or safe failure
05Handle outages under the same policy
Evaluate a compatible permitted private fallback and fail closed if none remains authorized.
Active parts: Policy-aware model router, Constrained fallback policy, Private model endpoint, Checked response or safe failure
06Record safe telemetry
Emit redacted usage, route and outcome data for operations without copying sensitive prompts by default.
Active parts: Checked response or safe failure, Redacted traces + usage
Connections
- Request + identityApplication request to Identity + quotasdata
- Validated scope + budgetIdentity + quotas to Policy-aware model routercontrol
- Scoped cache keyPolicy-aware model router to Tenant + permission scoped cachecontrol
- Authorized valid cache hitTenant + permission scoped cache to Checked response or safe failuredata
- Permitted hosted requestPolicy-aware model router to Approved hosted modelcontrol
- Private-only requestPolicy-aware model router to Private model endpointcontrol
- Model outputApproved hosted model to Checked response or safe failuredata
- Model outputPrivate model endpoint to Checked response or safe failuredata
- Endpoint unavailablePolicy-aware model router to Constrained fallback policycontrol
- Compatible permitted fallbackConstrained fallback policy to Private model endpointcontrol
- No authorized fallbackConstrained fallback policy to Checked response or safe failurecontrol
- Redacted metrics + outcomeChecked response or safe failure to Redacted traces + usagefeedback
Components
Application requestexternal
Submits a task together with authenticated caller context and declared workload requirements.
Responsibilities
- Provide the request and required data-handling classification
Inputs
- User task
- Application session
Outputs
- Request and identity context
Risks
- Missing classification
- Unbounded payloads
Identity + quotasdeterministic
Authenticates the caller, derives authorized scope and enforces request or token budgets.
Responsibilities
- Reject unauthorized or over-quota traffic before routing
Inputs
- Request
- Trusted identity
- Quota policy
Outputs
- Validated scope and budget
Risks
- Identity spoofing
- Quota keys shared across tenants
Policy-aware model routerdeterministic
Selects only endpoints allowed by capability, residency, classification, version and availability policy.
Responsibilities
- Route within the eligible model set and preserve policy on retries
Inputs
- Validated request
- Routing policy
- Endpoint health
Outputs
- Authorized route or fallback decision
Risks
- Cost-only routing
- Stale capability metadata
Tenant + permission scoped cachedata
Stores reusable responses only under keys that preserve tenant, permission, context and version boundaries.
Responsibilities
- Return only currently authorized and valid entries
Inputs
- Scoped cache key
- Cacheable approved responses
Outputs
- Authorized cache hit or miss
Risks
- Cross-tenant leakage
- Stale authorization or content
Approved hosted modelmodel
Serves workloads explicitly permitted for the approved hosted provider and deployment.
Responsibilities
- Run the requested compatible model version
Inputs
- Permitted hosted request
Outputs
- Hosted model output
Risks
- Provider outage
- Unexpected deployment-version change
Private model endpointmodel
Serves requests whose policy requires the private environment or an approved private fallback.
Responsibilities
- Keep restricted inference within its authorized boundary
Inputs
- Private-only or compatible fallback request
Outputs
- Private model output
Risks
- Capacity exhaustion
- Serving configuration drift
Constrained fallback policydeterministic
Evaluates alternate endpoints without relaxing authorization, residency or capability requirements.
Responsibilities
- Select a compatible permitted fallback or fail closed
Inputs
- Failed route
- Endpoint policy and health
Outputs
- Permitted fallback or safe-failure decision
Risks
- Policy downgrade during outage
- Retry storms
Checked response or safe failureexternal
Returns a validated model or cache result, or an explicit failure when no authorized route exists.
Responsibilities
- Apply response checks and disclose safe unavailability
Inputs
- Authorized cache hit
- Model output
- Failure decision
Outputs
- Application response
Risks
- Unchecked output
- Ambiguous fallback disclosure
Redacted traces + usagedata
Records endpoint, version, latency, usage and outcome signals without retaining unnecessary sensitive content.
Responsibilities
- Support operations, audit and capacity analysis with controlled telemetry
Inputs
- Redacted response metadata
Outputs
- Operational traces and usage measures
Risks
- Sensitive prompt leakage
- Insufficient incident evidence
Scenario reference
Provider outage
Use fallback only if authorization, residency and capability constraints still hold.
01Use a permitted private fallback
An unavailable route enters fallback policy, reaches the compatible private endpoint and records the returned outcome.
Active parts: Policy-aware model router, Constrained fallback policy, Private model endpoint, Checked response or safe failure, Redacted traces + usage
No allowed fallback
Fail safely instead of sending restricted data to an unauthorized provider.
01Fail closed and record the outcome
When no endpoint satisfies policy, return explicit unavailability and emit safe operational telemetry.
Active parts: Policy-aware model router, Constrained fallback policy, Checked response or safe failure, Redacted traces + usage
Design Decisions
- Authenticate, authorize and apply quotas before model selection.
- Express routing and fallback policy in deterministic controls.
- Scope cache entries to every factor that changes authorization or meaning.
- Redact traces while retaining endpoint version, latency, usage and outcome signals.
Risks & Trade-offs
A shared cache can leak another tenant's response. Loose fallback can move restricted data to an unauthorized provider. Model aliases can hide capability changes, and retries can multiply cost or duplicate tool effects. Gateway controls improve consistency but add a critical operational dependency.
When to Use / Not Use
Use this pattern when several approved endpoints serve multiple applications or policy classes. Do not add a router for one stable endpoint without a governance need. Do not cache personalized or sensitive responses unless isolation and invalidation are demonstrably correct, and never fall back across a prohibited boundary.

