Hey HN, we've been working with OpenAI for the past few months on the new Realtime API.<p>The goal is to give everyone access to the same stack that underpins Advanced Voice in the ChatGPT app.<p>Under the hood it works like this:
- A user's speech is captured by a LiveKit client SDK in the ChatGPT app
- Their speech is streamed using WebRTC to OpenAI’s voice agent
- The agent relays the speech prompt over websocket to GPT-4o
- GPT-4o runs inference and streams speech packets (over websocket) back to the agent
- The agent relays generated speech using WebRTC back to the user’s device<p>The Realtime API that OpenAI launched is the websocket interface to GPT-4o. This backend framework covers the voice agent portion. Besides having additional logic like function calling, the agent fundamentally proxies WebRTC to websocket.<p>The reason for this is because websocket isn’t the best choice for client-server communication. The vast majority of packet loss occurs between a server and client device and websocket doesn’t provide programmatic control or intervention in lossy network environments like WiFi or cellular. Packet loss leads to higher latency and choppy or garbled audio.
Imagine being able to tell an app to call the IRS during the day, endure the on-hold wait times, then ask the question to the IRS rep and log the answer. Then deliver the answer when you get home.<p>Or, have the app call a pharmacy every month to refill prescriptions. For some drugs, the pharmacy requires a manual phone call to refill which gets very annoying.<p>So many use cases for this.
This is really helpful, thanks!<p>OpenAI hired the ex fractional CTO of LiveKit, who created Pion, a popular WebRTC library/tool.<p>I'd expect OpenAI to migrate off of LiveKit within 6 months. LiveKit is too expensive. Also, WebRTC is hard, and OpenAI now being a less open company will want to keep improvements to itself.<p>Not affiliated with any competitors, but I did work at a PaaS company similar to LiveKit but used Websockets instead.
Super cool! Didn't realize OpenAI is just using LiveKit.<p>Does the pricing breakdown to be the same as having a OpenAI Advanced Voice socket open the whole time? It's like $9/hr!<p>It would be theoretically cheaper to use this without keeping the advanced voice socket open the whole time and just use the GPT4o streaming service [1] for whenever inference is needed (pay per token) and use livekits other components to do the rest (TTS, VAD etc.).<p>What's the trade off here?<p>[1]: <a href="https://platform.openai.com/docs/api-reference/streaming" rel="nofollow">https://platform.openai.com/docs/api-reference/streaming</a>
That’s some crazy marketing for a „our library happened to support this relatively simple use case“ situation. Impressive!<p>By the way: The cerebras voice demo <i>also</i> uses LiveKit for this: <a href="https://cerebras.vercel.app/" rel="nofollow">https://cerebras.vercel.app/</a>
Olivier, Michelle, and Romain gave you guys a shoutout like 3 times in our DevDay recap podcast if you need more testimonial quotes :) <a href="https://www.latent.space/p/devday-2024" rel="nofollow">https://www.latent.space/p/devday-2024</a>
Is there anyone besides OpenAI working on a speech to speech model? I find it incredibly useful and it's the sole reason that I pay for their service but I do find it very limited. I'd be interested to know if any other groups are doing research on voice models.
This suggests that the AI "brain" receives the user input as text prompt (agent relays the speech prompt to GPT-4o) and generates audio as output (GPT-4o streams speech packets back to the agent).<p>But when I asked advanced voice mode it said the exact opposite. That it receives input as audio and generates text as output.
Nice they have many partners on this. I see Azure as well.<p>There is a common consensus that the new Realtime API is not actually using the same Advanced Voice model / engine - or however it works - since at least the TTS part doesn’t seem to be as capable as the one shipped with the official OpenAI app.<p>Any idea on this?<p>Source: <a href="https://github.com/openai/openai-realtime-api-beta/issues/2">https://github.com/openai/openai-realtime-api-beta/issues/2</a>
so the WebRTC helps with the unreliable network between the mobile clients and the server side. if the application is backend only, would it make sense to use WebRTC or should I go directly to realtime api?