Talking Avatar Open Source · Developer guide · JavaScript and React
Open-source talking avatar SDK
Add a talking 3D character to your app with @interviewflowai/talking-avatar. The SDK's 1 MB model turns audio into mouth shapes and animates a 3D avatar in real time, in the user's browser. A female and a male avatar are built in, or use your own .glb. The code, the lip-sync model and the built-in avatars are MIT licensed, free for commercial and noncommercial use, with no API key or avatar usage fees.
Install the open-source talking avatar npm package
The package uses ES modules and includes TypeScript declarations. Install three alongside it for 3D rendering (version 0.160.0 or later). React 18 or later is needed only for the React component. It's only the free open-source SDK. Talking Avatar Realistic Avatars, the separate hosted product, has its own package, @talkingavatar/sdk, which needs an API key and is billed per minute.
npm install @interviewflowai/talking-avatar threePrefer another package manager? Use pnpm add @interviewflowai/talking-avatar three or yarn add @interviewflowai/talking-avatar three. See the package on npm →
Prepare your avatar, audio and model
- Pick an avatar: leave out
avatarUrlfor the built-in female avatar, passAVATARS.malefor the male one, or put your own .glb with the 15 Oculus viseme morph targets in your public assets (usemorphTargetsif the names differ). - Add a recording or TTS audio file as
/hello.mp3. The SDK animates audio you supply; speech generation is separate. - Create
public/sdkand copy the packaged model there with the command below. Both examples self-host it. - Give the avatar container a width and height, then start audio from a click or tap.
cp node_modules/@interviewflowai/talking-avatar/dist/viseme-model.bin public/sdk/viseme-model.binAlternatively, omit modelUrl to load this package version's model from jsDelivr. The built-in avatars load the same way; your own avatar and audio need the same origin, or CORS on the asset host.
JavaScript and React quickstart
Choose the class for a plain JavaScript app, or the component for React. Replace the audio path with your own file. React handles disposal on unmount; with the class, call dispose() yourself.
import { AVATARS, TalkingAvatar } from "@interviewflowai/talking-avatar";
// Add a sized <div id="avatar"> and a <button id="play">.
const avatar = new TalkingAvatar({
container: document.getElementById("avatar"),
avatarUrl: AVATARS.male, // optional: the female avatar is the default, or your own .glb
modelUrl: "/sdk/viseme-model.bin",
onError: console.error,
});
document.getElementById("play").onclick = () => {
avatar.speak("/hello.mp3").catch(console.error);
};
// Call avatar.dispose() when you remove this view."use client"; // Needed in Next.js App Router.
import { useRef } from "react";
import { AVATARS } from "@interviewflowai/talking-avatar";
import { TalkingAvatarView } from "@interviewflowai/talking-avatar/react";
export function Avatar() {
const avatar = useRef(null);
return (
<>
<div style={{ width: "100%", height: 360 }}>
<TalkingAvatarView
ref={avatar}
avatarUrl={AVATARS.male} // optional: female by default
modelUrl="/sdk/viseme-model.bin"
onError={console.error}
/>
</div>
<button onClick={() => {
avatar.current?.speak("/hello.mp3").catch(console.error);
}}>Play audio</button>
</>
);
}For live audio, pass a MediaStream to attachStream() or the React stream prop. See the open-source talking avatar API reference for constructor options, stream handling, playback and cleanup.
Voice agents and talking mascots
Use your voice agent's remote audio as the input, whether it comes from OpenAI Realtime, LiveKit, Daily or another WebRTC integration. A tutor, interviewer or support assistant can speak through the same 3D avatar. A brand mascot works too if its .glb model has compatible mouth shapes; the SDK does not create or rig mascot artwork.
Free to use and modify
The MIT License permits commercial and noncommercial use, modification and redistribution. Keep its copyright and permission notice with copies or substantial portions of the software. The built-in avatars are from Microsoft Rocketbox, also MIT licensed. Your own avatar assets, TTS and hosting have their own terms.
See what the free talking avatar includes for a demo and answers about costs, compatible avatars and free use.
Lip sync accuracy and performance
A ~260k-parameter causal convolutional network reads the audio in 10 ms frames and picks one of 22 mouth shapes (visemes), running as plain JavaScript with no WebAssembly or ML runtime. On 39 speakers held out from training, with speech passed through the Opus codec as on a WebRTC call, it picks the right mouth shape for 82% of frames and closes the lips on 99% of p, b and m sounds. Noisy or unclear audio scores lower.
- Code: about 10 KB gzipped (27 KB raw, v0.3.0), plus three.js, which renders the avatar.
- Built-in avatars: under 1 MB each, loaded only when used.
- Model: 1 MB, downloaded once and cached.
- CPU: about 2% of one core while audio plays (on an Apple M5 Pro; plan for 2–3× on low-end laptops).
- Training data: LibriTTS-R (CC BY 4.0), with phoneme timings from the Montreal Forced Aligner.
Method and limits: how the open-source avatar works.
Browser requirements and best results
Use a browser with WebGL and Web Audio support. Live audio uses AudioWorklet and needs HTTPS or localhost. Start audio after a user interaction, and let the avatar play its own audio to avoid echo. Clean TTS or recorded speech gives more reliable lip sync than noisy microphones. The model was trained on English speech, so mouth shapes for other languages are approximate.
The GitHub README documents avatar requirements, model training, troubleshooting and contributions. You can inspect the implementation, report an issue or contribute a fix directly in the repository.
Realistic Avatars and Open Source
The two versions of Talking Avatar
Talking Avatar comes in two separate versions. Talking Avatar Realistic Avatars is a hosted, paid service of ready-made photorealistic avatars, rendered on our servers and streamed to your page over WebRTC or into your LiveKit room (with a LiveKit Agents plugin for Python), for $0.02 a minute. Talking Avatar Open Source is a free, MIT-licensed 3D talking avatar for the browser: it renders a built-in female or male 3D avatar, or your own .glb, and animates its face from any audio (lip sync from a 1 MB model, plus natural blinks and brows), with no server, account or API key, free for commercial and noncommercial use. Both are driven by your own voice agent: OpenAI Realtime, LiveKit, Pipecat or any TTS. No voice agent yet? Talking Avatar Voice Agents run the whole conversation on a realistic avatar, with no code, for $0.06 a minute.
Talking Avatar Realistic Avatars
$0.02 / minHosted, ready-made photorealistic avatars that speak your voice agent's audio in real time, with lip sync, natural expressions and subtle head motion. Rendered on our servers and streamed to your page over WebRTC or into your LiveKit room, from the Node.js SDK, our LiveKit Agents plugin for Python, or a WebSocket API that works in any language.
- $1 of free credits when you sign up
- Billed per second, commercial use included
- No subscription, setup fee or minimum
- Sessions up to 3 hours each
- Ready-made avatars; custom avatars $199 one time
Talking Avatar Open Source
FreeA 3D talking avatar that runs entirely in the user's browser: it renders a built-in female or male avatar, or your own .glb, and animates its face from your agent's audio, with lip sync from a 1 MB model plus natural blinks and brows. No server, no API key, and the audio never leaves the page.
- Free for commercial and noncommercial use (MIT)
- npm install @interviewflowai/talking-avatar
- Source on GitHub