The token bucket is the workhorse. Picture a bucket that holds up to a fixed number of tokens, the capacity. Tokens are added at a steady refill rate, say ten per second, and the bucket never holds more than its capacity. Every request must remove one token to proceed. If a token is available, the request is allowed and one token is spent. If the bucket is empty, the request is rejected, usually with HTTP status 429 Too Many Requests.
The clever part is the capacity. Because unused tokens accumulate up to that limit, a client that has been idle can briefly burst above the steady rate, spending the saved tokens, and then settle back to the refill rate once they run out. That matches how real traffic behaves, bursty but bounded, which is why the token bucket feels fairer than a hard fixed cap.
Two numbers define the policy: the refill rate sets the long-run average requests per second, and the capacity sets how large a burst you tolerate. Tune them separately. A high capacity with a modest refill rate allows spiky clients; a capacity equal to the refill rate behaves almost like a smooth, even limit.