Skip to content

Nextjs 15 starter with shadcn/ui to leverage the Realtime API Beta (12-17-2024) and tool calling capabilities. Build your own Voice AI Nextjs app or feature using OpenAI Realtime API & WebRTC.

License

Notifications You must be signed in to change notification settings

cameronking4/openai-realtime-api-nextjs

Repository files navigation

OpenAI WebRTC Shadcn Next15 Starter

This is a WebRTC-based Voice AI stream application using OpenAI's Realtime API and WebRTC. Project contains /api route and UI components developed with Next.js and shadcn/ui. It supports real-time audio conversations implented in skrivov/openai-voice-webrtc-next with the addition of a hook to abstract the WebRTC handling.

demo.mp4

Features

openai-realtime-api-nextjs-shadcn

  • Next.js Framework: Built with Next.js for server-side rendering and API routes.
  • Modern UI: Animated using Tailwind CSS & Framer Motion & shadcn/ui.
  • Use-WebRTC Hook: A hook to abstract the OpenAI WebRTC handling.
  • Tool Calling: 5 example functions to demonstrate client side tools along with Realtime API: getCurrentTime, partyMode, changeBackground, launchWebsite, copyToClipboard
  • Type Safety: TypeScript with strict eslint rules (optional)

Requirements

  • Deno runtime or Node.js
  • OpenAI API Key or Azure OpenAI API Key in .env file

Installation

1. Clone the Repository

git clone https://github.com/cameronking4/openai-realtime-api-nextjs.git
cd openai-realtime-api-nextjs

2. Environment Setup

Create a .env file in the root directory:

OPENAI_API_KEY=your-openai-api-key

3. Install Dependencies

If using Node.js:

npm install

If using Deno:

deno install

4. Run the Application

Using Node.js:

npm run dev

Using Deno:

deno task start

The application will be available at http://localhost:3000.

Usage

  1. Open the app in your browser: http://localhost:3000.
  2. Select a voice and start the audio session.

Deploy to Vercel

Deploy in one-click

Deploy with Vercel

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

About

Nextjs 15 starter with shadcn/ui to leverage the Realtime API Beta (12-17-2024) and tool calling capabilities. Build your own Voice AI Nextjs app or feature using OpenAI Realtime API & WebRTC.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages