Back to library
AI
best practice

Enable Streaming Speech to Create Instant Voice AI Responses

Reduce response lag with Gemini's new streaming speech generation support.

Implement streaming for text-to-speech (TTS) using the gemini-3.1-flash-tts-preview model to create low-latency, real-time voice interactions.

Google Gemini

The Scenario

A developer is building a real-time AI voice assistant that needs to respond instantly to user queries without waiting for the full response to generate.

Before & after

The old way

Standard TTS requires the entire text to be processed before audio playback begins, causing a noticeable delay of 5–10 seconds for long paragraphs.

With AI

By integrating TTS streaming, your application can start speaking the first words of a long response in less than 1 second.

The Prompt

Set up a streaming text-to-speech request for the following long-form content using gemini-3.1-flash-tts-preview: [INPUT_TEXT_HERE]. Ensure audio starts immediately as the content generates.

The gemini-3.1-flash-tts-preview model now supports streaming via streamGenerateContent for real-time applications.

Source

Release notes  |  Gemini API  |  Google AI for Developers
"Streaming via streamGenerateContent... is now supported for the gemini-3.1-flash-tts-preview model."