Environment details
- Programming language: Python
- OS: Linux (Ubuntu)
- Language runtime version: 3.13.2
- Package version: 1.70.0
Description
When connecting to gemini-3.1-flash-live-preview via the Live API with response_modalities=[TEXT], the connection immediately fails with a 1011 Internal error encountered WebSocket close frame.
Using response_modalities=[AUDIO] with the same model and API key works without issues. The workaround is to use AUDIO modality with output_audio_transcription to obtain text responses, but this is suboptimal for text-only use cases.
Steps to reproduce
import asyncio
from google import genai
from google.genai import types
client = genai.Client(api_key="YOUR_API_KEY")
async def main():
# This FAILS with 1011
config_text = types.LiveConnectConfig(
response_modalities=[types.Modality.TEXT],
)
async with client.aio.live.connect(
model="gemini-3.1-flash-live-preview", config=config_text
) as session:
await session.send_realtime_input(text="Hello")
async for msg in session.receive():
print(msg.text)
asyncio.run(main())
Error
websockets.exceptions.ConnectionClosedError: received 1011 (internal error) Internal error encountered.
google.genai.errors.APIError: 1011 None. Internal error encountered.
Working comparison (AUDIO modality)
# This WORKS
config_audio = types.LiveConnectConfig(
response_modalities=[types.Modality.AUDIO],
speech_config=types.SpeechConfig(
voice_config=types.VoiceConfig(
prebuilt_voice_config=types.PrebuiltVoiceConfig(voice_name="Puck")
)
),
output_audio_transcription=types.AudioTranscriptionConfig(),
)
async with client.aio.live.connect(
model="gemini-3.1-flash-live-preview", config=config_audio
) as session:
# Connected successfully, receives audio + transcription
...
Additional notes
- Tested with both
v1alpha and v1beta API versions — same result
- Tested with raw WebSocket (bypassing the SDK) — same result
- Tested with ephemeral tokens +
BidiGenerateContentConstrained — same result
- The model is listed in
client.models.list() and is the only model supporting bidiGenerateContent
- Regular (non-Live) API calls work fine with the same API key
Environment details
Description
When connecting to
gemini-3.1-flash-live-previewvia the Live API withresponse_modalities=[TEXT], the connection immediately fails with a1011 Internal error encounteredWebSocket close frame.Using
response_modalities=[AUDIO]with the same model and API key works without issues. The workaround is to use AUDIO modality withoutput_audio_transcriptionto obtain text responses, but this is suboptimal for text-only use cases.Steps to reproduce
Error
Working comparison (AUDIO modality)
Additional notes
v1alphaandv1betaAPI versions — same resultBidiGenerateContentConstrained— same resultclient.models.list()and is the only model supportingbidiGenerateContent