elegant-magician-80782
10/16/2025, 9:31 AMtall-airline-16756
10/16/2025, 9:31 AMtall-airline-16756
10/16/2025, 9:32 AMelegant-magician-80782
10/16/2025, 9:34 AMtall-airline-16756
10/16/2025, 9:35 AMtimeout parameter when you initialize the LLM instance. For example:
from livekit.plugins.openai import LLM
import httpx
llm_instance = LLM(
model="gpt-4o",
timeout=httpx.Timeout(connect=30.0, read=60.0, write=30.0, pool=10.0)
)
• LiveKit Inference LLM: Try using the conn_options parameter in the chat() method to set a custom timeout like this:
from livekit.agents.inference.llm import LLM
from livekit.agents.types import APIConnectOptions
llm = LLM(model="openai/gpt-4o")
async with llm.chat(
chat_ctx=chat_context,
conn_options=APIConnectOptions(timeout=30.0) # Timeout in seconds
) as stream:
async for chunk in stream:
print(chunk)
• Google LLM Plugin: You can set the timeout in milliseconds using the http_options parameter like this:
from livekit.plugins.google import LLM
llm = LLM(
model="google/gemini-2.5-pro",
http_options={"timeout": 60_000} # 60 seconds in milliseconds
)
Feel free to adjust these settings based on what works best for your use case. And if you have any questions or need a hand with anything else, just let me know—I’m here to help!
Sources: livekit-agents/livekit/agents/llm/llm.py | Quotas and limits | LiveKit Docs | Operational Guidance & Best Practices | livekit/livekit_composite | DeepWik...