Skip to main content
The SDK’s LiveAvatar is a thin client for this API. Use the API directly when your server isn’t Node.js (Python, Go, Java, Ruby, .NET, Rust…), or when you want full control. Everything the SDK can do, the API can do: start a session, stream your agent’s voice, interrupt, get speech events, and show the avatar in browsers or in your LiveKit room.

Messages

Every message you send and receive, with its fields.

Python example

A complete client, with FastAPI and LiveKit.

Browser playback

Show the avatar in your page over WebRTC.

Node.js SDK

On Node.js, the SDK does all of this for you.

Endpoint

One WebSocket connection is one avatar session. Authenticate with your API key in the first message. Keep the key, and the connection, on your server.

A session, step by step

  1. Connect and send a start message within 10 seconds. It names your API key, the avatar, your audio’s sample rate, and where the avatar goes: direct to browsers over WebRTC, or into your LiveKit room.
  2. Wait for ready. The avatar is live, and billing starts.
  3. Show it. Direct output: relay a view handshake for each browser (Browser playback). LiveKit: the avatar joins your room by itself.
  4. Stream your agent’s voice as binary audio messages of raw PCM16 mono. The avatar speaks it, with the voice and lips in sync.
  5. Interrupt with clear when the user talks over the avatar.
  6. Close the WebSocket when the conversation ends. Billing stops.

The smallest session

Any WebSocket client works. In Python:

Billing

$0.02 per minute, billed per second from ready until the connection closes, from your prepaid balance. It’s the same session, with the same price and limits, as one started with the SDK, and it appears on the Usage page under your API key’s name.

Limits

Close codes

The connection’s close code says why a session ended. Before closing for an error, the server usually sends an error message with the details.