l
hello
t
Thanks for reaching out, Pavan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi — thanks for reaching out. How can I help you today? If you're not sure where to start, here are a few common topics I can assist with: • Troubleshooting a call or connection issue • SDK integration or sample code questions • Room, participant, or permissions setup • Billing or account questions • Feature requests or roadmap questions Tell me which one fits or give a brief description of your issue and I’ll guide you next.
l
livekit.agents._exceptions.APIStatusError: Sarvam TTS API Error: {"error":{"message":"Rate limit exceeded","code":"rate_limit_exceeded_error","request_id":"20251205_eb62ab57-80a4-4993-80cb-1727c43d2f41"}} (status_code=429, request_id=None, body=None, retryable=False) can you please check
t
I’m sorry you hit that rate-limit error — I’m responding about the Sarvam TTS 429:
rate_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 Docs
l
ernative 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. how to do this
t
You're asking how to switch from the Sarvam plugin to a LiveKit-managed TTS model via LiveKit Inference. Below are concise, actionable steps and example code. 1) Remove Sarvam plugin usage • Delete any
from 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`:
Copy code
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:
Copy code
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 docs
l
i want to use sarvam only how to slove this
t
You're hitting Sarvam's rate limits and want to keep using Sarvam — here are focused steps to resolve that and get reliable TTS. What to check first • Verify your Sarvam plan quotas in the Sarvam dashboard (requests/sec, characters/minute, concurrent requests). • Confirm whether multiple services or users share the same Sarvam API key. Immediate fixes to stop 429s • Add exponential backoff on 429 responses: ◦ Wait ~200–500ms, then retry; double the wait each retry; cap retries (e.g., 3–5 attempts). • Queue or throttle requests: ◦ Limit concurrent TTS calls to below your documented concurrent-request quota. ◦ Rate-limit requests to fit requests/sec and characters/minute limits. • Batch or reduce payloads: ◦ Combine small TTS texts into fewer calls when latency allows. ◦ Reduce characters per request or simplify text where possible. Implementation patterns • Token-bucket or leaky-bucket limiter to smooth bursts. • Single shared request queue if multiple processes/instances use the same API key. • Circuit-breaker: pause attempts for a short cooldown after repeated 429s. Monitoring and logging • Log timestamps, request sizes, and 429 occurrences to identify traffic patterns causing the limit. • Track concurrent active requests and request rate (RPS) in real time. Account and quota options • Check Sarvam dashboard for upgraded plans or quota increases. • If limits on your current plan are too low, request a quota increase from Sarvam sales/support. If you want, I can: • Suggest concrete retry/backoff code for your language (Python, Node, etc.). • Review a small snippet of your current TTS request flow and recommend throttling values. Which language or framework are you using?
l
return 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, )
t
Thanks — I’ll help you keep using Sarvam and stop the 429s. You shared this TTS constructor:
Copy code
return 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