average-jordan-45543
11/17/2025, 8:26 PMsession = AgentSession(
tts=google.TTS(
voice_name=voice,
),
llm=google.realtime.RealtimeModel(
model=llm_model,
voice=voice,
temperature=temperature,
instructions="",
input_audio_transcription=InputAudioTranscription(
model=transcription_model,
language=language,
prompt="Context is a phone call in language {language}",
),
enable_affective_dialog=True,
thinking_config=types.ThinkingConfig(include_thoughts=False),
),
vad=silero.VAD.load(),
)tall-airline-16756
11/17/2025, 8:26 PMtall-airline-16756
11/17/2025, 8:27 PMuv add "livekit-agents[google]~=1.2"
And for Node.js, use:
pnpm add @livekit/agents-plugin-google@1.x
2. Authentication:
Make sure to set the GOOGLE_API_KEY or GOOGLE_APPLICATION_CREDENTIALS environment variable so the Google Gemini API or Vertex AI can authenticate properly.
3. Configure TTS:
In Python, you can set it up like this:
`from livekit.plugins import google
session = AgentSession(
tts=google.beta.GeminiTTS(
model="gemini-2.5-flash-preview-tts",
voice_name="Zephyr",
instructions="Speak in a friendly and engaging tone."
),
# Other configurations
)`For Node.js, here’s how you can do it:
import * as google from '@livekit/agents-plugin-google';
const session = new voice.AgentSession({
tts: new google.beta.TTS({
model: 'gemini-2.5-flash-preview-tts',
voiceName: 'Zephyr',
instructions: 'Speak in a friendly and engaging tone.'
}),
// Other configurations
});
4. Parameters:
Feel free to choose models like gemini-2.5-flash-preview-tts and voices such as Zephyr or Kore. Adding instructions helps you control the tone and style exactly how you want it.
5. Integration with Gemini Live API:
You can configure the TTS alongside the Gemini Live API for smooth real-time interactions. For example:
session = AgentSession(
llm=google.realtime.RealtimeModel(modalities=[Modality.TEXT]),
tts="cartesia/sonic-3"
)
If you have any questions or need a hand with any part of this setup, just let me know—I’m here to help!
Sources: .cursor/rules/agent-core.mdc | livekit-plugins/livekit-plugins-google/README.md | Gemini Live API plugin | LiveKit docs | Google AI and LiveKit | LiveKit Docs | Gemini TTS plugin guide | LiveKit Docsaverage-jordan-45543
11/17/2025, 8:29 PMtall-airline-16756
11/17/2025, 8:29 PMmodalities=["AUDIO"] or ["TEXT", "AUDIO"], it enables real-time voice interactions. This means spoken input gets transcribed, and the responses come back as audio, making conversations feel natural and smooth.
• TTS Behavior: The built-in Gemini TTS works by generating the full audio response after processing the entire text, rather than streaming it bit by bit in real-time. It’s a straightforward approach that ensures clear and complete audio replies.
• Fallback for Greetings: If you’d like to use TTS as a backup for greetings, you can configure the RealtimeModel with modalities=["TEXT"]. This way, you’ll get text responses that your TTS engine can then convert into audio, offering flexibility in how you deliver those greetings.
• Streaming TTS: For true real-time streaming audio output, you might want to consider using a separate TTS engine like Cartesia, since the native Gemini TTS doesn’t support streaming audio as it processes the full text first.
Please feel free to reach out if you'd like more help setting this up or have any other questions—I’m here to support you every step of the way!
Sources: Gemini Live API plugin | LiveKit docs | Real-time AI Models & Streaming | livekit/livekit_composite | DeepWiki | plugins/google/src/beta/gemini_tts.test.ts