Looking for a faster start? The Quickstart guide gets you running in a single HTML file without a server.
Prerequisites
- Node.js (version 16 or higher) and npm installed on your system
- Basic knowledge of JavaScript
- An Anam API key (get one here)
- A microphone and speakers for voice interaction
Project Setup
This example creates a web application with three main files:1
Create project directory
2
Initialize Node.js project
3
Create public directory
4
Install dependencies
5
Create environment file
Create a
.env file in your project root to store your API key securely:.env
Step 1: Set up your server
Create a basic Express server to handle session token generation. In a production application, integrate this into your existing backend service.server.js
Step 2: Set up your HTML
Create an HTML page with a video element for the persona and controls to start/stop the chat:public/index.html
Step 3: Initialize the Anam client
Create the client-side JavaScript to control your persona connection:public/script.js
createClient, streamToVideoElement, and stopStreaming, see the SDK Reference.
Step 4: Run your application
- Start your server:
- Open http://localhost:3000 in your browser
- Click “Start Chat” to begin your conversation with Cara
You should see Cara appear in the video element, ready to chat through voice interaction.
How it works
- Server-side authentication: Your server exchanges the API key for a session token, keeping credentials secure
- Client connection: The SDK creates a WebRTC connection for real-time video streaming
- Voice interaction: Cara listens for your voice input and responds with synchronized audio and video
- Connection control: Start and stop buttons control when the persona is active
Next steps
Cookbook: Basic Next.js App
Full tutorial for building a Next.js app with the Anam SDK
Core Concepts
Learn how personas, tokens, and streaming work
Handle Events
React to conversation events and user interactions
Production Setup
Deploy your persona securely at scale
Common issues
Persona not appearing?- Check that your API key is set correctly in
.env - Ensure the video element has
autoplayandplaysinlineattributes - Check the browser console for errors
- Make sure your browser allows autoplay with sound
- The user must interact with the page first (clicking “Start Chat” satisfies this)
- Verify your server can reach api.anam.ai
- Check network connectivity and firewall settings

