Request for OpenAI Team: Need Split Frontend and Backend Example for Real-Time API

Dear OpenAI Team and community,

I’m reaching out to request your assistance in providing a working example of OpenAI Real-Time API with a split frontend and backend setup. The current documentation only includes a frontend solution, which poses a risk of exposing the API key. A comprehensive example demonstrating how to implement both frontend and backend components would be immensely helpful for developers looking to integrate your API without compromising security.

Thank you for your attention to this matter.

Best regards,

Tomas K
Selendia AI

While not an official example, here is our Real-Time API front-end and back-end solution. We are leveraging the open-source Your Priorities platform and the Policy Synth AI library.

Our solution integrates a hybrid voice/text interface. We are using WebSockets to send audio to the client but plan to upgrade this functionality to WebRTC soon.

Back-end:

Front-end:

One example of this code in action:

The AI agent library driving our solution:

1 Like

Hi @robertb , thank you for fast reply. Unfortunatelly you are running javascript code on frontend so its big security risk.

The OpenAI API key is never exposed to the front-end and we use our own user/role system to control access. So pretty much exactly like in the quote above about secure usage of the API.

We would like to see working example code of connection between backend and openai websocket for Real Time API.

Update: solved by update from Openai, rollout webRTC (Implementing an ephemeral API key). Thank you :pray:

2 Likes

solution is also over node.js server.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.