# Rate Limit Planner

- **URL:** https://codeasystem.com/calculators/developer/rate-limit-calculator/
- **Category:** developer
- **Description:** Convert an API quota into a safe sustained requests-per-second budget with pacing intervals and burst headroom.
- **Primary output:** Safe sustained rate (20% margin): 8 req/s

## Inputs
- Quota limit (name: `limitRequests`, type: number, example: 600)
- Window length (name: `windowSeconds`, type: number, example: 60)
- Safety margin (name: `marginPct`, type: number, example: 20)

## Outputs
- Safe sustained rate (20% margin): 8 req/s
- Safe requests per window: 480 of 600
- Minimum spacing between requests: 125 ms
- Burst headroom per window: 120 requests kept in reserve

## Formula / methodology
```
safe/window = limit × (1 − margin)
safe rps = safe ÷ window   interval ms = 1000 ÷ safe rps
```

Quotas fail you at the worst moment; retries, other consumers and clock skew eat headroom precisely when traffic peaks. Reserving a percentage margin converts the raw quota into a sustainable budget, expressed as requests per second, minimum spacing between sends, and the burst reserve kept for genuine peaks.

## Assumptions & limitations
- Rolling or fixed windows both approximated by simple division.
- Margin default 20% named as convention, tunable per contract.
- Single-consumer assumption; shared quotas divide further.

## How to use
1. **Copy the quota from docs**; Providers quote limits like 600/min or 10k/hour; enter both numbers.
2. **Keep a safety margin**; 20% absorbs retries and neighbors; tighten only with dedicated quotas.
3. **Pace to the interval**; Throttle senders to the spacing figure or use token buckets sized to the burst row.

## Example
A 600-requests-per-minute quota with a 20% margin yields a safe 8 req/s; space calls at least 125 ms apart and keep 120 requests of burst reserve.

Result for these inputs:

```
Safe sustained rate (20% margin): 8 req/s
```

## About this calculator
### Why not max the quota?

Sustained ceiling-rate traffic leaves zero room for retry storms, background jobs or a second deploy target sharing the key. The first 429 usually cascades: retries add load exactly when the limiter is tightest. Margins convert hard failures into graceful degradation.

### Pacing versus bursting

Even spacing (the interval row) suits steady workers. Interactive features prefer token-bucket bursts into reserved headroom, refilling at the safe rate. Both strategies derive from the same two numbers this planner produces.

## FAQs
### Is the margin applied per second or per window?

Per window; 20% of 600 is 480 allowed per minute, hence 8 req/s. Percentages behave identically either way here.

### What if multiple services share my quota?

Divide the safe budget across consumers before applying margins, or negotiate separate keys per workload.

### Do providers actually enforce exact windows?

Implementation varies (fixed, sliding, token bucket) and enforcement has slop; another reason the margin stays.

## Related calculators
- [Concurrency & Throughput Calculator](https://codeasystem.com/calculators/developer/concurrency-throughput-calculator/)
- [API Pagination Calculator](https://codeasystem.com/calculators/developer/api-pagination-calculator/)
- [Error Budget Calculator](https://codeasystem.com/calculators/developer/error-budget-calculator/)

---
Last updated: 2026-08-23 · Version: 1.0.0 · [HTML version](https://codeasystem.com/calculators/developer/rate-limit-calculator/)
