‹ Platforms
Build a LiveKit agent
Fit the LiveKit plugin into your own client, room and server.
Integrate into your app
- Your own client. The avatar is a normal LiveKit participant: any LiveKit client SDK (JavaScript, Swift, Kotlin) subscribes to its video and audio tracks. The app takes a room token from your server, never a bitHuman secret.
- Choosing a model. The plugin serves the agent’s own model. Do not pass
model=; create the agent with the model you want (Models). - A photo instead of an agent.
avatar_image=with noavatar_idanimates the photo on Expression 1 only. On every other model the launch is refused with400 VALIDATION_ERRORbefore anything is billed: create an agent from the photo and pass its code asavatar_id. - Rendering on your own machine. Pass
model_path=(an avatar file) instead ofavatar_id=, and the secret explicitly:api_secret=os.environ["BITHUMAN_MASTER_SECRET"]. The avatar renders inside the worker’s process, and the secret stays in that process. Runnable example: Voice agent. - Without the plugin. If your voice pipeline is not a LiveKit Agents worker, start the avatar with one REST call and stream it your audio: Cloud avatar without the plugin.
- Several agents in one room. The avatar lip-syncs the agent that calls
AvatarSession.start()and ignores other agents’ audio. - Gestures. Trigger avatar actions from your agent: Gestures.
The cloud example packages this worker with a web UI and Docker Compose.
Platform notes
- The mint call is one per session. The token starts that session only; it expires after an hour, and a session that runs longer continues.
livekit_urlin the mint call must be the URL the plugin connects to (LIVEKIT_URL, unless you passlivekit_url=toAvatarSession.start()).- If you run your own LiveKit server for your own worker, use
livekit-server1.9.12 or newer (bithuman runneeds 1.13 or newer). With older servers, browsers leave and rejoin the room every 15 s, and the video stalls each time.
Reference
- Runtime tokens:
POST /v1/runtime-tokens/mint. - LiveKit Agents docs.
- Python: the runtime the plugin builds on.