Skip to main content
Get up and running with Choked in minutes.

Installation

Basic Usage

Create a Choked instance and use it as a decorator:

Backend Options

Choose between Redis (self-hosted) or managed proxy service:

Redis Backend

Managed Proxy Service

Parameters Explained

  • key: Unique identifier for this rate limit. Functions with the same key share the same bucket.
  • request_limit: Request rate limit (e.g., “10/s”, “100/m”). Optional if token_limit provided.
  • token_limit: Token rate limit (e.g., “1000/s”, “100000/m”). Optional if request_limit provided.
  • token_estimator: Token estimation method (“openai”, “voyageai”, “default”). Required for token_limit.

Async Functions

Choked automatically detects and handles async functions:

Token-Based Limiting

Perfect for AI/ML APIs that have token limits:

Dual Limiting

Apply both request and token limits simultaneously:

Multiple Rate Limits

You can create multiple Choked instances or use different keys:

Next Steps