Gemini TTS
GeminiTTS synthesises speech with Google’s Gemini speech models (gemini-3.1-flash-tts-preview) over the Gen AI SDK’s streaming generate_content surface. The model emits PCM L16 at 24 kHz; the adapter resamples to the pipeline rate (16 kHz by default) and the stream handler does the final 16k to 8k mu-law step for the carrier.
Beta. The adapter is validated against the Google Gen AI SDK surface; it has
not yet been exercised against a live phone call.
Install
Authentication
GEMINI_API_KEY is read automatically when api_key / apiKey is omitted, with GOOGLE_API_KEY as the second fallback.
Usage
Use the namespaced import (
getpatter.tts.gemini) or the flat re-export
(GeminiTTS). Both auto-resolve the key from the environment.Delivery tags
Square-bracket tags inside the text are read as delivery direction rather than spoken, so the LLM can annotate its own replies:[warm], [short pause], and [sigh] shape prosody. Everything outside the brackets is spoken verbatim.
Output rate
The adapter emits PCM16-LE mono and declares that format to the pipeline, so the sender derives the right resample ratio instead of assuming 16 kHz.
Any other value is rejected at construction.
Warmup
warmup() drains one tiny synthesis so the connection and the model are hot before the first turn. It is called automatically for outbound calls when the agent has prewarm=True (the default), and a failure is logged rather than raised.

