Deepgram 4.3.3
See the version list below for details.
dotnet add package Deepgram --version 4.3.3
NuGet\Install-Package Deepgram -Version 4.3.3
<PackageReference Include="Deepgram" Version="4.3.3" />
paket add Deepgram --version 4.3.3
#r "nuget: Deepgram, 4.3.3"
// Install Deepgram as a Cake Addin #addin nuget:?package=Deepgram&version=4.3.3 // Install Deepgram as a Cake Tool #tool nuget:?package=Deepgram&version=4.3.3
Deepgram .NET SDK
Official .NET SDK for Deepgram. Power your apps with world-class speech and Language AI models.
- Deepgram .NET SDK
- Documentation
- Getting an API Key
- Requirements
- Installation
- Quickstarts
- Example Code
- Logging
- Backwards Compatability
- Development and Contributing
- Getting Help
- Backwards Compatibility
Documentation
Complete documentation of the .NET SDK can be found on the Deepgram Docs.
You can learn more about the full Deepgram API at https://developers.deepgram.com.
Getting an API Key
🔑 To access the Deepgram API, you will need a free Deepgram API Key.
Requirements
This SDK supports the following versions:
- .NET 8.0
- .NET 7.0
- .NET 6.0
Installation
To install the latest version of the C# SDK using NuGet (latest means this version will guarantee change over time), run the following command from your terminal in your project's directory:
dotnet add package Deepgram
Or use the NuGet package Manager. Right click on project and select manage NuGet packages.
Installing the Previous Version
We guarantee that major interfaces will not break in a given major semver (ie, 4.*
release). However, all bets are off moving from a 3.*
to 4.*
major release. This follows standard semver best-practices.
To install the previous major version of the .NET SDK, run the following command from your terminal in your project's directory:
dotnet add package Deepgram --version 3.4.2
Quickstarts
This SDK aims to reduce complexity and abstract/hide some internal Deepgram details that clients shouldn't need to know about. However, you can still tweak options and settings if you need.
PreRecorded Audio Transcription Quickstart
You can find a walkthrough on our documentation site. Transcribing Pre-Recorded Audio can be done using the following sample code:
// Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
var deepgramClient = ClientFactory.CreateListenRESTClient();
var response = await deepgramClient.TranscribeUrl(
new UrlSource("https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav"),
new PreRecordedSchema()
{
Model = "nova-2",
});
Console.WriteLine(response);
Live Audio Transcription Quickstart
You can find a walkthrough on our documentation site. Transcribing Live Audio can be done using the following sample code:
// Set "DEEPGRAM_API_KEY" environment variable to your Deepgram API Key
var liveClient = ClientFactory.CreateListenWebSocketClient();
// Subscribe to the EventResponseReceived event
liveClient.Subscribe(new EventHandler<OpenResponse>((sender, e) =>
{
Console.WriteLine($"\n\n----> {e.Type} received");
}));
liveClient.Subscribe(new EventHandler<MetadataResponse>((sender, e) =>
{
Console.WriteLine($"----> {e.Type} received");
}));
liveClient.Subscribe(new EventHandler<ResultResponse>((sender, e) =>
{
Console.WriteLine($"----> Speaker: {e.Channel.Alternatives[0].Transcript}");
}));
liveClient.Subscribe(new EventHandler<SpeechStartedResponse>((sender, e) =>
{
Console.WriteLine($"----> {e.Type} received");
}));
liveClient.Subscribe(new EventHandler<UtteranceEndResponse>((sender, e) =>
{
Console.WriteLine($"----> {e.Type} received");
}));
liveClient.Subscribe(new EventHandler<CloseResponse>((sender, e) =>
{
Console.WriteLine($"----> {e.Type} received");
}));
liveClient.Subscribe(new EventHandler<UnhandledResponse>((sender, e) =>
{
Console.WriteLine($"----> {e.Type} received");
}));
liveClient.Subscribe(new EventHandler<ErrorResponse>((sender, e) =>
{
Console.WriteLine($"----> { e.Type} received. Error: {e.Message}");
}));
// Start the connection
var liveSchema = new LiveSchema()
{
Model = "nova-2",
Encoding = "linear16",
SampleRate = 16000,
Punctuate = true,
SmartFormat = true,
InterimResults = true,
UtteranceEnd = "1000",
VadEvents = true,
};
await liveClient.Connect(liveSchema);
// Microphone streaming
var microphone = new Microphone(liveClient.Send);
microphone.Start();
// Wait for the user to press a key
Console.WriteLine("Press ENTER to exit...");
Console.ReadKey();
// Stop the microphone
microphone.Stop();
// Stop the connection
await liveClient.Stop();
Example Code
There are examples for every API call in this SDK. You can find all of these examples in the examples folder at the root of this repo.
These examples provide:
Text to Speech - REST:
- Hello World - examples/text-to-speech/rest/file
Text to Speech - WebSocket:
- Simple - example/speak/websocket/simple
Analyze Text:
- Intent Recognition - examples/analyze/intent
- Sentiment Analysis - examples/analyze/sentiment
- Summarization - examples/analyze/summary
- Topic Detection - examples/analyze/topic
PreRecorded Audio:
- Transcription From an Audio File - examples/speech-to-text/rest/file
- Transcription From a URL - examples/speech-to-text/rest/url
- Intent Recognition - examples/speech-to-text/rest/intent
- Sentiment Analysis - examples/speech-to-text/rest/sentiment
- Summarization - examples/speech-to-text/rest/intent
- Topic Detection - examples/speech-to-text/rest/topic
Live Audio Transcription:
- From a Microphone - examples/speech-to-text/websocket/microphone
- From an HTTP stream - examples/speech-to-text/websocket/http
- From a File - examples/speech-to-text/websocket/file
Management API exercise the full CRUD operations for:
- Balances - examples/manage/balances
- Invitations - examples/manage/invitations
- Models - examples/manage/models
- Keys - examples/manage/keys
- Members - examples/manage/members
- Projects - examples/manage/projects
- Scopes - examples/manage/scopes
- Usage - examples/manage/usage
To run each example, set the DEEPGRAM_API_KEY
as an environment variable, then cd
into each example folder and execute the example: dotnet run <Project File>.csproj
.
Logging
This SDK uses Serilog to perform all of its logging tasks. By default, this SDK will enable Information
level messages and higher (ie Warning
, Error
, etc.) when you initialize the library as follows:
// Default logging level is "Information"
Library.Initialize();
To increase the logging output/verbosity for debug or troubleshooting purposes, you can set the Debug
level but using this code:
Library.Initialize(LogLevel.Debug);
Backwards Compatibility
Older SDK versions will receive Priority 1 (P1) bug support only. Security issues, both in our code and dependencies, are promptly addressed. Significant bugs without clear workarounds are also given priority attention.
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, please let us know! You can either:
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Http.Polly (>= 6.0.33)
- Microsoft.Extensions.Logging (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.4)
- Polly.Contrib.WaitAndRetry (>= 1.1.1)
- Serilog (>= 3.1.1)
- Serilog.Sinks.Console (>= 5.0.1)
- Serilog.Sinks.File (>= 5.0.0)
- System.Text.Json (>= 6.0.9)
- System.Threading.Channels (>= 6.0.0)
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Http.Polly (>= 6.0.33)
- Microsoft.Extensions.Logging (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.4)
- Polly.Contrib.WaitAndRetry (>= 1.1.1)
- Serilog (>= 3.1.1)
- Serilog.Sinks.Console (>= 5.0.1)
- Serilog.Sinks.File (>= 5.0.0)
- System.Text.Json (>= 6.0.9)
- System.Threading.Channels (>= 6.0.0)
-
net7.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Http.Polly (>= 7.0.20)
- Microsoft.Extensions.Logging (>= 7.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.1)
- Polly.Contrib.WaitAndRetry (>= 1.1.1)
- Serilog (>= 3.1.1)
- Serilog.Sinks.Console (>= 5.0.1)
- Serilog.Sinks.File (>= 5.0.0)
- System.Text.Json (>= 7.0.4)
- System.Threading.Channels (>= 7.0.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Http.Polly (>= 8.0.8)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Polly.Contrib.WaitAndRetry (>= 1.1.1)
- Serilog (>= 3.1.1)
- Serilog.Sinks.Console (>= 5.0.1)
- Serilog.Sinks.File (>= 5.0.0)
- System.Text.Json (>= 8.0.4)
- System.Threading.Channels (>= 8.0.0)
Version | Downloads | Last updated |
---|---|---|
4.4.1 | 75 | 12/20/2024 |
4.4.0 | 5,248 | 11/4/2024 |
4.3.6 | 3,792 | 10/2/2024 |
4.3.5 | 275 | 9/27/2024 |
4.3.4 | 222 | 9/26/2024 |
4.3.3 | 154 | 9/24/2024 |
4.3.2 | 10,231 | 9/18/2024 |
4.2.0 | 3,699 | 8/14/2024 |
4.1.0 | 9,376 | 7/15/2024 |
4.0.3 | 4,098 | 7/9/2024 |
4.0.2 | 5,603 | 6/11/2024 |
4.0.1 | 10,188 | 4/24/2024 |
4.0.0 | 165 | 4/22/2024 |
3.4.2 | 14,396 | 3/29/2024 |
3.4.1 | 7,055 | 2/13/2024 |
3.4.0 | 36,709 | 9/26/2023 |
3.3.0 | 1,337 | 9/14/2023 |
3.2.0 | 1,089 | 8/28/2023 |
3.1.0 | 2,195 | 8/14/2023 |
2.2.0 | 12,444 | 7/20/2023 |
2.1.0 | 3,565 | 6/30/2023 |
2.0.0 | 8,595 | 4/12/2023 |
1.13.0 | 1,478 | 1/17/2023 |
1.12.0 | 817 | 12/13/2022 |
1.11.1 | 599 | 11/30/2022 |
1.10.0 | 2,283 | 11/15/2022 |
1.9.0 | 876 | 10/30/2022 |
1.8.0 | 749 | 10/6/2022 |
1.7.1 | 716 | 10/1/2022 |
1.7.0 | 694 | 9/27/2022 |
1.6.0 | 714 | 9/20/2022 |
1.5.1 | 734 | 9/2/2022 |
1.4.1 | 756 | 8/17/2022 |
1.4.0 | 775 | 7/14/2022 |
1.3.1 | 729 | 7/1/2022 |
1.2.0 | 827 | 4/20/2022 |
1.1.0 | 1,056 | 2/4/2022 |
1.0.0 | 627 | 12/20/2021 |
1.0.0-beta2 | 606 | 11/22/2021 |
1.0.0-beta1 | 681 | 11/21/2021 |