skip to content

When your model gateway is down, should applications fail open straight to the provider or fail closed, and what does a bypass lose?

level: seniorimportance: should knowfreq 38%

answer

  1. per route, not global
  2. keys, caps, logs, failover, shape
  3. unreachable versus refused
  4. central switch, short-lived credentials
  5. drill the unused path

basics

~20 s

Decide per route. Failing closed keeps key custody, spend caps and logs but loses the feature; a bypass keeps it up but its calls go uncapped and unlogged, so bound it and trigger it only when the gateway is unreachable.

solid answer

~40 s

I would decide per route, not globally. Failing closed keeps every guarantee the gateway gives (key custody, spend caps, central logs, failover) and costs availability. Failing open keeps the feature up, but bypassed calls are uncapped, unlogged, need provider credentials in the app and must use the provider's native request shape. Routes carrying regulated data or customer-billed spend fail closed; cheap, low-risk user-facing routes may fail open through a break-glass path: a central switch, narrow short-lived provider credentials issued only then, a hard local call limit, local logs shipped later, automatic expiry. The bypass fires only when the gateway is unreachable, never on a refusal like an exceeded budget, and I would drill it regularly, because an unused path rots.

code

yaml · 13 lines
yaml
# illustrative gateway outage policy; every field name is invented
bypass_trigger: central_switch        # never a per-client timeout
never_bypass_on: [budget_exceeded, policy_denied, invalid_request]
routes:
  - name: support-reply-suggestions
    on_gateway_unreachable: fail_open
    bypass:
      credential: issued_on_switch     # scoped to one provider and model
      credential_ttl_minutes: 60
      max_calls_per_instance: 500
      local_log: buffer_and_ship
  - name: claims-summary-regulated
    on_gateway_unreachable: fail_closed

go deeper

for a junior

Recall the two options when the gateway is down, the feature stops or the app calls the provider directly, and that the direct call skips the gateway's caps and logs.

for a middle

Explain each guarantee a bypass drops (key custody, caps, logs, failover, one request shape) and why a refusal from a healthy gateway must never trigger the bypass.

for a senior

Show the per-route design: which routes fail closed, a break-glass with issued short-lived credentials, local limits and logs, a central switch, expiry and regular drills.

for a principal

Own the default the company sets and enforces: who may mark a route fail-open, who flips the switch, and how much uncapped spend and unlogged traffic the business accepts per window.

## What the gateway guarantees, and what a bypass drops When every model call goes through a **model gateway**, the gateway is where several guarantees live. If the gateway is down, an application can **fail closed** (the AI feature stops) or **fail open** (the application calls the provider directly, a **bypass**). The bypass keeps the feature up, but each guarantee the gateway gave is gone for those calls: | guarantee | fail closed | fail open (bypass) | |---|---|---| | key custody: only the gateway holds provider keys | kept | apps need provider credentials | | spend caps per team | kept (nothing is spent) | not enforced: the gateway never sees the calls | | central request logs and replay records | kept | missing unless apps log locally | | failover across providers | n/a | gone: the app talks to one provider | | one request shape | kept | apps must speak the provider's native shape | | feature availability | **lost** | kept | Whether the gateway should be the only holder of provider keys is covered with team keys and budgets; the point here is that a bypass needs *some* credential in the app, and how it gets one decides how much a bypass leaks. ## Down is not the same as no A common and damaging mistake is to bypass on the wrong signal: - **Bypass only when the gateway is unreachable**: connections refused, or timeouts across the fleet, confirmed by health checks. - **Never bypass on a refusal from a healthy gateway**: a budget-exceeded 429, a policy denial, an invalid-request 400. Those are the gateway doing its job; bypassing on them turns every cap into a suggestion. - **A failing route is not a failing gateway.** If one upstream provider is erroring while the gateway is healthy, that is the provider-failover problem, handled inside the gateway; bypassing would only lose the gateway's own fallback. - **Prefer a central switch** that on-call (or a fleet-wide health rule) flips, over each client deciding on its own timeout. Thousands of clients flipping independently on a slow-but-alive gateway stampede the provider and flap back and forth. ## Choosing per route The answer is per route, not one global default. Fail-open versus fail-closed as a general principle belongs to any enforcing service; for a model gateway the questions are: 1. **What does the route carry?** Regulated or contract-bound data, or a check the route is required to pass in the path: fail closed. 2. **Whose money?** Customer-billed or unbounded spend, such as an autonomous agent: fail closed, or open only with a hard local limit. 3. **What does downtime cost?** A user-facing feature with a cheap, low-risk call (a suggestion, a summary): a bounded bypass is often right. 4. **Is there a degraded mode?** Hiding the feature or serving a non-AI fallback is generic graceful degradation, often better than either extreme. For example, reply suggestions in a support tool are cheap per call, carry no regulated data and annoy agents when they vanish, so a bounded bypass is reasonable. An insurance claims summary over regulated records is the opposite: an unlogged call is worse than a missing summary, so it fails closed and the claims screen simply shows the summary as unavailable. Writing the choice into the route's own config, reviewed like any other change, means the decision is made calmly in advance rather than by whoever is on call during the incident. ## A bounded break-glass A fail-open route should bypass through a designed path, not standing keys in every app: - **Credentials issued on the switch**, scoped as narrowly as the provider allows (ideally one project and the models the route uses) and short-lived. - **A hard local call limit** per application instance, since the gateway's caps cannot count calls it never sees. - **Local logs buffered and shipped later**, so the record of the window is not empty. - **Automatic expiry**: the window closes itself and traffic returns through the gateway. - **Reconciliation afterwards**: provider-side usage for the window is matched back to teams from those local logs. ## Bypass paths rot The bypass is the one path nobody runs on a normal day. Providers change their native APIs, credentials expire, the local limit was never wired. Teams that rely on a bypass exercise it in scheduled drills: flip the switch for one low-risk route in a quiet window and check that credentials issue, native calls succeed and local logs arrive. An untested bypass often fails exactly when the gateway does.

  • Why should the bypass be a central switch rather than each client's own timeout?
    Client timeouts fire when the gateway is slow, not only when it is dead, and thousands of clients deciding independently flip at different moments, stampede the provider with uncapped calls and flap back. A central switch gives one decision, one window and one record of who flipped it and when.
  • What happens to team spend caps during a fail-open window, and how do you bound the exposure?
    The gateway cannot count calls it never sees, so caps stop applying for the window. Bound it with a hard per-instance call limit, credentials that expire on their own, and a short window; afterwards, reconcile the provider's usage for that period back to teams from the locally shipped logs.
  • How do you know a model gateway's bypass path still works before you need it?
    Drill it: on a schedule, flip the switch for one low-risk route in a quiet window and check that credentials issue, native-shape calls succeed against the current provider API, and local logs arrive. Providers change their APIs and credentials expire, so an untested bypass tends to fail exactly when needed.

A badge-controlled office during a fire alarm: exit doors unlock so people can leave, while the server room stays locked. Each door has its own rule, and the doors unlock because the alarm fired, never because someone's badge was refused.

  • Every route should fail open, because availability always beats the gateway's controls.
  • A budget-exceeded response from the gateway is a good reason to call the provider directly.
  • Giving every app a standing provider key is a fine way to prepare for bypass.
  • Spend caps still hold during a bypass because the gateway enforces them.
  • Each client should switch to bypass on its own as soon as a gateway call times out.