adorable-wall-42754
05/18/2026, 1:10 PMtall-airline-16756
05/18/2026, 1:10 PMtall-airline-16756
05/18/2026, 1:11 PMinference.LLM. Plugin LLMs (like openai.LLM() / openai.responses.LLM()) let you call the provider’s API directly with your own credentials, billing, and rate-limit handling. The observer pattern example uses inference.LLM, but switching to a plugin-based LLM achieves the same observer behavior without the gateway.
Do you want a short code example for wiring an observer to an OpenAI plugin LLM or help with credential setup?
Sources: How to Build a Background Observer for Voice AI Guardrails | LiveKit | How to Build a Background Observer for Voice AI Guardrails | LiveKit | Models overview | LiveKit Documentation | OpenAI LLM models | LiveKit Documentation | DeepSeek LLM | LiveKit Documentation, with interactive elementsadorable-wall-42754
05/18/2026, 1:11 PMtall-airline-16756
05/18/2026, 1:12 PM# Python-like pseudocode — adjust to your SDK/environment
# 1) Create a plugin-based LLM (OpenAI) with your provider key
from livekit_agents import plugins, Observer, RoomClient
openai_plugin = plugins.openai.OpenAILLM(api_key="OPENAI_API_KEY") # or use environment var
# 2) Create an observer which uses the plugin LLM
class MyObserver(Observer):
def __init__(self, llm):
self.llm = llm
async def on_message(self, message):
# Prepare prompt from observed message
prompt = f"Summarize this message for moderation: {message.text}"
# Call the plugin LLM directly (no inference gateway)
response = await self.llm.complete(prompt=prompt, max_tokens=100)
# Handle response (e.g., log, raise alert, or store)
print("Observer LLM response:", response.text)
# 3) Attach observer to a room/client to receive events
room = RoomClient(api_key="LIVEKIT_API_KEY", room="example-room")
observer = MyObserver(openai_plugin)
# Hook observer into room event stream (pseudo-code; use actual SDK event hooks)
room.on("message", observer.on_message)
# 4) Run event loop / client
await room.connect()
await room.listen_forever()
Notes:
• Replace method names (complete, response.text, event names) with the exact calls from your SDK/plugin implementation.
• You are responsible for provider credentials, billing, and rate limits when using plugin LLMs.
• If you want, I can provide the same example in TypeScript/Node or adapt it to your exact SDK version. Which language are you using?, with interactive elements