Despite our SDK working in the browser, our API is restricted by CORS. Our SDK has an option to utilise a REST proxy, so you can still benefit from the SDK's functionality in the browser.
It is your responsibility to secure this application behind your own authentication, or risk others using your Deepgram credit for their own purpose.
This is an example proxy, built using http-proxy
. Please consider securing it behind your own client authentication before making it available generally.
Clone this repository from GitHub.
Install the dependencies to be able to run this application.
npm i
Run the following to generate an PKCS12 file, to act as your SSL indentity when making a secure request to the Deepgram API. This does not affect your ability to run this proxy behind it's own SSL.
openssl genrsa -out key.pem 2048
openssl req -new -sha256 -key key.pem -out csr.csr
openssl req -x509 -sha256 -days 365 -key key.pem -in csr.csr -out certificate.pem
openssl pkcs12 -export -out certificate.p12 -inkey key.pem -in certificate.pem
Copy the sample.env
to .env
and fill out the variables.
ALLOWED_ORIGIN=http://localhost:3000 # the origin of the application making the REST requests to Deepgram
PORT=4433 # the port you intend to run your proxy on
DEEPGRAM_API_KEY=5364knj5hgbnipjgp9h490g84h245h524h # your Deepgram API with atleast the usage:write scope
npm run dev
Interested in contributing? We ❤️ pull requests!
To make sure our community is safe for all, be sure to review and agree to our Code of Conduct. Then see the Contribution guidelines for more information.
We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either: