TalkLabs TTS and STT plugin for LiveKit Agents
Project description
livekit-plugins-talklabs
TalkLabs TTS plugin for LiveKit Agents. Provides high-quality Brazilian Portuguese text-to-speech synthesis with streaming support.
Installation
pip install livekit-plugins-talklabs
Compatibility
This plugin is compatible with LiveKit Agents Framework and can be used as a drop-in TTS provider alongside other LiveKit plugins:
- ✅ Works with LiveKit Voice Assistant
- ✅ Compatible with all LiveKit STT providers (Deepgram, OpenAI, etc.)
- ✅ Compatible with all LiveKit LLM providers (OpenAI, Anthropic, etc.)
Usage
Basic Example
from livekit.plugins.talklabs import TalkLabsTTS
# Initialize TTS (same pattern as other LiveKit plugins)
tts = TalkLabsTTS(
api_key="your-api-key" # Get from https://talklabs.com.br
)
# Use with default voice (adam_rocha)
tts = TalkLabsTTS(api_key="your-api-key")
# Or specify custom settings
tts = TalkLabsTTS(
api_key="your-api-key",
voice="maria_silva", # Female voice
language="pt", # Portuguese
speed=1.2, # Slightly faster
sample_rate=24000 # High quality
)
With LiveKit Voice Assistant
from livekit.agents import JobContext, WorkerOptions, cli
from livekit.agents.voice_assistant import VoiceAssistant
from livekit.plugins.openai import LLM
from livekit.plugins.deepgram import STT
from livekit.plugins.silero import VAD
from livekit.plugins.talklabs import TalkLabsTTS
import os
async def entrypoint(ctx: JobContext):
# Create a voice assistant with TalkLabs TTS
assistant = VoiceAssistant(
vad=VAD.load(),
stt=STT(),
llm=LLM(),
tts=TalkLabsTTS(api_key=os.environ["TALKLABS_API_KEY"]) # Same as other plugins
)
await assistant.start(ctx.room)
if __name__ == "__main__":
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
Complete Integration Example
from livekit.agents import JobContext, WorkerOptions, cli
from livekit.agents.voice_assistant import VoiceAssistant
from livekit.plugins.openai import LLM
from livekit.plugins.deepgram import STT
from livekit.plugins.silero import VAD
from livekit.plugins.talklabs import TalkLabsTTS
import os
async def entrypoint(ctx: JobContext):
"""LiveKit Voice Assistant with Brazilian Portuguese support."""
# Initialize plugins - all follow same pattern
vad = VAD.load()
stt = STT(language="pt-BR") # Portuguese speech recognition
llm = LLM(model="gpt-4")
tts = TalkLabsTTS(api_key=os.environ["TALKLABS_API_KEY"]) # Portuguese TTS
# Create voice assistant
assistant = VoiceAssistant(
vad=vad,
stt=stt,
llm=llm,
tts=tts, # TalkLabs as TTS provider
)
# Set Portuguese context
assistant.llm_context.append({
"role": "system",
"content": "You are a helpful assistant. Respond in Portuguese (pt-BR)."
})
await assistant.start(ctx.room)
# Greet in Portuguese
await assistant.say("Olá! Como posso ajudá-lo hoje?")
if __name__ == "__main__":
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
Available Voices
| Voice | Gender | Description |
|---|---|---|
adam_rocha |
Male | Default voice, natural Brazilian accent |
maria_silva |
Female | Clear and professional |
carlos_santos |
Male | Deep and authoritative |
ana_costa |
Female | Young and friendly |
Configuration
Environment Variables
Set your API key as an environment variable:
export TALKLABS_API_KEY="your-api-key"
Then use it in your code:
tts = TalkLabsTTS(api_key=os.environ["TALKLABS_API_KEY"])
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key |
str | Required | Your TalkLabs API key |
voice |
str | "adam_rocha" |
Voice identifier |
language |
str | "pt" |
Language code |
speed |
float | 1.0 |
Speech speed (0.5-2.0) |
sample_rate |
int | 24000 |
Audio sample rate |
base_url |
str | "https://api.talklabs.com.br" |
API endpoint |
Comparison with Other LiveKit TTS Plugins
| Plugin | Languages | Streaming | Best For |
|---|---|---|---|
| livekit-plugins-talklabs | Portuguese (pt-BR) | ✅ | Brazilian Portuguese applications |
| livekit-plugins-openai | Multiple | ✅ | General purpose, English |
| livekit-plugins-elevenlabs | Multiple | ✅ | High quality English voices |
| livekit-plugins-cartesia | English | ✅ | Low latency English |
Working Example
import asyncio
import os
from livekit.agents import JobContext, WorkerOptions, cli
from livekit.agents.voice_assistant import VoiceAssistant
from livekit.plugins.openai import LLM
from livekit.plugins.deepgram import STT
from livekit.plugins.silero import VAD
from livekit.plugins.talklabs import TalkLabsTTS
async def entrypoint(ctx: JobContext):
"""Minimal working example."""
# Simple one-line TTS initialization like other plugins
assistant = VoiceAssistant(
vad=VAD.load(),
stt=STT(),
llm=LLM(),
tts=TalkLabsTTS(api_key=os.environ["TALKLABS_API_KEY"])
)
await assistant.start(ctx.room)
if __name__ == "__main__":
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
Features
- 🎯 Native LiveKit Integration: Works seamlessly with LiveKit Agents Framework
- 🔄 Streaming Support: Real-time audio streaming for low latency
- 🇧🇷 Brazilian Portuguese: Optimized for pt-BR pronunciation
- ⚡ Low Latency: < 200ms to first byte
- 🎵 High Quality: 24kHz sample rate
- 🔌 Plugin Architecture: Drop-in replacement for any LiveKit TTS provider
Requirements
- Python 3.9+
- LiveKit Agents 0.8.0+
- TalkLabs API key (get from talklabs.com.br)
Support
- 📧 Email: support@talklabs.com.br
- 📖 Documentation: docs.talklabs.com.br
- 🐛 Issues: GitHub Issues
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file livekit_plugins_talklabs-2.0.2.tar.gz.
File metadata
- Download URL: livekit_plugins_talklabs-2.0.2.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b83661322b1f772ff7f44235bc53a2cbee56c2547b28956f1e0fdc3c94f92a32
|
|
| MD5 |
6830e835a1efb0c7bafc9d559b1d80e2
|
|
| BLAKE2b-256 |
b59f7767f1fe8df4db8a3acd95fc504d3da3ad6efe75458cf83c794c2d2a73c3
|
File details
Details for the file livekit_plugins_talklabs-2.0.2-py3-none-any.whl.
File metadata
- Download URL: livekit_plugins_talklabs-2.0.2-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2d407b3843aef21a74fbeea43f34c71744be87adf82f3037131742bcf82bb8f
|
|
| MD5 |
c0c430aca65c31ded235404c5d09bcbd
|
|
| BLAKE2b-256 |
f70354782b3f99063c77084f6d91ccb1f98841d14b7e1e462eb33acb3e31c3bf
|