Skip to main content

Simli Avatar

The Simli Avatar plugin allows you to integrate a real-time, lip-synced AI avatar into your VideoSDK agent. This creates a more engaging and interactive experience for users by providing a visual representation of the AI agent.

Installation​

Install the Simli-enabled VideoSDK Agents package:

pip install "videosdk-plugins-simli"

Authentication​

The Simli plugin requires an Simli API key.

Set SIMLI_API_KEY in your .env file.

Importing​

from videosdk.plugins.simli import SimliAvatar, SimliConfig

Setup Credentials​

To use Simli, you need an API key. You can get one from the Simli Dashboard.

Set up your credentials by exporting them as an environment variable:

export SIMLI_API_KEY="YOUR_SIMLI_API_KEY"

You can also provide a faceId if you have a custom one.

export SIMLI_FACE_ID="YOUR_FACE_ID"

Example Usage​

Here's how you can integrate the Simli Avatar with both CascadingPipeline and RealTimePipeline.

Cascading Pipeline​

This example shows how to add the Simli Avatar to a CascadingPipeline.

import os
from videosdk.agents import CascadingPipeline
from videosdk.plugins.simli import SimliAvatar, SimliConfig
# Import other necessary components like STT, LLM, TTS

# 1. Initialize SimliConfig
simli_config = SimliConfig(
apiKey=os.getenv("SIMLI_API_KEY"),
faceId=os.getenv("SIMLI_FACE_ID"), # This is optional and has a default value
)

# 2. Create a SimliAvatar instance
simli_avatar = SimliAvatar(config=simli_config)

# 3. Add the avatar to the pipeline
pipeline = CascadingPipeline(
# ... stt=stt, llm=llm, tts=tts
avatar=simli_avatar
)

Real-time Pipeline​

This example shows how to add the Simli Avatar to a RealTimePipeline.

import os
from videosdk.agents import RealTimePipeline
from videosdk.plugins.simli import SimliAvatar, SimliConfig
# from videosdk.plugins.google import GeminiRealtime # Example model

# 1. Initialize SimliConfig
simli_config = SimliConfig(
apiKey=os.getenv("SIMLI_API_KEY"),
)

# 2. Create a SimliAvatar instance
simli_avatar = SimliAvatar(config=simli_config)

# 3. Add the avatar to the pipeline
pipeline = RealTimePipeline(
model=your_realtime_model, # e.g., GeminiRealtime()
avatar=simli_avatar
)
note

When using an environment variable for credentials, you should still load it in your code using os.getenv("SIMLI_API_KEY") and pass it to SimliConfig.

Configuration Options​

You can customize the avatar's behavior using the SimliConfig and SimliAvatar classes.

SimliConfig​

  • faceId: (str, optional) The ID for the avatar face. You can find available faces in the Simli Docs or create your own. Defaults to "0c2b8b04-5274-41f1-a21c-d5c98322efa9".
  • maxSessionLength: (int, optional) A hard time limit in seconds after which the session will disconnect. Defaults to 1800 (30 minutes).
  • maxIdleTime: (int, optional) A soft time limit in seconds that disconnects the session after a period of not sending data. Defaults to 300 (5 minutes).

SimliAvatar​

  • config: (SimliConfig) A SimliConfig object with your desired settings.

Additional Resources​

The following resources provide more information about using Simli with VideoSDK Agents SDK.

Got a Question? Ask us on discord