A demo Node.js server for integrating Stream's Video SDK with OpenAI's Realtime API. This project showcases how to build AI-powered video applications with voice interactions.
This repository provides two main components:
-
Standalone UI: A simple script that launches a browser-based video call with an AI assistant powered by OpenAI's Realtime API.
-
Server API: A Hono-based HTTP server that provides endpoints for creating and managing AI-powered video calls.
Both components demonstrate how to use Stream's Video SDK to create video calls and connect them with OpenAI's Realtime API for AI-powered voice interactions.
- Node.js 22 or later
- Stream account with API key and secret
- OpenAI API key with access to the Realtime API
-
Clone this repository:
git clone https://github.com/yourusername/stream-video-ai-demo-server.git cd stream-video-ai-demo-server
-
Install dependencies:
npm install
-
Create a
.env
file with your API keys:STREAM_API_KEY=your_stream_api_key STREAM_API_SECRET=your_stream_api_secret OPENAI_API_KEY=your_openai_api_key
You can copy the example file as a starting point:
cp .env.example .env
The standalone UI provides a quick way to test the AI-powered video call experience:
npm run standalone-ui
This will:
- Create a new video call with a unique ID
- Connect an OpenAI AI assistant to the call
- Open your default browser with a URL to join the call
- Log all events from the OpenAI Realtime API to the console
You can speak to the AI assistant through your microphone, and it will respond with voice and can perform actions based on your requests.
The server provides API endpoints for creating and managing AI-powered video calls:
npm run server
This starts an HTTP server on port 3000 (by default).
Creates a new video call and returns the necessary credentials to join it.
Response:
{
"apiKey": "your_stream_api_key",
"token": "user_authentication_token",
"callType": "default",
"callId": "unique_call_id",
"userId": "user_id"
}
Use these credentials in your frontend application to connect to the video call.
Connects an OpenAI AI assistant to an existing video call.
URL Parameters:
callType
: The type of call (e.g., "default")callId
: The unique ID of the call to connect to
Response:
{
"ok": true
}
After calling this endpoint, the AI assistant will join the specified call and be ready to interact with users.
- Call the
/credentials
endpoint to create a new call and get connection details - Use the Stream Video SDK in your frontend to join the call with the provided credentials
- Call the
/:callType/:callId/connect
endpoint with the call type and ID to connect the AI assistant - Interact with the AI assistant through voice in the video call
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.