Skip to main content

Gemini TTS integration guide

How to use the Gemini TTS plugin for LiveKit Agents.

Available in
Beta
|
Python
|
Node.js

Overview

Gemini TTS generates speech from text with customizable style, tone, accent, and pace through natural language prompts. It’s designed for scenarios that require precise recitation and nuanced audio output. With LiveKit's Gemini TTS integration and the Agents framework, you can build voice AI applications with accurate and nuanced speech.

Quick reference

This section includes a basic usage example and some reference material. For links to more detailed documentation, see Additional resources.

Installation

Install the plugin from PyPI:

pip install "livekit-agents[google]~=1.2"

Authentication

Credentials must be provided by one of the following methods:

  • To use VertexAI: Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of the service account key file.
  • To use Gemini API: Set the api_key argument or the GOOGLE_API_KEY environment 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.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.",
),
# ... llm, stt, etc.
)

Parameters

This section describes some of the available parameters. See the plugin reference for a complete list of all available parameters.

modelstringOptionalDefault: gemini-2.5-flash-preview-tts

The model to use for speech generation. For a list of models, see Supported models.

voice_namestringOptionalDefault: Kore

Voice name. For supported voices, see Voice options.

voice_namestringOptional

Name of the voice to use for speech. For a full list of voices, see Supported voices and languages.

instructionsstringOptional

Prompt to control the style, tone, accent, and pace. To learn more, see Controlling speech style with prompts.

Additional resources

The following resources provide more information about using Gemini TTS with LiveKit Agents.