Skip to content
masterclass Buddy

Upstash · Function

tokenBucket

Token Bucket limits requests with a bucket of tokens. Requests use one token, tokens refill over time, and empty buckets reject requests.

Last updated

Syntax

TokenBucket(max_tokens, refill_rate, interval)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • Ratelimit
  • Redis
  • Fixed Window
  • Sliding Window

Source: Ratelimit Python SDK Algorithms - Upstash Documentation. Checked 2026-11-03.