Using SDKs with On-Prem

Learn about how to use Deepgram SDKs with Deepgram On-Prem installations.

By default, Deepgram's SDKs hit the hosted endpoint To use one of our SDKs with your on-prem deployment, you will need to specify your own on-prem endpoint instead.

Determining your host URL

If running your requests locally on your on-prem server, your URL may be as simple as http://localhost:8080 (pre-recorded) or ws://localhost:8080 (streaming).

If running your requests on other servers, you may use a static IP, such as

If you use a multi-server or auto-scaled environment, you may configure a URL that is served by a load balancer that routes your requests across several instances.

Note that for a host that does not have TLS enabled, you will use http rather than https, and ws rather than wss.

Python SDK

When deploying in a containerized environment, you can set client configuration parameters using the class ClientOptionsFromEnv. This will set configuration options in DeepgramClientOptions, obtaining those inputs from environments variables. Set the DEEPGRAM_HOST environment variable to direct your requests to your on-prem server rather than the hosted API.

Alternatively, you may also pass the url parameter as input in code to the DeepgramClientOptions constructor.

Below is an example of how to make your first API request using the Python SDK on-prem. Substitute your own host address in place of localhost if needed.

Note that the api_key field cannot be a blank string as it is a required parameter for the Python SDK, but it does not need to be a valid Deepgram API key, as on-prem does not rely on API keys for authorizing usage.

from deepgram import DeepgramClient, ClientOptionsFromEnv, PrerecordedOptions

deepgram = DeepgramClient(config=ClientOptionsFromEnv(api_key="a", url="http://localhost:8080"))
response = deepgram.listen.prerecorded.v("1").transcribe_url(
    "url": ""


The .NET SDK provides DeepgramHttpClientOptions (pre-recorded) and DeepgramWsClientOptions (streaming) classes, through which you can pass your host address. Below is a streaming example. Note that you should provide the /v1 suffix to the base address.

var apiKey = "<your API key>";
var options = new DeepgramWsClientOptions(){
  BaseAddress = "ws://localhost:8080/v1"
var liveClient = new LiveClient(apiKey, options);

If you encounter the following error message, note that you are receiving a 400 (bad request) when a 101 (successful stream) is expected.

Error: "The server returned status code \u0027400\u0027 when status code \u0027101\u0027 was expected."

Ensure that your request parameters are specifying a model that you have available on your on-prem instance. For example, when you intend to serve requests through a formatted Nova-2 model, specify the following params:

var liveSchema = new LiveSchema()
  Model = "nova-2",
  SmartFormat = true,

If that model is not present in your models/ directory, the above error will occur.


To modify the Host option in type-client.go

// ClientOptions defines any options for the client
type ClientOptions struct {
	ApiKey     string
	Host       string // override for the host endpoint
	ApiVersion string // override for the version used
	Path       string // override for the endpoint path usually <version/listen> or <version/projects>
	OnPrem     bool   // set to true if using on-prem

	// live client options
	SkipServerAuth  bool // keeps the client from authenticating with the server
	RedirectService bool // allows HTTP redirects to be followed
	EnableKeepAlive bool // enables the keep alive feature

You can create an object of type ClientOptions and then set the Host value.

	// create a Deepgram client
	c := client.New("", interfaces.ClientOptions{
		Host: "http://localhost:8080",

JavaScript SDK

To modify the URL, you can pass the url property within the global object to a new client.

const options: DeepgramClientOptions = {
  global: {
    url: "http://localhost:8080", // Set the desired URL here

const client = createClient("DEEPGRAM_API_KEY", options);