LiveKit docs › Partner spotlight › Azure › Azure OpenAI LLM

---

# Azure OpenAI LLM plugin guide

> How to use the Azure OpenAI LLM plugin for LiveKit Agents.

Available in:
- [x] Node.js
- [x] Python

## Overview

This plugin allows you to use [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service) as an LLM provider for your voice agents.

> 💡 **LiveKit Inference**
> 
> Azure OpenAI is also available in LiveKit Inference, with billing and integration handled automatically. See [the docs](https://docs.livekit.io/agents/models/llm/openai.md) for more information.

## Quick reference

This section includes basic usage and reference material for each API mode. For links to more detailed documentation, see [Additional resources](#additional-resources).

The Azure OpenAI plugin supports two API modes:

- The [Responses API](#responses-api) is available in Python only and is the newer endpoint with support for provider tools such as web search and file search. It is the recommended option for new Python projects when you want the latest capabilities and tooling.
- The [Chat Completions API](#chat-completions-api) is available in both Python and Node.js. Use it with Node.js or when you need the established endpoint or compatibility with existing code.

To learn more about OpenAI's different modes, see [API modes](https://docs.livekit.io/agents/models/llm/openai.md#api-modes).

### Responses API

Available in:
- [ ] Node.js
- [x] Python

The Responses API is the recommended option for Python projects.

#### Installation

Install the Azure plugin to add Azure OpenAI support:

```shell
uv add "livekit-agents[azure]~=1.5"

```

#### Authentication

Use an [Azure OpenAI API key](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource) or a Microsoft Entra ID token. Set the following in your `.env` file:

- `AZURE_OPENAI_API_KEY` or `AZURE_OPENAI_AD_TOKEN`
- `AZURE_OPENAI_ENDPOINT`
- `OPENAI_API_VERSION`

#### Usage

Use the Azure plugin and `azure.responses.LLM()` within an `AgentSession` or as a standalone LLM. For example, you can use this LLM in the [Voice AI quickstart](https://docs.livekit.io/agents/start/voice-ai.md).

```python
from livekit.plugins import azure

session = AgentSession(
    llm=azure.responses.LLM(
        model="gpt-4o",
        azure_deployment="<model-deployment>",
        azure_endpoint="https://<endpoint>.openai.azure.com/",  # or AZURE_OPENAI_ENDPOINT
        api_version="2024-10-01-preview",  # or OPENAI_API_VERSION
    ),
    # ... tts, stt, vad, turn_detection, etc.
)

```

### Chat Completions API

Available in:
- [x] Node.js
- [x] Python

Use the Chat Completions API mode with Node.js or when you prefer the Chat Completions format.

#### Installation

Install the OpenAI plugin to add OpenAI support:

**Python**:

```shell
uv add "livekit-agents[openai]~=1.5"

```

---

**Node.js**:

```shell
pnpm add @livekit/agents-plugin-openai@1.x

```

#### Authentication

Use an [Azure OpenAI API key](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource) or a Microsoft Entra ID token. Set the following in your `.env` file:

- `AZURE_OPENAI_API_KEY` or `AZURE_OPENAI_AD_TOKEN`
- `AZURE_OPENAI_ENDPOINT`
- `OPENAI_API_VERSION`

#### Usage

Use the Azure OpenAI plugin within an `AgentSession` or as a standalone LLM. For example, you can use this LLM in the [Voice AI quickstart](https://docs.livekit.io/agents/start/voice-ai.md).

**Python**:

```python
from livekit.plugins import openai

session = AgentSession(
    llm=openai.LLM.with_azure(
        azure_deployment="<model-deployment>",
        azure_endpoint="https://<endpoint>.openai.azure.com/", # or AZURE_OPENAI_ENDPOINT
        api_key="<api-key>", # or AZURE_OPENAI_API_KEY
        api_version="2024-10-01-preview", # or OPENAI_API_VERSION
    ),
    # ... tts, stt, vad, turn_handling, etc.
)

```

---

**Node.js**:

```typescript
import * as openai from '@livekit/agents-plugin-openai';

const session = new voice.AgentSession({
    llm: openai.LLM.withAzure({
        azureDeployment: "<model-deployment>",
        azureEndpoint: "https://<endpoint>.openai.azure.com/",  // or AZURE_OPENAI_ENDPOINT
        apiKey: "<api-key>",  // or AZURE_OPENAI_API_KEY
        apiVersion: "2024-10-01-preview",  // or OPENAI_API_VERSION
    }),
    // ... tts, stt, vad, turnHandling, etc.
});

```

## Parameters

The following parameters are commonly used. For a complete list, see the plugin reference links in the [Additional resources](#additional-resources) section.

- **`azure_deployment`** _(string)_: Name of your model deployment.

- **`azure_ad_token`** _(string)_ (optional) - Environment: `AZURE_OPENAI_AD_TOKEN`: Azure Active Directory token. Required if not using API key authentication. To learn more, see Azure's [Authentication](https://learn.microsoft.com/en-us/azure/api-management/api-management-authenticate-authorize-azure-openai) documentation.

- **`temperature`** _(float)_ (optional) - Default: `0.1`: Sampling temperature that controls the randomness of the model's output. Higher values make the output more random, while lower values make it more focused and deterministic. Range of valid values can vary by model.

 Valid values are between `0` and `2`.

- **`max_completion_tokens`** _(int)_ (optional): Available in:
- [ ] Node.js
- [x] Python

Maximum number of tokens to generate in the completion.

**Required** if using o-series models (`o1`, `o3`) on Azure, which use `max_completion_tokens` instead of `max_tokens`.

- **`parallel_tool_calls`** _(bool)_ (optional): Controls whether the model can make multiple tool calls in parallel. When enabled, the model can make multiple tool calls simultaneously, which can improve performance for complex tasks.

- **`tool_choice`** _(ToolChoice | Literal['auto', 'required', 'none'])_ (optional) - Default: `auto`: Controls how the model uses tools. String options are as follows:

- `'auto'`: Let the model decide.
- `'required'`: Force tool usage.
- `'none'`: Disable tool usage.

- **`timeout`** _(httpx.Timeout | None)_ (optional) - Default: `httpx.Timeout(connect=15.0, read=5.0, write=5.0, pool=5.0)`: Available in:
- [ ] Node.js
- [x] Python

Configures connect, read, write, and pool timeouts on the underlying HTTP client.

## Additional resources

The following links provide more information about the Azure OpenAI LLM plugin.

- **[Azure OpenAI docs](https://learn.microsoft.com/en-us/azure/ai-services/openai/)**: Azure OpenAI service documentation.

- **[Voice AI quickstart](https://docs.livekit.io/agents/start/voice-ai.md)**: Get started with LiveKit Agents and Azure OpenAI.

- **[Azure ecosystem overview](https://docs.livekit.io/agents/integrations/azure.md)**: Overview of the entire Azure AI ecosystem and LiveKit Agents integration.

---

This document was rendered at 2026-06-07T11:36:31.442Z.
For the latest version of this document, see [https://docs.livekit.io/agents/models/llm/azure-openai.md](https://docs.livekit.io/agents/models/llm/azure-openai.md).

To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).