ChatGPT's Voice Mode is Open-Source (how to setup a LiveKit voice agent)

Science & Technology


Introduction

Since ChatGPT's rise to fame, OpenAI has positioned itself as a pioneering AI company. However, while most people may associate ChatGPT's voice capability directly with OpenAI, it is, in fact, LiveKit that is responsible for the voice mode behind ChatGPT. LiveKit has open-sourced the actual code behind this voice mode, providing users with an opportunity to run it independently on their own systems.

The open-source nature of LiveKit allows for significant customization. In this article, we will explore how to utilize LiveKit's Agent Playground, enabling you to easily set up a real-time voice assistant application using OpenAI models.

Getting Started with LiveKit

To kick off the process, you'll need to follow these steps:

  1. Create an Account: Head over to the LiveKit.io homepage and click on the "Start Building for Free" button. If you don’t already have an account, you’ll need to sign up.

  2. Try the Sandbox: Once logged in, navigate to your dashboard and select "Try Sandbox". Here, you can utilize the voice assistant frontend template to create your application.

  3. Install Command Line Interface: After creating your app, you'll receive installation commands specific to your operating system. For Windows users, run these commands in the Command Prompt as an administrator. Mac and Linux users should execute the commands in their terminal.

  4. Obtain an OpenAI API Key: During the setup, you will need an OpenAI API key linked to an account with usage credits. Paste this key when prompted after running the installation commands.

Modifying Code for Customization

LiveKit generates a fair amount of code automatically, but you will need to make a small modification:

  1. Access the Code Editor: Open the programs folder in VS Code or any preferred code editor.

  2. Find the agent.py File: In the Explorer tab, locate and open the agent.py file. Use the search function (Command + F for Mac, Control + F for Windows/Linux) to look for stt.

  3. Change Speech-to-Text Engine: By default, LiveKit uses the Deepgram API for speech-to-text. For simplicity, you can switch this to the OpenAI API.

    • Save your changes before proceeding.

Running the Voice Agent

To start your voice agent, follow these steps:

  1. Open the Terminal: Within your VS Code editor, open the terminal.

  2. Run the Voice Agent: Execute the command python3 agent.py.

  3. Launch the Application: Go back to LiveKit’s playground section and click the launch button for the newly created Voice app.

With these steps completed, LiveKit will open a web interface that mimics ChatGPT’s voice mode. You can initiate conversations and interact with your voice assistant, which has been set up in just minutes.

Expanding Your Functionality

For those interested in further modifying LiveKit's code, numerous features can be explored, including:

  • Running other Large Language Models (LLMs)
  • Implementing different speech detection models
  • Integrating text-to-speech models
  • Setting up a local server for the web UI
  • Adding function calling and much more

The open-source nature of LiveKit provides unlimited customization possibilities for developers and enthusiasts alike.

For detailed customization and code modifications, be sure to subscribe for more in-depth videos and articles. This is AI Austin, and I look forward to seeing you in the next one!

Keywords

  • LiveKit
  • ChatGPT
  • Open-Source
  • Voice Mode
  • Speech Recognition
  • API Key
  • Voice Assistant
  • Customization
  • Installation
  • Command Line

FAQ

Q1: What is LiveKit?
A1: LiveKit is an open-source platform that enables real-time communication capabilities, including voice modes, which can be integrated with various AI models.

Q2: Can I use my own API key with LiveKit?
A2: Yes, you must obtain and use an OpenAI API key linked to an account with usage credits for running the voice agent.

Q3: Is it difficult to set up a voice assistant with LiveKit?
A3: No, setting up a voice assistant application using LiveKit is relatively straightforward, especially with the provided templates and installation commands.

Q4: Can I modify LiveKit for different models and functionalities?
A4: Yes, LiveKit's open-source nature allows for extensive customization, including running different LLMs, speech detection, and text-to-speech models.

Q5: Where can I find more information on modifying LiveKit code?
A5: For in-depth tutorials and resources on customizing your LiveKit agents, stay tuned for further content and discussions on related platforms.