Overview
Azure OpenAI provides access to OpenAI's powerful language models like gpt-4o
and o1
through Azure's managed service. With LiveKit's Azure OpenAI integration and the Agents framework, you can build sophisticated voice AI applications using their industry-leading models.
Using the OpenAI platform instead of Azure? See our OpenAI LLM integration 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.0"
Authentication
The Azure OpenAI plugin requires either an Azure OpenAI API key or a Microsoft Entra ID token.
Set the following environment variables in your .env
file:
AZURE_OPENAI_API_KEY
orAZURE_OPENAI_ENTRA_TOKEN
AZURE_OPENAI_ENDPOINT
OPENAI_API_VERSION
Usage
Use Azure 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.with_azure(azure_deployment="<model-deployment>",azure_endpoint="https://<endpoint>.openai.azure.com/", # or AZURE_OPENAI_ENDPOINTapi_key="<api-key>", # or AZURE_OPENAI_API_KEYapi_version="2024-10-01-preview", # or OPENAI_API_VERSION),# ... tts, stt, vad, turn_detection, etc.)
Parameters
This section describes the Azure-specific parameters. For a complete list of all available parameters, see the plugin documentation.
Name of your model deployment.
Microsoft Entra ID authentication token. Required if not using API key authentication. To learn more see Azure's Authentication documentation.
Additional resources
The following links provide more information about the Azure OpenAI LLM plugin.
Python package
The livekit-plugins-openai
package on PyPI.
Plugin reference
Reference for the Azure OpenAI LLM plugin.
GitHub repo
View the source or contribute to the LiveKit OpenAI LLM plugin.
Azure OpenAI docs
Azure OpenAI service documentation.
Voice AI quickstart
Get started with LiveKit Agents and Azure OpenAI.
Azure ecosystem overview
Overview of the entire Azure AI ecosystem and LiveKit Agents integration.