Overview
OpenAI provides powerful language models like gpt-4o
and o1
. With LiveKit's OpenAI integration and the Agents framework, you can build sophisticated voice AI applications using their industry-leading models.
Using Azure OpenAI? See our Azure OpenAI LLM guide.
Quick reference
This section includes a basic usage example and some reference material. For links to more detailed documentation, see Additional resources.
Installation
Install the plugin from PyPI:
pip install "livekit-agents[openai]~=1.0rc"
Authentication
The OpenAI plugin requires an OpenAI API key.
Set OPENAI_API_KEY
in your .env
file.
Usage
Use OpenAI within an AgentSession
or as a standalone LLM service. For example, you can use this LLM in the Voice AI quickstart.
from livekit.plugins import openaisession = AgentSession(llm=openai.LLM(model="gpt-4o-mini"),# ... tts, stt, vad, turn_detection, etc.)
Parameters
This section describes some of the available parameters. See the plugin reference for a complete list of all available parameters.
The model to use for the LLM. For more information, see the OpenAI documentation.
A measure of randomness in output. A lower value results in more predictable output, while a higher value results in more creative output.
Specifies whether to use tools during response generation.
Additional resources
The following resources provide more information about using OpenAI with LiveKit Agents.
Python package
The livekit-plugins-openai
package on PyPI.
Plugin reference
Reference for the OpenAI LLM plugin.
GitHub repo
View the source or contribute to the LiveKit OpenAI LLM plugin.
OpenAI docs
OpenAI platform documentation.
Voice AI quickstart
Get started with LiveKit Agents and OpenAI.
OpenAI ecosystem overview
Overview of the entire OpenAI and LiveKit Agents integration.