Skip to main content

Module rate_limiter

Module rate_limiter 

Source
Expand description

Token-bucket and sliding-window rate limiter per model.

Provides RateLimiterRegistry which holds a ModelRateLimiter for each registered model. Each model limiter combines a TokenBucket (burst-capable refilling bucket) with a SlidingWindow (rolling request-count check) so that both instantaneous bursts and sustained throughput are controlled.

Structs§

ModelRateLimiter
Combined rate limiter for a single model.
RateLimiterConfig
Configuration used when registering a model with the RateLimiterRegistry.
RateLimiterRegistry
Registry that holds one ModelRateLimiter per model.
SlidingWindow
Rolling-window request counter.
TokenBucket
Refilling token bucket.

Enums§

RateLimitError
Errors returned when a rate-limit check fails.