upstash-ratelimit
Serverless ratelimiting package from Upstash
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-ratelimituv
uv add upstash-ratelimitpoetry
poetry add upstash-ratelimitInstalling 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
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
upstash-redisHTTP-based Redis client for Python that…
permissive · top 5,000 on PyPI
limitsImplements rate limiting with multiple…
permissive · top 1,000 on PyPI
rushrush provides rate-limiting algorithms…
permissive · top 15,000 on PyPI
qstashPython SDK for publishing and receiving…
permissive · top 15,000 on PyPI
throttled-pyImplements rate limiting with multiple…
permissive · top 15,000 on PyPI
ratelimitA function decorator that enforces rate limits…
permissive · top 5,000 on PyPI
fastapi-limiterAdds request rate limiting to FastAPI routes…
permissive · top 5,000 on PyPI
asynciolimiterProvides rate limiting for async Python code by…
permissive · top 5,000 on PyPI
ratelimRatelim enforces rate limits on function calls…
permissive · top 5,000 on PyPI
pyrate-limiterPyrateLimiter implements the Leaky-Bucket…
permissive · top 5,000 on PyPI