billflare.

cloudflare-cost-guard

Louis Cai’s open-source rules and TypeScript base class for keeping Durable Object alarms and Worker schedulers from runaway loops.

Products
Durable ObjectsWorkers
Source
Community resourceGitHub repository
Author
Louis Cai (@louis__cai)

Key points

  • The README lists five anti-patterns: setAlarm in the constructor, rescheduling at every return without an exit condition, immediate retry on exceptions, alarm polling under 60 seconds, and one cron fanning out to many objects.
  • Its four gates are: delete the alarm and return when idle, with explicit stop criteria and a minimum interval; daily and lifetime invocation ceilings with a tripped state that needs a human reset; exponential backoff with a consecutive-error ceiling; and tests that no alarm remains when idle and that the breaker trips.
  • The repository ships a SafeAlarmDurableObject base class and a SKILL.md for coding agents. The README states that budget notifications do not suspend Workers, and that each setAlarm() on SQLite-backed Durable Objects is billed as a row written.

Original sources

  1. Undated

    cloudflare-cost-guard

    Open original source

    Louis Cai’s open-source rules and TypeScript base class for keeping Durable Object alarms and Worker schedulers from runaway loops.

  2. The author announces the library in a reply to @vikingmute and sums it up in three rules: exit when idle without renewing, trip a code-level breaker when daily calls exceed a limit, and stop completely after consecutive errors.

    Read on 𝕏

    Louis

    @louis__cai · Original 𝕏 post

    睡醒欠一万刀太真实了。 AI 根本不知道钱贵,写后台定时器特别喜欢在末尾顺手续订,或者报错后秒级重试。加上 Cloudflare 没有断网级的消费硬顶,直接变成印钞机。 顺手把防爆规则和 TypeScript 安全基类抽成了一个开源库: https://t.co/KXVaSERwHd…
Community resourceWorkers +5

FlareCost: Free plan limits that fail the request (not bill)

FlareCost’s free-plan-limits page lists Workers, KV, D1, R2, Durable Objects and Queues Free meters in one table: daily Free limits reset at 00:00 UTC and fail the request instead of billing, except R2 which bills past its monthly free tier on any plan. Reviewed against official pricing pages on 2026-11-02.

Durable Objects

igorrizzom: a forgotten Durable Object alarm billed US$ 2,038; Support refunded US$ 1,533.29, leaving US$ 505.

X user @igorrizzom (Igor Rizzo), who also posted on Cloudflare Community as igorarm (urnaaovivo.com), says a personal, non-commercial prototype that collected public election data in Brazil was left running after the October 25 runoff. A Durable Object kept rescheduling itself via alarm every ~5 seconds and writing to SQLite, and the invoice reached US$ 2,038, almost all from DO rows written, with about 10k pageviews. The author says budget alerts were set up but went to an old inbox that was never checked, and that alerts do not stop usage. Spend limits for Workers and Durable Objects were only announced on November 13, after almost all of the usage; the author then set a US$ 1 spend limit, turned the collector off, and removed Cron Triggers. The author says Support refunded US$ 1,533.29 as a one-time courtesy. The remaining US$ 505, which the author later described as US$ 500 of usage plus the US$ 5 Workers Paid fee, was closed as final; the author asked for a supervisor review in case #02442826 (follow-up to #02435308) and also asked @SidChatterjee whether any goodwill path remained for pre-launch cases. There is no Cloudflare staff reply on the public X thread or the Community thread. Public Support actions are reported by the author.

Author experienceAccount-wide usage-based products

NatashaTheRobot: a bot that sends a daily Cloudflare billing summary

After a $10 surprise alert, NatashaTheRobot built a scheduled bot that monitors her Cloudflare account and sends a daily billing usage summary, and shared it as a template.