Summary
Add a built-in rate limiter to the Python SDK that manages concurrent WebSocket streaming sessions, automatically handles HTTP 429 responses with exponential backoff, and provides backpressure signaling when approaching rate limits. This enables developers to safely run multiple concurrent streaming sessions without manually implementing rate limiting logic.
Problem it solves
Developers running multiple concurrent streaming sessions (e.g., transcribing multiple audio streams in a call center, batch-processing recordings with parallel streams) frequently encounter HTTP 429 errors when they exceed their plan's connection limits. Currently, each developer must implement their own retry logic with exponential backoff, track active connection counts, and handle rate limit headers — a pattern that is error-prone and repeated across every production deployment.
Proposed API
from deepgram import DeepgramClient, RateLimitConfig
# Configure rate limiting at client level
client = DeepgramClient(
api_key="...",
rate_limit=RateLimitConfig(
max_concurrent_streams=10, # Max concurrent WebSocket connections
retry_on_429=True, # Auto-retry with backoff on 429
max_retries=3, # Max retry attempts
backoff_base=1.0, # Base backoff in seconds
)
)
# Sessions automatically respect rate limits
async with client.listen.v2.connect(options) as session:
# If max_concurrent_streams reached, this blocks until a slot opens
await session.send(audio_data)
# Or check availability before connecting
if client.rate_limit.available_slots > 0:
session = await client.listen.v2.connect(options)
Acceptance criteria
Raised by the DX intelligence system.
Summary
Add a built-in rate limiter to the Python SDK that manages concurrent WebSocket streaming sessions, automatically handles HTTP 429 responses with exponential backoff, and provides backpressure signaling when approaching rate limits. This enables developers to safely run multiple concurrent streaming sessions without manually implementing rate limiting logic.
Problem it solves
Developers running multiple concurrent streaming sessions (e.g., transcribing multiple audio streams in a call center, batch-processing recordings with parallel streams) frequently encounter HTTP 429 errors when they exceed their plan's connection limits. Currently, each developer must implement their own retry logic with exponential backoff, track active connection counts, and handle rate limit headers — a pattern that is error-prone and repeated across every production deployment.
Proposed API
Acceptance criteria
available_slotsandactive_connectionsproperties for monitoringRaised by the DX intelligence system.