ChatFX Avatar for LiveKit Agents
A real-time talking face for your LiveKit voice agent. The avatar joins your agent's LiveKit Cloud room as one more participant, takes your agent's voice and speaks it with its lips in time, shown as your agent. You keep your own listening, AI and voice; ChatFX adds the face, billed by the minute.
Install
pip install livekit-plugins-chatfx
Requires Python 3.10+ and livekit-agents 1.2 or newer.
Add your key
Create a key under API keys at avatar.chatfx.com. Then add it to your voice agent's secrets
at LiveKit, named exactly CHATFX_AVATAR_API_KEY. In your agent's folder:
lk agent update-secrets --secrets "CHATFX_AVATAR_API_KEY=cfx_..."
Running your agent on your own server instead? Add the key to that server's environment variables, with the same name.
Your agent also needs LIVEKIT_URL, LIVEKIT_API_KEY and LIVEKIT_API_SECRET, which it already has. They never leave your
server.
Use it
In your agent's entrypoint, after you make the AgentSession and before session.start():
from livekit.plugins import chatfx
avatar = chatfx.AvatarSession(avatar_id="chatfx-lois") # copy the id from the Avatars page
await avatar.start(session, room=ctx.room)
await session.start(agent=MyAgent(), room=ctx.room)
That's all the code. When the job ends, the session ends too, so billing stops. To end it earlier, call
await avatar.aclose().
What it does for you
- Shows a waiting picture, with nothing to add to your page. The moment a call starts, your agent shows the avatar's picture as its own video, with "Video starting..." on it, and the live face takes over when it's ready. Any page that shows the agent's video gets this.
- Greets with the face.
start()waits up to 10 seconds for the face, so your agent's first words come with it, and it checks the face can hear your agent before handing it the voice, so the first words are never cut. - Never depends on the face. If the face can't come, or leaves mid-call, your agent carries on by voice.
- Keeps answers whole. Your agent's voice goes to the face in short pieces, so a network hiccup costs a split second instead of the rest of the answer. Interrupting still stops the answer at once.
- Paces the voice. After the first moment of each answer, its sound goes to the face no faster than twice real time, so a long answer never floods the connection (a flood can cost a half-second gap in her voice).
- Keeps subtitles in step. Your agent's words still arrive word by word as it speaks after the voice moves to the face (LiveKit Agents 1.8.11 or later).
- Stops forgotten calls, so they don't use your minutes: after 2 minutes with nobody talking, 2 minutes after the visitor leaves (long enough for a page reload), or at 1 hour.
Options
chatfx.AvatarSession(
avatar_id="chatfx-lois",
api_key=None, # defaults to CHATFX_AVATAR_API_KEY
api_url=None, # defaults to https://api.chatfx.com
avatar_participant_identity="chatfx-avatar",
avatar_participant_name="ChatFX",
face_first_seconds=10.0, # how long start() waits for the face
start_timeout=300.0, # how long start() keeps trying to start the avatar
quiet_seconds=120.0, # end the call after this long with nobody talking (None: never)
visitor_gone_seconds=120.0, # end the call this long after the last visitor leaves (None: never)
longest_call_seconds=3600.0, # end the call at this length (None: never)
end_call_when_idle=True, # False: only the avatar leaves, and your agent carries on by voice
waiting_picture=True, # show the avatar's picture until the live face is ready
waiting_text="Video starting...", # the words on it, in your language (None: no words)
)
avatar.start() also takes livekit_url, livekit_api_key and livekit_api_secret if you'd rather not use the settings.
We recommend "interruption": {"min_words": 1} in your session's turn handling. The avatar's sound can't pause and carry on,
so a false alarm would otherwise cut a reply off for good.
If you build your own call screen
Your agent's participant attribute chatfx-face says where the face is: on, off, voice (by voice over the picture) or
waking (not on yet). In the agent,
avatar.face_status says the same. You don't need either to get the waiting picture.
When there's no face
A refusal doesn't stop the call. The log says why, and avatar.failure is a chatfx.ChatFXException with the API's code
(for example invalid_api_key, avatar_not_found, premium_avatar, out_of_minutes) and a plain message. A missing key or
missing LiveKit setting raises right away, so you find it while setting up.
Docs
Connecting your agent · Building avatars · Minutes and plans
Metadata
Release files for livekit-plugins-chatfx 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| livekit_plugins_chatfx-0.2.4.tar.gz | 22.0 kB | Without provenance | Details for livekit_plugins_chatfx-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| livekit_plugins_chatfx-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for livekit_plugins_chatfx-0.2.4-py3-none-any.whl |
Total release size: 38.8 kB
Release files / livekit_plugins_chatfx-0.2.4.tar.gz
| Download URL | livekit_plugins_chatfx-0.2.4.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24558129bc0f196ff017cb5856542d5240ad6da8eb7dec0a22f36d895b84811d
|
|
BLAKE2b-256 checksum How to use checksums |
deb406d32a03da47671659201d48e0639ecc3bc65ad46f3160096b0e943469a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / livekit_plugins_chatfx-0.2.4-py3-none-any.whl
| Download URL | livekit_plugins_chatfx-0.2.4-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6eff2446c0dd3b1c3ee27a437e9ef5acb775a8d01b0972ed20bfaf4baff2650e
|
|
BLAKE2b-256 checksum How to use checksums |
fac4123a1abe1ef875453701f40d5998ae3fcd03cdbae23e1e3d8061b9ab57f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for livekit-plugins-chatfx 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.