can we use openrouter as a llm provider?
# ask-ai
j
can we use openrouter as a llm provider?
t
Thanks for reaching out, Tyler. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Absolutely, LiveKit can work smoothly with OpenRouter as an LLM provider. You can easily set it up using the
with_openrouter
method from the OpenAI plugin. Here’s a little example to guide you:
Copy code
from livekit.plugins import openai

llm = openai.LLM.with_openrouter(
    model="auto",  # or specify a specific model
    api_key="your_openrouter_api_key",  # or set OPENROUTER_API_KEY env var
    site_url="https://yoursite.com",  # for analytics
    app_name="Your App Name"  # for analytics
)
Just be sure to provide your OpenRouter API key, either directly as an argument or by setting the
OPENROUTER_API_KEY
environment variable. If you’d like, I’m here to help with any advanced configurations or if you want to dive into more details—just let me know! Sources: livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/models.py