LiveKit Agents

Raya with LiveKit

Raya Bakbak in a LiveKit agent: through our plugin, or through Raya's LiveKit plugin with a changed URL.

With our plugin#

Raya Bakbak voices for Indian languages, in Raya's own parameter names.

pip install livekit-plugins-tts-cache-router
agent.py
from livekit.plugins import tts_cache_router# The API key comes from TTS_CACHE_ROUTER_API_KEY.tts = tts_cache_router.TTS(    provider=tts_cache_router.Raya(        model="standard",        voice_id="d6a002d0-230c-49b1-a137-b8a7d564b1ae",        language="hi",    ),)

Pass tts to AgentSession(tts=tts). Set TTS_CACHE_ROUTER_API_KEY in the agent’s environment, and store your Raya key under Provider keys. The constructor of TTS itself is on the plugin’s page.

tts_cache_router.Raya(...)#

modelstrRequired
"standard" or "m1".
voice_idstrRequired
A Raya voice id. It must belong to model: Raya refuses it otherwise.
languagestrRequired
A Raya language code, e.g. "hi". en and pa are m1 only.
speedfloatDefault 1.0
Speech speed, 0.5–1.5.

Every value the router accepts, and the languages per model, are in Models and options.

Changing settings#

Replies that start afterwards use the new settings:

Python
tts.update_options(speed=1.1)

With Raya's LiveKit plugin#

Keep livekit-plugins-raya and point it at the router: your router API key in place of your Raya key, and the router’s address. Nothing else changes.

pip install "livekit-plugins-raya @ git+https://github.com/raya-voice-ai/livekit-plugins-raya"
agent.py
import osfrom livekit.plugins import rayatts = raya.TTS(    model="standard",    voice_id="d6a002d0-230c-49b1-a137-b8a7d564b1ae",    language="hi",    api_key=os.environ["TTS_CACHE_ROUTER_API_KEY"],    base_url="https://api.ttscacherouter.dev/raya",)

Raya publishes its plugin on GitHub rather than PyPI. Instead of base_url you can set RAYA_BASE_URL in the environment. Streaming uses Raya’s SSE endpoint, and list_voices() works through the router too.

Requests, responses and errors keep Raya’s own shape. The endpoints behind it are described in Raya API drop-in.

Which to choose#

Both use your org's cache and your stored provider key, and sound the same.

  • Our plugin reports only the characters Raya billed in LiveKit’s TTSMetrics (cache hits count zero), and lets you switch provider with update_options.
  • Raya’s plugin is the smallest change to an agent that already uses it. Its metrics count every character, cached or not; the dashboard’s Usage page has the real split.