Choose your pace
Set a safety threshold, concurrency, and a burst first or uniform strategy.
Queue API requests, respect the quota, and keep your app moving. One small library with a modern Promise API and a maintained compatibility release.
THE SMALL THING THAT HELPS
Give the limiter your provider’s quota headers. It reserves capacity as work starts, holds queued calls when the budget runs out, and resumes when the provider window resets.
Set a safety threshold, concurrency, and a burst first or uniform strategy.
Hand each operation to limit(). The scheduler dispatches only what the budget allows.
When the provider’s window opens again, the waiting queue continues on its own.
INTERACTIVE PLAYGROUND
This runs the published 2.0.0 browser bundle with simulated requests. Nothing is sent to an external API.
Connecting to the published package…
GET STARTED
New projects should start on 2.x. Existing projects can stay on the callback-compatible 1.x line and receive maintenance updates.
Promise-based, typed, and ready for current Node.js.
npm install rate-limiter-apiPreserves the original Stampit-style factory and callback behavior.
npm install rate-limiter-api@legacy// Queue a request and keep a little quota in reserve
const limiter = RateLimiterAPI({
threshold: 1,
concurrency: 2,
})
limiter.updateRateLimits({
rateLimit: 60,
rateRemaining: 42,
rateReset: Date.now() + 60_000,
})
const result = await limiter.limit(() => fetch('/api/data'))
limit() · updateRateLimits() · getRateLimits()