Skip to main content
ResilientModel wraps any model with automatic key rotation and provider failover. It handles rate limits (429) transparently.

Key Rotation

Distribute load across multiple API keys:
When a key gets rate-limited (HTTP 429), it enters cooldown with exponential backoff. The next key in the pool is used automatically.

Provider Failover

Fall back to alternative providers when one fails:
If the primary model fails, ResilientModel tries each failover entry in priority order.

Key Pool Options

List[str]
required
API keys to rotate between.
str
default:"round_robin"
Selection strategy: round_robin or lru (least recently used).
float
default:"60.0"
Base cooldown time for rate-limited keys.

Events

Imports