Newsletter

    Subscribe our newsletter

    Get new infrastructure guides, comparison reports, and migration notes in your inbox.

    Infrastructure notes, guides, and new tools. Unsubscribe anytime.

    Back to Blog
    API Gateway
    Inference
    Reliability

    How can a service gateway automatically switch traffic when a model or inference service becomes unhealthy?

    June 14, 2026
    9 min read read

    A service gateway can automatically switch traffic by monitoring the health of each internal model-service channel, removing an unhealthy channel from routing, sending requests to an approved fallback path, recording the degradation event, and switching traffic back after recovery. The source v3.2 gateway design supports this exact operating pattern.

    The main architectural benefit is that callers keep using one external endpoint. Health-based routing and recovery happen behind that endpoint, so the application does not need to be redeployed every time an inference instance or model channel changes.

    What is a model-service channel?

    A model-service channel is an internal service path that the unified gateway can route traffic to.

    The source gateway design exposes:

    One interface externally
    Multiple channels internally

    A channel can represent an approved model service or inference path.

    The gateway manages whether that channel is eligible to receive traffic.

    That makes the gateway the separation point between callers and runtime instances.

    The caller needs a stable service contract.

    The gateway handles the changing internal supply.

    How does the gateway know a channel is unhealthy?

    The source model-instance layer tracks health-check results and runtime state.

    Instances can be marked:

    Running
    Degraded
    Stopped

    The service layer also tracks success and quality indicators.

    The source does not specify one universal health-check algorithm.

    A deployment can therefore use the health signals appropriate to the serving runtime.

    The important requirement is that the result becomes a routing input.

    A channel that is considered unhealthy by the approved health policy should be removed from new traffic automatically.

    What does automatic removal mean?

    Automatic removal means the gateway stops selecting the unhealthy channel for new requests.

    The source describes this as automatic channel removal.

    That is safer than continuing to send production calls to a known-bad path.

    The unhealthy channel can remain visible in the operations interface.

    It simply stops receiving normal traffic.

    This distinction matters.

    Removal from routing is not the same as deleting the model or stopping the investigation.

    Operators still need the channel's health and event history to understand what happened.

    What happens to traffic after the channel is removed?

    Traffic follows the configured routing or degradation policy.

    The source gateway supports:

    Multiple internal channels
    Weighted routing
    Capability routing
    Fallback
    Degradation

    If another approved healthy channel can handle the service, the gateway can route requests there.

    If the service has no acceptable alternative, the degradation policy should define the predictable response.

    The source does not say every service always has a secondary model.

    Do not create a fallback simply to keep a green availability indicator.

    The alternate path still needs to meet the acceptable service contract.

    What is the difference between failover and degradation?

    Failover usually means traffic moves to another path that can continue the service.

    Degradation means the service operates in a reduced or alternate mode under an approved policy.

    The source uses the term degradation for the gateway fallback behavior.

    In practice, an alternate healthy model channel may act as failover.

    A lower-capability approved channel may be a degraded service.

    The exact semantics should be defined by the enterprise.

    The important source-supported behavior is that the gateway centralizes the decision and records the event.

    Why should fallback be configured before an incident?

    Because the service team should decide what is acceptable while the system is healthy.

    During an outage is the worst time to discover that nobody knows whether Model B can replace Model A.

    A fallback policy should identify:

    Primary channel
    Approved alternate channel
    Routing condition
    Service limitation if any
    Recovery behavior
    Owner

    The source supports fallback and model-capability routing but does not define a universal compatibility rule.

    That means the service owner has to approve the alternate.

    How can weighted routing help failover?

    Weighted routing gives the gateway a controlled way to distribute traffic across healthy channels.

    Before an incident, multiple channels may already carry traffic.

    If one becomes unhealthy, its weight effectively falls out of routing.

    The remaining healthy channels take the eligible traffic according to policy.

    Weighted routing also helps validate a new fallback path before relying on it.

    The source supports separate canary traffic and weighted routing.

    A small amount of traffic can be sent to the alternate channel before it becomes a full recovery path.

    How does canary release improve failover readiness?

    A fallback is safer when it has already handled controlled real traffic.

    The source gateway can release traffic separately to a canary channel.

    That lets the team observe:

    Health
    Success rate
    Latency
    Token throughput
    Errors

    before depending on the channel during failure.

    This is useful for new model versions or new inference deployments.

    For the general change-control concept, what is canary rollout in infrastructure operations, and how does it reduce operational risk explains how small initial exposure limits risk.

    What event should be recorded when fallback occurs?

    The source explicitly says degradation actions are written as events.

    A useful event should identify:

    Affected service
    Unhealthy channel
    Time
    Fallback channel or degradation state
    Routing action
    Recovery time
    Switchback result

    The source does not publish a full event schema.

    The operating requirement is that the transition is auditable.

    An operator investigating a latency change should be able to see that the service changed channels at that time.

    Without the event, failover can create invisible behavior changes.

    How should Token metering behave during failover?

    Token metering should continue at the unified gateway using the same project, tenant, and model attribution rules.

    The source gateway and Token operations model share the same service boundary.

    A traffic switch should therefore not create a gap in usage accounting.

    The usage record should still identify:

    Project
    Tenant
    Model
    Service
    Token volume
    Invocation result

    If the fallback uses a different model, the record should preserve that model identity.

    That helps explain later cost or performance differences.

    For gateway governance, how organizations can manage API keys, rate limits, quotas, routing, and fallback for AI and model services explains how routing and metering remain linked.

    How should rate limits behave during failover?

    Rate-limit and quota policy should remain predictable when the service moves to a fallback.

    The source centralizes rate limiting and tenant quota at the gateway.

    That is useful because the policy is not tied to one backend instance.

    If the fallback path has less capacity, the enterprise may define a more restrictive degradation policy.

    The source does not specify an automatic rate-limit adjustment algorithm.

    Any such behavior should be configured explicitly.

    Do not let the gateway silently change a tenant's contractual or operational limit without a known rule.

    How should the gateway switch traffic back?

    The source gateway automatically switches back after recovery.

    That requires the unhealthy channel to return to healthy state under the deployed health-check policy.

    The source does not define:

    How many successful checks are required
    How long the channel must remain stable
    Whether traffic returns instantly or gradually

    Those are implementation choices.

    A cautious design can return traffic gradually when the service has a history of instability.

    The key is to prevent uncontrolled flapping between channels.

    The recovery event should remain visible.

    What if the recovered channel fails again immediately?

    The gateway should follow the same health and fallback policy again, while operations investigates the unstable channel.

    The source does not prescribe a circuit-breaker algorithm or retry count.

    What it does provide is:

    Health-based removal
    Degradation event logging
    Automatic recovery switchback
    Operational audit

    A repeatedly failing channel should therefore become visible as a recurring reliability problem.

    Do not hide instability behind endless automatic switching.

    The SRE layer should capture the effect on service quality and error-budget consumption.

    How does this connect to SLOs?

    Failover exists to protect service reliability, so its success should be measured against the service SLO.

    The source SRE layer includes:

    SLO targets
    Error budgets
    Burn-rate alerts
    Token-service stability

    A gateway switch that keeps the service within the SLO is a successful resilience action.

    A switch that keeps the endpoint technically online but causes sustained latency or success-rate failure may still consume the error budget.

    For the reliability decision framework, how organizations can use error budgets to decide when to continue releases and when to prioritize reliability work explains how service degradation affects release policy.

    How should operators test failover?

    Test the path before a real production failure where policy and environment allow it.

    A controlled test can verify:

    Health state changes
    Channel removal
    Alternate routing
    Usage metering
    Alarm generation
    Degradation event
    Recovery detection
    Switchback

    The source does not specify a testing frequency.

    That should be set according to service criticality and change policy.

    The important point is that a configured fallback is not the same as a proven fallback.

    What should the gateway operations view show?

    A useful view can show:

    External endpoint
    Primary channel
    Alternate channels
    Channel health
    Routing weight
    Canary state
    Current degradation state
    Recent fallback event
    Success rate
    Token throughput
    Rate-limit policy
    Tenant quota
    Recovery state

    The source v3.2 gateway and model-instance pages support this operating view.

    A platform example that uses unified service routing with health-based degradation is Sensaka.

    If I were running a production model gateway, I would test one question for every service: if the preferred channel disappears right now, exactly where will the next request go, what service behavior will change, and how will I know when the primary is safe to use again? If those answers are not defined before the incident, the fallback is only a diagram.

    Frequently Asked Questions

    What is the source-supported failover sequence for model services?

    The source gateway detects channel health, automatically removes unhealthy channels, activates the configured degradation path, records the event, then automatically switches back after recovery.

    Should every model service have a fallback model?

    No. The source supports fallback policies, but it does not claim every model is interchangeable. A fallback should be configured only when the alternate channel is approved for the service requirement.

    What should be monitored before switching traffic back?

    The source requires health-aware service operation but does not prescribe one recovery threshold. The gateway should use the deployed health-check policy and return traffic only after the channel is considered healthy.