Deepgram 1.13.0

.NET 5.0 .NET Core 3.1 .NET Standard 2.0
dotnet add package Deepgram --version 1.13.0
NuGet\Install-Package Deepgram -Version 1.13.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Deepgram" Version="1.13.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Deepgram --version 1.13.0
#r "nuget: Deepgram, 1.13.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Deepgram as a Cake Addin
#addin nuget:?package=Deepgram&version=1.13.0

// Install Deepgram as a Cake Tool
#tool nuget:?package=Deepgram&version=1.13.0

Deepgram .NET SDK

Nuget Build Status Contributor Covenant

Official .NET SDK for Deepgram's automated speech recognition APIs.

To access the API you will need a Deepgram account. Sign up for free at signup.


Full documentation of the .NET SDK can be found on the Deepgram Developer Portal.

You can learn more about the full Deepgram API at


To install the C# client library using NuGet:

Run the following command from your terminal in your projects directory:

dotnet add package Deepgram

Targeted Frameworks

  • 6.0.0
  • 5.0.0
  • .NET Core 3.1
  • .NET Standard 2.0


To setup the configuration of the Deepgram Client you can do one of the following:

  • Create a Deepgram Client instance and pass in credentials in the constructor.
var credentials = new Credentials(YOUR_DEEPGRAM_API_KEY);
var deepgramClient = new DeepgramClient(credentials);


  • Provide the Deepgram API key and optional API Url in appsettings.json:
  "appSettings": {
    "Deepgram.Api.Key": "YOUR_DEEPGRAM_API_KEY",
    "Deepgram.Api.Uri": ""

Note: In the event multiple configuration files are found, the order of precedence is as follows:

* ```appsettings.json``` which overrides
* ```settings.json```


  • Access the Configuration instance and set the appropriate key in your code for example:
Configuration.Instance.Settings["appSettings:Deepgram.Api.Key"] = "YOUR_DEEPGRAM_API_KEY";
Configuration.Instance.Settings["appSettings:Deepgram.Api.Uri"] = "";


Sending a Remote File for Transcription

var credentials = new Credentials(DEEPGRAM_API_KEY);

var deepgramClient = new DeepgramClient(credentials);

var response = await deepgramClient.Transcription.Prerecorded.GetTranscriptionAsync(
    new Deepgram.Transcription.UrlSource(""),
    new Deepgram.Transcription.PrerecordedTranscriptionOptions()
        Punctuate = true

Sending a Local File for Transcription

var credentials = new Credentials(DEEPGRAM_API_KEY);

var deepgramClient = new DeepgramClient(credentials);

using (FileStream fs = File.OpenRead("path\\to\\file"))
    var response = await deepgramClient.Transcription.Prerecorded.GetTranscriptionAsync(
        new Deepgram.Transcription.StreamSource(
        new Deepgram.Transcription.PrerecordedTranscriptionOptions()
            Punctuate = true

Real-time Transcription

The example below demonstrates sending a pre-recorded audio to simulate a real-time stream of audio. In a real application, this type of audio is better handled using the pre-recorded transcription.

var credentials = new Credentials(DEEPGRAM_API_KEY);

var deepgramClient = new DeepgramClient(credentials);

using (var deepgramLive = deepgramClient.CreateLiveTranscriptionClient())
    deepgramLive.ConnectionOpened += HandleConnectionOpened;
    deepgramLive.ConnectionClosed += HandleConnectionClosed;
    deepgramLive.ConnectionError += HandleConnectionError;
    deepgramLive.TranscriptReceived += HandleTranscriptReceived;

    // Connection opened so start sending audio.
    async void HandleConnectionOpened(object? sender, ConnectionOpenEventArgs e)
        byte[] buffer;

        using (FileStream fs = File.OpenRead("path\\to\\file"))
            buffer = new byte[fs.Length];
            fs.Read(buffer, 0, (int)fs.Length);

        var chunks = buffer.Chunk(1000);

        foreach (var chunk in chunks)
            await Task.Delay(50);

        await deepgramLive.FinishAsync();

    void HandleTranscriptReceived(object? sender, TranscriptReceivedEventArgs e)
        if (e.Transcript.IsFinal && e.Transcript.Channel.Alternatives.First().Transcript.Length > 0) { 
            var transcript = e.Transcript;
            Console.WriteLine($"[Speaker: {transcript.Channel.Alternatives.First().Words.First().Speaker}] {transcript.Channel.Alternatives.First().Transcript}");

    void HandleConnectionClosed(object? sender, ConnectionClosedEventArgs e)
        Console.Write("Connection Closed");

    void HandleConnectionError(object? sender, ConnectionErrorEventArgs e)

    var options = new LiveTranscriptionOptions() { Punctuate = true, Diarize = true, Encoding = Deepgram.Common.AudioEncoding.Linear16 };
    await deepgramLive.StartConnectionAsync(options);

    while (deepgramLive.State() == WebSocketState.Open) { }


The Library uses Microsoft.Extensions.Logging to preform all of it's logging tasks. To configure logging for your app simply create a new ILoggerFactory and call the LogProvider.SetLogFactory() method to tell the Deepgram library how to log. For example, to log to the console with Serilog, you'd need to install the Serilog package with dotnet add package Serilog and then do the following:

using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
using Deepgram.Logger;
using Serilog;

var log = new LoggerConfiguration()
    .WriteTo.Console(outputTemplate: "{Timestamp:HH:mm} [{Level}]: {Message}\n")
var factory = new LoggerFactory();

Development and Contributing

Interested in contributing? We ❤️ pull requests!

To make sure our community is safe for all, be sure to review and agree to our Code of Conduct. Then see the Contribution guidelines for more information.

Getting Help

We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:

Further Reading

Check out the Developer Documentation at

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.13.0 265 1/17/2023
1.12.0 286 12/13/2022
1.11.1 194 11/30/2022
1.10.0 1,229 11/15/2022
1.9.0 412 10/30/2022
1.8.0 291 10/6/2022
1.7.1 253 10/1/2022
1.7.0 267 9/27/2022
1.6.0 281 9/20/2022
1.5.1 299 9/2/2022
1.4.1 322 8/17/2022
1.4.0 349 7/14/2022
1.3.1 329 7/1/2022
1.2.0 420 4/20/2022
1.1.0 484 2/4/2022
1.0.0 227 12/20/2021
1.0.0-beta2 290 11/22/2021
1.0.0-beta1 323 11/21/2021