LiveKit is constantly sending audio to openai real...
# ask-ai
a
LiveKit is constantly sending audio to openai realtime model? even when user is away
t
Thanks for reaching out, Sebastián. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're right to be concerned — regarding LiveKit sending audio to the OpenAI realtime model even when a user appears away, this usually means audio input was left enabled or turn/away detection isn't configured. To help fix it, please confirm a few things: • Do you have
turn_detection
configured? If not, or if it's misconfigured, audio can keep streaming. • Is
input_audio_transcription
enabled? • Are you calling
session.input.set_audio_enabled(False)
when a user is away or idle? • What is your
user_away_timeout
value (default is 15s)? What you can do immediately: • Disable audio input when the user is away:
session.input.set_audio_enabled(False)
• Enable/verify VAD/turn detection so silence stops transmission • Lower
user_away_timeout
if it's too long Send your
turn_detection
settings and whether you currently toggle
session.input
when idle and I’ll give precise steps to stop the continuous streaming. Sources: OpenAI Realtime API plugin guide | LiveKit docs | Events and error handling | LiveKit docs | Text and transcriptions | LiveKit docs | Realtime model plugins | LiveKit Docs
a
turn detection is server side (on the Realtime Model) input audio transcription is enabled im not calling input disabled always, do i have to? user_away_timeout is 8sec
t
Thanks — given your settings (server-side turn detection, transcription enabled,
user_away_timeout = 8s
) here's what to do and why. What’s happening • Server-side turn detection will stop the model from processing silent chunks, but it does not automatically stop the client/device from capturing or streaming raw audio. With transcription enabled, audio can still be sent until the client explicitly stops sending. • Because you’re not always disabling input on the client, audio capture may continue during “away” periods until the server VAD fully cuts the stream or the session ends. Recommended fixes 1. Disable client audio when user_state becomes away: ◦ Listen for the user state change to "away" and call:
Copy code
session.input.set_audio_enabled(False)
• Re-enable (
True
) when the user returns. 1. Or add client-side VAD so the client stops sending audio during silence (complements server VAD). 2. Verify turn_detection settings if you want faster server-side silence detection;
user_away_timeout = 8s
is reasonable, but shorter timeouts reduce wasted streaming. Which would you prefer—I can give the exact code snippet to detect user_state changes in your client, or steps to add client-side VAD.