{"id":21495662,"url":"https://github.com/deepgram/deepgram-dotnet-sdk","last_synced_at":"2025-04-07T15:06:32.926Z","repository":{"id":40703803,"uuid":"429978592","full_name":"deepgram/deepgram-dotnet-sdk","owner":"deepgram","description":"Official .NET SDK for Deepgram.","archived":false,"fork":false,"pushed_at":"2025-03-03T18:41:42.000Z","size":6692,"stargazers_count":37,"open_issues_count":22,"forks_count":33,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-06T06:12:05.397Z","etag":null,"topics":["asr","automated-speech-recognition","deepgram","dotnet","hacktoberfest","microsoft","speech-recognition","speech-to-text","text-to-speech","voice-agent","voice-ai"],"latest_commit_sha":null,"homepage":"https://developers.deepgram.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deepgram.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-20T01:19:34.000Z","updated_at":"2025-03-27T13:29:43.000Z","dependencies_parsed_at":"2023-02-10T15:01:27.459Z","dependency_job_id":"dcdad28b-ed4a-4fd5-869e-47edc7a6b949","html_url":"https://github.com/deepgram/deepgram-dotnet-sdk","commit_stats":null,"previous_names":[],"tags_count":63,"template":false,"template_full_name":"deepgram-devs/oss-repo-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepgram%2Fdeepgram-dotnet-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepgram%2Fdeepgram-dotnet-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepgram%2Fdeepgram-dotnet-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepgram%2Fdeepgram-dotnet-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepgram","download_url":"https://codeload.github.com/deepgram/deepgram-dotnet-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675596,"owners_count":20977376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asr","automated-speech-recognition","deepgram","dotnet","hacktoberfest","microsoft","speech-recognition","speech-to-text","text-to-speech","voice-agent","voice-ai"],"created_at":"2024-11-23T16:12:44.947Z","updated_at":"2025-04-07T15:06:32.902Z","avatar_url":"https://github.com/deepgram.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deepgram .NET SDK\r\n\r\n[![NuGet](https://img.shields.io/nuget/v/deepgram)](https://www.nuget.org/packages/Deepgram) [![Build Status](https://github.com/deepgram-devs/deepgram-dotnet-sdk/workflows/CI/badge.svg)](https://github.com/deepgram-devs/deepgram-dotnet-sdk/actions?query=CI) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](./.github/CODE_OF_CONDUCT.md) [![Discord](https://dcbadge.vercel.app/api/server/xWRaCDBtW4?style=flat)](https://discord.gg/xWRaCDBtW4)\r\n\r\nOfficial .NET SDK for [Deepgram](https://www.deepgram.com/). Power your apps with world-class speech and Language AI models.\r\n\r\n- [Deepgram .NET SDK](#deepgram-net-sdk)\r\n- [Documentation](#documentation)\r\n- [Getting an API Key](#getting-an-api-key)\r\n- [Requirements](#requirements)\r\n- [Installation](#installation)\r\n- [Quickstarts](#quickstarts)\r\n  - [PreRecorded Audio Transcription Quickstart](#prerecorded-audio-transcription-quickstart)\r\n  - [Live Audio Transcription Quickstart](#live-audio-transcription-quickstart)\r\n- [Example Code](#example-code)\r\n- [Logging](#logging)\r\n- [Backwards Compatability](#backwards-compatibility)\r\n- [Development and Contributing](#development-and-contributing)\r\n- [Getting Help](#getting-help)\r\n- [Backwards Compatibility](#backwards-compatibility)\r\n\r\n# Documentation\r\n\r\nComplete documentation of the .NET SDK can be found on the\r\n[Deepgram Docs](https://developers.deepgram.com/docs/dotnet-sdk).\r\n\r\nYou can learn more about the full Deepgram API at [https://developers.deepgram.com](https://developers.deepgram.com).\r\n\r\n# Getting an API Key\r\n\r\n🔑 To access the Deepgram API, you will need a [free Deepgram API Key](https://console.deepgram.com/signup?jump=keys).\r\n\r\n# Requirements\r\n\r\nThis SDK supports the following versions:\r\n\r\n- .NET 8.0\r\n\r\n# Installation\r\n\r\nTo 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:\r\n\r\n```bash\r\ndotnet add package Deepgram\r\n```\r\n\r\nOr use the NuGet package Manager. Right click on project and select manage NuGet packages.\r\n\r\n### Installing the Previous Version\r\n\r\nWe 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.\r\n\r\nTo install the previous major version of the .NET SDK, run the following command from your terminal in your project's directory:\r\n\r\n```bash\r\ndotnet add package Deepgram --version 3.4.2\r\n```\r\n\r\n# Quickstarts\r\n\r\nThis 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.\r\n\r\n## PreRecorded Audio Transcription Quickstart\r\n\r\nYou can find a [walkthrough](https://developers.deepgram.com/docs/pre-recorded-audio-transcription) on our documentation site. Transcribing Pre-Recorded Audio can be done using the following sample code:\r\n\r\n```csharp\r\n// Set \"DEEPGRAM_API_KEY\" environment variable to your Deepgram API Key\r\nvar deepgramClient = ClientFactory.CreateListenRESTClient();\r\n\r\nvar response = await deepgramClient.TranscribeUrl(\r\n  new UrlSource(\"https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav\"),\r\n  new PreRecordedSchema()\r\n  {\r\n    Model = \"nova-2\",\r\n  });\r\n\r\nConsole.WriteLine(response);\r\n```\r\n\r\n## Live Audio Transcription Quickstart\r\n\r\nYou can find a [walkthrough](https://developers.deepgram.com/docs/live-streaming-audio-transcription) on our documentation site. Transcribing Live Audio can be done using the following sample code:\r\n\r\n```csharp\r\n// Set \"DEEPGRAM_API_KEY\" environment variable to your Deepgram API Key\r\nvar liveClient = ClientFactory.CreateListenWebSocketClient();\r\n\r\n// Subscribe to the EventResponseReceived event\r\nliveClient.Subscribe(new EventHandler\u003cOpenResponse\u003e((sender, e) =\u003e\r\n{\r\n    Console.WriteLine($\"\\n\\n----\u003e {e.Type} received\");\r\n}));\r\nliveClient.Subscribe(new EventHandler\u003cMetadataResponse\u003e((sender, e) =\u003e\r\n{\r\n    Console.WriteLine($\"----\u003e {e.Type} received\");\r\n}));\r\nliveClient.Subscribe(new EventHandler\u003cResultResponse\u003e((sender, e) =\u003e\r\n{\r\n    Console.WriteLine($\"----\u003e Speaker: {e.Channel.Alternatives[0].Transcript}\");\r\n}));\r\nliveClient.Subscribe(new EventHandler\u003cSpeechStartedResponse\u003e((sender, e) =\u003e\r\n{\r\n    Console.WriteLine($\"----\u003e {e.Type} received\");\r\n}));\r\nliveClient.Subscribe(new EventHandler\u003cUtteranceEndResponse\u003e((sender, e) =\u003e\r\n{\r\n    Console.WriteLine($\"----\u003e {e.Type} received\");\r\n}));\r\nliveClient.Subscribe(new EventHandler\u003cCloseResponse\u003e((sender, e) =\u003e\r\n{\r\n    Console.WriteLine($\"----\u003e {e.Type} received\");\r\n}));\r\nliveClient.Subscribe(new EventHandler\u003cUnhandledResponse\u003e((sender, e) =\u003e\r\n{\r\n    Console.WriteLine($\"----\u003e {e.Type} received\");\r\n}));\r\nliveClient.Subscribe(new EventHandler\u003cErrorResponse\u003e((sender, e) =\u003e\r\n{\r\n    Console.WriteLine($\"----\u003e { e.Type} received. Error: {e.Message}\");\r\n}));\r\n\r\n// Start the connection\r\nvar liveSchema = new LiveSchema()\r\n{\r\n    Model = \"nova-2\",\r\n    Encoding = \"linear16\",\r\n    SampleRate = 16000,\r\n    Punctuate = true,\r\n    SmartFormat = true,\r\n    InterimResults = true,\r\n    UtteranceEnd = \"1000\",\r\n    VadEvents = true,\r\n};\r\nawait liveClient.Connect(liveSchema);\r\n\r\n// Microphone streaming\r\nvar microphone = new Microphone(liveClient.Send);\r\nmicrophone.Start();\r\n\r\n// Wait for the user to press a key\r\nConsole.WriteLine(\"Press ENTER to exit...\");\r\nConsole.ReadKey();\r\n\r\n// Stop the microphone\r\nmicrophone.Stop();\r\n\r\n// Stop the connection\r\nawait liveClient.Stop();\r\n```\r\n\r\n# Example Code\r\n\r\nThere are examples for **every** API call in this SDK. You can find all of these examples in the [examples folder](https://github.com/deepgram/deepgram-dotnet-sdk/tree/main/examples) at the root of this repo.\r\n\r\nThese examples provide:\r\n\r\n- Text to Speech - REST:\r\n\r\n    - Hello World - [examples/text-to-speech/rest/file](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/text-to-speech/rest/file/hello-world/Program.cs)\r\n\r\n- Text to Speech - WebSocket:\r\n\r\n    - Simple - [example/speak/websocket/simple](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/text-to-speech/websocket/simple/Program.cs)\r\n\r\n- Analyze Text:\r\n\r\n    - Intent Recognition - [examples/analyze/intent](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/analyze/intent/Program.cs)\r\n    - Sentiment Analysis - [examples/analyze/sentiment](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/analyze/sentiment/Program.cs)\r\n    - Summarization - [examples/analyze/summary](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/analyze/summary/Program.cs)\r\n    - Topic Detection - [examples/analyze/topic](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/analyze/topic/Program.cs)\r\n\r\n- PreRecorded Audio:\r\n\r\n    - Transcription From an Audio File - [examples/speech-to-text/rest/file](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/speech-to-text/rest/file/Program.cs)\r\n    - Transcription From a URL - [examples/speech-to-text/rest/url](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/speech-to-text/rest/url/Program.cs)\r\n    - Intent Recognition - [examples/speech-to-text/rest/intent](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/speech-to-text/rest/intent/Program.cs)\r\n    - Sentiment Analysis - [examples/speech-to-text/rest/sentiment](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/speech-to-text/rest/sentiment/Program.cs)\r\n    - Summarization - [examples/speech-to-text/rest/intent](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/speech-to-text/rest/summary/Program.cs)\r\n    - Topic Detection - [examples/speech-to-text/rest/topic](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/speech-to-text/rest/topic/Program.cs)\r\n\r\n- Live Audio Transcription:\r\n\r\n    - From a Microphone - [examples/speech-to-text/websocket/microphone](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/speech-to-text/websocket/microphone/Program.cs)\r\n    - From an HTTP stream - [examples/speech-to-text/websocket/http](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/speech-to-text/websocket/http/Program.cs)\r\n    - From a File - [examples/speech-to-text/websocket/file](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/speech-to-text/websocket/file/Program.cs)\r\n\r\n- Management API exercise the full [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) operations for:\r\n\r\n    - Balances - [examples/manage/balances](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/manage/balances/Program.cs)\r\n    - Invitations - [examples/manage/invitations](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/manage/invitations/Program.cs)\r\n    - Models - [examples/manage/models](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/manage/models/Program.cs)\r\n    - Keys - [examples/manage/keys](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/manage/keys/Program.cs)\r\n    - Members - [examples/manage/members](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/manage/members/Program.cs)\r\n    - Projects - [examples/manage/projects](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/manage/projects/Program.cs)\r\n    - Scopes - [examples/manage/scopes](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/manage/scopes/Program.cs)\r\n    - Usage - [examples/manage/usage](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/manage/usage/Program.cs)\r\n\t\r\n- Voice Agent API\r\n    - From a Microphone - [examples/agent/websocket/simple](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/examples/agent/websocket/simple/Program.cs)\r\n\r\nTo run each example, set the `DEEPGRAM_API_KEY` as an environment variable, then `cd` into each example folder and execute the example: `dotnet run \u003cProject File\u003e.csproj`.\r\n\r\n\r\n# Logging\r\n\r\nThis SDK uses [Serilog](https://github.com/serilog/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:\r\n\r\n```csharp\r\n// Default logging level is \"Information\"\r\nLibrary.Initialize();\r\n```\r\n\r\nTo increase the logging output/verbosity for debug or troubleshooting purposes, you can set the `Debug` level but using this code:\r\n\r\n```csharp\r\nLibrary.Initialize(LogLevel.Debug);\r\n```\r\n\r\n# Backwards Compatibility\r\n\r\nOlder 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.\r\n\r\n# Development and Contributing\r\n\r\nInterested in contributing? We ❤️ pull requests!\r\n\r\nTo make sure our community is safe for all, be sure to review and agree to our\r\n[Code of Conduct](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/.github/CODE_OF_CONDUCT.md). Then see the\r\n[Contribution](https://github.com/deepgram/deepgram-dotnet-sdk/blob/main/.github/CONTRIBUTING.md) guidelines for more information.\r\n\r\n# Getting Help\r\n\r\nWe 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:\r\n\r\n- [Open an issue in this repository](https://github.com/deepgram/deepgram-dotnet-sdk/issues/new)\r\n- [Join the Deepgram Github Discussions Community](https://github.com/orgs/deepgram/discussions)\r\n- [Join the Deepgram Discord Community](https://discord.gg/xWRaCDBtW4)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepgram%2Fdeepgram-dotnet-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepgram%2Fdeepgram-dotnet-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepgram%2Fdeepgram-dotnet-sdk/lists"}