Skip to main content
This is the final step of the quickstart. With the server route from step two in place, connect the browser and start a conversation with your avatar.

Install the JavaScript SDK

In your Next.js project, install the SDK with your package manager:

Connect the browser

Request the session token, create an Anam client, and attach its stream to your video element:
streamToVideoElement() starts microphone capture and renders the avatar’s video and audio in the element with the matching ID.

Working component example

Below is a React component with connection lifecycle and a streaming transcript. The MESSAGE_STREAM_EVENT_RECEIVED event fires for each chunk of text from both the user and the agent. Accumulate chunks by message ID to build the full transcript.

Run your first conversation

  1. Save the component above as AvatarChat.tsx and render it on a page in your Next.js app. Pass your Cara 4 avatar ID as avatarId and the ElevenLabs agent ID from step one as agentId.
  2. Start your development server with your project’s dev command, such as npm run dev. Open the page on localhost.
  3. Click Start and allow microphone access. The avatar video should appear and the button should change to Stop.
  4. Speak to the agent. Confirm that you hear its reply, see the avatar speaking in sync, and see both sides of the conversation in the transcript.
  5. Click Stop to end the session. Click Start again to check that you can reconnect, then stop the session when you finish testing.
Quickstart complete. You now have a working ElevenLabs agent with an Anam avatar.
If the video or conversation does not start, follow Troubleshooting.

Upgrade your avatar

Your avatar session is running. Build on it with expressive performance, personalised conversations, and actions in your app:
  • Director Notes: add expressions that follow ElevenLabs audio tags.
  • Session customisation: pass user-specific variables, override settings, or attach a user ID.
  • Client tools: let the agent trigger actions in your browser and receive the results.
For more on event handling, message history, and connection lifecycle, see the basic Next.js app recipe.

Next: Add Director Notes

Connect ElevenLabs audio tags to the avatar’s performance.
Last modified on October 8, 2026