Skip to main content
Last verified: 2026-08-05

Overview

Use this integration to speak a LiveAvatar avatar’s responses with a Cartesia Sonic TTS voice. Set provider to cartesia in the session’s voice settings to render the avatar with Sonic — see Use your own Cartesia voices to import your own API key and voices.

Prerequisites

Quick start

The LiveAvatar Web SDK repo ships a Next.js demo app. Point it at your space, switch the TTS provider to Cartesia, and run it.
1

Clone the SDK repo and install

2

Add your LiveAvatar API key

Set API_KEY in apps/demo/app/api/secrets.ts. The avatar, voice, and context IDs already point at a working demo persona — swap them for your own once the session runs.
3

Set Cartesia as the TTS provider

In apps/demo/app/api/start-session/route.ts, add a voice_settings block inside the existing avatar_persona object in the session token request. The provider field selects which TTS engine renders the voice:
The route returns { session_token, session_id }, which the demo passes to LiveAvatarSession from @heygen/liveavatar-web-sdk.
4

Run the demo

Open http://localhost:3001, click Full Mode, then unmute and talk. The avatar answers in the Sonic voice that is the default voice ID in secrets.ts.
The voice ID in secrets.ts refers to the ID provided by LiveAvatar. It corresponds to the provider_voice_id, which is the voice ID provided by Cartesia. The two IDs are not the same, but they refer to the same voice.

Use your own Cartesia voices

Register your Cartesia API key as a LiveAvatar secret, then bind a Cartesia voice to it — full flow in Custom TTS Integration. Get provider_voice_id from the Cartesia playground or the list voices endpoint. Set the environment variables used in the requests:
The returned JSON contains a secret id:
Pass it with the Cartesia voice ID to create a LiveAvatar voice:
The response returns a LiveAvatar voice_id (different from the Cartesia Voice ID you supplied). Use it as VOICE_ID in secrets.ts. LiveAvatar generates that session’s audio with your Cartesia credentials.
The imported voice stops working if the underlying Cartesia voice is deleted or the secret is removed.

Configuration

avatar_persona.voice_settings fields for Cartesia:

Resources