@upstash/ratelimit
Serverless rate limiting with sliding window, token bucket, and fixed window algorithms backed by Upstash Redis.
Official Documentation ↗v2.0. Check the official docs for the latest API surface.Installation
npm install @upstash/ratelimitMethods
No methods match this filter.
@upstash/ratelimit is serverless rate limiting with sliding window, token bucket, and fixed window algorithms backed by upstash redis. This page documents the core methods, installation, and common usage patterns for the current stable release.
Installation
Install @upstash/ratelimit with your preferred package manager using the command shown in the frontmatter. The package is published to the npm registry and ships with TypeScript types where applicable.
Core methods
The methods listed in the frontmatter cover the primary API surface. Each signature reflects the v2.0 release. Consult the official documentation linked in sourceUrl for advanced options, edge cases, and breaking changes between major versions.
Frequently asked questions
The faq section in the frontmatter answers the most common questions about @upstash/ratelimit, including comparisons with alternatives, configuration tips, and runtime requirements. If your question is not covered, check the source URL for the full guide.
Security notes
Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://docs.upstash.com/ratelimit · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:53:17.182Z.
- Run: npx wrangler secret put UPSTASH_REDIS_REST_URL When prompted, enter the value of UPSTASH_REDIS_REST_URL when prompted. (https://docs.upstash.com/ratelimit)
FAQ
- Which algorithm should I pick?
- Sliding window is precise; token bucket allows bursts; fixed window is cheapest but has boundary spikes.
- Does it work at the edge?
- Yes. It uses Upstash Redis over HTTP, so it works in Cloudflare Workers and Vercel Edge.
- How is cost calculated?
- Each limit call is one Redis command; the free tier covers tens of thousands of checks.
Report a problem with this API docOpens a pre-filled issue on GitHub.