hundreds-rainbow-68836
11/17/2025, 10:39 AMelif self.provider == "azure":
azure_config = {
"language": self.language
}
speech_endpoint=os.getenv("AZURE_SPEECH_ENDPOINT")
if speech_endpoint:
azure_config["speech_endpoint"] = speech_endpoint
azure_config["speech_key"] = os.getenv("AZURE_SPEECH_API_KEY")
else:
azure_config["speech_key"] = os.getenv("AZURE_SPEECH_API_KEY")
azure_config["speech_region"] = os.getenv("AZURE_SPEECH_REGION")
self.stt_service = azure.STT(
**azure_config
)
now i set the endpoint and key in the env but i get this error
{
"message": "failed to synthesize speech, retrying in 0.1s\nTraceback (most recent call last):\n File \"/app/.venv/lib/python3.12/site-packages/livekit/agents/tts/tts.py\", line 267, in _main_task\n raise APIError(f\"no audio frames were pushed for text: {self._input_text}\")\nlivekit.agents._exceptions.APIError: no audio frames were pushed for text: Hi, I am Arya, an AWS Engineer designed and developed by NTT DATA. (body=None, retryable=True)",
"level": "WARNING",
"name": "livekit.agents",
"tts": "livekit.plugins.azure.tts.TTS",
"attempt": 1,
"streamed": false,
"pid": 28,
"job_id": "AJ_rJx8eDoYVaAi",
"timestamp": "2025-11-17T10:34:32.689836+00:00"
}tall-airline-16756
11/17/2025, 10:39 AMtall-airline-16756
11/17/2025, 10:41 AMuv add "livekit-agents[azure]~=1.2"
2. Next, make sure to set the necessary environment variables in your .env file:
AZURE_SPEECH_KEY, AZURE_SPEECH_REGION, and if you have it, AZURE_SPEECH_ENDPOINT.
3. Then, initialize the Azure STT and TTS plugins in your code like this:
from livekit.plugins import azure
# Initialize STT
stt = azure.STT()
# Initialize TTS
tts = azure.TTS(voice="en-US-JennyNeural", sample_rate=24000)
About the error message "no audio frames were pushed for text," this usually means the Azure service didn’t generate any audio. Here are a few friendly tips to help you troubleshoot:
• Double-check that your environment variables are correctly set and valid.
• Try enabling detailed logging to get more insight:
import logging
logging.basicConfig(level=logging.DEBUG)
• It can also help to test Azure TTS on its own, outside of LiveKit, using a simple script to send requests directly to Azure’s API.
• Make sure your SSML input is valid and that the sample rate you’re using (like 24000 Hz) is supported.
If you’re still running into trouble after these steps, just let me know—I’m here to help you figure it out together!
Sources: Azure Speech STT plugin guide | LiveKit Docs | Azure Speech TTS plugin guide | LiveKit Docs | examples/voice_agents/error_callback.py