adorable-hairdresser-72064
07/08/2025, 12:53 PMtall-airline-16756
07/08/2025, 12:53 PMtall-airline-16756
07/08/2025, 12:54 PM<https://api.openai.com/v1/>
when using the livekit-agents[deepgram,openai,silero]>=1.1.0
package typically occurs because the OpenAI Realtime API endpoint and connection protocol are not correctly configured.
To resolve this, you need to ensure:
• The base URL for the OpenAI Realtime API should include the /realtime
endpoint and use a WebSocket connection via the wss://
protocol rather than https://
.
• The API key is set correctly either as an environment variable (OPENAI_API_KEY
) or passed explicitly.
• You use the appropriate client setup, for example:
from livekit.plugins import openai
realtime_model = openai.realtime.RealtimeModel(
model="gpt-4o-realtime-preview"
)
The package will convert the base URL automatically to <wss://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview>
internally.
Also, ensure your package is up to date:
pip install --upgrade "livekit-agents[deepgram,openai,silero]>=1.1.0"
If you are using Azure OpenAI, you should configure it with the Azure-specific parameters.
Additional troubleshooting steps include verifying that your network allows WebSocket connections and that your API key has the correct permissions.
This approach resolves the 404 error caused by incorrect REST endpoint usage instead of the required WebSocket endpoint for OpenAI Realtime API.
Sources: README.md | OpenAI STT integration guide | LiveKit Docsadorable-hairdresser-72064
07/08/2025, 12:58 PM/realtime
endpoint and use a WebSocket connection via the wss://
protocol rather than https://
.tall-airline-16756
07/08/2025, 12:59 PMbase_url
parameter when initializing the RealtimeModel
.
Here's a cool behind-the-scenes detail: the package has this smart process_base_url
function that automatically converts your base URL (like `https://api.openai.com/v1`) into the right WebSocket URL (`wss://api.openai.com/v1/realtime?model=gpt-4`). It even adds the /realtime
path and switches to a secure WebSocket protocol - how neat is that?
Let me show you an example:
from livekit.plugins.openai import realtime
realtime_model = realtime.RealtimeModel(
model="gpt-4",
base_url="<https://api.openai.com/v1>",
api_key="your-api-key"
)
See? No need to wrestle with complex URL settings. Just provide the base REST URL and your API key, and you're all set!
Pro tip for Azure OpenAI users: this base_url
method works perfectly for you too, just use your Azure endpoint URL.
Sources: tests/test_config.py | Azure OpenAI Realtime API and LiveKit | LiveKit Docsadorable-hairdresser-72064
07/08/2025, 1:08 PMtall-airline-16756
07/08/2025, 1:09 PMlivekit-agents[deepgram,openai,silero]>=1.1.0
without Speech-to-Text (STT), good news – you won't need any extra complicated setup.
• Feel free to simply skip adding STT to your AgentSession
configuration.
• Go ahead and set up your LLM and TTS plugins like you normally would – maybe OpenAI for LLM and a cool TTS option like Silero or OpenAI TTS.
• Just a friendly tip: double-check that your LLM output plays nicely with your TTS input requirements.
From what I can tell, there aren't any special quirks or roadblocks when you're leaving STT out of the mix.
Sources: livekit-agents/livekit/agents/voice/agent.pyadorable-hairdresser-72064
07/08/2025, 1:24 PMtall-airline-16756
07/08/2025, 1:24 PMhttpx.HTTPStatusError: 404 Not Found
when trying to connect to OpenAI? No worries, I can help you sort this out!
The issue is actually pretty simple - when you're working with OpenAI's real-time API, you'll need to use a WebSocket URL that starts with wss://
. Think of it like speaking a specific "language" that the API understands.
Here's what a correct endpoint looks like:
<wss://api.openai.com/v1/realtime?model=gpt-4>
To fix this, when you're setting up your OpenAI Realtime client in livekit-agents
, just make sure you set the base_url
parameter right. Check out this example:
realtime_model = RealtimeModel(
model="gpt-4",
base_url="<https://api.openai.com/v1>",
api_key="your-api-key"
)
The cool part? The package will automatically convert your base URL to the correct WebSocket format, so you'll dodge that 404 error completely. Pretty neat, right? 😊adorable-hairdresser-72064
07/08/2025, 1:27 PMtall-airline-16756
07/08/2025, 1:27 PMbase_url
in the OpenAI RealtimeModel
. I know these technical details can be a bit confusing, so I'll break it down in a friendly way.
1. Think of the base_url
like the main entrance to the OpenAI API. You'll want to use the root endpoint, without the /realtime
path. For example:
<https://api.openai.com/v1>
2. Don't worry about the WebSocket magic – the package will handle converting this to the right URL behind the scenes.
3. A quick heads up: avoid adding /realtime
manually. That'll just lead to some annoying 404 errors, and we definitely want to avoid those!
4. If you're using Azure OpenAI, no stress! Just set your base_url
to your Azure endpoint and use RealtimeModel.with_azure()
for the specific Azure settings.
Here's a simple example for standard OpenAI setup:
model = RealtimeModel(
model="gpt-4",
base_url="<https://api.openai.com/v1>",
api_key="your-api-key"
)
And for my Azure friends:
model = RealtimeModel.with_azure(
azure_deployment="your-deployment",
base_url="<https://your-azure-endpoint.openai.azure.com>"
)
Trust me, this setup will keep those pesky 404 errors at bay and make your realtime endpoint work smoothly. You've got this!adorable-hairdresser-72064
07/08/2025, 1:29 PMtall-airline-16756
07/08/2025, 1:29 PMRealtimeModel
in your speech-to-text, language model, and text-to-speech workflow? I'd love to take a look and help you figure out what might be causing the issue. Sometimes these configuration details can be sneaky! 😊adorable-hairdresser-72064
07/08/2025, 1:30 PMtall-airline-16756
07/08/2025, 1:30 PMLLM
and TTS
clients—especially how you're handling the API key and whether you've configured any base_url
settings—that would help us get to the bottom of this together. I'm here to help!adorable-hairdresser-72064
07/08/2025, 1:31 PMtall-airline-16756
07/08/2025, 1:32 PMadorable-hairdresser-72064
07/08/2025, 1:33 PMtall-airline-16756
07/08/2025, 1:33 PMOPENAI_API_KEY
is set up correctly and can be accessed by your runtime environment.
• Make sure you're running the latest version of livekit-agents[deepgram,openai,silero]
(version 1.1.0 or newer) which has some important fixes for base URL processing.
• If you've got any custom environment settings or proxy configurations, take a quick look to make sure they aren't causing any connection hiccups.
The LiveKit library should handle the WebSocket endpoint conversion behind the scenes. If you're still seeing issues after checking these things, it might be worth reaching out to the LiveKit team for a deeper dive. I'm here if you need any more help!adorable-hairdresser-72064
07/08/2025, 1:34 PMtall-airline-16756
07/08/2025, 1:34 PM