Upstash Documentation home pagelight logodark logo
  • Discord
  • Blog
  • X
  • Console
  • Console
General
Redis
Kafka
Vector
QStash
SDKs
Developer API
Overall
  • Overview
SDKs
  • Typescript
    • @upstash/redis
    • @upstash/query
    • @upstash/vector
    • @upstash/edge-flags
    • @upstash/ratelimit
      • Overview
      • Getting Started
      • Methods
      • Features
      • Ratelimiting Algorithms
      • Costs
    • @upstash/kafka
    • @upstash/qstash
  • Python
DevOps
  • Terraform
  • Pulumi
  • CLI
@upstash/ratelimit

Overview

​
Upstash Rate Limit

It is the only connectionless (HTTP based) rate limiting library and designed for:

  • Serverless functions (AWS Lambda, Vercel …)
  • Cloudflare Workers
  • Vercel Edge
  • Fastly Compute@Edge
  • Next.js, Jamstack …
  • Client side web/mobile applications
  • WebAssembly
  • and other environments where HTTP is preferred over TCP.

​
Quick Links:

  • Github Repository
  • Getting Started
  • Costs

​
Features

Caching

Handle blocked requests without having to call the Redis Database

Timeout

If the Redis call of the ratelimit is not resolved in some timeframe, allow the request by default

Analytics & Dashboard

Collect information on which identifiers made how many requests and how many were blocked.

Multiple Limits

Use different limits for different kinds of requests (example: paid and free users)

Custom Rates

Consume different amounts of tokens in different requests (example: limiting based on request/response size)

Multi Region

Utilize several Redis databases in different regions to serve users faster

For more information about the features, see the Features tab.

​
Examples

Cloudflare Workers

Rate limit access to your Cloudflare Workers

Nextjs

Rate limit an API in a Nextjs project using the App router

Nextjs with Middleware

Rate limit an API with a Middleware in a Nextjs project using the Pages router

Remix

Rate limit access to a Remix App

Rate limit using Vercel KV

Rate limit a Nexjs app using Vercel KV

Rate limit your Chatbot

Limiting requests to a Chatbot endpoint which streams LLM outputs

Was this page helpful?

Suggest editsRaise issue
React ClientGetting Started
xgithubdiscord
Powered by Mintlify
On this page
  • Upstash Rate Limit
  • Quick Links:
  • Features
  • Examples
Assistant
Responses are generated using AI and may contain mistakes.