livekit.…ns.google Gemini Realtime API error: rece...
# ask-ai
l
livekit.…ns.google Gemini Realtime API error: received 1008 (policy violation) models/gemini-2.5-flash-preview-09-2… is not found for API version v1beta, or is not supported for bidiGenerateContent. C; then sent 1008 (policy violation) models/gemini-2.5-flash-preview-09-2… is not found for API version v1beta, or is not supported for bidiGenerateContent. C Traceback (most recent ca
t
Thanks for reaching out, Pavan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — you're hitting the Gemini Realtime API error about model compatibility. I'm responding to your error: "1008 (policy violation) ... model ... is not found for API version v1beta, or is not supported for bidiGenerateContent." What you can do next: • Use a Live-compatible Gemini model name (example: gemini-2.5-flash-native-audio-preview-09-2025). • Use the RealtimeModel plugin (not the regular LLM). Example:
Copy code
from livekit.plugins import google
  llm = google.realtime.RealtimeModel(model="gemini-2.5-flash-native-audio-preview-09-2025")
• Ensure you're calling the realtime/bidirectional interface (
bidiGenerateContent
) — only select live/streaming models support that. • Verify authentication: ◦ Set
GOOGLE_API_KEY
for Gemini Live API. ◦ If using Vertex AI, set
GOOGLE_APPLICATION_CREDENTIALS
to your service account key. If this doesn’t resolve it, please share: 1. The exact model string you’re using. 2. The code snippet that initializes the RealtimeModel and starts the bidi stream. 3. Whether you’re using the Gemini API directly or Vertex AI. I’ll review those and suggest the precise fix. Sources: Gemini Live API plugin | LiveKit docs
l
can you provide all available model
t
You're asking for all available Gemini models for the Realtime API. The LiveKit plugin supports these Gemini realtime models: •
gemini-2.0-flash-exp
•
gemini-2.5-flash-native-audio-preview-09-2025
If you need examples for initializing either model with
google.realtime.RealtimeModel
, or want to confirm which one supports a specific feature (speech-to-speech, native audio input, etc.), tell me which feature you need and I’ll provide the exact snippet. Sources: Gemini Live API plugin | LiveKit docs
l
wich model will return text as response
t
You can get text responses from either supported realtime model —
gemini-2.0-flash-exp
or
gemini-2.5-flash-native-audio-preview-09-2025
— by configuring the model to use the TEXT modality. If you want, tell me which SDK/language you’re using and I’ll provide the exact initialization snippet to return text only. Sources: Gemini Live API plugin | LiveKit docs
l
Error event: type='error' error=RealtimeModelError(type='realtime_model_error', timestamp=1765964195.9799895, label='livekit.plugins.google.realtime.realtime_api.RealtimeModel', error=ConnectionClosedError(Close(code=1007, reason='Cannot extract voices from a non-audio request.'), Close(code=1007, reason='Cannot extract voices from a non-audio request.'), True), recoverable=False) source=<livekit.plugins.google.realtime.realtime_api.RealtimeModel object at 0x000001D5AB1C42F0> created_at=1765964195.980391
t
You're seeing a
1007
close with reason "Cannot extract voices from a non-audio request." — that means the RealtimeModel expected audio in the request (for voice extraction / native-audio flows) but received a non-audio payload. What you can do next: • If you want text-only responses: configure the model to use the TEXT modality so audio processing/voice extraction isn't required. ◦ Set
modalities=[Modality.TEXT]
(or the equivalent in your SDK) when creating the RealtimeModel. • If you intend to send audio (speech-to-speech or native-audio flows): make sure you send a proper audio track / audio frames on the bidi stream or attach a microphone track so the RealtimeModel receives audio input. • If using a native-audio model (e.g.,
gemini-2.5-flash-native-audio-preview-09-2025
), do not send a non-audio request that includes voice configuration expecting extraction. If you’d like, tell me: 1. Which model you’re using. 2. The modalities/options you set when initializing the RealtimeModel. 3. A short code snippet showing how you open the bidi stream / send the request. I’ll provide the exact snippet to fix either the text-only or audio flow.
l
model="gemini-2.5-flash-native-audio-preview-09-2025",
t
You're using
gemini-2.5-flash-native-audio-preview-09-2025
. That model expects native audio unless configured otherwise — your error shows the model received a non-audio request while voice extraction was expected. To resolve this, choose one of two options and tell me which you want to implement: 1) Text-only responses (no audio required) • Initialize the RealtimeModel with TEXT modality so the model won't expect audio:
Copy code
from livekit.plugins import google
from livekit.plugins.google import Modality

llm = google.realtime.RealtimeModel(
  model="gemini-2.5-flash-native-audio-preview-09-2025",
  modalities=[Modality.TEXT]
)
This accepts text input (or transcribed audio) and returns text responses. 2) Audio (speech-to-speech / native audio) — send real audio • Ensure you send an audio track/frames on the bidi stream (microphone or PCM frames) rather than a non-audio payload. • Do not set modalities to TEXT-only; include audio modality or native audio settings so voice extraction runs. Tell me which option you want (text-only or audio). If audio, paste: • The code snippet that opens the bidi stream and sends the initial request, and • How you attach/send audio (mic track, raw frames, or other). I’ll provide the exact snippet to fix your flow.
l
llm=google.realtime.RealtimeModel( model="gemini-2.5-flash-native-audio-preview-09-2025", api_key=settings.GOOGLE_API_KEY, modalities=[Modality.TEXT], temperature=0.8, ), i have add this but still got the error
t
Thanks — I see you’re using
gemini-2.5-flash-native-audio-preview-09-2025
with
modalities=[Modality.TEXT]
but still get the 1007 "Cannot extract voices from a non-audio request" error. Let's pinpoint the issue. Please check and apply these items: 1. Import and use the correct
Modality
enum:
Copy code
from google.genai.types import Modality
1. Ensure you disable audio in room options so the agent won’t initialize audio input:
Copy code
from livekit.plugins.room_io import RoomInputOptions
room_options = RoomInputOptions(audio_enabled=False)
1. Remove any voice/tts/affective settings (e.g.,
voice
,
enable_affective_dialog
) when using
modalities=[Modality.TEXT]
. 2. Minimal initialization example to test:
Copy code
from livekit.agents import AgentSession
from livekit.plugins import google
from google.genai.types import Modality
from livekit.plugins.room_io import RoomInputOptions

session = AgentSession(
  llm=google.realtime.RealtimeModel(
    model="gemini-2.5-flash-native-audio-preview-09-2025",
    api_key=settings.GOOGLE_API_KEY,
    modalities=[Modality.TEXT],
    temperature=0.8,
  ),
  room_options=RoomInputOptions(audio_enabled=False),
)
If you’ve already done all the above and still see the error, please paste: • The exact imports and the small code block that creates the RealtimeModel and starts the session (minimal reproducible snippet). • Any room/agent options you set (especially anything related to audio or TTS). I’ll review that snippet and point out the specific line causing the audio expectation. Sources: Gemini Live API plugin | LiveKit docs | How to Set Up Speech-to-Text Input with Text-Only Output in LiveKit Agents | Text and transcriptions | LiveKit docs | OpenAI Realtime API plugin guide | LiveKit docs
l
session = AgentSession( llm=google.realtime.RealtimeModel( model="gemini-2.0-flash-exp", api_key=settings.GOOGLE_API_KEY, modalities=[Modality.TEXT], temperature=0.8, ), tts=get_tts(assistant), user_away_timeout=25.0, ) this model is working fine