Cloud Cost Management Cloud Ops

Cloudflare adds spending caps for Workers and Durable Objects

Cloudflare has introduced Spend Management in beta, giving pay-as-you-go customers a way to set spending limits for Workers and Durable Objects. Unlike budget alerts that only notify customers about rising costs, the new controls can automatically pause covered activity when a spending cap is reached.

Cloudflare says the feature is intended to help developers avoid unexpected bills from unplanned usage. Customers can configure spending limits and alert thresholds through the dashboard, the cf command-line interface or the REST API. The beta is available to any Cloudflare pay-as-you-go customer, and the company says support for additional products is planned.

Limits, alerts and service behavior

In the dashboard, customers can find the controls under Manage Account, Billing and Spend limits. For each supported product, they can enable spending controls, set a cap, choose an email recipient and configure one or more alert thresholds. Cloudflare sends notifications when evaluated spending reaches a threshold or the cap.

When a blocking limit is reached, Cloudflare automatically pauses the product’s covered activity. New invocations that incur costs are rejected. The company notes that this does not necessarily disable every feature associated with a product: for Workers, Cron Trigger and Queue consumer invocations are paused, while static assets continue to be served.

Customers can resume activity by raising the cap above the amount already accumulated in the current billing cycle, disabling or deleting the blocking policy, or waiting for the next billing cycle, when the existing block expires. The billing cycle is tied to the start of the paid subscription rather than the date a Worker is deployed or a spending cap is created. A subscription that begins on October 10, for example, generally has a cycle running from October 10 to November 10.

The dashboard displays current-cycle costs for supported products in near real time, which Cloudflare defines as updates in under 10 minutes. It also provides an overview of configured limits and thresholds, and an audit log showing who changed a limit and when, as well as when a cap was reached.

How Cloudflare calculates and applies caps

Cloudflare describes Spend Management as a multi-stage system designed to handle usage across its distributed network. Rather than sending every raw usage event directly to the pricing system, the company aggregates measurements close to where they are collected. Product-specific meters convert events—such as requests, CPU time, execution duration or storage operations—into measurements, usually grouped into one-minute windows. A second service merges partial aggregates, typically over five-minute windows, before forwarding them to the Usage Engine. Consolidated aggregates are also archived for analytics and reconciliation.

The Usage Engine maps those product measurements to standardized usage records and partitions processing by account. Cloudflare says this keeps an account’s usage and subscription information together, allowing its system to apply allowances and track accumulated spend without coordinating pricing calculations across partitions for every update. Each partition maintains local state and a durable write-ahead log, which Cloudflare says supports parallel processing and recovery after failures.

The Rating Engine combines usage records with subscription details and pricing rules, including rates, included allowances and billing-rounding rules. It calculates accumulated spend rather than rounding and pricing each request independently. For example, CPU usage may first be covered by an included allowance before any excess is charged.

Usage and subscription updates can arrive separately. If usage reaches the Rating Engine before the subscription information needed to price it, Cloudflare says the system keeps that usage pending and processes it when the information becomes available. Once it calculates spend, the system evaluates warning and blocking policies and makes estimated charges available through the dashboard and APIs. Email alerts are sent when configured.

Cap enforcement does not happen synchronously inside the Rating Engine or in the request path. Instead, a policy service sends limits to Cloudflare’s runtime configuration service and Quicksilver, the company’s internal key-value store for global replication and low-latency access. Runtime systems receive the configuration through periodic refreshes and then reject covered activity locally. Cloudflare says this design avoids making requests wait for rating calculations.

Integration and planned expansion

Customers can manage policies through the REST API or cf CLI as well as the dashboard. The API supports operations including listing, creating, retrieving, updating and deleting spending policies, along with listing audit and activity records. Cloudflare’s example policy uses a threshold expressed in cents and the action “usage_block.”

Spend Management can be used alongside AI Gateway budgets. Cloudflare says AI Gateway supports per-user and per-model budgets for Workers AI and other AI providers when requests pass through the gateway. The company’s longer-term plans include extending caps to more products, shortening the measurement-to-enforcement interval—potentially to under a minute—and enabling budgets associated with applications or AI agents across multiple services. Those broader controls are plans, not capabilities described as available in the beta.