echoing-lamp-18687
12/16/2025, 11:09 AMfrom livekit.agents import AgentSession, inference
session = AgentSession(
llm=inference.LLM(
model="gpt-oss-120b", # host model name
provider="openai", # or other provider name
api_key="YOUR_API_KEY", # from the inference provider
base_url="<https://api.provider.com/v1>", # custom endpoint
),
# other LiveKit settings (tts, stt, etc.)
)tall-airline-16756
12/16/2025, 11:09 AMtall-airline-16756
12/16/2025, 11:09 AMapi_key and base_url to inference.LLM to use another provider. Short answer: no — LiveKit Inference is a managed gateway and does not accept api_key or base_url.
What you can do:
• Use a plugin instead (for example livekit.plugins.openai.LLM) which lets you specify api_key and base_url for OpenAI‑compatible providers.
Example using the OpenAI plugin:
from livekit.agents import AgentSession
from livekit.plugins import openai
session = AgentSession(
llm=openai.LLM(
model="model-name",
base_url="<https://api.provider.com/v1>",
api_key="YOUR_API_KEY"
),
# other settings...
)
If you want, tell me which provider you plan to use and I can show the exact plugin usage or confirm compatibility.
Sources: Models | LiveKit Docs | Introducing LiveKit Inference: A unified model interface for voice AI | Qwen LLM | LiveKit Docs | OpenAI and LiveKit | LiveKit docsechoing-lamp-18687
12/16/2025, 11:56 AMtall-airline-16756
12/16/2025, 11:56 AMlivekit.plugins.openai.LLM) and set base_url and api_key as shown earlier.
• If no (custom API): I can help you either build a small custom plugin adapter or map Qubrid’s API to LiveKit’s plugin interface.
Please tell me which of these is true for Qubrid (OpenAI‑compatible or not), and if possible paste an example request/response from Qubrid’s API (auth header and chat/completion endpoint) so I can give exact code snippets.echoing-lamp-18687
12/16/2025, 11:57 AMechoing-lamp-18687
12/16/2025, 12:04 PMtall-airline-16756
12/16/2025, 12:04 PMbase_url and api_key. Example:
from livekit.agents import AgentSession
from livekit.plugins import openai
session = AgentSession(
llm=openai.LLM(
model="gpt-4o-mini", # Qubrid model name
base_url="<https://platform.qubrid.com/v1>", # Qubrid base URL (example)
api_key="YOUR_QUBRID_API_KEY",
),
# other LiveKit settings (tts, stt, etc.)
)
# Example: ask a simple chat prompt via the session API
response = session.chat.create(
messages=[{"role": "user", "content": "Summarize the benefits of using Qubrid with LiveKit."}]
)
print(response.choices[0].message["content"])
Notes:
• Replace model, base_url, and api_key with the exact values Qubrid provides.
• If Qubrid’s OpenAI-compat path differs (e.g., /v1/openai), use that full base URL.
• Tell me the exact base URL or a sample request/response if you want a tailored snippet or if you run into auth/response shape issues.