What an edge proxy gives you, and where teams outgrow it
Most teams adopt an edge proxy for good reasons. Cloudflare AI Gateway offers analytics, caching and rate limiting free with a Cloudflare account, and bills guardrails as Workers AI inference, as summarised from Cloudflare's own pages on 2026-10-20.1 It also has dollar spend limits scoped by provider, model or metadata that return a 429 at the cap or move traffic to a fallback model, and they apply to your own keys for models with known pricing. Cloudflare says plainly that its cost tracking is a best-effort estimate and that a burst of concurrent requests can briefly pass a limit.1
That is a solid base for one app on a couple of providers. Teams usually outgrow it when the questions change from "what happened?" to "what should happen?":
- Which provider or model should this request use, given who sent it and how big it is?
- When a call fails, which kind of failure should retry, which should move on, and which should stop?
- Which team's budget refuses a request before the provider is called, and does that hold under a burst?
- Who holds which provider key, which gateway keys exist, and who changed which policy?
A gateway in the request path can answer some of these. A control plane is the policy, identity, cost and record keeping around that path.2 The rest of this guide treats the choice as a test: what to try, what a pass looks like, and where a different layer is warranted.
Edge proxy and control plane: the job map
The useful question is which jobs a product performs, and whether it performs them before or after the provider call.2 Use this table as a worksheet: fill the middle column from your own account, not from a feature list.
| Job | Test on your current proxy | What a control plane adds (INFRO) |
|---|---|---|
| Logs and analytics | Can you filter by project, key, end user? | Usage and estimated cost per request, queryable by project and key |
| Caching | Exact or semantic? What is the TTL cap? | Opt-in exact-match cache for chat completions, no semantic matching |
| Routing policy | Can a rule send a request to a target by metadata, size or time? | If-rules on a route, first match wins, up to 20 per route |
| Failover | Across providers or only to another model? Per failure kind? | Same-model connection failover plus ordered cross-model fallbacks; failure rules per kind |
| Budgets | Which scopes? Checked before the call? Under bursts? | Caps per organization, project, member and key, with worst-case admission |
| Key governance | Who can create keys, restrict them, rotate them? | Gateway keys limited by provider or IP range, rotation with an overlap window, audit log |
| As code | Can policy be reviewed and versioned? | Management API for routes, keys, budgets and connections |
The rows to focus on are the three that an observability-shaped proxy is least likely to cover: routing policy, failure rules and key governance. The sections below take them in turn, after a note on caching, the feature most teams adopt an edge proxy for.
INFRO's response cache is opt-in and exact-match: an identical request inside the time-to-live you set is answered from the cache and never reaches your provider, so your provider does not bill it. The longest time-to-live depends on the plan, from one hour on Developer to 30 days on Business and Enterprise, and there is no semantic matching.3 If caching is the only thing you use your proxy for, you may not need to move at all.
Routing policy: rules as data
The first sign of outgrowing a proxy is a retry loop in application code: try provider A, catch, try provider B. Moving that into configuration lets someone change it during an incident without a deploy.4
In INFRO a route is a stable name your application sends as model, resolving to an ordered or weighted list of your own provider connections and the model each should serve.5 A weighted route picks the first target by weight and still falls through the rest if it fails, and a target at weight 0 is a standby that never takes a first attempt.5 A route can carry up to 20 rules in front of its targets; rules are checked in order and the first match decides.5
{
"name": "Gold tier",
"match": "all",
"conditions": [
{ "field": "metadata", "key": "tier", "op": "in", "value": ["gold", "platinum"] },
{ "field": "input_tokens", "op": "gt", "value": 50000 }
],
"targets": [{ "connection_id": "conn_…", "model": "openai/gpt-6-sol" }],
"fallthrough": true
}Rules can read request metadata, attribution values such as feature and end user, the key's project and environment, whether the request streams or carries images or tools, an upper-bound estimate of prompt size, and the hour or weekday.5 The design advice from INFRO's routing guide is to keep rules away from prompt text and to decide deliberately what a request that sets nothing should match.4
Test: write two rules that overlap, send a request that matches both, and confirm that the first wins and that the request log names the rule. Then send one with the metadata field missing.
Failover: same model, other model, and what each failure should do
Failover has two layers in INFRO. Connection failover tries the same model on another of your own connections. Model fallbacks are an ordered list of up to five alternate catalog models, set per request. Both operate strictly before the first token.6 A provider 429 does not count against the connection's health, and INFRO's own refusals (invalid body, budget, allowlist) are decided before any provider is called and never fail over.6
Failure kinds deserve different treatment. A rate limit on one key is not an outage; another key of the same provider has its own window. A spend-cap 429 stops that account until access resumes. A request the provider rejected as malformed will usually be rejected by the next target as well.4 A route's failure rules can change the default per kind of failure (rate limit, server error, timeout, connection, rejected key) to retry, move to the next target at once, or stop. A route can also retry the same target 0 to 3 times, immediately and with no backoff.7
Two limits are worth knowing before you rely on it. Once a stream has started, INFRO does not restart it on another target.7 And a connection can list alternate API hosts for the same key, tried when the first host cannot be reached.7
Test: see the checklist below. The point is to produce each failure kind on purpose, in staging, and read what the gateway did.
Budgets: before the call, and under a burst
A dashboard reports spend after the fact. A budget controls it only if it can refuse a request before the provider is called.2 Ask three things of any gateway, Cloudflare's included: which scopes exist, whether the check uses a worst-case estimate or the last known total, and what happens at the edge of the limit when requests are in flight.
INFRO budgets exist at organization, project, member and key scope. An organization has a monthly target, which only alerts, and a hard cap that only the owner sets; key limits always block.8 A blocking budget admits a request only if its worst-case estimated cost fits the room left, counting recorded spend plus every reservation held against it across the infrastructure. The worst case covers the whole request body, the most expensive input rate the model could apply, and the most expensive model and provider the request could fall back to.8 The trade-off is stated in the docs: close to a limit, a request can be briefly refused for room that is reserved but not yet spent, and the figure is an upper bound on INFRO's estimate, not on the provider's invoice.8
Test: set a small blocking limit on a staging key, then send many concurrent requests with large max_tokens. Count how many were admitted, and compare the recorded spend with the limit. Cloudflare's own page warns that a burst can briefly pass a limit, so this test is where the two designs differ in practice.1
Key governance: who holds what
A proxy that logs well can still leave the provider keys scattered. A control plane holds provider credentials once and gives applications its own gateway keys. In INFRO each provider credential is encrypted when saved, scoped to your organization and never shown again, and applications use INFRO gateway keys instead.9 Gateway keys can be limited to chosen providers or IP ranges and rotated with an overlap window so the old key keeps working while you deploy the new one. Each gateway key belongs to one environment and never reaches a connection outside it, and an audit log records member, key and policy changes with actor and timestamp.
Anthropic's own gateway guidance lists the same set: provider keys kept server-side, usage attributed per developer or team, budgets and rate limits in one place, and audit logging.2 Also decide whose accounts carry the traffic. In a BYOK model your provider bills you directly at your own rates, and the control plane stays out of the money flow.2 INFRO runs only on provider accounts you connect, with a software subscription and 0% markup on model spend.9 It adds no shared pool of capacity: your provider accounts keep their own quotas.10
Test: list every place a provider key lives today. After moving, the answer should be "one connection, and gateway keys everywhere else", and revoking one gateway key should break one service, not all of them.
A test checklist before you move
Run these in staging, with real provider keys of small value, and keep the request log open. A pass means the observed behaviour matches the written claim.
- Kill the primary. Disable the first target's key. The client sees a normal answer; the log shows the attempt trail and which target served it.
- Rate-limit one key. Force a 429 on one of two keys of the same provider. The next request goes to the other key, and the limited key is not marked unhealthy.
- Quota exhaustion. Simulate a spend-cap 429. The policy stops retrying that account, or moves to another account, without looping.
- Bad request. Send an invalid parameter. Check whether it is retried across several targets; providers differ on which optional parameters they accept, so read the policy for this kind of failure.
- Timeout. Set a short per-attempt timeout on a long generation. Note what the provider still bills.
- Stream cut. Break a stream midway. Confirm what your application receives, since a started stream is not restarted elsewhere.7
- Rule order. Two overlapping rules, one request that matches both, one that sets no metadata.
- Budget burst. Concurrent requests against a small blocking limit; compare admitted spend with the limit.
- Fallback price gap. Compare the rate of each fallback target with the primary, since failover can change what the provider bills you.
- Key rotation. Rotate a gateway key with an overlap window and deploy without downtime.
- Policy as code. Export the route and budget configuration, then re-create it in a clean organization from the API.
- Exit. Write down how to point applications back at the providers directly, and whether any state would be lost.
When to stay, when to stack, when to move
Stay on the edge proxy if you run a few apps on one or two providers, your problem is visibility and repeat requests, and your cap needs are met by the limits you tested.
Stack a control plane behind or beside it if you already rely on Cloudflare for other traffic and need policy for AI calls only. Pick one layer to own retries and timeouts, and one to count budgets.11
Move the AI traffic if several teams, providers or customers share spend and someone has to answer for it, or a provider incident has already taken a feature down.2 INFRO is a hosted option that fits that case, runs only on your own provider accounts, and is not a fit if you need to self-host without an enterprise agreement or want to start at zero cost.1 For a wider list of options by constraint, see Best AI gateways in 2026, and for the routing design in detail, LLM routing rules.
