skillfed

upstash-ratelimit

Serverless ratelimiting package from Upstash

upstash-ratelimit v1.1.0 83.3K downloads/30d#14,079 on PyPI34
Permissive license DORMANT released

What it is and what it does

upstash-ratelimit is a Python SDK for rate limiting designed specifically for serverless environments like AWS Lambda, Vercel, and Google Cloud Functions. It uses HTTP to communicate with Upstash's managed Redis service rather than TCP connections, making it suitable for ephemeral compute contexts where persistent connections are impractical. The package provides three rate-limiting algorithms—Fixed Window, Sliding Window, and Token Bucket—each with different trade-offs between computational cost and burst-handling behavior.

You instantiate a Ratelimit object with a Redis client and your chosen algorithm, then call the limit() method with an identifier (user ID, API key, IP address, etc.) to check whether a request should be allowed. The method returns a Response object containing whether the request passed, the configured limit, remaining requests in the window, and when the limit resets. The package also supports async/await patterns via an asyncio module and allows you to block until a request is ready to proceed.

Use it for:

  • Protect Lambda functions or serverless APIs from being overwhelmed by enforcing per-user or per-IP request quotas
  • Implement tiered rate limits (e.g., 10 req/10s for free users, 60 req/10s for paid) using multiple Ratelimit instances with different prefixes
  • Smooth out traffic bursts in serverless workloads using Token Bucket to process requests at a constant rate
  • Prevent request stampedes at window boundaries by using Sliding Window instead of Fixed Window
  • Share a single Redis instance across multiple applications by setting custom key prefixes to avoid collisions

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides connectionless rate limiting for Python applications in serverless environments, using Redis as the backing store and supporting multiple rate-limiting algorithms.

Yes, if you are building serverless applications and need rate limiting backed by a managed Redis service. The package is production-stable, has no known vulnerabilities, and low install friction. However, maintenance is dormant—no updates since mid-2024—so you should be comfortable with a package that will not receive active development or rapid bug fixes. It is a good fit for established serverless workloads where the core functionality is stable and you do not expect frequent feature requests.

Install

upstash-ratelimit on PyPI

pip

pip install upstash-ratelimit

uv

uv add upstash-ratelimit

poetry

poetry add upstash-ratelimit

Installing upstash-ratelimit

Before you install

Low friction install with a single runtime dependency (upstash-redis). Maintenance status is dormant—last commit was 2024-06-24 and no releases since 2024-05-16—so expect no active bug fixes or feature development, though the package is marked Production/Stable.

License in practice

Licensed under MIT (permissive), so you can use it freely in commercial and private projects without restriction.

Quickstart

pip install upstash-ratelimit

from upstash_ratelimit import Ratelimit, FixedWindow
from upstash_redis import Redis

ratelimit = Ratelimit(
    redis=Redis.from_env(),
    limiter=FixedWindow(max_requests=10, window=10),
)
response = ratelimit.limit("identifier")
if response.allowed:
    print("Request allowed")

Requires an Upstash Redis database to be created and UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN environment variables to be set.

Verify before relying

  • Whether the package works with async/await patterns beyond what the description excerpt shows
  • Performance characteristics and latency overhead of each rate-limiting algorithm in production
  • Support status and response time from Upstash for issues or questions

Package facts

License not declared (permissive)
Python support supports the current Python release (<4.0,>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 1 — upstash-redis
Maintenance dormant — 820 days since the last release
Last repo commit
First released
Downloads 83,347/month — #14,079 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: upstash_ratelimit-1.1.0-py3-none-any.whl

Keywords: ratelimit, rate limit, Upstash rate limit, Redis rate limit

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Libraries

Tags

serverless rate limitingredis rate limit pythonapi rate limitingrequest throttlingtoken bucket rate limitsliding window rate limitlambda rate limiting
serverlessrate-limitingredis

More Libraries packages