astonishing-horse-62951
12/16/2025, 8:55 AMtall-airline-16756
12/16/2025, 8:56 AMtall-airline-16756
12/16/2025, 8:56 AMLLM.with_openrouter isn't working right now, could you share these details?
• The exact error message or logs you see (copy/paste).
• Your code snippet showing how you call LLM.with_openrouter.
• Your environment: Python/Node version, LiveKit Agents version, and whether you installed the OpenAI plugin (livekit-agents[openai]).
• How you set the OpenRouter key (confirm OPENROUTER_API_KEY in your .env or env vars).
• Whether this fails locally, in CI, or in production, and any recent changes (network, firewall, dependency updates).
Quick checklist you can verify now:
• OPENROUTER_API_KEY is set and valid.
• Correct model name (example: anthropic/claude-sonnet-4.5) or use openrouter/auto.
• Network allows outbound calls to OpenRouter.
• OpenAI plugin installed (uv add "livekit-agents[openai]~=1.2").
Share the error and environment details and I’ll point to the specific fix.
Sources: OpenRouter LLM plugin guide | LiveKit docsastonishing-horse-62951
12/16/2025, 5:33 PMtall-airline-16756
12/16/2025, 5:33 PMwith_openrouter on openai.LLM. That means your runtime's LiveKit Agents package doesn't expose that helper. To fix this, please check these items:
1. Verify the OpenAI plugin is installed:
◦ Run: pip show livekit-agents
◦ If you installed with extras, ensure you used the openai extra:
uv add "livekit-agents[openai]~=1.2" (or install the matching pip wheel for your environment).
1. Confirm the Agents version supports `with_openrouter`:
◦ Check the installed version from pip show. with_openrouter is available in the OpenAI plugin for the Agents release that includes the OpenRouter integration (install the same or newer than the example you followed).
1. Confirm imports are using the plugin namespace:
◦ Your code uses from livekit.plugins import openai — keep that import and then call openai.LLM.with_openrouter(...).
1. If you upgraded/installed while a worker was running, restart the worker process so the new package is loaded.
Please share the output of:
• pip show livekit-agents
• the top of your file imports (so I can confirm you're importing openai correctly)
With those I’ll tell you the exact next step.astonishing-horse-62951
12/16/2025, 5:39 PMtall-airline-16756
12/16/2025, 5:39 PMlivekit-agents 1.2.8 is installed and your editor's autocomplete shows other with_… helpers but not with_openrouter, which matches the AttributeError.
Quick actionable steps to resolve this:
1. Install or upgrade the OpenAI plugin package (it provides the OpenRouter helper):
◦ Run: pip install --upgrade livekit-plugins-openai
1. Restart the worker/process that runs your job so Python loads the updated package.
2. Confirm the plugin version and presence of the helper:
◦ Run: pip show livekit-plugins-openai
◦ In a Python REPL run:
from livekit.plugins import openai dir(openai.LLM)
Confirm with_openrouter appears in that listing.
If that doesn't expose with_openrouter, share the output of:
• pip show livekit-plugins-openai
• the dir(openai.LLM) result
I’ll guide the next step from there.astonishing-horse-62951
12/16/2025, 5:58 PMtall-airline-16756
12/16/2025, 5:59 PM.model and .provider from your turn_detection instance, but MultilingualModel doesn't define those attributes. That causes the AttributeError.
Two ways to resolve it:
1) Preferred — upgrade so the runtime and turn-detector plugin match
• Upgrade LiveKit Agents and the turn-detector plugin so the framework handles the detector type correctly.
• Install/update the extras:
◦ pip install --upgrade livekit-agents livekit-plugins-turn-detector
• Restart your worker/process after upgrading.
2) Quick workaround — provide compatible attributes via a thin wrapper
• Wrap the MultilingualModel so it exposes model and provider while delegating behavior:
class WrappedTurnDetector:
def __init__(self, detector):
self._detector = detector
self.model = "multilingual-eou-model" # compatibility value
self.provider = "livekit" # compatibility value
def __getattr__(self, name):
return getattr(self._detector, name)
Then use:
turn_detection = WrappedTurnDetector(MultilingualModel())
session = AgentSession(..., turn_detection=turn_detection)
Which path would you prefer — upgrade now or use the wrapper so you can continue without upgrading?
Sources: LiveKit turn detector plugin | LiveKit docs | Turn detection and interruptions | LiveKit Docs | Improved End-of-Turn Model Cuts Voice AI Interruptions 39%astonishing-horse-62951
12/16/2025, 6:17 PMtall-airline-16756
12/16/2025, 6:17 PMastonishing-horse-62951
12/16/2025, 9:19 PMtall-airline-16756
12/16/2025, 9:20 PMRoomOptions was moved out of the top-level livekit.agents namespace. Update your imports and any usages to the new location.
Do this:
1. Replace the import line:
from livekit.agents import AgentSession, RoomOptions, ChatContext
with:
from livekit.agents import AgentSession, ChatContext
from livekit.agents.voice import room_io
1. Replace RoomOptions(...) usages with room_io.RoomOptions(...) (and similarly for AudioInputOptions, etc.), for example:
await session.start(
...,
room_options=room_io.RoomOptions(
audio_input=room_io.AudioInputOptions(
noise_cancellation=noise_cancellation.BVC(),
),
),
)
Make that change and restart your worker. Tell me if you want me to scan the file and suggest exact replacements.
Sources: Text and transcriptions | LiveKit docs | Agent session | LiveKit docsastonishing-horse-62951
12/17/2025, 12:09 AMtall-airline-16756
12/17/2025, 12:10 AMsession = AgentSession(..., use_tts_aligned_transcript=True)
This syncs chat context commits with actual audio playback so the agent won’t treat text as finished until TTS finishes.
2) Prevent punctuation from being spoken
• Normalize/transforms before TTS by overriding transcription_node (strip or replace punctuation like "." so TTS won’t say “period”):
async def transcription_node(self, text, model_settings):
async for chunk in text:
if isinstance(chunk, str):
yield chunk.replace(".", "")
else:
yield chunk.model_copy(update={"text": chunk.text.replace(".", "")})
3) Reduce TTS latency
• Use a streaming/low-latency TTS provider (Cartesia Sonic, ElevenLabs) or a faster model.
• Tune provider parameters (speed/rate) if supported.
• If your TTS supports incremental streaming, enable it so audio begins on partial LLM output.
4) Avoid premature context commits
• Ensure you aren’t calling chat_ctx.add_message() manually before playback completes. Let the session add messages after playback or use aligned transcripts.
5) Observability and diagnostics
• Add observability to see timings:
ctx.add_observability_handler()
• Capture: LLM finish time, TTS start/stop, audio frame delays, CPU/network metrics.
Tell me:
• Which TTS provider/model you’re using and whether you call generate_reply() or say() — I’ll give exact parameter suggestions and a sample config to test. Sources: Text and transcriptions | LiveKit docs | Pipeline nodes and hooks | LiveKit docs | Rime TTS plugin guide | LiveKit Docs | ElevenLabs TTS plugin guide | LiveKit Docs | Agent speech and audio | LiveKit docs