Registry / ai-ml / livekit-plugins-silero

livekit-plugins-silero

JSON →
library1.7.1pypypi✓ verified 23d ago

The livekit-plugins-silero library provides a Voice Activity Detection (VAD) plugin for the LiveKit Agent Framework. It leverages the Silero VAD model to accurately detect speech versus silence, which is crucial for natural turn-taking in voice AI applications and for optimizing Speech-to-Text (STT) resource usage. The current version is 1.5.2, released as part of the LiveKit Agents framework, which follows a rapid release cadence.

pip install livekit-plugins-silero
INSTALL
IMPORT
SIG · LIVEKIT-PLUGINS-SI
L
livekit-plugins-silero
ai-mlpythonv1.7.1
Install
21.7s avg
Import
6619ms
Disk
443MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
1/2 runs
✓ 26.05s
py 3.11
1/2 runs
✓ 19.5s
py 3.12
1/2 runs
✓ 16.5s
py 3.13
1/2 runs
✓ 16.95s
py 3.9
1/2 runs
✓ 29.55s
443MB installed
● package 443MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

silero
from livekit.plugins import silero
VAD
from livekit.plugins.silero.vad import VAD
from livekit.plugins.silero import VAD
VAD is typically accessed via the top-level 'silero' import (e.g., `silero.VAD.load()`), but the class itself is in `livekit.plugins.silero.vad` if direct import is needed.

This quickstart demonstrates how to integrate `livekit-plugins-silero` into a LiveKit Agent. It sets up an `AgentServer` with a `prewarm` function to load the Silero VAD model efficiently once per process. The `my_agent` entrypoint then retrieves the prewarmed VAD instance and initializes an `AgentSession` with it, enabling voice activity detection for the agent. Remember to download model weights before running.

import asyncio import os from livekit.agents import AgentServer, AgentSession, JobContext, JobProcess, cli from livekit.plugins import silero # Ensure LiveKit credentials are set up as environment variables # LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET server = AgentServer() def prewarm(proc: JobProcess): # Load the VAD model once per process for faster job startup print("Prewarming Silero VAD model...") proc.userdata["vad"] = silero.VAD.load() print("Silero VAD model prewarmed.") server.setup_fnc = prewarm @server.rtc_session(agent_name="my-silero-agent") async def my_agent(ctx: JobContext): print(f"Agent {ctx.agent_name} received job {ctx.job_id}") await ctx.connect() # Retrieve the prewarmed VAD instance vad = ctx.proc.userdata["vad"] # Example: Initializing AgentSession with Silero VAD session = AgentSession( ctx, vad=vad, # Other components like STT, TTS, LLM would go here # stt=..., # tts=..., # llm=..., ) print("Agent session started with Silero VAD.") try: await session.start() # Keep the agent running, e.g., for a conversation loop await asyncio.sleep(600) # Keep alive for 10 minutes finally: await session.end() print("Agent session ended.") if __name__ == "__main__": # Important: Download model weights before first run: # python -m livekit.agents.cli download-files # Set dummy credentials for runnable quickstart if not in environment os.environ.setdefault('LIVEKIT_URL', os.environ.get('LIVEKIT_URL', 'wss://your-livekit-server.livekit.cloud')) os.environ.setdefault('LIVEKIT_API_KEY', os.environ.get('LIVEKIT_API_KEY', 'SK_XXXXX')) os.setdefault('LIVEKIT_API_SECRET', os.environ.get('LIVEKIT_API_SECRET', 'YOUR_SECRET')) cli.run_app(server)
Debug
Known issues
breakingLiveKit Agents v1.5.0 introduced significant changes to how turn handling (including VAD settings) is configured. Old keyword arguments like `min_endpointing_delay` and `allow_interruptions` in `AgentSession` are deprecated and will be removed in v2.0. Users should migrate to the new `TurnHandlingOptions` dictionary.
fix
Update `AgentSession` initialization to use the `turn_handling` parameter with a `TurnHandlingOptions` dictionary. For example, to opt out of adaptive interruption and use VAD-only interruption, set `turn_handling={'interruption': {'mode': 'vad'}}`.
affects: >=1.5.0
gotchaThe Silero VAD model weights are not bundled with the package and must be downloaded separately before the first use. Failure to do so will result in runtime errors.
fix
Run `python -m livekit.agents.cli download-files` from your terminal or include this command in your deployment script.
affects: All versions
gotchaLoading the Silero VAD model via `silero.VAD.load()` is a blocking operation. Calling it directly within each agent session's entrypoint can lead to slow startup times for new jobs.
fix
It is highly recommended to prewarm the VAD model by loading it once in an `AgentServer`'s `setup_fnc` (or similar pre-job hook) and then passing the preloaded instance to each `AgentSession`.
affects: All versions
gotchaBy default, Silero VAD runs on the CPU. While it supports GPU acceleration (e.g., with `onnxruntime-gpu`), explicitly setting `force_cpu=False` during loading and ensuring the correct GPU environment is configured is necessary. Simply installing `onnxruntime-gpu` might not be sufficient to guarantee GPU utilization.
fix
If GPU inference is desired, set `force_cpu=False` when calling `silero.VAD.load()` and verify your `onnxruntime-gpu` installation and environment are correctly configured to utilize the GPU.
affects: All versions
Errors
Common errors & fixes
ValueError: If an unsupported sample rate is provided.
The Silero VAD model only supports specific audio sample rates (8KHz and 16KHz), and the provided audio input or configuration uses an unsupported rate.
fix
Ensure your audio input or the `sample_rate` parameter in `silero.VAD.load()` is set to either 8000 or 16000 Hz. For example: `vad = silero.VAD.load(sample_rate=16000)`.
WARNING: inference is slower than realtime
The VAD model's inference is taking longer than the real-time audio duration, often occurring during initial startup or warmup, especially on less powerful machines or Windows environments.
fix
This is often a warning during warmup and may resolve itself once the agent is fully running. To potentially mitigate, ensure `onnxruntime` is optimally configured for your system, consider using `force_cpu=True` if you suspect GPU issues, or try prewarming the VAD model in a `prewarm` function within the LiveKit Agent framework.
silero stream failed
This generic error indicates a failure within the Silero VAD's internal streaming or processing logic, often seen in tracebacks pointing to `livekit.plugins.silero.vad.py`.
fix
Examine the full traceback for more specific details. Common causes include issues with the audio frames being pushed, unexpected audio data formats, or internal ONNX Runtime errors. Ensure your audio data is clean and consistently formatted. Check LiveKit Agent and `livekit-plugins-silero` versions for compatibility.
FileNotFoundError: No such file or directory: '.../livekit/plugins/silero/resources/silero_vad.onnx'
The required Silero VAD model weights (the `.onnx` file) have not been downloaded or cannot be found at the expected path after installation.
fix
After installing `livekit-plugins-silero`, you must explicitly download the model weights. If using `livekit-agents` CLI, run `uv run agent.py download-files` or similar command as instructed by LiveKit. If manually managing, ensure the `silero_vad.onnx` file is present in the `livekit/plugins/silero/resources` directory or specify its path using the `onnx_file_path` parameter in `silero.VAD.load()`.
Upgrade
Version history
1.7.1latest on PyPI · released Aug 27, 2026
Audit
Dependencies
livekit-agentsrequiredThis is a plugin for the LiveKit Agent Framework.
Agent activity
31 hits · last 30 days
node
28
OpenAI (training)
1
Resources
livekit-plugins-silero — pip install livekit-plugins-silero · libregistry