This project demonstrates real-time communication using WebSockets and OpenAI's Function Calling API. It is designed as a minimal example to show how you can build an interactive, real-time system powered by AI responses.
- π WebSocket server for real-time messaging
- π€ Integration with OpenAI's Function Calling API
- π οΈ Simple, readable Node.js backend
- Clone the repository
git clone https://github.com/crisperpo/realtime-demo.git
cd realtime-demo
- Install dependencies
npm install
- Set up environment variables
Create a .env
file in the root directory and add your OpenAI API key:
OPENAI_API_KEY=your-api-key-here
Start the WebSocket server:
node index.js
Clients can connect to ws://localhost:3000
to send and receive messages.
- Client sends a message via WebSocket.
- The server processes the message using OpenAI's function calling API.
- The response (including structured function output) is sent back to the client in real time.
MIT License Built by @crisperpo with π‘