Reduce Voice App Latency Using New Gemini Speech Streaming Support
Enable streaming forSpeech-to-Text to reduce AI voice latency.
Implement the `streamGenerateContent` feature with the `gemini-3.1-flash-tts-preview` model to deliver real-time speech generation in your applications.
The Scenario
An app developer is building a real-time voice assistant and wants to reduce the delay between a user asking a question and the AI speaking.
Before & after
Developers would wait for the full audio file to generate before playing it for the user, causing a latency of 15-30 seconds per interaction.
Updating model IDs and testing the new speech streaming outputs takes approximately 10-15 minutes using the API guides.
The Prompt
Show me a code example for implementing streaming speech generation using the 'gemini-3.1-flash-tts-preview' model in [PROGRAMMING_LANGUAGE].
Streaming is now supported for the `gemini-3.1-flash-tts-preview` model via the `streamGenerateContent` method or the `stream: true` flag in the Interactions API.
Source
Release notes | Gemini API | Google AI for Developers"Streaming support for speech generation: Streaming via streamGenerateContent... is now supported for the gemini-3.1-flash-tts-preview model."
