late-businessperson-58140
12/08/2025, 5:28 AMtall-airline-16756
12/08/2025, 5:28 AMtall-airline-16756
12/08/2025, 5:29 AMlate-businessperson-58140
12/08/2025, 5:29 AMtall-airline-16756
12/08/2025, 5:29 AMrate_limit_exceeded_error.
What happened
• Sarvam returned HTTP 429, meaning your requests exceeded Sarvam’s allowed rate for your API key.
What you can do now
• Pause or slow bursts of TTS requests (add short delays).
• Add retry with exponential backoff for transient spikes.
• Ensure you’re not sharing the same Sarvam API key across many concurrent sessions.
• Check your Sarvam dashboard for your account’s request/characters-per-minute limits and current usage.
• If you need higher throughput, upgrade your Sarvam plan.
Alternative option
• Consider switching to a LiveKit-managed TTS model via LiveKit Inference (e.g., inworld/inworld-tts-1:ashley) so rate limits are handled through LiveKit Cloud instead of Sarvam.
If you’d like, tell me:
• how many TTS requests/sec or concurrent sessions you’re seeing, and
• whether you’re using a single shared Sarvam API key —
and I’ll suggest concrete retry/queue settings or a migration approach.
Sources: Sarvam TTS plugin guide | LiveKit Docs | Models | LiveKit Docs | Introducing LiveKit Inference: A unified model interface for voice AI | Text-to-speech (TTS) models | LiveKit Docslate-businessperson-58140
12/08/2025, 5:30 AMinworld/inworld-tts-1:ashley) so rate limits are handled through LiveKit Cloud instead of Sarvam.
how to do thistall-airline-16756
12/08/2025, 5:30 AMfrom livekit.plugins import sarvam imports and any sarvam.TTS(...) references.
2) Replace with a LiveKit Inference TTS descriptor
• Use a model string like "inworld/inworld-tts-1:Ashley" directly in `AgentSession`:
from livekit.agents import AgentSession
session = AgentSession(
tts="inworld/inworld-tts-1:Ashley",
stt="assemblyai/universal-streaming",
llm="openai/gpt-4o",
# other config...
)
3) (Optional) Use inference.TTS for extra parameters
• If you need language, speaking rate, or other provider-specific options:
from livekit.agents import AgentSession, inference
session = AgentSession(
tts=inference.TTS(
model="inworld/inworld-tts-1",
voice="Ashley",
language="en",
extra_kwargs={"speaking_rate": 1.1, "pitch": 0.0}
),
# ...
)
4) Authentication and rate limits
• No Sarvam API key or plugin is required. Use your LiveKit API key; LiveKit Cloud handles model auth and rate limiting.
• Monitor usage in the LiveKit Cloud dashboard.
5) Deploy and test
• Start your agent and confirm TTS output. If you hit issues, share your AgentSession config and any error messages and I’ll help troubleshoot.
Would you like a specific example matching your existing code (share the snippet) or help picking a provider/voice?
Sources: Introducing LiveKit Inference: A unified model interface for voice AI | Cartesia TTS | LiveKit docslate-businessperson-58140
12/08/2025, 5:35 AMtall-airline-16756
12/08/2025, 5:36 AMlate-businessperson-58140
12/08/2025, 6:22 AMtall-airline-16756
12/08/2025, 6:22 AMreturn sarvam.TTS(
api_key=assistant.sarvam_api_key or settings.SARVAM_API_KEY,
model=model or "bulbul:v2",
speaker=voice or "karun",
target_language_code=language or "en-IN",
speech_sample_rate=22050,
)
To resolve rate-limit errors, do the following:
1) Add retry with exponential backoff + jitter
• Retry on 429, with delays like 0.5s, 1s, 2s, 4s + random jitter; cap retries (3–5).
2) Throttle concurrent requests
• Use a semaphore (e.g., asyncio.Semaphore) to limit simultaneous TTS creations/calls to a safe number (start with 1–3 and raise if safe).
3) Rate-limit requests over time
• Implement a token-bucket or leaky-bucket to ensure requests/sec and characters/minute stay under your Sarvam quota.
4) Batch or reduce payloads
• Combine short texts into fewer requests or shorten requests to lower characters/minute.
5) Monitor & log
• Log timestamp, request size, and 429 occurrences to tune limits. Check the Sarvam dashboard for your quota and usage.
6) Optional: circuit-breaker + cooldown
• After N consecutive 429s, pause requests for a cooldown (e.g., 30–60s) before resuming.
Example patterns (Python async):
• Wrap your constructor/call in a retry loop with backoff (I can provide code).
• Use a global asyncio.Semaphore(2) around TTS calls to limit concurrency.
If you want, I can:
• Provide a ready-to-run Python snippet implementing semaphore + exponential backoff for your exact snippet.
• Recommend concrete semaphore count, RPS, and retry values if you tell me your expected requests/sec and concurrent sessions. Which language/runtime are you using and what throughput do you expect? Sources: Sarvam TTS plugin guide | LiveKit Docs | Sarvam STT plugin guide | LiveKit Docs | Events and error handling | LiveKit docs