Guía de Gemini 3.1 Flash Live API: agentes de voz, cámara y pantalla en tiempo real
Construye agentes multimodales de baja latencia con Gemini 3.1 Flash Live — arquitectura WebSocket, audio nativo, cámara y pantalla compartida a 1 FPS, llamadas a herramientas y tokens efímeros.
Por qué Gemini 3.1 Flash Live importa en agosto de 2026
Google lanzó Gemini 3.1 Flash Live mediante la Gemini Live API en marzo de 2026; en agosto es el modelo recomendado para agentes de voz y visión en producción. A diferencia de las llamadas batch generateContent, Live mantiene una sesión WebSocket persistente que transmite audio, fotogramas de vídeo y texto en ambos sentidos — el modelo escucha, ve y habla en un solo pipeline nativo, sin STT/TTS separados.
Cambios clave en agosto de 2026:
- Modelos 2.5 Flash Live deprecados — migrar a
gemini-3.1-flash-live-preview. - Ecosistema maduro — demos de Stitch, Ato y Weekend RPG con cámara en producción.
- Live API + Gemini 3.7 Flash — Live para diálogo subsegundo; 3.7 Flash REST para codificación profunda (ver anuncio 3.7 Flash).
Architecture: WebSocket sessions
The Live API is stateful — persistent WSS streams audio, video frames (≤1 FPS JPEG/PNG), and text bidirectionally. Setup via BidiGenerateContentSetup, then BidiGenerateContentRealtimeInput.
| Layer | Role |
|---|---|
| Transport | Stateful WSS |
| Input | PCM16 @ 16 kHz, video ≤1 FPS, text |
| Output | PCM @ 24 kHz, transcripts, tool calls |
Deploy server-to-server (proxy + logging) or client-to-server (lower latency; use ephemeral tokens).
Native end-to-end audio
Input: 16-bit PCM LE mono 16 kHz. Output: 24 kHz PCM. Convert browser float32 capture to PCM16. VAD handles turns; push-to-talk uses manual activityStart/activityEnd.
Camera and screen share
Stream JPEG/PNG at 1 FPS max — camera Q&A, screen-share code review (Stitch demo), accessibility. Default TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO bills all frames in a turn; send video only during speech to save cost.
Session limits: 15 min audio-only, 2 min audio+video — extend via session resumption and context compression.
Tool calling
Synchronous function calling + Google Search grounding. 3.1 Flash Live does not support NON_BLOCKING async tools from 2.5.
thinkingLevel and 90+ languages
Use thinkingLevel: minimal (default, lowest latency) through high. Supports 90+ languages with improved tone and pace recognition vs 2.5 Native Audio.
Security
Never ship API keys in clients — mint ephemeral tokens on your backend. For WebRTC scale, use partner integrations (Fishjam, Stream Vision Agents, Voximplant).
Migrate from 2.5 Flash Live
Replace deprecated models with gemini-3.1-flash-live-preview. Switch thinkingBudget → thinkingLevel; use send_realtime_input for mid-session text; handle multi-part server events; review turnCoverage.
3.1 Live vs 3.7 Flash REST
| 3.1 Live | 3.7 REST | |
|---|---|---|
| Protocol | WebSocket | HTTP |
| Latency | Sub-second audio | 85ms+ first token |
| Context | 128K session | 2.5M tokens |
| Best for | Voice agents, screen assist | Coding agents, RAG |
Get started
- Google AI Studio → Stream
pip install google-genaiornpm install @google/genai- Capabilities guide