Skip to content
Cloud 5 min read

Cloudflare caps spending on Workers and Durable Objects, and the surprise bill becomes optional

On November 13, 2026, Cloudflare launched Spend Management in beta for pay-as-you-go customers, adding spending limits and alerts that pause Workers and Durable Objects once a threshold is hit. Set a cap on every account that runs billable code before a runaway loop turns into a five-figure invoice.

November 13, 2026. Cloudflare shipped Spend Management, a beta feature that brings real spending limits to pay-as-you-go customers, starting with Workers and Durable Objects. November 13, 2026. The feature is the payoff of a request that has topped the developer wishlist for years: a threshold past which the platform stops, rather than merely warns. November 13, 2026. More than 10 million developers now build on Cloudflare, and plenty of them have lived the same story — a loop that runs away, a script that calls itself, a cache key that grows without bound. Why it matters: until now, Cloudflare could tell you a bill was inflating, but it could not stop you from paying it.

A hard cap, not another alert

Cloudflare has long offered usage notifications and budget alerts on paid plans. The problem is one the company states plainly in its own announcement: "informing is not the same as controlling." An alert that lands at 3 a.m. does not save you from a bill generated by a bug nobody notices until the end-of-month statement.

Spend Management flips the logic. You set a spending threshold, a notification email, and one or more alert thresholds. When evaluated spend reaches the cap, Cloudflare enforces a blocking policy: the product is paused automatically. This is no longer a question of human vigilance — it is a circuit breaker that trips.

The controls live in the dashboard (Account → Billing → Spend limits), but also in the cf CLI and the REST API, which means the policy can be wired into infrastructure-as-code. Cloudflare’s own example shows a cap of 10,000 cents — 100 dollars — with the usage_block action.

A complete example through the API sums up the mechanism:

curl --fail-with-body --request POST \
  "https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_ACCOUNT_ID}/billing/spend-policies" \
  --header "Authorization: Bearer ${CLOUDFLARE_API_TOKEN}" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Workers spending cap",
    "product_id": "workers",
    "enabled": true,
    "threshold_cents": 10000,
    "action": "usage_block",
    "notification_email": "[email protected]"
  }'

Six fields do the whole job: an account id, a threshold in cents, a blocking action, and a notification address. The same policy is declared with the cf CLI (cf billing spend-policies create), which makes it something you can wire into a Terraform pipeline or a provisioning script — enforceable, not just visible.

The case study in surprise bills

The demand for a hard cap did not come from nowhere. Cloudflare’s serverless pricing has produced, over the years, recurring stories of unexpected invoices: a poorly written Worker that invokes itself in a loop, a site caught in a traffic spike, a config error that doubles consumption overnight. On a usage-billed model, a developer’s only defense was to watch the alerts — and hope to catch them in time.

That is what separates a cap from an alert: an alert depends on a human reading it, a cap acts even when nobody is watching. For a solo developer or a team running dozens of Workers, the difference is not cosmetic — it is insurance. The breaker trips, the bill stops, and the argument about "who left that running" becomes an argument about "why was the threshold so high."

The hard cap also changes who owns the risk. Without it, the responsibility for a runaway bill sits with the developer who has to notice and react. With it, the responsibility shifts to whoever set the limit — and a limit can be debated, reviewed, and audited after the fact, which is exactly how a finance team wants to think about spend.

What the cap stops, and what it leaves running

The blocking behavior is finer-grained than a global switch. Once the cap is reached, new invocations of the product are rejected — but Cloudflare only pauses what actually costs money. On Workers, Cron Triggers and Queue consumers are paused, while static assets keep being served. In practice: a site can stay partly online while the part that runs billable code stops.

There are three ways to resume service: raise the limit above the cycle’s accumulated spend, disable or delete the blocking policy, or wait for the next billing cycle. One detail trips people up: the billing cycle starts on the subscription date, not the first of the month. A subscription that started on October 10 runs from October 10 to November 10 — a classic trap when budgeting on a calendar month.

The console also exposes an audit log: who changed a limit, when, and when a cap was hit. For a team managing several accounts, that is the difference between an explained billing incident and a mystery.

The mechanics: a two-stage metering pipeline

The most instructive part of the announcement is the architecture, because it explains why the cap took so long to ship. Applying a blocking decision globally — from any point on Cloudflare’s distributed network — requires measuring consumption in near real time at enormous scale.

Cloudflare describes a two-stage metering pipeline. Every invocation produces raw usage measurements — requests, CPU time, execution duration, storage operations. The first stage aggregates these events as close to the source as possible, into one-minute windows; the second merges those partial aggregates over five-minute windows, shrinking the volume before it reaches the Usage Engine. That engine, partitioned by account, turns aggregated measurements into standardized usage records and applies included allowances. Each partition keeps a fast local state and a durable write-ahead log (WAL) on disk.

The visible result: the dashboard shows current-cycle costs in under ten minutes. That latency, not instantaneity, is the real promise of the product — a spending cap is never a wall accurate to the millisecond.

The limits to know before relying on it

Three caveats temper the enthusiasm. First, scope: the beta covers only Workers and Durable Objects. Other billable products will come "soon," per Cloudflare, but until then services like R2 or Stream remain without a hard cap. Second, the cap is opt-in: an account that never enables it keeps the old behavior, surprise bill included. Third, the cut-off is partial — static assets keep serving, so a reached cap does not necessarily freeze the invoice to the exact cent if an uncapped portion keeps consuming.

The feature composes with AI Gateway spend limits, which already enforce per-user and per-model budgets for Workers AI and other providers. Together they sketch a real FinOps posture: compute and inference caps applied to the requests that flow through your gateway.

The verdict

If you run billable code on Workers or Durable Objects under pay-as-you-go, set a cap today. It takes minutes in the dashboard, and the risk it covers is the five-figure invoice of a runaway loop. Start deliberately low, confirm the alerts arrive, then raise the threshold once your load’s baseline is established.

If you depend on products still out of scope, treat Spend Management as a beginning, not a complete answer. Cloudflare’s promise to extend caps to other products is still unfulfilled. Until then, keep your budget alerts and watch the audit log to see what consumed before the threshold. The doctrinal shift is real: Cloudflare is moving from a platform that tells you when things go wrong to one that can stop itself before they do. That is exactly the kind of control you expect from a cloud provider, and it took years to arrive.

References

You are reading the Cloud section.

RSS Cloud

Walid Ettayeb

DevSecOps engineer in Paris: cloud, Kubernetes and security.

Related articles