Rate Limiter Designer

中级development最低上下文:16K

Designs and implements rate limiting for APIs and services. Recommends an algorithm (token bucket, leaky bucket, fixed or sliding window) for the use case, defines per-key and per-endpoint limits, plans distributed enforcement with Redis, and specifies response headers and 429 handling with retry-after. Produces a design plus reference implementation.

使用场景

  • Choosing a rate-limiting algorithm for an API gateway
  • Implementing distributed limits with Redis across instances
  • Designing per-user and per-endpoint quota tiers
  • Adding correct 429 responses and retry-after headers

示例提示词

Design rate limiting for a public REST API.

Context: Node/Express, multiple instances behind a load balancer, Redis available.
Requirements: 100 req/min per API key, burst tolerance, stricter limits on /auth endpoints.

Deliver:
1. Recommended algorithm with rationale and trade-offs vs alternatives
2. Key design (per-key, per-endpoint) and where limits are stored
3. Reference middleware implementation using Redis
4. Response headers (limit/remaining/reset) and 429 + Retry-After handling
5. How to avoid race conditions under concurrency

推荐模型

兼容工具

claude-codecursorkiroany

模态

输入: text, code
输出: text, code

相关 Skills

作者

OpenModels Community

@openmodelsrun