rich-dusk-37560
08/12/2025, 7:42 PMfrom livekit.plugins.google.beta import gemini_tts
tts = gemini_tts.TTS(model="gemini-2.5-pro-preview-tts")
tall-airline-16756
08/12/2025, 7:42 PMtall-airline-16756
08/12/2025, 7:43 PMpip install "livekit-agents[google]~=1.0"
1. Next, import the modules you’ll need:
from livekit.plugins import google
1. Now, set up and configure your Gemini TTS:
tts = google.beta.GeminiTTS(
model="gemini-2.5-flash-preview-tts",
voice_name="Kore",
instructions="Say the text with a proper tone"
)
1. Finally, use the TTS in an AgentSession:
from livekit.agents import AgentSession
session = AgentSession(
tts=tts,
# ... other components like LLM, STT
)
Just a heads-up: make sure you’re authenticated with Google Cloud by providing your credentials through api_key
, credentials_info
, or credentials_file
. And if you want, you can easily tweak the voice with the voice_name
parameter.
If you hit any bumps or have questions, I’m here to help—just give me a shout!rich-dusk-37560
08/12/2025, 9:25 PMtall-airline-16756
08/12/2025, 9:26 PMlanguage
parameter. Just pop in the language code you want (like en-US
for American English or fr-FR
for French).
Here’s a quick example:
from livekit.plugins import google
google_tts = google.TTS(
language="fr-FR", # Specify the language
voice_name="fr-FR-Standard-A",
gender="female"
)
Just make sure the language code matches one of the supported voices and languages. If you want to see all the options, you can check out the Google TTS supported voices and languages.
Feel free to reach out if you have any more questions or need a hand!