Security
Rate Limiting: The Missing Defense in Almost Every AI-Built App
Why AI-generated applications ship without rate limiting, what that costs (brute force, scraping, surprise bills), and how to add layered limits properly.
By AI Production Partner · · 3 min read
The default is unlimited
Prompt an AI tool for a login endpoint and you'll get one that accepts unlimited attempts; ask for an API and you'll get one that serves unlimited requests. No rate limiting means brute-force attacks on auth, effortless scraping of your data, one buggy client taking down the service, and — if your endpoints call paid APIs like LLMs — an attacker converting your API keys directly into your invoice.
In our audits, missing rate limits sit alongside missing authorization checks as the most universal finding in AI-generated backends.
Layered limits, not one number
Effective rate limiting is layered: strict per-account limits on authentication endpoints (with lockout/backoff), moderate per-user limits on expensive operations (anything hitting an LLM, sending email, or generating files), and generous global per-IP limits as the outer wall. Return 429 with Retry-After so legitimate clients behave; log and alert on sustained limit-hitting so abuse becomes visible instead of silent.
Implementation is a solved problem in every stack — middleware plus Redis for distributed counting — a day or two of work for most apps.
Special case: apps with LLM features
If your app calls language models, rate limiting is also cost control: every uncapped endpoint is a metered bill an attacker can run up. Add per-user token budgets and spend alerts on top of request limits — we've seen the alternative, and it arrives as a five-figure invoice.
Rate limiting is a standard item in our security hardening work: quick to add, painful to lack.