Skip to main content

Installation

Install LLMRTC packages and dependencies. This guide covers both backend and web client setup.


Package Overview

LLMRTC consists of three packages:

PackageDescriptionUse When
@llmrtc/llmrtc-backendNode.js server with all providersBuilding the voice server
@llmrtc/llmrtc-web-clientBrowser SDK for audio/videoBuilding the client UI
@llmrtc/llmrtc-coreShared types and orchestratorsBuilding custom integrations

Backend Installation

npm

npm install @llmrtc/llmrtc-backend

yarn

yarn add @llmrtc/llmrtc-backend

pnpm

pnpm add @llmrtc/llmrtc-backend

The backend package includes:

  • LLMRTCServer with WebRTC and WebSocket transport
  • All provider implementations (OpenAI, Anthropic, Gemini, etc.)
  • VAD (Voice Activity Detection)
  • Session management

Web Client Installation

npm

npm install @llmrtc/llmrtc-web-client

yarn

yarn add @llmrtc/llmrtc-web-client

pnpm

pnpm add @llmrtc/llmrtc-web-client

The web client includes:

  • WebRTC connection management
  • Microphone capture
  • Camera/screen capture for vision
  • Automatic TTS playback
  • Reconnection handling

FFmpeg Installation

FFmpeg is required for streaming TTS (converting audio formats). Install it for your operating system:

macOS

# Using Homebrew
brew install ffmpeg

Ubuntu/Debian

sudo apt update
sudo apt install ffmpeg

Windows

Download from ffmpeg.org or use Chocolatey:

choco install ffmpeg

Verify Installation

ffmpeg -version
# Should show version info

Node.js Requirements

LLMRTC requires Node.js 20 or higher.

Check Your Version

node --version
# Should be v20.x.x or higher

Upgrade with nvm

# Install nvm if needed: https://github.com/nvm-sh/nvm
nvm install 20
nvm use 20

Browser Requirements

The web client requires a modern browser with:

FeaturePurposeSupport
WebRTCReal-time audio/videoChrome 56+, Firefox 44+, Safari 11+
getUserMediaMicrophone accessChrome 53+, Firefox 36+, Safari 11+
WebSocketSignalingAll modern browsers
ES ModulesPackage formatChrome 61+, Firefox 60+, Safari 11+

Recommended: Chrome or Firefox for development (best WebRTC debugging tools).


Project Setup

New Project

Create a new project from scratch:

# Create directory
mkdir my-voice-assistant
cd my-voice-assistant

# Initialize package.json
npm init -y

# Set module type for ES imports
npm pkg set type=module

# Install packages
npm install @llmrtc/llmrtc-backend

TypeScript Project

For TypeScript projects:

npm install @llmrtc/llmrtc-backend typescript @types/node
npx tsc --init

Update tsconfig.json:

{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"strict": true,
"outDir": "dist"
}
}

Monorepo Setup

If you cloned the LLMRTC repository:

# Install all workspace dependencies
npm install

# Build all packages
npm run build

Environment Setup

Create a .env file for your API keys:

# .env
OPENAI_API_KEY=sk-...

Install dotenv to load environment variables:

npm install dotenv

Load in your application:

import 'dotenv/config';
// or
import { config } from 'dotenv';
config();

Verify Installation

Backend Verification

Create test-backend.ts:

import { LLMRTCServer, OpenAILLMProvider } from '@llmrtc/llmrtc-backend';

console.log('LLMRTCServer imported successfully');
console.log('OpenAILLMProvider imported successfully');

// Verify types
const config = {
providers: {
llm: new OpenAILLMProvider({
apiKey: process.env.OPENAI_API_KEY || 'test'
})
}
};

console.log('Configuration valid');
console.log('Installation verified!');

Run:

npx tsx test-backend.ts

Web Client Verification

Create a simple HTML file:

<!DOCTYPE html>
<html>
<head>
<title>LLMRTC Test</title>
</head>
<body>
<script type="module">
import { LLMRTCWebClient } from 'https://esm.sh/@llmrtc/llmrtc-web-client';

console.log('LLMRTCWebClient imported successfully');

const client = new LLMRTCWebClient({
signallingUrl: 'ws://localhost:8787'
});

console.log('Client created:', client);
console.log('Installation verified!');
</script>
</body>
</html>

Open in a browser and check the console.


Common Installation Issues

"Cannot find module" Errors

Ensure your package.json has "type": "module":

{
"type": "module"
}

TypeScript Import Errors

Use .js extensions in imports (even for .ts files) with NodeNext:

// Correct
import { something } from './utils.js';

// Incorrect
import { something } from './utils';

Or use a bundler like tsx, ts-node, or esbuild.

FFmpeg Not Found

Ensure FFmpeg is in your PATH:

# Check if ffmpeg is accessible
which ffmpeg

# Add to PATH if needed (macOS/Linux)
export PATH="/usr/local/bin:$PATH"

Permission Denied (npm)

Fix npm permissions:

# Option 1: Use nvm (recommended)
nvm use 20

# Option 2: Fix npm prefix
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH

Next Steps

With packages installed, continue to the backend quickstart: