billowy-agent-42774
09/26/2025, 6:57 AM{
"audioConfig": {
"audioEncoding": "LINEAR16",
"pitch": 0,
"speakingRate": 1
},
"input": {
"text": "Movies, oh my gosh, I just just absolutely love them. They're like time machines taking you to different worlds and landscapes, and um, and [whisper] I just can't get enough of it."
},
"voice": {
"languageCode": "en-US",
"modelName": "gemini-2.5-flash-preview-tts",
"name": "Achernar"
}
}
old:
{
"audioConfig": {
"audioEncoding": "LINEAR16",
"pitch": 0,
"speakingRate": 1
},
"input": {
"text": "Movies, oh my gosh, I just just absolutely love them. They're like time machines taking you to different worlds and landscapes, and um, and [whisper] I just can't get enough of it."
},
"voice": {
"languageCode": "en-US",
"modelName": "gemini-2.5-flash-preview-tts",
"name": "Achernar"
}
}tall-airline-16756
09/26/2025, 6:57 AMtall-airline-16756
09/26/2025, 6:57 AMGeminiTTS class from the LiveKit Google plugin. Let me walk you through the configuration step-by-step:
Installation:
• If you're using Python, just run: pip install "livekit-agents[google]~=1.2"
Authentication:
• Make sure to set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to your service account key file for Vertex AI.
• Alternatively, you can set the GOOGLE_API_KEY environment variable or pass the API key directly when creating the Google Gemini API instance.
Configuration:
Here’s a simple example to configure the Gemini Flash model in Python:
from livekit.plugins import google
session = AgentSession(
tts=google.beta.GeminiTTS(
model="gemini-2.5-flash-preview-tts",
voice_name="Achernar",
instructions="Speak in a friendly and engaging tone.",
),
# ... other configurations (LLM, STT, etc.)
)
Key Parameters:
• `model`: Use gemini-2.5-flash-preview-tts for the latest voice.
• `voice_name`: Choose the voice you like, for example, Achernar.
• `instructions`: This helps you customize the tone, style, and pace of the speech.
Just a quick note: streaming isn’t supported yet, and the audio sample rate is fixed at 24000 Hz. If you have any questions or need more help, please don’t hesitate to ask—I’m here to support you!
Sources: Docs::Agents | plugins/google/README.mdbillowy-agent-42774
09/26/2025, 6:57 AM{
"audioConfig": {
"audioEncoding": "LINEAR16",
"pitch": 0,
"speakingRate": 1
},
"input": {
"text": "Movies, oh my gosh, I just just absolutely love them. They're like time machines taking you to different worlds and landscapes, and um, and [whisper] I just can't get enough of it."
},
"voice": {
"languageCode": "en-US",
"name": "en-US-Chirp3-HD-Achernar"
}
}tall-airline-16756
09/26/2025, 6:58 AMmodelName parameter. To switch over to the Gemini Flash models, you’ll want to update your configuration to include the modelName field like this:
{
"audioConfig": {
"audioEncoding": "LINEAR16",
"pitch": 0,
"speakingRate": 1
},
"input": {
"text": "Movies, oh my gosh, I just just absolutely love them. They're like time machines taking you to different worlds and landscapes, and um, and [whisper] I just can't get enough of it."
},
"voice": {
"languageCode": "en-US",
"modelName": "gemini-2.5-flash-preview-tts",
"name": "Achernar"
}
}
Make sure your TTS setup in the code reflects this update. If you have any questions or need a hand with anything else, just let me know—I’m here to help!billowy-agent-42774
09/26/2025, 7:00 AMsession = AgentSession(
# A Large Language Model (LLM) is your agent's brain, processing user input and generating a response
# See all providers at https://docs.livekit.io/agents/integrations/llm/
llm=openai.LLM(model="gpt-4o-mini"),
# Speech-to-text (STT) is your agent's ears, turning the user's speech into text that the LLM can understand
# See all providers at https://docs.livekit.io/agents/integrations/stt/
stt=deepgram.STT(model="nova-3", language="multi"),
# Text-to-speech (TTS) is your agent's voice, turning the LLM's text into speech that the user can hear
# See all providers at https://docs.livekit.io/agents/integrations/tts/
tts=google.beta.GeminiTTS(
model="gemini-2.5-flash-preview-tts",
voice_name="Achernar",
),
# VAD and turn detection are used to determine when the user is speaking and when the agent should respond
# See more at https://docs.livekit.io/agents/build/turns
# # Temporarily disabled due to PyTorch dependency
vad=ctx.proc.userdata["vad"],
# allow the LLM to generate a response while waiting for the end of turn
# See more at https://docs.livekit.io/agents/build/audio/#preemptive-generation
preemptive_generation=True,
)tall-airline-16756
09/26/2025, 7:00 AMinstructions parameter to help the voice sound friendly and engaging, just as you wanted:
session = AgentSession(
# A Large Language Model (LLM) is your agent's brain, processing user input and generating a response
llm=openai.LLM(model="gpt-4o-mini"),
# Speech-to-text (STT) is your agent's ears, turning the user's speech into text that the LLM can understand
stt=deepgram.STT(model="nova-3", language="multi"),
# Text-to-speech (TTS) is your agent's voice, turning the LLM's text into speech that the user can hear
tts=google.beta.GeminiTTS(
model="gemini-2.5-flash-preview-tts",
voice_name="Achernar",
instructions="Speak in a friendly and engaging tone.",
),
# VAD and turn detection are used to determine when the user is speaking and when the agent should respond
vad=ctx.proc.userdata["vad"],
# Allow the LLM to generate a response while waiting for the end of turn
preemptive_generation=True,
)
If you have any questions or want to tweak anything further, just let me know—I’m here to help!billowy-agent-42774
09/26/2025, 7:05 AMsession = AgentSession(
# A Large Language Model (LLM) is your agent's brain, processing user input and generating a response
# See all providers at https://docs.livekit.io/agents/integrations/llm/
llm=openai.LLM(model="gpt-4o-mini"),
# Speech-to-text (STT) is your agent's ears, turning the user's speech into text that the LLM can understand
# See all providers at https://docs.livekit.io/agents/integrations/stt/
stt=deepgram.STT(model="nova-3", language="multi"),
# Text-to-speech (TTS) is your agent's voice, turning the LLM's text into speech that the user can hear
# See all providers at https://docs.livekit.io/agents/integrations/tts/
tts=google.TTS(
language="en-US",
gender="female",
voice_name="en-US-Chirp3-HD-Leda",
audio_encoding=texttospeech.AudioEncoding.LINEAR16,
),
When using this, everything is working. But when I add/use yours, the exact code you gave me above, I get credential errorstall-airline-16756
09/26/2025, 7:05 AMGOOGLE_APPLICATION_CREDENTIALS environment variable is set to the path of your service account key file.
• For Google Gemini API: Double-check that the GOOGLE_API_KEY environment variable is set, or that you’re passing the API key directly in the constructor.
2. Verify Permissions:
• It’s important to confirm that your service account or API key has the right permissions to access the Gemini Flash models.
3. Debugging:
• Take a close look at the exact error message—it often gives clues about whether the problem is missing credentials, incorrect file paths, or permissions issues.
If you’d like, I’m here to help you set up the credentials or dig deeper into the troubleshooting. Just let me know!billowy-agent-42774
09/26/2025, 7:06 AMtall-airline-16756
09/26/2025, 7:06 AMGOOGLE_APPLICATION_CREDENTIALS environment variable to point to your service account key file.
• API Key: Alternatively, use the GOOGLE_API_KEY environment variable or pass the API key directly in the TTS constructor.
If you'd like, I’m here to help you step-by-step with setting up these credentials—just let me know!billowy-agent-42774
09/26/2025, 7:13 AMtall-airline-16756
09/26/2025, 7:13 AMttfb (time to first byte) metric shows how quickly the TTS service starts responding. If you notice high ttfb values, it might indicate server-side delays or authentication hiccups.
If you'd like, I’m here to help you walk through these steps or troubleshoot further. Just let me know!billowy-agent-42774
09/26/2025, 7:15 AMtall-airline-16756
09/26/2025, 7:15 AMbillowy-agent-42774
09/26/2025, 7:16 AMtall-airline-16756
09/26/2025, 7:17 AMbillowy-agent-42774
09/26/2025, 7:35 AMtall-airline-16756
09/26/2025, 7:35 AMlanguage="en"
• language="en-US"
Both work perfectly! If you have any questions or need a hand with this, just let me know—I’m here to help!
Sources: Deepgram STT integration guide | LiveKit Docs | Deepgram integration guide | LiveKit Docs | plugins/deepgram/src/models.ts | livekit-plugins/livekit-plugins-speechmatics/livekit/plugins/speechmatics/s... | Deepgram STT integration guide | LiveKit Docs