OpenAI realtime support on LiteLLM ? #7423
Replies: 3 comments 9 replies
-
Now that you've implemented cost tracking on /v1/realtime, we would use WebRTC for the realtime models through proxy if it was available. Implementing speech-to-speech is doable with websockets, but a lot more challenging. I also don't think your current implementation works with browser WebSocket at all, since you can't pass headers. Consider the example provided by OpenAI where subprotocols are used instead of headers to supply auth info: /*
Note that in client-side environments like web browsers, we recommend
using WebRTC instead. It is possible, however, to use the standard
WebSocket interface in browser-like environments like Deno and
Cloudflare Workers.
*/
const ws = new WebSocket(
"wss://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview-2024-12-17",
[
"realtime",
// Auth
"openai-insecure-api-key." + OPENAI_API_KEY,
// Optional
"openai-organization." + OPENAI_ORG_ID,
"openai-project." + OPENAI_PROJECT_ID,
// Beta protocol, required
"openai-beta.realtime-v1"
]
);
ws.on("open", function open() {
console.log("Connected to server.");
});
ws.on("message", function incoming(message) {
console.log(message.data);
}); |
Beta Was this translation helpful? Give feedback.
-
Would also be interesting to see AWS' implementation of realtime supported as well. Certainly not a priority for us, but I could see competitive realtime models being added to Bedrock in the future. |
Beta Was this translation helpful? Give feedback.
-
For others looking for an easy frontend implementation path, the following Chainlit example works really well with LiteLLM proxy. Basically just need to change the way it's setting the URL and API key and it works as is. https://github.com/Chainlit/cookbook/tree/main/realtime-assistant
Nevermind, it does implement the above fine. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Starting a discussion for LiteLLM's implementation for OpenAI realtime endpoint support
If you have a request or feedback please leave a comment
Open Questions:
Beta Was this translation helpful? Give feedback.
All reactions