Hi everyone, I’m working on a voice assistant usin...
# self-hosting
i
Hi everyone, I’m working on a voice assistant using LiveKit SIP (with Twilio) and the Google Gemini Realtime plugin. Calls connect successfully, and the conversation flows, but I am consistently facing significant latency issues. It takes 5-8 seconds for the agent to reply after I stop speaking. What I've Tested: 1. Self-Hosted Setup: Docker Compose (LiveKit Server, SIP, Redis, Python Agent) on a VM. 2. LiveKit Cloud: I migrated the setup to LiveKit Cloud to rule out local infrastructure issues, but the latency remained exactly the same (5-8s). My Stack: • Model:
gemini-2.5-flash-native-audio-preview
via
google.realtime
. • SIP: Twilio Elastic SIP Trunk. Optimization Attempts: • Added
silero.VAD
for faster speech-end detection. • Added
turn_detector.EnglishModel()
to optimize turn-taking. Despite these changes, the delay persists. Configuration Excerpt (
agent.py
):
Copy code
session = AgentSession(
    llm=google.realtime.RealtimeModel(
        model="gemini-2.5-flash-native-audio-preview-09-2025",
        voice="Kore",
        temperature=0.8,
        modalities=["AUDIO"],
    ),
    turn_detection=EnglishModel(),
    vad=silero.VAD.load(), 
)
Has anyone else experienced this specific 5-8s delay with the Gemini Realtime plugin? Can you tell me how can i solve this?
f
I've faced latency as well. In my case, when I looked at the logs, the Gemini realtime plugin was frequently running into a timeout error, which was what contributed to the lag as well. I also have a hunch that tool calls (if you're using them) might be slowing it down a little
i
@famous-farmer-93847 At the intial stage, I faced a timeout problem while I was using the free tier gemini api. But later it was fixed. Now the problem is latency. I want a fast reply. means I shut my mouth, and Gemini replies. Currently, I'm not using any kind of tools, which may cause latency, as you mentioned. Based on the VAD docs, I made the following changes to my AgentSession configuration to optimize the turn detection. I suspect the high default min_silence_duration. Now I'm reading LiveKit docs, if I find any solution.
Copy code
agent = Agent(
            instructions="""
            You are a friendly, helpful voice assistant for customer service.
            Answer callers' questions clearly and politely.
            Speak in a warm, natural tone.
            Keep responses concise and helpful.
            """
        )

session = AgentSession(
            llm=google.realtime.RealtimeModel(
                model="gemini-2.5-flash-native-audio-preview-09-2025",
                voice="Kore",
                temperature=0.8,
                api_key=api_key,
                instructions="Be a helpful assistant answering phone calls.",
                modalities=["AUDIO"],
            ),
            turn_detection=EnglishModel(),
            vad=silero.VAD.load(
                min_silence_duration=0.4,
            ),
        )
And thank you for your response.
h
im facing sub 1000ms with using gpt4o mini and have been running agents myself for about 2 years, gemini is good, but still not as reliable or consistent as gpt4o or 4o mini in terms of latency and quality of responses