Cloudflare Workers spend limits and budget alerts
You can set a Cloudflare Workers spend limit in Billing → Spend Management. Cloudflare's new Beta lets Pay-as-you-go customers pause Workers or Durable Objects at a product spending threshold. These are separate limits across your account. They do not guarantee a maximum invoice: blocking takes time, and some charges continue. Follow the setup below, then check which parts of your application can still spend.
Spend Management documentation checked November 16, 2026. Other settings and prices checked October 22, 2026. We have not tested a production cutoff. Configuration examples are illustrative; test them against your own workload.
| Control | What it does | What it leaves open |
|---|---|---|
| Product spend policy | Pauses supported Workers or Durable Objects operations | Separate product limits; delayed enforcement; some charges continue |
| Budget alert | Emails when account usage spend crosses your threshold | No automatic stop; billing data is processed daily |
| CPU and subrequest limits | Restrict work within an invocation | More incoming requests can still increase costs |
| Traffic rate limits | Restrict matching requests | Approximate counters; no account-wide dollar ceiling |
1. Set a Workers or Durable Objects spending limit
Cloudflare launched Spend Management in Beta on November 13 for Pay-as-you-go customers. You need billing edit permission. The current dashboard instructions are:
- Open your account's Billing → Spend Management.
- Find Workers or Durable Objects and choose Edit the spending limit.
- Enter a positive dollar amount in Monthly limit (USD), then choose Save limit.
- Check that the limit is On. Editing a saved limit preserves its enabled or disabled state.
Recorded spending in the current billing period counts immediately. A threshold below that spending can pause your applications after the next policy evaluation. To resume before renewal, raise the threshold above current spending, disable the policy or remove it. Otherwise the block expires when the subscription period renews.
Check what the limit can stop
A Workers limit counts requests and CPU after included usage, across every Worker in the account. The subscription fee is separate. Once enforced, it rejects new HTTP, cron, Queue consumer and Email Worker invocations, plus calls from other Workers or Durable Objects. Static assets that need no Worker code still load. A test Worker can therefore exhaust the shared limit and interrupt production.
A Durable Objects limit counts requests, duration, SQLite rows and legacy key-value operations after included usage. It blocks new stub requests, SQL reads and writes, SQLite storage growth and new alarms. Pending alarms wait; alarms older than seven days are deleted while held. Already running requests, existing WebSocket messages and legacy key-value operations can continue. Stored data still incurs charges during the pause; the shared subscription fee is excluded.
These policies do not cap D1, KV, R2, Queues or Workers AI charges. Neither can target a single Worker, object namespace or customer. Check every product your application uses.
For API setup, inspect the policy state
The Spend Policies API accepts notification or usage_block actions for workers and durable_objects. List existing policies before creating one. For example, this illustrative body sets a $20 Workers usage threshold:
{
"product_id": "workers",
"action": "usage_block",
"name": "Workers monthly threshold",
"enabled": true,
"threshold_cents": 2000
}
Submit a policy body to POST /accounts/{account_id}/billing/spend-policies. To receive policy emails, include notification_email; saving a dashboard limit alone does not add a recipient. A standalone notification policy emails you without pausing usage.
The get endpoint returns current_state, based on asynchronously calculated balances. Check enforcement delivery as well as threshold status: delivery may be pending or retrying. Missing state does not mean zero spending. Neither the dashboard status nor this API response guarantees an exact invoice ceiling. We have not verified a production cutoff or a maximum overshoot.
2. Set a Cloudflare budget alert
- Sign in to the Cloudflare dashboard and select your account.
- Open Manage Account → Billing → Billable Usage.
- Select Create budget alert.
- Enter an alert name, a budget threshold in USD and the email recipients.
- Save it. Reopen Budget alerts to check or edit the recipients and threshold.
Budget alerts cover cumulative usage-based spending across the account for the billing period. They are available for Pay-as-you-go accounts, not Enterprise contracts. They reset with the billing period.
Cloudflare's July 20, 2026 announcement describes a phased rollout of a default $10 alert for eligible accounts without an existing alert. Check your account rather than assuming it is present. The announcement says usage is processed daily for the previous day, so notification comes the day after the threshold is crossed. Recurring subscription fees are excluded. This is a warning, not an emergency shutoff.
3. Limit CPU time and subrequests
For HTTP requests on Workers Paid, the default CPU limit is 30,000 ms, with a maximum of 300,000 ms. Use your normal CPU measurements to choose a smaller limit with room for legitimate work. Cloudflare reports CPU-limit failures as Error 1102, with exceededCpu in analytics. Occasional overruns have some runtime flexibility; treat this as a per-invocation control rather than a precise billing cutoff.
In the dashboard, open Workers & Pages → your Worker → Settings → CPU Limits. Or merge a limits block into your existing Wrangler configuration:
{
"limits": {
"cpu_ms": 50,
"subrequests": 50
}
}
These example values are not a recommendation for every app. The Wrangler limits documentation says custom limits apply to the Standard usage model and are enforced on Cloudflare's network, not in local development. Test a deployed staging Worker before changing production.
Paid Workers allow 10,000 subrequests per invocation by default, configurable up to 10 million. Lower the limit to match your intended work. Subrequests include fetches and calls to services such as KV, D1 and R2. Their limits do not prevent another incoming request from starting more work. Add explicit retry limits and termination conditions to application loops; that is application guidance, not a Cloudflare dollar cap.
4. Restrict costly traffic and check every public URL
WAF rate limiting rules apply actions to requests matching your expression. Start with the costly API path and a rate your real clients can tolerate. The Free zone plan includes one rule; Pro includes two and Business five. Counters operate per data center and may lag, so excess requests can get through. A rate limit is not a monthly request allowance.
Use a route or Custom Domain for production, as Cloudflare recommends. Set "workers_dev": false in Wrangler if you do not need the public workers.dev endpoint. Disabling it does not disable version, preview or deployment URLs. Review those separately and use Cloudflare Access where authentication is needed; verify that each public path has the protection you intend.
Inside your Worker, the Rate Limiting binding can reject work before a database query or paid API call. Its counters are approximate and local to each Cloudflare location. Use it to reduce expensive downstream work, not to enforce an exact global quota. The Worker request has already reached your code.
5. Know which part of the bill you are limiting
Prices as of October 22, 2026: Workers Paid has a $5 monthly minimum and includes 10 million requests and 30 million CPU milliseconds. Additional usage is $0.30 per million requests and $0.02 per million CPU milliseconds. At those rates, an illustrative month with 15 million Worker requests at 7 ms CPU each costs $5 + $1.50 + $1.50 = $8, before other products or taxes. See Cloudflare's pricing and examples.
KV, D1, R2, Durable Objects and Queues have their own usage charges. A lower CPU limit does not set a dollar ceiling on those services. Check the products your Worker calls when a bill rises.
6. Set customer quotas in your application
If you sell an API and need a separate allowance for each customer, a product policy cannot replace your own customer meter. Authenticate each caller, record their usage and reject work when their allowance runs out. Include retries and concurrent requests in that design. This is application guidance; the policy API does not document per-customer quotas.
7. Add spend monitoring and decide who responds
CostHex estimates Cloudflare resource spend in dollars per hour at list prices and estimates the current billing-period bill. Free checks one account hourly. Alerts can go to email, Slack, Discord or Telegram, with resource links and handling suggestions. CostHex cannot stop spending, and end-to-end alert latency has not been measured.
Resources in an account share a default hourly threshold and are checked separately. Optional anomaly detection needs at least 24 hours of data and compares spend against a 7-day baseline. See Cloudflare cost alert coverage and plans and availability.
Before leaving this setup unattended, confirm your policy state and budget email recipients, test your deployed limits and choose who will investigate a spike. CostHex alerts do not configure or enforce Cloudflare spend policies.
Sources
- Spending limits and alerts, Cloudflare Docs
- Workers spending limits, Cloudflare Docs
- Durable Objects spending limits, Cloudflare Docs
- Introducing Spend Management, Cloudflare Blog, November 13, 2026
- Create a spend policy, Cloudflare API
- List spend policies, Cloudflare API
- Get a spend policy and its current state, Cloudflare API
- Budget alerts, Cloudflare Docs
- Budget alerts now on by default for Pay-as-you-go accounts, Cloudflare Docs, July 20, 2026
- Workers pricing, Cloudflare Docs
- Workers limits, Cloudflare Docs
- Wrangler configuration, Cloudflare Docs
- workers.dev routing, Cloudflare Docs
- WAF rate limiting rules, Cloudflare Docs
- Workers Rate Limiting binding, Cloudflare Docs