Cloudflare Spend Management: Workers and Durable Objects spending caps in beta
Cloudflare's Spend Management is in beta for PayGo customers, letting you set spending limits and auto-pause Workers and Durable Objects when caps are hit.
Cloudflare has launched Spend Management in beta for any pay-as-you-go (PayGo) customer, starting with Workers and Durable Objects. The feature lets you set spending thresholds and have Cloudflare pause activity when those limits are reached, rather than just notifying you after the fact.
According to Cloudflare, spend controls have been among the most requested features from developers on its developer platform, which now counts more than 10 million developers. The company says its existing usage notifications and budget alerts for paid plans “doesn’t solve the problem completely; informing is not the same as controlling.”
How the limits work
You set things up in the dashboard under Manage Account > Billing > Spend limits, or through the cf CLI and REST API. For each product you enable, you define a spending limit, a recipient email for notifications, and one or more alert thresholds.
When evaluated spend hits a threshold or your limit, Cloudflare emails the recipient. When the limit itself is reached, a blocking policy is enforced and the product is paused automatically. The dashboard shows current billing-cycle costs per supported product in near real time, under 10 minutes, and an overview panel flags which products have thresholds and limits configured.
One detail worth knowing: the billing cycle starts when your paid subscription begins, not when you deploy a Worker or create a cap. A subscription starting October 10 generally runs October 10 to November 10, not a calendar month. An audit log in the dashboard records who changed a limit and when, or when a cap was reached.
API and CLI access
Spend Management is also available programmatically. Policies are created through the billing spend-policies endpoint, with fields such as product_id, threshold_cents, action (usage_block) and notification_email. The cf CLI mirrors this with commands including cf billing spend-policies create, list, get, update and delete, plus audit list and activity list.
Cloudflare suggests pairing Spend Management with AI Gateway spend limits, which already support per-user and per-model budgets for Workers AI and other AI providers on requests routed through your gateway, to cover both compute and AI inference costs.
Spend Management is in beta for PayGo accounts, starting with Workers and Durable Objects. To try it, open Manage Account > Billing > Spend limits in the Cloudflare dashboard and enable the products you want to cap, or check the Developer Documentation for the API reference.
Related reading
Sources
- Introducing Spend Management: Spending limits and alerts for Cloudflare — Cloudflare Blog
Some links on this page may be affiliate links. If you buy through them we may earn a commission at no extra cost to you. See our affiliate disclosure.