Cloud Servers

Cloudflare AI Gateway Policies: Per-User AI Budgets and Model Blocks Replace Spend Limits (December 2026)

11 min read

Cloudflare AI Gateway Policies: Per-User AI Budgets and Model Blocks Replace Spend Limits (December 2026)

The Short Answer

Cloudflare has turned its AI Gateway from a meter into a gatekeeper. In a changelog entry published on December 4, 2026 and checked today, December 6, 2026, Cloudflare says AI Gateway policies now control who can use which models and providers on a gateway, and how much each user or team can spend. Policies read the verified identity of the caller from Cloudflare Access — an email address, identity provider (IdP) groups, or values passed in custom metadata — then allow the request, block it, or check it against one or more spend caps.

Three changes matter. First, budgets are now per identity: you can give a team or an email domain a shared monthly budget, cap each individual user inside it, or block an IdP group from expensive models entirely. Second, policies replace spend limits, which are now deprecated — existing rules continue to work, but new control belongs in policies. Third, the default flips: a gateway with no enabled policies allows all requests, but after you publish the first policy, any request that matches no policy is rejected. That deny-by-default behavior is the feature most likely to surprise operators on day one.

For anyone running AI features from a VPS or cloud server, this is the same lesson the hyperscalers have been teaching all month — one controlled path to every model, with a dollar cap on it — now expressed as identity policy instead of a shared API key and a hope. If your app calls models through AI Gateway today, plan a migration from spend limits and test policies before you publish them.

What Cloudflare Actually Announced

The December 4 changelog entry is short, and its claims are precise. Policies use the verified identity of the caller from Cloudflare Access, such as the user’s email or IdP groups, or values passed in custom metadata. Each policy targets an identity and a set of models or providers, then allows, blocks, or caps matching requests. Spend caps reset hourly, daily, weekly, or monthly on UTC boundaries. A Test policies tool in the dashboard checks how policies handle a request before it reaches real traffic. And the example Cloudflare chose to publish is telling: a policy named “Block contractors from Claude Opus” that blocks members of the contractors IdP group from all anthropic/claude-opus-* models.

The documentation behind the changelog, also checked today, fills in the mechanics. AI Gateway evaluates each request against the caller’s identity, then allows it, blocks it with a 403, or checks it against spend limits; if any applicable limit is used up, the request is rejected with a 429. Policies add two capabilities spend limits did not have: verified Access identity, and the ability to block or allow access to models outright. No pricing for policies is stated in the sources checked today, and none is quoted here.

How a Policy Is Built

Every policy has four parts, and the structure is worth understanding because it maps directly onto how teams actually argue about AI spend.

Who (actor). The identity the policy targets — and, for spend caps, the budget bucket the request draws on. The options are Everyone (one shared budget), a single User identified by email, an Email domain (one budget shared by everyone in it), or an Actor bucket: a custom string such as team:engineering or user:{cf.user.id} that Cloudflare resolves per request. If a field in the actor cannot be resolved, the policy does not apply to that request.

Resources. The models or providers covered: all models and providers, specific model IDs such as openai/gpt-5.5, specific providers such as anthropic, or specific models from a specific provider. Model IDs support the * wildcard — openai/gpt-* matches openai/gpt-5.5 and openai/gpt-5.5-mini — but a wildcard does not match across a /, and provider names do not support wildcards.

Action. What happens on a match: allow until capped, allow without a cap, or block with a 403. Caps use calendar-based windows aligned to UTC: hourly resets at the start of every hour, daily at 00:00 UTC, weekly every Monday at 00:00 UTC, monthly on the first of the month at 00:00 UTC.

Conditions. An optional Common Expression Language (CEL) expression that narrows when the policy applies — by IdP group ("contractors" in cf.user.groups), by metadata, by email suffix, by country, by environment. Conditions can only use Access identity fields, the request country, and custom metadata; the model and provider are deliberately not available there, because Resources already matches them.

Identity reaches the gateway two ways. Behind Cloudflare Access, AI Gateway validates the Access JWT on each request, making cf.user.id, cf.user.email, and cf.user.groups available — values clients cannot forge. Or pass identity in the cf-aig-metadata header as a flat JSON object with up to five keys, referenced as metadata.<key>; nested objects and arrays are ignored. That distinction is the security core of the feature: Access identity is verified, metadata is asserted by the caller.

How Requests Are Judged — and Where Operators Will Trip

Evaluation order is documented, and three rules deserve emphasis. Block wins: if any matching policy blocks the request, AI Gateway rejects it with a 403 and no other policy can override it. Every bucket must pass: remaining policies are grouped by resolved actor and resource into budget buckets, and a request subject to a company budget, a team budget, and a personal budget must be under the limit in all three, or it gets a 429. If a bucket contains several caps with the same window, the highest amount applies. Deny by default: if no policy matches, the request is rejected with a 403.

Two edge cases are documented and easy to miss. A block policy that references an identity field missing from the request still blocks when the resource matches, while other policies referencing a missing field simply do not apply — fail-closed for blocks, fail-open for caps. Requests authenticated with a service token have no groups and an empty email claim, and a failure to load a user’s groups rejects the request with a 503.

The workflow is staged: create or edit a policy, stage the change, test it, then publish. Staged changes do not apply until published, published changes can take up to 15 minutes to apply everywhere, and deleting a policy applies immediately. Test policies evaluates staged changes without calling a provider or recording spend — but test results do not account for spend already recorded against a budget.

Policies vs the Old Spend Limits

Old spend limits (deprecated) New AI Gateway policies No gateway: direct provider keys
Status today Deprecated; existing rules continue to work Current control layer per Cloudflare docs checked today Still the default for many small apps
Identity used Request metadata Verified Cloudflare Access identity (email, IdP groups) or custom metadata Whoever holds the API key
Can block a model No — caps spend only Yes — block action returns 403, and block wins over allows Only by revoking or rotating the key
Budget shape Gateway-level limits Per user, per team, per email domain, or custom actor buckets; every bucket must pass One bill per key; no per-user split
Reset windows Per gateway settings Hourly, daily, weekly, monthly — all on UTC boundaries Provider billing cycle
Default when nothing matches Requests allowed After the first policy is published, unmatched requests are rejected with 403 Requests allowed while the key is valid
Testing before live Not described in the sources checked Test policies in the dashboard, including staged changes None

The comparison covers only what Cloudflare’s December 4 changelog and policies documentation state today. The strategic read is that Cloudflare is following the same arc as the hyperscaler gateways we have covered this month: our report on Azure AI Gateway reaching general availability described one controlled path to every model, and our coverage of Amazon Bedrock Gateway and smart routing described AWS putting a dollar cap on every AI request. Cloudflare’s version is identity-first: the budget follows the person and the group, not the key — a better fit for internal tools, where the expensive accident is rarely a stranger with your key, but a legitimate user or agent looping against a frontier model at 3 a.m.

What This Means for Server Owners

If you run an AI feature from a VPS, a cloud server, or a Workers app, four practical consequences follow.

Shared keys stop being a budget strategy. A single provider key behind your app gives you one bill and no attribution. Policies let you express the rules you actually mean — this team gets a monthly pool, each user inside it gets a cap, contractors never touch the most expensive model — and enforce them at the gateway instead of in application code. The deny-by-default flip cuts both ways: publish your first policy carelessly and legitimate callers who match nothing start receiving 403s. Stage, test, then publish, in that order.

UTC resets will confuse someone. A “daily” budget that resets at 00:00 UTC resets at 07:00 in Vietnam and in the evening in the Americas. Document the reset time where your users can see it, or expect a support ticket that says the budget refilled at the wrong hour.

Choose your identity source deliberately. Access JWTs cannot be forged by clients; cf-aig-metadata values can be asserted by whoever sends the request. Metadata-based budgets are fine for attribution inside a trusted backend that sets the header itself, but they are not a security boundary for requests from untrusted clients. If the budget protects real money, put the gateway behind Access or set metadata server-side.

Self-hosting remains an option, with homework. Teams that want the gateway pattern without a hosted control plane can look at running the runtime themselves — our report on Cloudflare workerd clustering on your own servers covered the experimental self-hosted Workers path. But a self-hosted gateway means you own the policy engine, the spend accounting, and the uptime. For most small deployments the hosted layer is the cheaper engineering decision, and the provider keys feeding it still need the hygiene we described in our coverage of Cloudflare’s Varlock acquisition and the .env problem: keys belong in a vault, not in plaintext files your agents can read.

What to Do This Week

If you use AI Gateway spend limits today: migrate them to policies while the old rules still work. Recreate each limit as a policy, add the identity dimension you actually want, test with Test policies, and publish during a quiet window — remembering that propagation can take up to 15 minutes and that the first published policy turns on deny-by-default for everything unmatched.

If you use AI Gateway without limits: start with one company-wide monthly cap and one block policy for the model you fear most, test both, and watch the 429 and 403 responses in your logs before adding per-user buckets.

FAQ

What did Cloudflare announce on December 4, 2026?
AI Gateway policies: identity-based controls that decide who can use which models and providers and how much each user or team can spend, using verified identity from Cloudflare Access or custom metadata. Policies replace spend limits, which are now deprecated, per Cloudflare’s changelog checked today.

Are existing spend limits broken?
No. Cloudflare states that existing spend limit rules continue to work, and provides a migration path to policies. New control — especially model blocking and verified-identity budgets — belongs in policies.

What happens when a budget runs out, or a policy blocks a request?
A blocked request, or one matching no policy after the first policy is published, receives a 403 with “Access denied by policy”. A request over its spend cap receives a 429 with “Spending limit exceeded”, including the bucket, amount spent, and limit, per the documentation checked today.

Do I need Cloudflare Access to use policies?
No. You can pass identity values in the cf-aig-metadata header instead. The trade-off is trust: Access JWT values cannot be forged by clients, while metadata is caller-asserted, so metadata-based budgets should be set by a trusted backend.

Can I test policies before they affect real traffic?
Yes. Test policies in the dashboard evaluates staged changes without calling a provider or recording spend. Note that test results do not account for spend already recorded against a budget, and published changes can take up to 15 minutes to apply everywhere.

The Bottom Line

Cloudflare’s December 4 announcement, verified on the provider’s own changelog and documentation today, December 6, 2026, replaces AI Gateway spend limits with identity-based policies: per-user, per-team, and per-domain budgets on UTC reset windows, model blocking where block always wins, and deny-by-default once the first policy is published. Existing spend limits keep working, but they are deprecated. For server owners the verdict is practical: AI spend is now a per-identity governance problem, whether you solve it with Cloudflare policies, a hyperscaler gateway, or your own accounting on a VPS. If you are on AI Gateway, migrate and test before you publish. If you are not, copy the pattern — authenticate the caller, budget by identity, block the models each group should never touch — before an automated loop teaches you the lesson at provider prices.

Sources: Cloudflare Developers changelog, “Control spend and model access with AI Gateway policies,” developers.cloudflare.com (published December 4, 2026; checked December 6, 2026); Cloudflare AI Gateway documentation, “Policies,” developers.cloudflare.com (checked December 6, 2026). No AI Gateway pricing is quoted, as none was stated in the sources checked.

One response to “Cloudflare AI Gateway Policies: Per-User AI Budgets and Model Blocks Replace Spend Limits (December 2026)”

Leave a Reply

Your email address will not be published. Required fields are marked *