openai.LLM.with_openrouter doesnt work now?
# ask-ai
j
openai.LLM.with_openrouter doesnt work now?
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.
I'm here to help you with the
openai.LLM.with_openrouter
method, which is still fully supported and functional. If you're running into any issues, let's walk through some common troubleshooting steps together: 1. API Key: Please double-check that your OpenRouter API key is set correctly—either as an environment variable (
OPENROUTER_API_KEY
) or passed directly when calling the method. 2. Package Installation: Make sure the
livekit-plugins-openai
package is installed and up-to-date. You can update it easily with
pip install --upgrade livekit-plugins-openai
. 3. Correct Usage: Here's a quick reminder on how to import and use the method:
Copy code
from livekit.plugins import openai
llm = openai.LLM.with_openrouter(model="auto")
4. Network Issues: It’s a good idea to verify your connection to
https://openrouter.ai
and ensure there are no timeouts happening. 5. Model Selection: Use a valid model name or simply
"auto"
for automatic selection. You can also specify fallback models if needed. 6. Debugging: To get more insight, try enabling debug logging by setting
export LK_OPENAI_DEBUG=1
in your environment. If you’re still experiencing difficulties, please feel free to share the exact error message or describe what’s happening, along with your setup details. I’m here to help you get this sorted out! Sources: OpenRouter LLM plugin guide | LiveKit docs | livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/real...