LiveKit
Using OpenRouter with LiveKit Agents
Using LiveKit Agents
LiveKit Agents is an open-source framework for building voice AI agents. The OpenRouter plugin allows you to access 500+ AI models from multiple providers through a unified API, with automatic fallback support and intelligent routing.
Installation
Install the OpenAI plugin to add OpenRouter support:
Authentication
The OpenRouter plugin requires an OpenRouter API key. Set OPENROUTER_API_KEY in your .env file.
Basic Usage
Create an OpenRouter LLM using the with_openrouter method:
Python
Advanced Features
Fallback Models
Configure multiple fallback models to use if the primary model is unavailable:
Python
Provider Routing
Control which providers are used for model inference:
Python
Web Search Plugin
Enable OpenRouter’s web search capabilities:
Python
Analytics Integration
Include site and app information for OpenRouter analytics:
Python