scram: a self-hosted kill switch for a Cloudflare account
An open-source Worker that prices the account's usage every 15 minutes from the GraphQL Analytics API and, once a spend line is crossed, removes routes and schedules; a restore endpoint puts them back.
- Products
- WorkersD1
- Source
- Community resourceGitHub repository
- Author
- pid1
Key points
- The README notes that budget alerts are informational, do not cap usage and, in the author's account, are computed daily from the previous day's usage, so they can arrive after the money is spent.
- Every run discovers each Worker, route, custom domain, cron trigger and workers.dev subdomain. A trip deletes routes and clears schedules but never deletes a Worker, its code, bindings, R2 objects or D1 rows; the removed state is recorded first and POST /api/restore puts it back.
- It ships disarmed and only watches and reports until armed, excludes itself from shutdown plans, and by the README's count runs 2,880 invocations a month plus one D1 row per check. Setup needs Node 22+, a Cloudflare API token and setup.sh or manual wrangler steps; the license is BSD-3-Clause.
- Prices are estimated against published rates; estimates can differ from the invoice, and changes faster than the 15-minute interval plus analytics delay can still be billed.
Original sources
Last updated
scram: a self-hosted kill switch for a Cloudflare account
Open original sourceAn open-source Worker that prices the account's usage every 15 minutes from the GraphQL Analytics API and, once a spend line is crossed, removes routes and schedules; a restore endpoint puts them back.
More to read
FlareCost: what the $5 Workers Paid plan includes
FlareCost's explainer says Workers Paid is a $5 monthly minimum per account that includes the Paid allowances for Workers requests and CPU, KV, Hyperdrive and Durable Objects; included usage is not extra credit on top of the $5, overages are added to it, R2 keeps its own free tier, and the plan is separate from a zone plan. Reviewed against the Workers pricing page on 2026-11-02.
Duncan (@ephraimduncan): card charged $1,264 while $7,032 in Cloudflare startup credits remained.
Duncan (@ephraimduncan) asks who to contact after Cloudflare charged the card $1,264 while $7,032 in startup credits were still available. Cloudflare social media manager Val Vesa replies that it is probably a glitch, asks for a private message with the account email and a billing ticket number so it can be escalated internally and fixed; Cloudflare developer advocate Harshil asks for a DM with details to forward to the team. The author replies that the details are being sent.
Cloudflare Billing Helper: a browser extension that shows free-allowance progress on the billing page
Meathill (@meathill1) built a Chrome extension that adds a panel to Cloudflare’s Billable Usage page: remaining free allowance for each billing line, projected exhaustion dates, estimated cost for the period, and a breakdown by Worker, KV namespace, D1 database, R2 bucket and Durable Object.