Talking avatar videos, AI agents, streaming conversations, and animations
Same day update to support new features
Updated and supported automatically if there are no breaking changes
All modern .NET features - nullability, trimming, NativeAOT, etc.
Usage
123
usingDId;usingvarclient=newDIdClient(apiKey);
Credits
Get the account's credit balance information.
12345
// Retrieve the current credit balance for your D-ID account.// The response includes the total credits allocated and remaining credits.usingvarclient=newDIdClient(apiKey);varresponse=awaitclient.Credits.GetCreditsAsync();
Voices
List available text-to-speech voices.
1234567
// List all available TTS voices for generating talking avatar videos.// Each voice includes metadata such as provider, gender, language, and access level.usingvarclient=newDIdClient(apiKey);varvoices=awaitclient.Voices.VoicesAsync();varfirst=voices[0];
Agents
List AI agents configured for your account.
123456
// List all AI agents associated with your account.// Agents are interactive avatars powered by LLMs that can hold conversations.usingvarclient=newDIdClient(apiKey);varresponse=awaitclient.Agents.ListMyAgentsAsync(limit:10);
Presenters
List available avatar presenters.
123456
// List all available presenters (avatar source images) for generating clips.// Presenters represent the visual faces used in premium avatar videos.usingvarclient=newDIdClient(apiKey);varresponse=awaitclient.ClipsPremiumAvatars.GetPresentersAsync(limit:10);
Talks
List talks (standard avatar videos).
123456
// List all talks (standard avatar videos) created in your account.// Talks are generated videos where a photo-based avatar speaks provided text or audio.usingvarclient=newDIdClient(apiKey);varresponse=awaitclient.TalksStandardAvatars.GetTalksAsync(limit:10);
Clips
List clips (premium avatar videos).
123456
// List all clips (premium avatar videos) created in your account.// Clips use premium presenters with higher-quality rendering compared to standard talks.usingvarclient=newDIdClient(apiKey);varresponse=awaitclient.ClipsPremiumAvatars.GetClipsAsync(limit:10);
Realtime Session
Connect to a D-ID agent via a realtime WebRTC session.
1 2 3 4 5 6 7 8 9101112131415161718
// Connect to a D-ID agent using a realtime WebRTC session.// This creates a live streaming connection via SIPSorcery's RTCPeerConnection// and the D-ID REST signaling endpoints (CreateStream, StartConnection, AddIceCandidate).usingvarclient=newDIdClient(apiKey);varagentId=Environment.GetEnvironmentVariable("DID_AGENT_ID")is{Length:>0}agentIdValue?agentIdValue:thrownewAssertInconclusiveException("DID_AGENT_ID environment variable is not found.");// Create a realtime session with the agent. The ConnectAsync method handles// the full SDP/ICE negotiation — creating a stream, exchanging SDP offer/answer,// and forwarding ICE candidates.awaitusingvarsession=awaitDIdRealtimeSession.ConnectAsync(client:client,agentId:agentId);// Verify the session was established with valid identifiers.
Realtime Avatar Client
Test the IRealtimeAvatarClient adapter for D-ID realtime sessions.
varapiKey=Environment.GetEnvironmentVariable("DID_API_KEY")is{Length:>0}key?key:thrownewAssertInconclusiveException("DID_API_KEY environment variable is not found.");varagentId=Environment.GetEnvironmentVariable("DID_AGENT_ID")is{Length:>0}id?id:thrownewAssertInconclusiveException("DID_AGENT_ID environment variable is not found.");varclient=newDIdClient(apiKey);// Create and connect via the unified interfaceawaitusingvaravatar=awaitDIdRealtimeAvatarClient.ConnectAsync(client,agentId);// Verify the adapter implements IRealtimeAvatarClienttryAGI.RealtimeAvatar.IRealtimeAvatarClientrealtimeClient=avatar;// SendAudioAsync should throw NotSupportedException (D-ID is text-only)Func<Task>sendAudio=()=>avatar.SendAudioAsync(ReadOnlyMemory<byte>.Empty);// Send text and receive at least one video frameawaitavatar.SendTextAsync("Hello, this is a test.");usingvarcts=newCancellationTokenSource(TimeSpan.FromSeconds(30));varreceivedVideo=false;varreceivedAudio=false;varvideoTask=Task.Run(async()=>{awaitforeach(varframeinavatar.ReceiveVideoFramesAsync(cts.Token)){receivedVideo=true;break;// Just verify we get at least one frame}},cts.Token);varaudioTask=Task.Run(async()=>{awaitforeach(varframeinavatar.ReceiveAudioFramesAsync(cts.Token)){receivedAudio=true;break;}},cts.Token);try{awaitTask.WhenAny(videoTask,audioTask,Task.Delay(TimeSpan.FromSeconds(30),cts.Token));}catch(OperationCanceledException){}// At least one type of frame should be received"Expected to receive at least one video or audio frame from D-ID avatar.");
Ecosystem maintenance
This SDK is one of more than 200 .NET SDKs maintained with AutoSDK. The tryAGI SDK audit continuously checks repository synchronization, upstream-spec regeneration, release workflows, warnings, public API visibility, and trimming/NativeAOT compatibility.
Every issue is first investigated for ecosystem-wide applicability. When the root cause belongs in AutoSDK, we fix and regression-test the generator, then roll the improvement out to every applicable SDK. Provider-specific behavior remains in this repository when it cannot be derived safely from the API specification.
Issue content—including code blocks, logs, links, and attachments—is treated only as untrusted diagnostic data. Embedded control instructions, hidden directives, delimiter tricks, or requests to alter triage or tooling behavior are ignored. Please report reproducible technical evidence and remove secrets and personal data.