Neuphonic TTS and LiveKit Integration Guide
LiveKit is a powerful open-source platform for building real-time voice and video applications. By combining LiveKit with Neuphonic's text-to-speech capabilities, you can create interactive AI agents that communicate naturally through voice. Below you'll find resources to help you get started with the integration.
- Python
- JavaScript
๐ LiveKit Demo Applications
Explore our comprehensive LiveKit demo applications built with our Neuphonic LiveKit integration.
๐ LiveKit Agents Docs
LiveKit Agents: Realtime framework for production-grade multimodal and voice AI agents.
Here is a guide to using Neuphonic with LiveKit. For this example, we will use LiveKit Agent Playground to make an interactive agent.
1. Set up local machine for the agentโ
- Clone the LiveKit Agent starter project from GitHub.
- Navigate to the project directory and install the dependencies:
npm install @livekit/agents-plugin-neuphonic
- Make a
.env.localfile, and add your NEUPHONIC_API_KEY environment variable:
NEUPHONIC_API_KEY=<your key>
- Go to
src/agent.tsfile, add the following import at the top:
import * as neuphonic from '@livekit/agents-plugin-neuphonic';
- Go to the
defineAgentfunction'sentrymethod and add the Neuphonic plugin into thettsfield:
tts: new neuphonic.TTS({
apiKey: process.env.NEUPHONIC_API_KEY!,
langCode: 'en',
voiceId: '9626c31c-bec5-4cca-baa8-f8ba9e84c8bc', // change to your preferred voice ID
speed: 1.0, // optional, default is 1.0
}),
2. Create a LiveKit Cloud projectโ
- Log in to LiveKit Agent Playground, create a project.
- Log in to LiveKit Cloud. On the bottom left corner of the browser, choose your project.
- Go to Settings โ Project โ API Keys.
- Create a new API key, copy the environment variables into your
.env.localfile in your local project.
3. Connect the agent to the LiveKit Cloud projectโ
- Go back to LiveKit Agent Playground, connect to your project. You should see an interactive frontend for agents.
- Go to your local project directory, download LiveKit model files, and start the agent:
pnpm download-files
npm run build
npm start
- In the LiveKit Agent Playground, you should see your agent connected. Talk to the agent and hear its responses synthesized by Neuphonic!