Overview
This plugin allows you to use Gemini TTS as a TTS provider for your voice agents.
Installation
Install the plugin from PyPI:
uv add "livekit-agents[google]~=1.8"
pnpm add @livekit/agents-plugin-google@1.x
Authentication
Credentials must be provided by one of the following methods:
- For Vertex AI, you must set the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable to the path of the service account key file. For more information about mounting files as secrets when deploying to LiveKit Cloud, see File-mounted secrets. - To use Gemini API: Set the
api_keyargument or theGOOGLE_API_KEYenvironment variable.
Usage
Use a Gemini TTS in an AgentSession or as a standalone speech generator. For example, you can use this TTS in the Voice AI quickstart.
from livekit.agents import AgentSessionfrom livekit.plugins import googlesession = AgentSession(tts=google.beta.GeminiTTS(model="gemini-3.1-flash-tts-preview",voice_name="Zephyr",instructions="Speak in a friendly and engaging tone.",),# ... llm, stt, etc.)
import * as google from '@livekit/agents-plugin-google';import { voice } from '@livekit/agents';const session = new voice.AgentSession({tts: new google.beta.TTS({model: 'gemini-3.1-flash-tts-preview',voiceName: 'Zephyr',instructions: 'Speak in a friendly and engaging tone.',}),// ... llm, stt, etc.});
Parameters
This section describes some of the available parameters. See the plugin reference links in the Additional resources section for a complete list of all available parameters.
modelstringDefault: gemini-3.1-flash-tts-previewThe model to use for speech generation. For a list of models, see Supported models .
voice_namestringDefault: KoreThe prebuilt voice used to synthesize speech. For supported voices, see Voice options . In Node.js this parameter is called voiceName.
instructionsstringPrompt to control the style, tone, accent, and pace. To learn more, see Controlling speech style with prompts . Defaults to Say the text with a proper tone, don't omit or add any words.
customPronunciationsCustomPronunciationsPronunciation instructions for the Gemini model. Pass an object with a pronunciations array, where each entry specifies a phrase, pronunciation, and optional phoneticEncoding. These instructions are formatted as prompt text sent to the Gemini model alongside the speech generation request.
const tts = new google.beta.TTS({model: 'gemini-3.1-flash-tts-preview',voiceName: 'Aoede',customPronunciations: {pronunciations: [{phrase: 'LiveKit',pronunciation: 'Live Kit',},{phrase: 'gRPC',pronunciation: 'gee arr pee see',phoneticEncoding: 'IPA', // optional},],},});
Expressive mode
Gemini's gemini-3.8-flash-tts and gemini-3.8-flash-lite-tts work with expressive mode, where the LLM marks up its replies and LiveKit renders the delivery. Gemini sets an emotional tone, adjusts pacing, inserts pauses, and produces non-verbal sounds such as laughs and sighs. It also publishes the current mood as the lk.expression attribute for your frontend.
Turn it on with expressive=True on your AgentSession. To adjust the delivery, see Customization.
Additional resources
The following resources provide more information about using Gemini TTS with LiveKit Agents.
Expressive mode
Let the LLM add emotion, pacing, and non-verbal sounds to Gemini speech automatically.
Gemini TTS docs
Gemini Developer API docs for TTS.
Voice AI quickstart
Get started with LiveKit Agents and Gemini TTS.
Google ecosystem guide
Overview of the entire Google AI and LiveKit Agents integration.