Overview
D-iD's Realtime Avatars let you create your own avatar that can participate in live, interactive conversations. You can use the open source D-iD integration for LiveKit Agents in your voice AI app.
Installation
uv add "livekit-agents[did]~=1.5"
Authentication
The D-iD plugin requires a D-iD API key.
Set DID_API_KEY in your .env file.
Usage
Use the plugin in an AgentSession. For example, you can use this avatar in the Voice AI quickstart.
from livekit import agentsfrom livekit.agents import AgentServer, AgentSessionfrom livekit.plugins import didserver = AgentServer()@server.rtc_session(agent_name="my-agent")async def my_agent(ctx: agents.JobContext):session = AgentSession(# ... stt, llm, tts, etc.)avatar = did.AvatarSession(agent_id="...", # ID of the D-iD avatar to use. See "Avatar setup" for details.)# Start the avatar and wait for it to joinawait avatar.start(session, room=ctx.room)# Start your agent session with the userawait session.start(# ... room, agent, room_options, etc....)
Preview the avatar in the Agents Playground or a frontend starter app that you build.
Avatar setup
This plugin only supports v4 avatars (type: expressive). To retrieve an agent ID, create a new agent:
curl -X POST https://api.d-id.com/agents \-H "Authorization: Basic <YOUR_API_KEY>" \-H "Content-Type: application/json" \-d '{"presenter": {"type": "expressive","presenter_id": "public_mia_elegant@avt_TJ0Tq5"},"preview_name": "My Expressive Agent"}'
Use the agent ID from the response as the agent_id parameter in the plugin.
Parameters
This section describes some of the available parameters. See the plugin reference for a complete list of all available parameters.
avatar_idstringID of the D-iD avatar to use. See Avatar setup for details.
avatar_participant_namestringDefault: did-avatar-agentThe name of the participant to use for the avatar.
Additional resources
The following resources provide more information about using D-iD with LiveKit Agents.