how can I get my own local ai avatar videogen work...
# ask-ai
h
how can I get my own local ai avatar videogen working?
t
Thanks for reaching out, Brian. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm excited to help you set up local AI avatar video generation in LiveKit using the bitHuman integration! This setup lets your avatars run directly on your CPU with a downloaded
.imx
model file. Let’s walk through the steps together: 1. Install the Plugin: First, you’ll want to install the
livekit-agents[bithuman]
package:
pip install "livekit-agents[bithuman]~=1.2"
2. Authentication: Next, get your bitHuman API Secret from bitHuman and set it as an environment variable like this:
BITHUMAN_API_SECRET=your_api_secret_here
3. Download the Avatar Model: Then, download a
.imx
model file, such as the Einstein model: `wget https://repo.one.bithuman.io/resources/rt_models/samples/albert_einstein.imx`Don’t forget to set the path in your environment:
BITHUMAN_MODEL_PATH=/path/to/albert_einstein.imx
4. Configure the Avatar in Code: Here’s a simple snippet to enable local mode in your code:
Copy code
from livekit.plugins import bithuman

avatar = bithuman.AvatarSession(
    model_path="./albert_einstein.imx",  # Local model path
)
await avatar.start(session, room=ctx.room)
5. Run the Agent: Run the agent worker using the LiveKit CLI with:
python agent_local.py dev
6. Rendering on Frontend: The avatar’s video will be published as a regular video track, which you can render using LiveKit’s client SDKs, like this:
<videotrack trackref="{videoTrack}"/>
If you want to dive deeper, the bitHuman integration guide has lots of helpful info. And of course, if you have any questions or need a hand with any step, just let me know—I’m here to help! Sources: Docs::Agents | examples/avatar_agents/bithuman/agent_cloud.py | Bringing AI avatars to voice agents
h
I have a local model that's different than bithuman, how can I use it? it can take in audio and output the video.
t
Thanks for reaching out! I want to help you understand how LiveKit supports local AI avatar video generation. Right now, this is available through the bitHuman integration, which works with models in the
.imx
format. If your custom model isn’t in this format, it won’t be compatible directly with LiveKit’s local avatar system, but don’t worry—we have some options to explore together! Here’s what you can consider: 1. Convert to bitHuman Format: If it’s possible, converting your model to a
.imx
file would let you use it seamlessly with the bitHuman integration, running locally on your CPU. 2. Custom Integration: Another route is to use LiveKit’s ByteStream and RPC APIs to connect your local AI model. This way, you can forward audio to your model and publish the generated video frames directly into the room as a participant bot. 3. Cloud-Based Options: If running locally isn’t a must, you might want to explore cloud-based avatar platforms like Tavus or Hedra. They integrate with LiveKit nicely, though they don’t support local models. Please feel free to reach out if you’d like some help with a custom integration or if you have any specific needs for your setup—I’m here to support you every step of the way! Sources: bitHuman virtual avatar integration guide | LiveKit Docs | Docs::Agents | examples/avatar_agents/tavus/README.md | Bringing AI avatars to voice agents