I’m implementing a real-time voice assistant using Google Gemini Live API with Python (genai SDK) and PyAudio. My setup works for capturing microphone input, running VAD, and sending audio chunks, but I keep hitting the following issue intermittently:
[USER] ⚠️ Send error: sent 1011 (internal error) keepalive ping timeout; no close frame received
Environment:
-
Python 3.11
-
OS: Windows 10
-
PyAudiofor mic input -
genaiSDK withAsyncLive.connect() -
Audio settings: 16kHz input, 3–4s speech chunks
Symptoms:
-
VAD detects speech normally and sends chunks.
-
Many
[SKIP] ❌ Dropped low-quality inputmessages appear. -
Sometimes the assistant receives responses correctly.
-
Eventually, the
1011 internal erroroccurs, terminating the session.
What I tried:
-
Using
ThreadPoolExecutorfor audio read/write to avoid blocking the event loop. -
Throttling sends with small
asyncio.sleep()delays. -
Adjusting VAD thresholds and minimum speech chunk sizes.
What is the correct way to avoid keepalive ping timeout with Gemini Live API?