Your text, verbatim
Each sentence reaches the provider exactly as your agent wrote it.
- Only whitespace is normalized
- Case and punctuation are kept, because they change how a sentence is spoken
tts-cache-router sits between your voice agent and Sarvam, Raya or ElevenLabs, using your own provider key. A sentence your agent has said before, in the same voice, plays back as the provider’s own take, without calling the provider again.
One reply, said twice
A real run: Sarvam bulbul:v3, voice shubh
First time
206 characters billed
Said again
0 characters billed
Greetings, confirmations and disclosures your agent says again play from cache, with no round trip to the provider. Above, the first sentence started after 6 ms instead of 422 ms.
Save your Sarvam, Raya or ElevenLabs key once; it’s stored encrypted and used only for your own requests. The provider bills you directly, and only for the sentences it actually synthesized.
The router’s splitter ends a sentence at the Hindi full stop as well as at English punctuation, so a Hindi reply starts speaking after its first sentence, not after a full stop that never comes.
How it works
The router cuts your agent’s streamed reply into sentences and sends each one on the moment it’s complete.
The exact text and every setting the provider receives: model, voice, language, speed, sample rate, format and options. Entries belong to your org and never play for another.
A hit never contacts the provider. A miss goes to the provider with your key and streams to your agent as it’s produced.
Sentences play in the order your agent wrote them. On barge-in the audio stops, and a sentence already sent still finishes and is cached.
The promise
Two identical requests to a TTS provider never return identical audio, so caching can’t mean “close enough.” It has to mean the provider’s own take, for exactly what you asked.
Each sentence reaches the provider exactly as your agent wrote it.
The settings you choose reach the provider as you set them.
A hit replays audio the provider made for that exact request.
LiveKit Agents
Swap your agent’s tts= for the plugin and keep everything else.
pip install livekit-plugins-tts-cache-routerexport TTS_CACHE_ROUTER_API_KEY=tcr_… # from your dashboard# Your Sarvam, Raya or ElevenLabs key goes in the dashboard, once.from livekit.agents import AgentSessionfrom livekit.plugins import tts_cache_routertts = tts_cache_router.TTS( provider=tts_cache_router.Sarvam( model="bulbul:v3", speaker="shubh", language="hi-IN", ),)session = AgentSession(tts=tts, ...)How to connect
Save your provider key in the dashboard once, then connect with your router API key in whichever way your agent already speaks.
A TTS for LiveKit Agents over the router’s WebSocket. Sentence-aligned transcripts, warm connections kept across barge-ins.
tts_cache_router.TTS( provider=tts_cache_router.Sarvam( model="bulbul:v3", speaker="shubh", language="hi-IN", ),)POST /v1/audio/speech, shaped like OpenAI’s. Use the OpenAI SDK with base_url api.ttscacherouter.dev/v1; audio streams back sentence by sentence.
client.audio.speech.create( model="sarvam/bulbul:v3", voice="shubh", input=text, extra_body={"language": "hi-IN"},)Sarvam’s, Raya’s and ElevenLabs’ APIs, mirrored under api.ttscacherouter.dev/sarvam, /raya and /elevenlabs. Keep your client; change only the base URL and the key.
raya.TTS( voice_id="d6a002d0-…", base_url="https://api.ttscacherouter.dev/raya", api_key="tcr_…",)Pricing
Every new org gets $10 of credit, about 5 million cached characters, with no card. After that, buy prepaid credit from $10. It never expires.
Pricing and billing in the docs365 days by default. Change your org’s retention in the dashboard, in days, or set it to 0 and nothing new is stored. Retention counts from when the audio was made; playing it doesn’t extend it. Audio is deleted within about a day after its retention ends, and a change applies to audio already cached.
Your agent keeps speaking. The router sends every sentence to the provider until the cache is back, so a lost cache costs provider calls, never correctness.
Yes. Call POST /v1/audio/speech with the OpenAI SDK, point your Sarvam, Raya or ElevenLabs client at the drop-in endpoints, or speak the WebSocket protocol from any language.
Use the hosted router with an API key, or run the router and its cache yourself with one Docker Compose stack, and this website as a static site.