alert-wire-7024
12/19/2025, 7:06 PMgemini-2.5-flash-native-audio-preview-12-2025 live model which livekit supports. The normal version works fine but when I try to use it with a 3rd party tts provider e.g elevenlabs, I get the following error:
ConnectionClosedError: received 1007
(invalid frame payload data) Cannot
extract voices from a non-audio request.;
then sent 1007 (invalid frame payload
data) Cannot extract voices from a
non-audio request.
I use the model as follows:
return google.realtime.RealtimeModel(
model="gemini-2.5-flash-native-audio-preview-12-2025",
modalities=[types.Modality.TEXT],
# voice="Sulafat",
)
session = agents.AgentSession(
llm=llm,
stt=stt,
tts=tts,
vad=vad,
)tall-airline-16756
12/19/2025, 7:06 PMtall-airline-16756
12/19/2025, 7:07 PMmodalities=[genai.types.Modality.TEXT] or equivalent).
• Do NOT pass a voice parameter when you intend to use an external TTS provider.
1. Minimal example pattern
• LLM: RealtimeModel(model="gemini-2.5-flash-native-audio-preview-12-2025", modalities=[Modality.TEXT])
• TTS: separate ElevenLabs TTS instance provided to your AgentSession.
• AgentSession should include the external tts so the model returns text and ElevenLabs synthesizes audio.
1. If you already set modalities to text and removed voice, verify:
• Your code is importing the correct Modality enum (ensure it’s the same types.Modality the plugin expects).
• No other place in your code passes voice or audio output flags to the Gemini model.
• Your ElevenLabs TTS receives plain text (log the outgoing text chunk before sending to ElevenLabs).
1. Turn on debug logging to observe frames
• Enable logging (e.g., logging.basicConfig(level=logging.DEBUG)) and capture the frames sent/received to confirm whether a non-audio binary frame is being sent to Gemini or LiveKit.
One clarifying question to narrow this down:
• In your full runtime, are you sending any binary/audio frames to the Gemini model (for example via STT, microphone stream, or an earlier step)? If yes, describe how STT/VAD are wired into the session.
If you share the exact modalities import line and whether voice appears anywhere else in your stack (or a short log showing the request payload before ElevenLabs gets it), I can point to the precise fix.
Sources: Gemini Live API plugin | LiveKit docsalert-wire-7024
12/19/2025, 7:19 PMreturn NotGiven()
Here are all the logs I could find:
ConnectionClosedError: received 1007
(invalid frame payload data) Cannot
extract voices from a non-audio request.;
then sent 1007 (invalid frame payload
data) Cannot extract voices from a
non-audio request.
APIConnectionError: Failed to connect to
Gemini Live (body=None, retryable=True)
78755 12/19/2025, 7:17:53 PM ERROR [livekit.agents] Error in _realtime_reply_task
RealtimeError: generate_reply timed out
waiting for generation_created event.tall-airline-16756
12/19/2025, 7:19 PMNotGiven() for STT and VAD and you shared the logs showing 1007 + APIConnectionError + a generation timeout. I’m responding to those errors and your setup.
Next steps to isolate and fix this:
1. Confirm the model is explicitly set to text-only
• Show me the exact import line you use for Modality. It must be the same enum the plugin expects (for example from google.generativeai import types as genai_types then modalities=[genai_types.Modality.TEXT]). A mismatched enum can let the model still expect audio.
1. Ensure no audio/voice flags are sent anywhere
• Search your codebase for any voice=, audio=, or modalities uses elsewhere. Even a stray voice or an audio flag will cause the model or LiveKit to expect audio frames.
1. Verify you are not sending any binary/audio frames
• Even if STT/VAD return NotGiven(), confirm your application is not sending microphone binary frames or previously-buffered audio to the Gemini realtime connection. Log outgoing frames right before sending.
1. Check connectivity / retry behavior
• The APIConnectionError indicates intermittent failure to reach Gemini Live; ensure network connectivity and that calls are retried. That connectivity issue can cause timeouts and generation failures.
1. Enable debug logging and capture payloads
• Turn on debug logging (logging.basicConfig(level=logging.DEBUG)) and capture the exact request payloads and frame types sent to Gemini. If you can paste a single sample request payload (redact secrets), I’ll inspect it.
Quick checks you can run now
• Confirm modalities import line (paste it here).
• Grep for voice= across your repo and paste any hits.
• Share one debug log snippet showing the outgoing request/frame before the 1007 error.
If you send the three small items above, I’ll point to the exact field causing Gemini to treat the request as non-audio and show the minimal code change to fix it.alert-wire-7024
12/19/2025, 7:24 PM_from_ google.genai _import_ types
There's nothing with voice=
Here's all the logs I can find:
78755 12/19/2025, 7:17:47 PM DEBUG [livekit.plugins.google] connecting to Gemini Realtime API...
78755 12/19/2025, 7:17:48 PM ERROR [livekit.plugins.google] Gemini Realtime API error: received 1007 (invalid frame payload data) Cannot extract voices from a non-audio request.; then sent 1007 (invalid frame payload data) Cannot extract voices from a non-audio requesttall-airline-16756
12/19/2025, 7:24 PMfrom google.genai import types).
What I see
• Your import is from google.genai not google.generativeai (the expected enum provider). The Gemini realtime model still appears to be treating the connection as audio-capable and rejecting a non-audio request, which produces the 1007 error.
Next steps (try these in order)
1. Use the correct Modality enum
• Replace from google.genai import types with the plugin/SDK enum used by the RealtimeModel, for example:
from google.generativeai import types as genai_types
llm = google.realtime.RealtimeModel(
model="gemini-2.5-flash-native-audio-preview-12-2025",
modalities=[genai_types.Modality.TEXT],
)
• Confirm modalities is exactly Modality.TEXT from that import.
1. Verify nothing else signals audio
• Grep your project for voice=, audio=, modalities= or other Gemini-related flags and ensure no other module or default sets an audio modality.
• Ensure your AgentSession tts is the external ElevenLabs instance (the model should only return text to that session).
1. Test a minimal repro
• Run a tiny script that only creates the RealtimeModel with modalities=[Modality.TEXT] and opens a session (no STT/VAD, no mic frames). If it connects without 1007, the issue is elsewhere in your stack.
1. Capture debug frames if still failing
• Enable debug logging and paste the debug lines around the connection (you already have a useful line). If failure persists, share the next block of debug log that shows the initial request/handshake frames (redact keys).
One quick question to confirm: after you change the import to google.generativeai.types (or equivalent the plugin expects), can you re-run the minimal repro and paste the next 5–10 debug lines if the 1007 still happens? I’ll inspect them and point to the exact field causing Gemini to expect audio.