### Install Client Dependencies and Start Dev Server Source: https://developers.deepgram.com/docs/pipecat-integration.mdx Navigate to the client directory, install Node.js dependencies using npm, and start the development server. ```bash cd my-bot/client npm install npm run dev ``` -------------------------------- ### Run the Setup Wizard Source: https://developers.deepgram.com/docs/inbound-telephony-agent Execute the setup script to configure Twilio, deploy to Fly.io, and automatically set up webhooks. The wizard will guide you through the necessary steps. ```bash python setup.py ``` -------------------------------- ### Install and Start Node Media Server Source: https://developers.deepgram.com/docs/integrate-deepgram-with-zoom.mdx Installs Node Media Server globally and starts the server. This is used to receive RTMP stream data from Zoom. ```bash npm i node-media-server -g && node-media-server ``` -------------------------------- ### Python SDK Configuration Example Source: https://developers.deepgram.com/reference/custom-endpoints.mdx Example of configuring the Python SDK. For more migration guides, visit the provided URL. ```python # For more Python SDK migration guides, visit: ``` -------------------------------- ### Get Distribution Credentials - Go Source: https://developers.deepgram.com/reference/self-hosted/distribution-credentials/get.mdx This Go example demonstrates how to make a GET request to fetch distribution credentials using the standard net/http package. Replace `` with your actual API key. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.deepgram.com/v1/projects/project_id/self-hosted/distribution/credentials/distribution_credentials_id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Token ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Project Key - Go Source: https://developers.deepgram.com/reference/manage/keys/get.mdx Use Go's net/http package to make a GET request to retrieve a project key. This example demonstrates reading the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.deepgram.com/v1/projects/project_id/keys/key_id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Token ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Install Deepgram Go SDK Source: https://developers.deepgram.com/docs/flux/quickstart.mdx Instructions for installing the Deepgram Go SDK using the go get command. This is a placeholder as the SDK is coming soon. ```Go // Install the Deepgram Go SDK // https://github.com/deepgram/deepgram-go-sdk // $ go get github.com/deepgram/deepgram-go-sdk ``` -------------------------------- ### Install Deepgram Go SDK Source: https://developers.deepgram.com/docs/pre-recorded-audio.mdx Install the Deepgram Go SDK using the go get command. ```shell # Install the Deepgram Go SDK # https://github.com/deepgram/deepgram-go-sdk go get github.com/deepgram/deepgram-go-sdk ``` -------------------------------- ### Transcribe Pre-recorded Audio with Deepgram Go SDK Source: https://developers.deepgram.com/docs/the-deepgram-model-improvement-partnership-program.mdx This Go example transcribes a local audio file using the Deepgram SDK. Install the SDK using `go get github.com/deepgram/deepgram-go-sdk`. The `mip_opt_out` parameter is set to `true` to opt out of the Model Improvement Program. ```go // Install the SDK: go get github.com/deepgram/deepgram-go-sdk package main import ( "context" "encoding/json" "fmt" "os" prettyjson "github.com/hokaccha/go-prettyjson" api "github.com/deepgram/deepgram-go-sdk/pkg/api/listen/v1/rest" interfaces "github.com/deepgram/deepgram-go-sdk/pkg/client/interfaces" client "github.com/deepgram/deepgram-go-sdk/pkg/client/listen" ) const ( filePath string = "./Bueller-Life-moves-pretty-fast.mp3" ) func main() { client.Init(client.InitLib{ LogLevel: client.LogLevelTrace, }) ctx := context.Background() options := &interfaces.PreRecordedTranscriptionOptions{ Model: "nova-3", } // create a Deepgram client c := client.NewREST("", &interfaces.ClientOptions{ Host: "https://api.deepgram.com", }) dg := api.New(c) // Custom option to opt out of Model Improvement Program params := make(map[string][]string, 0) params["mip_opt_out"] = []string{"true"} ctx = interfaces.WithCustomParameters(ctx, params) res, err := dg.FromFile(ctx, filePath, options) if err != nil { if e, ok := err.(*interfaces.StatusError); ok { fmt.Printf("DEEPGRAM ERROR:\n%s:\n%s\n", e.DeepgramError.ErrCode, e.DeepgramError.ErrMsg) } fmt.Printf("FromStream failed. Err: %v\n", err) os.Exit(1) } data, err := json.Marshal(res) if err != nil { fmt.Printf("json.Marshal failed. Err: %v\n", err) os.Exit(1) } prettyJSON, err := prettyjson.Format(data) if err != nil { fmt.Printf("prettyjson.Marshal failed. Err: %v\n", err) os.Exit(1) } fmt.Printf("\n\nResult:\n%s\n\n", prettyJSON) vtt, err := res.ToWebVTT() if err != nil { fmt.Printf("ToWebVTT failed. Err: %v\n", err) os.Exit(1) } fmt.Printf("\n\n\nVTT:\n%s\n\n\n", vtt) srt, err := res.ToSRT() if err != nil { fmt.Printf("ToSRT failed. Err: %v\n", err) os.Exit(1) } fmt.Printf("\n\n\nSRT:\n%s\n\n\n", srt) } ``` -------------------------------- ### List Project Keys in PHP Source: https://developers.deepgram.com/reference/manage/keys/list.mdx This PHP example uses the Guzzle HTTP client to fetch project keys. Ensure you have Guzzle installed via Composer. ```php request('GET', 'https://api.deepgram.com/v1/projects/project_id/keys', [ 'headers' => [ 'Authorization' => 'Token ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Get Project Agent Info (PHP) Source: https://developers.deepgram.com/reference/voice-agent/agent-configurations/get-agent-configuration.mdx This PHP example uses the Guzzle HTTP client to make a GET request to the Deepgram API. Make sure you have Guzzle installed via Composer. Replace 'project_id', 'agent_id', and '' with your specific values. ```php request('GET', 'https://api.deepgram.com/v1/projects/project_id/agents/agent_id', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Token ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### Fetch Project Usage Breakdown (C#/RestSharp) Source: https://developers.deepgram.com/reference/manage/usage/breakdown/get.mdx This C# example uses RestSharp to make a GET request for project usage breakdown. Ensure the RestSharp NuGet package is installed. ```csharp using RestSharp; var client = new RestClient("https://api.deepgram.com/v1/projects/project_id/usage/breakdown?accessor=12345678-1234-1234-1234-123456789012&alternatives=true&callback_method=true&callback=true&channels=true&custom_intent_mode=true&custom_intent=true&custom_topic_mode=true&custom_topic=true&deployment=hosted&detect_entities=true&detect_language=true&diarize=true&dictation=true&encoding=true&endpoint=listen&extra=true&filler_words=true&intents=true&keyterm=true&keywords=true&language=true&measurements=true&method=async&model=6f548761-c9c0-429a-9315-11a1d28499c8&multichannel=true&numerals=true¶graphs=true&profanity_filter=true&punctuate=true&redact=true&replace=true&search=true&sentiment=true&smart_format=true&summarize=true&tag=tag1&topics=true&utt_split=true&utterances=true&version=true"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Token "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Get Project Requests with PHP SDK Source: https://developers.deepgram.com/reference/manage/requests/list.mdx This PHP example uses GuzzleHttp to fetch project requests. Replace `` with your valid Deepgram API key and ensure the GuzzleHttp library is installed. ```php request('GET', 'https://api.deepgram.com/v1/projects/project_id/requests?accessor=12345678-1234-1234-1234-123456789012&request_id=12345678-1234-1234-1234-123456789012&deployment=hosted&endpoint=listen&method=async&status=succeeded', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Token ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### List Project Keys in Go Source: https://developers.deepgram.com/reference/manage/keys/list.mdx This Go example demonstrates how to fetch project keys using the net/http package. It includes reading the response body and printing it. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.deepgram.com/v1/projects/project_id/keys" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Token ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Initialize Client Options in Go Source: https://developers.deepgram.com/docs/voice-agent.mdx Initialize the client library with verbose logging in Go. This is a preliminary step before configuring the agent. ```go // Configure the Agent func configureAgent() *interfaces.ClientOptions { // Initialize library client.Init(client.InitLib{ LogLevel: client.LogLevelVerbose, }) // The code in the following steps will go here }; ``` -------------------------------- ### Get Billing Fields with PHP (Guzzle) Source: https://developers.deepgram.com/reference/manage/billing/fields/get.mdx Example using the Guzzle HTTP client in PHP to fetch billing fields from the Deepgram API. It requires the Guzzle library to be installed via Composer. ```php request('GET', 'https://api.deepgram.com/v1/projects/project_id/billing/fields', [ 'headers' => [ 'Authorization' => 'Token ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Get Project Purchases with Swift Source: https://developers.deepgram.com/reference/manage/billing/purchases/get.mdx This Swift example demonstrates fetching project purchase data from Deepgram using `URLSession`. It configures the request with the necessary authorization header and starts a data task. ```swift import Foundation let headers = ["Authorization": "Token "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.deepgram.com/v1/projects/project_id/purchases")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Create Project Agent with Go Source: https://developers.deepgram.com/reference/voice-agent/agent-configurations/create-agent-configuration.mdx This Go example demonstrates creating a project agent using the net/http package. Replace `` with your valid API key. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.deepgram.com/v1/projects/project_id/agents" payload := strings.NewReader("{\n \"config\": \"{\\\"language\\\":\\\"en-US\\\",\\\"model\\\":\\\"general\\\",\\\"punctuate\\\":true,\\\"profanity_filter\\\":false,\\\"diarize\\\":true}\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Token ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Project Invites (Go) Source: https://developers.deepgram.com/reference/manage/invites/list.mdx This Go example uses the `net/http` package to fetch project invites. Remember to substitute `` with your valid API key. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.deepgram.com/v1/projects/project_id/invites" payload := strings.NewReader("{}") req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Authorization", "Token ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Clone and Set Up Proxy Repository Source: https://developers.deepgram.com/docs/amazon-bedrock-and-deepgram-voice-agent.mdx Clone the repository, create a virtual environment, activate it, and install dependencies. ```bash git clone https://github.com/deepgram-devs/deepgram-voice-agent-client-llm-proxy.git cd deepgram-voice-agent-client-llm-proxy python3 -m venv venv source venv/bin/activate pip install -r requirements.txt ``` -------------------------------- ### Get Project Member Scopes (PHP) Source: https://developers.deepgram.com/reference/manage/members/scopes/list.mdx Using GuzzleHttp in PHP to retrieve member scopes. This example requires the GuzzleHttp library to be installed via Composer. Replace the placeholder values with your actual project ID, member ID, and API key. ```php request('GET', 'https://api.deepgram.com/v1/projects/project_id/members/member_id/scopes', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Token ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### Setup Wizard Modes Source: https://developers.deepgram.com/docs/outbound-telephony-agent Various modes for the setup script to manage deployment and configuration. Use `--twilio-only` to skip Fly.io deployment and provide your own URL. ```bash python setup.py --twilio-only ``` ```bash python setup.py --status ``` ```bash python setup.py --teardown ``` ```bash python setup.py --redeploy ``` -------------------------------- ### Start the Proxy Server Source: https://developers.deepgram.com/docs/amazon-bedrock-and-deepgram-voice-agent.mdx Run the main application file to start the local proxy server. ```bash python app.py ``` -------------------------------- ### Get Project Key - Python Source: https://developers.deepgram.com/reference/manage/keys/get.mdx Use the requests library to make a GET request to retrieve a project key. Ensure you have the 'requests' library installed. ```python import requests url = "https://api.deepgram.com/v1/projects/project_id/keys/key_id" headers = {"Authorization": "Token "} response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Full Example: Create Agent Configuration with Template Variables Source: https://developers.deepgram.com/docs/reusable-agent-configurations.mdx A step-by-step guide to creating an agent configuration that utilizes template variables and then using that configuration in a Voice Agent session. ```APIDOC ## Full Example: Create Agent Configuration with Template Variables ### Description This example demonstrates the process of creating a template variable, then creating an agent configuration that references this variable, and finally using the agent's ID in a Voice Agent session. ### Step 1: Create a template variable #### Method POST #### Endpoint /v1/projects/{project_id}/agent-variables #### Request Body ```json { "key": "DG_SYSTEM_PROMPT", "value": "You are a helpful customer service agent for Acme Corp." } ``` ### Step 2: Create an agent configuration referencing the variable #### Method POST #### Endpoint /v1/projects/{project_id}/agents #### Request Body ```json { "config": "{\"language\": \"en\", \"listen\": {\"provider\": {\"type\": \"deepgram\", \"model\": \"nova-3\"}}, \"think\": {\"provider\": {\"type\": \"open_ai\", \"model\": \"gpt-4o-mini\"}, \"prompt\": \"DG_SYSTEM_PROMPT\"}, \"speak\": {\"provider\": {\"type\": \"deepgram\", \"model\": \"aura-2-thalia-en\"}}, \"greeting\": \"Hello! How can I help you today?\"}", "metadata": { "name": "acme-support-agent" } } ``` **Note:** This request returns an `agent_id` (e.g., `a1b2c3d4-e5f6-7890-abcd-ef1234567890`). ### Step 3: Use the UUID in your Settings message #### Request Body Example (Settings Message) ```json { "type": "Settings", "audio": { "input": { "encoding": "linear16", "sample_rate": 24000 }, "output": { "encoding": "linear16", "sample_rate": 24000, "container": "none" } }, "agent": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" } ``` **Explanation:** Deepgram resolves the agent UUID, substitutes the template variable (`DG_SYSTEM_PROMPT`) with its defined value, and applies the complete agent configuration to your session. ``` -------------------------------- ### Main server setup Source: https://developers.deepgram.com/docs/twilio-and-deepgram-tts.mdx Defines the main function to set up and run the asynchronous WebSocket server. Includes commented-out code for SSL context setup. ```python def main(): # use this if using ssl # ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) ``` -------------------------------- ### Start MCP Server (Stdio Transport) Source: https://developers.deepgram.com/cli/mcp-server.mdx Starts the MCP server using the default stdio transport. This is the basic command to get the server running. ```shell dg mcp ``` -------------------------------- ### List Project Models in Go Source: https://developers.deepgram.com/reference/manage/projects/models/list.mdx Demonstrates how to fetch project models using Go's standard net/http package. Remember to substitute 'project_id' and '' with your specific details. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.deepgram.com/v1/projects/project_id/models" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Token ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Function Call Request Example Source: https://developers.deepgram.com/guides/integrations/amazon-connect-and-deepgram-voice-agent.mdx When the agent requires external data, it sends a `FunctionCallRequest`. This JSON example shows a request to get order status. ```json { "type": "FunctionCallRequest", "functions": [ { "name": "get_order_status", "arguments": { "order_id": "12345" }, "client_side": false } ] } ``` -------------------------------- ### Get Project Balance with Go SDK Source: https://developers.deepgram.com/reference/manage/billing/get.mdx This Go example shows how to fetch project balance data using the standard `net/http` package. Replace `` with your Deepgram API key. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.deepgram.com/v1/projects/project_id/balances/balance_id" payload := strings.NewReader("{}") req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Authorization", "Token ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Project Key - JavaScript Source: https://developers.deepgram.com/reference/manage/keys/get.mdx Use the fetch API to make a GET request to retrieve a project key. This example includes basic error handling. ```javascript const url = 'https://api.deepgram.com/v1/projects/project_id/keys/key_id'; const options = {method: 'GET', headers: {Authorization: 'Token '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Setup Wizard Alternative Modes Source: https://developers.deepgram.com/docs/inbound-telephony-agent Utilize alternative modes of the setup wizard for specific configurations, such as skipping Fly.io deployment or updating Twilio webhook URLs. ```bash python setup.py --twilio-only ``` ```bash python setup.py --update-url URL ``` ```bash python setup.py --status ``` ```bash python setup.py --teardown ``` -------------------------------- ### Get Project Request Details (PHP) Source: https://developers.deepgram.com/reference/manage/requests/get.mdx Example using GuzzleHttp in PHP to get project request information. Remember to replace `` with your Deepgram API key. ```php request('GET', 'https://api.deepgram.com/v1/projects/project_id/requests/request_id', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Token ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### Run Local Development Client Source: https://developers.deepgram.com/docs/inbound-telephony-agent Start the main server in one terminal and the development client in another. The client connects via WebSocket and streams audio from your microphone for testing. ```bash # Terminal 1: python main.py # Terminal 2: python dev_client.py ``` -------------------------------- ### Get Billing Breakdown with Java (Unirest) Source: https://developers.deepgram.com/reference/manage/billing/breakdown/get.mdx This Java example uses the Unirest library to make a GET request. Ensure the Unirest library is included in your project dependencies. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.deepgram.com/v1/projects/project_id/billing/breakdown?accessor=12345678-1234-1234-1234-123456789012&deployment=hosted&tag=tag1&line_item=streaming%3A%3Anova-3&grouping=%5B%22deployment%22%2C%22line_item%22%5D") .header("Authorization", "Token ") .asString(); ``` -------------------------------- ### Import Dependencies and Set Up Main Function (C#) Source: https://developers.deepgram.com/docs/voice-agent.mdx Includes necessary Deepgram namespaces and sets up the `Program` class with an asynchronous `Main` method. The `try-catch` block is prepared for future error handling. ```C# using Deepgram.Logger; using Deepgram.Models.Authenticate.v1; using Deepgram.Models.Agent.v2.WebSocket; using System.Collections.Generic; using System.Net.Http; namespace SampleApp { class Program { static async Task Main(string[] args) { try { // The code in the following steps will go here ``` -------------------------------- ### Get LLM Model Settings in Python Source: https://developers.deepgram.com/reference/voice-agent/think-models.mdx Use the `requests` library to make a GET request to the Deepgram API for LLM model settings. Ensure the `requests` library is installed. ```python import requests url = "https://api.deepgram.com/v1/agent/settings/think/models" payload = {} headers = {"Content-Type": "application/json"} response = requests.get(url, json=payload, headers=headers) print(response.json()) ``` -------------------------------- ### Get Project Key - PHP Source: https://developers.deepgram.com/reference/manage/keys/get.mdx Use the Guzzle HTTP client for PHP to make a GET request to retrieve a project key. Ensure Guzzle is installed via Composer. ```php request('GET', 'https://api.deepgram.com/v1/projects/project_id/keys/key_id', [ 'headers' => [ 'Authorization' => 'Token ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Install Deepgram Go SDK Source: https://developers.deepgram.com/docs/live-streaming-audio.mdx Use the go get command to install the Deepgram Go SDK. This SDK includes all necessary dependencies for interacting with the Deepgram API from Go. ```bash go get github.com/deepgram/deepgram-go-sdk ``` -------------------------------- ### Install Ngrok Authtoken Source: https://developers.deepgram.com/docs/build-voice-agent-with-twilio-deepgram-openai.mdx Install your ngrok authtoken to connect the ngrok agent to your account. Replace with your actual ngrok authtoken. ```shell ngrok config add-authtoken ``` -------------------------------- ### Create Self-Hosted Distribution Credentials (Go) Source: https://developers.deepgram.com/reference/self-hosted/distribution-credentials/create.mdx A Go program to create distribution credentials. This example uses the standard 'net/http' package and demonstrates reading the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.deepgram.com/v1/projects/project_id/self-hosted/distribution/credentials" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Token ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Project Usage Data (C#) Source: https://developers.deepgram.com/reference/manage/usage/get.mdx Retrieve project usage data using C# with the RestSharp library. This example demonstrates setting up the client and executing a GET request. ```csharp using RestSharp; var client = new RestClient("https://api.deepgram.com/v1/projects/project_id/usage?accessor=12345678-1234-1234-1234-123456789012&alternatives=true&callback_method=true&callback=true&channels=true&custom_intent_mode=true&custom_intent=true&custom_topic_mode=true&custom_topic=true&deployment=hosted&detect_entities=true&detect_language=true&diarize=true&dictation=true&encoding=true&endpoint=listen&extra=true&filler_words=true&intents=true&keyterm=true&keywords=true&language=true&measurements=true&method=async&model=6f548761-c9c0-429a-9315-11a1d28499c8&multichannel=true&numerals=true¶graphs=true&profanity_filter=true&punctuate=true&redact=true&replace=true&search=true&sentiment=true&smart_format=true&summarize=true&tag=tag1&topics=true&utt_split=true&utterances=true&version=true"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Token "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Get Project Credentials with Go SDK Source: https://developers.deepgram.com/reference/self-hosted/distribution-credentials/list.mdx This Go example demonstrates making an HTTP GET request to the Deepgram API to fetch credentials. Remember to replace `` with your token. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.deepgram.com/v1/projects/project_id/self-hosted/distribution/credentials" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Token ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Fetch Project Usage Fields with Go Source: https://developers.deepgram.com/reference/manage/usage/list.mdx This Go example shows how to fetch project usage fields using the standard net/http package. Remember to substitute 'project_id' and '' with your specific details. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.deepgram.com/v1/projects/project_id/usage/fields" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Token ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Run Mock Server Source: https://developers.deepgram.com/docs/getting-started-with-the-streaming-test-suite.mdx Start the mock server to test custom audio streams in a simplified environment before integrating with Deepgram's service. ```bash python server.py ``` -------------------------------- ### Get Project Members with Ruby Source: https://developers.deepgram.com/reference/manage/members/list.mdx A Ruby example using `Net::HTTP` to make a GET request for project members. Ensure your API key is correctly substituted for ``. ```ruby require 'uri' require 'net/http' url = URI("https://api.deepgram.com/v1/projects/project_id/members") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Token ' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Configure Environment Variables for Bedrock Source: https://developers.deepgram.com/docs/amazon-bedrock-and-deepgram-voice-agent.mdx Copy the example environment file and fill in your Bedrock provider details. ```bash cp .env.example .env ``` ```env AGENT_ID=your_bedrock_agent_id AGENT_ALIAS_ID=your_bedrock_agent_alias_id AWS_ACCESS_KEY_ID=your_aws_access_key_id AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key AWS_REGION=us-east-1 ``` -------------------------------- ### Get Project Key - Swift Source: https://developers.deepgram.com/reference/manage/keys/get.mdx Use Foundation's URLSession to make a GET request to retrieve a project key. This example demonstrates setting headers and handling the response. ```swift import Foundation let headers = ["Authorization": "Token "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.deepgram.com/v1/projects/project_id/keys/key_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Apply Multiple Settings via Environment Variables Source: https://developers.deepgram.com/docs/configure-sagemaker-deployments.mdx Demonstrates how to apply multiple configuration settings to both the engine and API server by using incrementing suffixes for environment variable names. ```bash DEEPGRAM_ENGINE_01=chunking.streaming.step=0.5 DEEPGRAM_ENGINE_02=health.gpu_required=true DEEPGRAM_API_01=features.listen_v2=true DEEPGRAM_API_02=features.topic_detection=false ``` -------------------------------- ### Create Qualifier Agent Configuration (Python) Source: https://developers.deepgram.com/docs/multi-agent-architecture.mdx Example of creating a configuration for the Qualifier agent, specifying settings for audio, listening, thinking (LLM), and speaking (TTS). ```python from deepgram.agent.v1.types import AgentV1Settings def get_qualifier_config(context: str = "") -> AgentV1Settings: return AgentV1Settings( audio=AgentV1SettingsAudio(...), # Audio encoding settings agent=AgentV1SettingsAgent( listen=AgentV1SettingsAgentListen(...), # Deepgram Flux STT think=ThinkSettingsV1( # LLM configuration model="gpt-4o-mini", prompt=QUALIFIER_PROMPT, functions=QUALIFIER_FUNCTIONS ), speak=SpeakSettingsV1(...), # Deepgram Aura TTS greeting="Hi, this is Alex..." ) ) ``` -------------------------------- ### Get Billing Breakdown with C# (RestSharp) Source: https://developers.deepgram.com/reference/manage/billing/breakdown/get.mdx This C# example uses the RestSharp library to perform a GET request to the Deepgram API. Add the RestSharp NuGet package to your project. ```csharp using RestSharp; var client = new RestClient("https://api.deepgram.com/v1/projects/project_id/billing/breakdown?accessor=12345678-1234-1234-1234-123456789012&deployment=hosted&tag=tag1&line_item=streaming%3A%3Anova-3&grouping=%5B%22deployment%22%2C%22line_item%22%5D"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Token "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Get Project Invites (JavaScript) Source: https://developers.deepgram.com/reference/manage/invites/list.mdx Utilize the `fetch` API to get project invites. This example includes basic error handling. Replace `` with your Deepgram API key. ```javascript const url = 'https://api.deepgram.com/v1/projects/project_id/invites'; const options = { method: 'GET', headers: {Authorization: 'Token ', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### TypeScript Complete Example Source: https://developers.deepgram.com/docs/deploy-amazon-sagemaker.mdx A sample script demonstrating how to capture microphone input and stream it to an Amazon SageMaker bidirectional endpoint for transcription. ```typescript // Sample script to capture microphone input and stream to Amazon SageMaker bidirectional ``` -------------------------------- ### Get LLM Model Settings in C# Source: https://developers.deepgram.com/reference/voice-agent/think-models.mdx This C# example uses the RestSharp library to perform a GET request for LLM model settings. Add RestSharp to your project's dependencies. ```csharp using RestSharp; var client = new RestClient("https://api.deepgram.com/v1/agent/settings/think/models"); var request = new RestRequest(Method.GET); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Create Project Agent with Swift Source: https://developers.deepgram.com/reference/voice-agent/agent-configurations/create-agent-configuration.mdx A Swift example demonstrating how to create a project agent using URLSession. Ensure you replace `` with your actual API key. ```swift import Foundation let headers = [ "Authorization": "Token ", "Content-Type": "application/json" ] let parameters = ["config": "{\"language\":\"en-US\",\"model\":\"general\",\"punctuate\":true,\"profanity_filter\":false,\"diarize\":true}"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.deepgram.com/v1/projects/project_id/agents")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Get Agent Variables with C# SDK (RestSharp) Source: https://developers.deepgram.com/reference/voice-agent/agent-variables/list-agent-variables.mdx This C# example uses RestSharp to make a GET request for agent variables. Ensure you replace `` with your Deepgram API key. ```csharp using RestSharp; var client = new RestClient("https://api.deepgram.com/v1/projects/project_id/agent-variables"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Token "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Invite User to Project (Ruby) Source: https://developers.deepgram.com/reference/manage/invites/create.mdx This Ruby example demonstrates how to invite a user to a project using the `net/http` library. It sets up a POST request with the necessary authentication and content type headers. Remember to update `` and `project_id`. ```ruby require 'uri' require 'net/http' url = URI("https://api.deepgram.com/v1/projects/project_id/invites") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Token ' request["Content-Type"] = 'application/json' request.body = "{\n \"email\": \"jane.doe@example.com\",\n \"scope\": \"read:transcripts write:projects\"\n}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Get Project Info with C# (RestSharp) Source: https://developers.deepgram.com/reference/manage/projects/get.mdx This C# example uses the RestSharp library to make a GET request to the Deepgram API. Ensure you replace `` with your valid API key. ```csharp using RestSharp; var client = new RestClient("https://api.deepgram.com/v1/projects/project_id"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Token "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Clone and Install Project Dependencies Source: https://developers.deepgram.com/docs/inbound-telephony-agent Clone the repository and install the necessary Python packages. Ensure you are using a virtual environment. ```bash git clone https://github.com/deepgram-devs/deepgram-voice-agent-inbound-telephony.git cd deepgram-voice-agent-inbound-telephony python -m venv venv source venv/bin/activate pip install -r requirements.txt ```