Building a rate-limited blog thread AI tool on Cloudflare Workers (no login, no DB)
说明与用途
Blog2Thread 允许用户粘贴博客 URL 或文本,立即生成推文线程,使用 Cloudflare KV 和 cookie 进行速率限制,无需登录或用户数据库。
问题
Indie makers need a frictionless draft tool that lets users paste a blog URL or text and instantly get a ready-to-post Twitter thread without requiring signup or storing user data, while preventing abuse.
结果
Blog2Thread provides a zero‑friction, no‑login AI thread generator with robust rate limiting, enabling indie makers to offer a free draft experience while protecting against abuse.
工作流
- 1. User pastes blog URL or text on the front‑end.
- 2. Front‑end sends request to Cloudflare Worker.
- 3. Worker reserves a generation slot using Cloudflare KV counters (cookie, IP, burst limits).
- 4. If reservation fails, return 429 error.
- 5. Worker calls an OpenAI‑compatible API to generate the thread.
- 6. On success, return the thread to the user and persist the draft ID for sharing.
- 7. On failure, rollback the reservation to free the quota.
- 8. Dynamic Open Graph metadata is generated from the first 4 tweets for social previews.
- 9. User copies the thread and can optionally schedule or distribute via paid tools.
证据
No account. No database of users.
Pattern: reserve before generate → rollback if the model call fails
- 记录日期: 2026-09-22T00:00:30.517Z