tryAGI provides a unified IRealtimeAvatarClient abstraction for interactive avatar streaming. Send text or audio, receive lip-synced video and audio from AI-powered avatars in real time.
D-ID uses WebRTC for bi-directional streaming with AI agents. The SDK handles SDP/ICE negotiation automatically.
Installation
1
dotnetaddpackagetryAGI.DId
Using the Unified Interface
1 2 3 4 5 6 7 8 91011121314151617181920
usingDId;usingtryAGI.RealtimeAvatar;varclient=newDIdClient(apiKey);// Connect returns IRealtimeAvatarClientawaitusingIRealtimeAvatarClientavatar=awaitDIdRealtimeAvatarClient.ConnectAsync(client,agentId:"your-agent-id");// Send text — the avatar speaks and lip-syncsawaitavatar.SendTextAsync("Hello! How can I help you today?");// Receive video frames (H.264 or VP8)awaitforeach(varframeinavatar.ReceiveVideoFramesAsync()){// frame.Data = encoded video bytes// frame.Codec = "H264" or "VP8"// frame.Timestamp = RTP timestamp}
usingDId;varclient=newDIdClient(apiKey);awaitusingvarsession=awaitDIdRealtimeSession.ConnectAsync(client,agentId:"your-agent-id",compatibilityMode:CreateStreamRequestCompatibilityMode.On,// VP8streamWarmup:true);// Send a chat messageawaitsession.SendMessageAsync("Tell me about quantum computing");// Receive video, audio, and data channel messages concurrentlyvarvideoTask=Task.Run(async()=>{awaitforeach(varframeinsession.ReceiveVideoFramesAsync()){Console.WriteLine($"Video: {frame.Format.FormatName} @ {frame.Timestamp}");}});varaudioTask=Task.Run(async()=>{awaitforeach(varframeinsession.ReceiveAudioFramesAsync()){Console.WriteLine($"Audio: {frame.Format.FormatName}, {frame.DurationMs}ms");}});vardataTask=Task.Run(async()=>{awaitforeach(varmsginsession.ReceiveDataMessagesAsync()){Console.WriteLine($"Data: {msg}");}});
Quick Start -- Simli
Simli uses WebSocket for signaling and audio input, with WebRTC for video/audio output.
Installation
1
dotnetaddpackagetryAGI.Simli
P2P WebSocket Connection
1 2 3 4 5 6 7 8 9101112131415161718192021222324
usingSimli;usingSimli.Realtime;varclient=newSimliClient(apiKey);// 1. Get a session tokenvartoken=awaitclient.Compose.CreateComposeTokenAsync(newCreateComposeTokenRequest{FaceId="your-face-id",});// 2. Connect via WebSocketvarws=newSimliPeerToPeerRealtimeClient();awaitws.ConnectAsync(token.SessionToken??string.Empty);// 3. Send PCM16 audio for lip-syncbyte[]pcmAudio=GetAudioBytes();// 16-bit PCMawaitws.SendAudioAsync(pcmAudio);// 4. Listen for server events (SDP answer, status signals)awaitforeach(varevtinws.ReceiveEventsAsync()){Console.WriteLine($"{evt.Type}: {evt.RawPayload}");}
The IRealtimeAvatarClient Interface
All adapters implement a common interface for provider-agnostic code:
Not all providers support both text and audio input:
Provider
SendTextAsync
SendAudioAsync
ReceiveVideoFramesAsync
ReceiveAudioFramesAsync
D-ID
Yes
No (text only)
Yes (WebRTC)
Yes (WebRTC)
Simli
No (audio only)
Yes
Via WebRTC*
Via WebRTC*
*Simli delivers video/audio over WebRTC tracks. The WebSocket client handles signaling and audio input; a WebRTC peer connection is needed to receive the output streams.