Skip to main content
This guide uses direct mode: Talking Avatar streams the avatar’s video and your agent’s voice to your page over WebRTC. Already using LiveKit? See LiveKit instead.

Before you start

  • A Talking Avatar account. Sign up to get $1 of free credits.
  • Node.js 22 or later on your server (or Node.js 18 or 20 with the ws package). Another language? Use the realtime avatar API instead.
  • A voice: any TTS or voice agent that gives you raw 16-bit PCM audio. See Stream audio for provider settings.

Steps

1

Create an API key

In the dashboard, open API keys → Create key. Copy the key and set it on your server:
.env
2

Install the SDK

In your server and in your web app:
3

Pick an avatar

Choose an avatar ID from Avatars, such as ava4 (professional, office) or ava6 (casual, home study). You can try each one live on the dashboard’s Avatars page.
4

Start the avatar and add one route

server.js
handleView answers your page’s WebRTC requests. One route serves any number of viewers, and your API key never reaches the browser.
5

Show it on your page

index.html
page.js
6

Talk to it

Click Start, then make your agent speak. The avatar plays the voice in sync with its lips.
Play the voice once. The avatar plays your agent’s voice itself, in sync with its lips. Remove any other playback of the same audio (an <audio> element, a speaker stream, track.attach()), or users hear it twice.

One avatar per conversation

Keep one LiveAvatar per conversation: start it when the conversation starts, and close() it when it ends, so billing stops. Running several conversations at once? Give each its own route, such as /avatar/:conversationId, that looks up that conversation’s avatar.
Protect the route with your app’s existing authentication.

Next steps

Stream audio

Audio formats and settings for OpenAI, ElevenLabs, Azure and Cartesia.

Interruptions

Barge-in, speech events and keeping your transcript accurate.

Sessions and errors

Billing, limits and close codes.

Production checklist

Before you go live.