Basic example showing how to create a client and make a request.
1
usingvarclient=newDeepgramClient(apiKey);
Speech To Text Client Get Text Async
1 2 3 4 5 6 7 8 910111213141516
usingvarclient=newDeepgramClient(apiKey);ISpeechToTextClientspeechClient=client;// Transcribe audio using the MEAI ISpeechToTextClient interface.// Deepgram requires an audio URL via RawRepresentationFactory.usingvardummyStream=newMemoryStream();varresponse=awaitspeechClient.GetTextAsync(dummyStream,newSpeechToTextOptions{ModelId=DeepgramClient.Nova3ModelId,RawRepresentationFactory=_=>newListenV1RequestUrl{Url="https://dpgr.am/spacewalk.wav",},});Console.WriteLine($"Text: {response.Text}");
Speech To Text Client Get Service Metadata
12345
usingvarclient=newDeepgramClient("test-api-key");ISpeechToTextClientspeechClient=client;// Retrieve metadata about the speech-to-text provider.varmetadata=speechClient.GetService<SpeechToTextClientMetadata>();
Realtime Speech To Text
Real-time speech-to-text streaming using the typed ConnectAsync with query parameters.
varapiKey=Environment.GetEnvironmentVariable("DEEPGRAM_API_KEY")is{Length:>0}apiKeyValue?apiKeyValue:thrownewAssertInconclusiveException("DEEPGRAM_API_KEY environment variable is not found.");// Create a realtime ListenV1 client and authenticate.awaitusingvarrealtimeClient=newRealtime.DeepgramListenV1RealtimeClient();realtimeClient.AuthorizeUsingToken(apiKey);// Connect with typed query parameters — model, interim results, and language.usingvarcts=newCancellationTokenSource(TimeSpan.FromSeconds(30));awaitrealtimeClient.ConnectAsync(model:Realtime.ListenV1Model.Nova3,interimResults:Realtime.ListenV1InterimResults.True,language:Realtime.ListenV1Language.FromString("en"),cancellationToken:cts.Token);// Download a short audio sample and send it as binary frames.usingvarhttpClient=newHttpClient();varaudioBytes=awaithttpClient.GetByteArrayAsync("https://dpgr.am/spacewalk.wav",cts.Token);// Send audio in 8KB chunks.constintchunkSize=8192;for(varoffset=0;offset<audioBytes.Length;offset+=chunkSize){varlength=Math.Min(chunkSize,audioBytes.Length-offset);awaitrealtimeClient.SendAsync(newArraySegment<byte>(audioBytes,offset,length),System.Net.WebSockets.WebSocketMessageType.Binary,endOfMessage:true,cts.Token);}// Signal end of audio and close the stream.awaitrealtimeClient.SendListenV1CloseStreamAsync(newRealtime.ListenV1ControlMessage{Type=Realtime.ListenV1ControlMessageType.CloseStream,},cts.Token);// Receive transcription events until the connection closes.vartranscripts=newList<string>();string?responseId=null;awaitforeach(varserverEventinrealtimeClient.ReceiveUpdatesAsync(cts.Token)){if(serverEvent.IsMetadata&&serverEvent.Metadatais{}metadata){responseId=metadata.RequestId.ToString();Console.WriteLine($"Session started: {responseId}");}elseif(serverEvent.IsResults&&serverEvent.Resultsis{}results){if(results.IsFinal==true&&results.Channel?.Alternativesis{Count:>0}alts&&alts[0].Transcriptis{Length:>0}transcript){transcripts.Add(transcript);Console.WriteLine($"Final: {transcript}");}}}// Verify we received transcription results.Console.WriteLine($"Total final transcripts: {transcripts.Count}");
Speech To Text Client Get Streaming Text Async
Real-time streaming speech-to-text via the MEAI ISpeechToTextClient interface.
Uses the generated realtime client internally for model and language selection.
usingvarclient=newDeepgramClient(apiKey);ISpeechToTextClientspeechClient=client;// Download a short audio sample to use as streaming input.usingvarhttpClient=newHttpClient();varaudioBytes=awaithttpClient.GetByteArrayAsync("https://dpgr.am/spacewalk.wav");usingvaraudioStream=newMemoryStream(audioBytes);// Stream audio through the MEAI ISpeechToTextClient interface.// This uses the generated realtime client internally with model and language params.varupdates=newList<SpeechToTextResponseUpdate>();awaitforeach(varupdateinspeechClient.GetStreamingTextAsync(audioStream,newSpeechToTextOptions{ModelId=DeepgramClient.Nova3ModelId,SpeechLanguage="en",})){updates.Add(update);if(update.Kind==SpeechToTextResponseUpdateKind.TextUpdated){Console.WriteLine($"Final: {update.Text}");}}// Verify we received session events and transcription results.varfinalTranscripts=updates.Where(u=>u.Kind==SpeechToTextResponseUpdateKind.TextUpdated&&u.Textis{Length:>0}).Select(u=>u.Text!).ToList();Console.WriteLine($"Total final transcripts: {finalTranscripts.Count}");
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.