Skip to main content

Installation

npm install vocode Or, start from our Replit template.

Usage

Setting up the conversation

Hosted

You’ll need to get an API key from our dashboard to get started. Similar to the Python Quickstart, we provide a TypeScript interface for the conversation configuration.

Running the conversation

We provide a React hook to facilitate conversations created from the configuration above.
  • start opens the microphone stream and starts sending audio from the conversation to the user
  • stop closes the microphone and speaker streams
  • status is an enum that contains the status of the conversation, one of idle, connecting, connected, and error
  • analyserNode is an object (defined by the Web Audio API here) that allows for audio visualizations based on the audio output of the conversation

Self-hosted

Our self-hosted backend allows you to expose a websocket route in the same format that our hosted backend does. This allows you to deploy any agent you’d to into the conversation. To get started, clone the Vocode repo or copy the client backend app directory.

Environment

Copy the .env.template and add your API keys.
You’ll need:
  • Deepgram (for speech transcription)
  • OpenAI (for the underlying agent)
  • Azure (for speech synthesis)

Running with Docker

From the client_backend directory:

Running with Python

You now have a server with a Vocode websocket route at localhost:3000! You can now use the useConversation hook with your self-hosted backend as follows:

Demo installation and setup

Clone the vocode-react-demo repository.
Run npm install inside the directory to download all of the dependencies.
Set your Client SDK key inside of your .env
Start the application