#Is setting up a proxy server mandatory for using Deepgram's Text-to-Speech (TTS) API?

1 messages · Page 1 of 1 (latest)

final hound
#

I'm exploring Deepgram's Text-to-Speech (TTS) API, and I wanted to know if setting up a proxy server is required for it to function properly. Are there any specific cases where a proxy is needed, or can it be used directly without one?

cyan viperBOT
#

Hi @final hound. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the knowledge sources provided, I need to clarify something important: Deepgram's Text-to-Speech (TTS) API is available and can be used directly without a proxy server in most cases.

The documentation shows that you can make direct API calls to Deepgram's TTS service using various programming languages. For example:

  • In Python, you can use the requests library to directly call the TTS API endpoint at <https://api.deepgram.com/v1/speak> Code Samples
  • Similar direct API calls are demonstrated in JavaScript, Ruby, and C++ Code Samples

However, there are specific scenarios where a proxy might be needed:

  1. Client-side applications: If you're implementing TTS in a browser-based application, Deepgram's API doesn't currently support custom CORS origins. As mentioned in one discussion, "Our API doesn't currently support custom CORS origins" Next.JS Discussion. In this case, you would need a server component to proxy the request.

  2. Security concerns: To avoid exposing your API key in client-side code, it's recommended to use a proxy. This is a general security best practice rather than a technical requirement Protecting API Key.

For server-side applications, you can make direct API calls without a proxy as shown in the code examples. The Go SDK also provides options for configuring a proxy if needed, but it's not mandatory Go SDK Documentation.

#

In summary, a proxy is not mandatory for using Deepgram's TTS API in server-side applications, but it may be necessary for client-side applications due to CORS limitations and security best practices.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@final hound Kapa.ai is still learning and improving, please let me know how I did by reacting below.

final hound
#

@cyan viper I am using a client side application. Is there any sample sample code for proxy server setup for TTS

cyan viperBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

Based on the knowledge sources provided, I don't see specific sample code for setting up a proxy server specifically for Deepgram's Text-to-Speech (TTS) in a client-side application. However, I can provide some relevant information from the sources.

For client-side applications, there is a recommendation to use a server component when working with Deepgram. In one of the discussions about live transcription from a laptop microphone, a Deepgram representative mentioned:

"We have this example: https://github.com/deepgram-devs/js-live-example. It does have a small node script, which is responsible for generating a limited scope temporary API key for the frontend client to use. If this is for localhost use only, you COULD bypass that. But, we do not recommend putting your API key in the client." Live/Real time transcription from laptop mic

While this example is for speech-to-text rather than TTS, the principle is similar - using a small server-side component to handle API key management securely.

When another user asked about converting from OpenAI TTS to Deepgram TTS, they were directed to look at Deepgram's starter apps:

"I recommend you take a look at our Starter Apps to see some working code examples of using Deepgram, they are a good getting started reference. https://github.com/deepgram-starters" Converting OpenAI TTS to Deepgram TTS

These starter apps might contain examples of proxy setups for client-side applications.

For implementing TTS directly (which would need to be proxied for client-side use), there are multiple code examples in various languages like JavaScript, Python, Ruby, and others that show how to make the API calls that your proxy would need to handle.

#

I recommend checking the Deepgram starter apps repository for more complete examples that might include proxy server setups for client-side applications. If you need specific proxy server code examples, you might want to reach out to Deepgram support directly as the knowledge sources don't contain explicit proxy server setup code for TTS.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: