Configuration
The Deepgram .NET SDK provides three ways to configure the Deepgram client:
- Via the
DeepgramClient
constructor - Via an
appsettings.json
orsettings.json
file - Via a Configuration instance
Below are examples of how to do each.
DeepgramClient Constructor
The DeepgramClient
constructor allows you to provide a Deepgram API key and optional custom API url.
var credentials = new Credentials(YOUR_DEEPGRAM_API_KEY);
var deepgram = new DeepgramClient(credentials);
Settings Files
If a Credentials
object is not provided in the DeepgramClient
constructor, the client will look for parameters within an appsettings.json
or settings.json
file.
{
"appSettings": {
"Deepgram.Api.Key": "YOUR_DEEPGRAM_API_KEY",
"Deepgram.Api.Uri": "https://api.deepgram.com"
}
}
Order of Precedence in Settings Files
In the event multiple configuration files are found, the order of precedence is
as follows:
- appsettings.json
- settings.json
Configuration Instance
If you have an existing Configuration
instance, you can provide your settings to it directly.
Configuration.Instance.Settings["appSettings:Deepgram.Api.Key"] = "YOUR_DEEPGRAM_API_KEY";
Configuration.Instance.Settings["appSettings:Deepgram.Api.Uri"] = "https://api.deepgram.com";
Updated about 1 month ago