Rate limiting prevents abuse, ensures fair resource usage, and protects against attacks.
Common strategies
- Fixed window: X requests per Y time period (simple but has burst issues).
- Sliding window: Rolling time window (more accurate).
- Token bucket: Accumulate tokens, spend on requests (allows bursts).
- Leaky bucket: Fixed rate processing (smooths traffic).
Where applied
- APIs: Prevent excessive calls (e.g., 1000/hour).
- Login forms: Prevent brute force (e.g., 5/minute).
- Public endpoints: Protect against DDoS.
- Email sending: Prevent spam (e.g., 100/day).
Implementation
- Store counters in Redis/Memcached.
- Return 429 (Too Many Requests) status.
- Include Retry-After header.
- Provide rate limit headers (X-RateLimit-*).
User experience
- Communicate limits clearly in documentation.
- Provide feedback when limits are approached.
- Offer higher tiers for legitimate high-volume users.
Related Articles
View all articlesI Capped My GPU to 150W and Barely Lost Any Speed
We cut an RTX 5060 Ti's power limit by 17% and lost essentially zero tokens per second while gaining 16% efficiency. Local LLM decoding is memory-bandwidth-bound, not compute-bound — so watts are mostly wasted.
Read article →
Robocopy Command Guide: Mirror, Copy and Sync (2026)
Robocopy examples for every job: mirror a folder with /MIR, copy with /E, resume large transfers with /Z, multithread with /MT, and test safely with /L. Full 2026 switch reference for Windows 10, 11 and Server.
Read article →
Claude Code Rate Limits: 5-Hour & Weekly Caps, Reset Times, and How to Avoid Them
A practical guide to Claude Code's 5-hour rolling window and weekly cap: how Pro, Max 5x, and Max 20x differ, when limits actually reset, and concrete ways to stop hitting them.
Read article →
Use Qwen3-Coder for Free with OpenRouter in Cline, Roo Code, and Claude Code
A practical guide to wiring OpenRouter's free qwen/qwen3-coder:free route into Cline, Roo Code, Claude Code, and any OpenAI-compatible client — including the base-URL gotchas, daily limits, and privacy settings that trip everyone up.
Read article →