acceptable-postman-74472
09/30/2025, 1:37 AMtall-airline-16756
09/30/2025, 1:37 AMtall-airline-16756
09/30/2025, 1:38 AMlivekit-agents v1.2.12 and livekit-plugins-openai v1.2.12. This usually happens when there's a mismatch between the API endpoint you intend to use and the one actually being accessed. Let’s walk through some steps together to help you resolve this:
1. Verify TTS Initialization Syntax: Double-check that you're using the correct syntax for your setup. For standard OpenAI, it should look like this:
from livekit.plugins import openai
session = AgentSession(
tts=openai.TTS(
model="gpt-4o-mini-tts",
voice="ash",
instructions="Speak in a friendly and conversational tone.",
),
# ... llm, stt, etc.
)
2. Check for Azure OpenAI Misconfiguration: If you’re using Azure OpenAI, it’s important to use the .with_azure() method like this:
from livekit.plugins import openai
session = AgentSession(
tts=openai.TTS.with_azure(
model="gpt-4o-mini-tts",
voice="coral",
azure_endpoint="https://your-resource.openai.azure.com",
api_key="your-api-key"
)
)
Using the wrong method here can lead to that 404 error, so it’s a good idea to double-check.
3. Validate API Key and Environment Variables: Make sure your environment variables are set correctly:
â—¦ For OpenAI: OPENAI_API_KEY
â—¦ For Azure OpenAI: AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT, and optionally AZURE_OPENAI_AD_TOKEN
1. Review Custom Base URLs: If you’re using a custom base_url, please confirm it points to a valid OpenAI-compatible endpoint. If you’re not using a proxy or custom gateway, it’s best to leave base_url out so the default endpoint is used.
2. Confirm Model and Voice Availability: Supported models include gpt-4o-mini-tts, tts-1, and tts-1-hd. Please ensure the model and voice combination you’re using is valid.
If after these checks the problem still persists, try enabling debug logging in your agent to capture the exact URL being requested. This can give us more clues to track down the issue. Please don’t hesitate to reach out if you need any more help—I’m here to support you!
Sources: OpenAI TTS integration guide | LiveKit Docs | Docs::Agents | tests/test_tts.py | pipeline-tts/openai_tts.py | Docs::Agentsacceptable-postman-74472
09/30/2025, 1:39 AMtall-airline-16756
09/30/2025, 1:40 AM