This Starter Kit empowers developers to build modern, real-time applications effortlessly. Designed with simplicity and versatility in mind, this kit provides everything you need to create seamless, voice-interactive AI chat interfaces with real-time audio streaming and text responses.
OpenAI's latest WebRTC APIs, introduced on Day 9 of "12 Days of OpenAI" (December 17, 2024), are at the core of this starter kit, ensuring you can deliver exceptional user experiences. For more information, visit the OpenAI WebRTC documentation.
When building real-time applications, efficiency, scalability, and ease of use are critical. With the OpenAI WebRTC API Starter Kit, you can:
- Quickly set up real-time voice communication between users and AI.
- Utilize WebRTC's peer-to-peer connectivity for low-latency interactions.
- Monitor real-time events with live status updates.
- Enjoy a clean and responsive UI designed for modern applications.
To get started, you'll need:
- Node.js (v14 or higher)
- npm (v6 or higher)
- An OpenAI API key with WebRTC API access
- Clone the repository:
git clone https://github.com/gabrimatic/OpenAI-WebRTC-API-Starter-Kit.git
cd OpenAI-WebRTC-API-Starter-Kit
- Install dependencies:
npm install
- Set up your environment:
Create a
.env
file in the root directory and add your OpenAI API key:
OPENAI_API_KEY=your_openai_api_key_here
- Start the server:
npm start
- Open
index.html
in your browser or serve it using a local server.
Retrieves an ephemeral token for OpenAI WebRTC API authentication.
Response:
{
"client_secret": {
"value": "ephemeral_token_value"
}
}
The starter kit supports essential WebRTC events, such as:
- Connection state updates
- ICE connection changes
- Data channel messages
- Real-time audio stream handling
This project is licensed under the MIT License - see the LICENSE file for details.
Created and maintained by Hossein Yousefpour
© All rights reserved.