Files
livekit-agents/python/livekit-plugins/livekit-plugins-azure
Théo Monnom 09262038db Harden realtime, worker and recording boundaries
Run realtime DST scenarios through production provider bookkeeping, with
asynchronous transcription, provider failures, response correlation and
cross-provider history coverage. Ignore unknown provider messages and
settle pending operations when streams or host tasks disappear.

Make job phases own their operations, preserve token restrictions on
refresh, validate inference options and contain failures at external
boundaries. Remove the duplicate Rust media benchmark.

Compare recordings against independent speaker PCM and keep transcripts,
provider spans and reports on the session audio clock across wall-clock
corrections. Preserve silence duration in Gladia energy filtering.

Add regression tests and document the provider and recording audit
findings, including the remaining backend waveform issue and two
independently reproduced baseline storage DST failures.
2026-11-18 04:07:42 -08:00
..

Azure Plugin for LiveKit Agents

Complete Azure AI integration for LiveKit Agents, including Azure Speech Services and Azure Voice Live Realtime API.

What's included:

  • RealtimeModel - Azure Voice Live for speech-to-speech
  • STT - Powered by Azure Speech Services
  • TTS - Powered by Azure Speech Services with neural voices

For Azure OpenAI LLM (non-realtime), see the OpenAI plugin which supports LLM.with_azure().

See https://docs.livekit.io/agents/integrations/azure/ for more information.

Installation

pip install livekit-plugins-azure

Realtime Mode (Azure Voice Live)

Azure Credentials

export AZURE_VOICE_LIVE_ENDPOINT=https://<resource>.services.ai.azure.com
export AZURE_VOICE_LIVE_API_KEY=<your-key>
export AZURE_VOICE_LIVE_MODEL=<model-name>  # e.g., gpt-realtime, gpt-4.1

To authenticate with Microsoft Entra ID instead of an API key, pass entra_token= a token with the https://ai.azure.com/.default scope.

You can choose between GPT-Realtime, GPT-5, GPT-4.1, Phi and more. For supported models and regions, see Supported models and regions.

Quick Start

from livekit.agents import Agent, VoiceSession
from livekit.plugins import azure

session = VoiceSession(
    llm=azure.realtime.RealtimeModel(voice="en-US-AvaMultilingualNeural"),
)

Advanced Configuration

Voice Live options are records from azure.realtime:

import os
from livekit.plugins import azure

model = azure.realtime.RealtimeModel(
    endpoint=os.getenv("AZURE_VOICE_LIVE_ENDPOINT"),
    api_key=os.getenv("AZURE_VOICE_LIVE_API_KEY"),
    model="gpt-4.1",
    voice="en-US-AvaMultilingualNeural",
    # azure-speech with text models such as gpt-4.1, whisper-1 with gpt-realtime
    input_audio_transcription=azure.realtime.AudioTranscription(
        model="azure-speech", language="en-US"
    ),
    turn_detection=azure.realtime.AzureSemanticVad(
        silence_duration_ms=500, remove_filler_words=True
    ),
    input_audio_noise_reduction=azure.realtime.AzureDeepNoiseSuppression(),
)

RealtimeModel Parameters

Parameter Description Default
endpoint Azure Voice Live resource endpoint AZURE_VOICE_LIVE_ENDPOINT env var
api_key Azure API key AZURE_VOICE_LIVE_API_KEY env var
entra_token Microsoft Entra token, instead of an API key None
model Model name AZURE_VOICE_LIVE_MODEL env var, or gpt-realtime
voice Azure voice name, OpenAI voice name, or an AzureVoice en-US-AvaMultilingualNeural
modalities ["text"] for text-only responses audio
input_audio_transcription AudioTranscription(model=, language=), None to disable azure-speech for text models and phi4-mm-realtime, whisper-1 otherwise
turn_detection ServerVad(...) or AzureSemanticVad(type=...) (azure_semantic_vad, azure_semantic_vad_en, azure_semantic_vad_multilingual) server VAD
input_audio_noise_reduction AzureDeepNoiseSuppression(), "near_field" or "far_field" None
tool_choice Function calling mode "auto"
max_output_tokens Maximum output tokens per response, None for unlimited 4096

See How to use the Voice Live API for every turn detection, noise suppression and voice option.

Pipeline Mode (STT + LLM + TTS)

Azure Credentials

Azure Speech Services (for STT/TTS)

export AZURE_SPEECH_KEY=<your-speech-key>
export AZURE_SPEECH_REGION=<your-region>  # e.g., eastus, westus2

Azure OpenAI (for LLM)

export AZURE_OPENAI_ENDPOINT=https://<your-resource>.openai.azure.com
export AZURE_OPENAI_API_KEY=<your-openai-key>
export AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o
export AZURE_OPENAI_API_VERSION=2024-10-01-preview

Quick Start

For more control over individual components:

from livekit.agents import Agent, VoiceSession
from livekit.plugins import azure, openai, silero

session = VoiceSession(
    stt=azure.STT(),
    llm=openai.LLM.with_azure(
        model="gpt-4o",
        azure_endpoint="https://your-resource.openai.azure.com",
        api_key="your-api-key",
        api_version="2024-10-01-preview",
    ),
    tts=azure.TTS(voice="en-US-JennyNeural"),
    vad=silero.VAD.load(),
)

await session.start(room=ctx.room, agent=Agent(instructions="You are helpful."))

Voice Selection

Azure provides a wide variety of neural voices. Use multilingual voices for multi-language support:

# Multilingual voices (recommended)
model = azure.realtime.RealtimeModel(
    voice="en-US-AvaMultilingualNeural"
)

# Or use TTS with specific voices
tts = azure.TTS(voice="en-US-JennyNeural")

Popular voices:

  • en-US-AvaMultilingualNeural - Multilingual, feminine
  • en-US-AndrewMultilingualNeural - Multilingual, masculine
  • en-US-JennyNeural - English, feminine
  • en-US-GuyNeural - English, masculine

See Azure Voice Gallery for full list.

HD Voices

For higher quality audio, use DragonHD voices:

tts = azure.TTS(voice="en-US-Ava:DragonHDLatestNeural")

Resources