Getting fast and accurate transcripts with Deepgram is often just one step in a broader project. We frequently get asked about adding translations to projects once transcripts are returned, and that's what we'll be doing in this project.

There are plenty of translation APIs available to developers, but I've become rather fond of iTranslate after using them in a project earlier this month. It's a fast an straightforward API with a generous free tier and no rate limits at the time of writing.

Before We Start

You will need:

Create a new directory and navigate to it with your terminal. Run npm init -y to create a package.json file and then install the following packages:

npm install dotenv @deepgram/sdk cross-fetch

Create a .env file and add the following:


Create an index.js file and add the following to it:

const fetch = require('cross-fetch')
const { Deepgram } = require('@deepgram/sdk')
const deepgram = new Deepgram(process.env.DG_KEY)

An Introduction to iTranslate

iTranslate supports text translation for over 50 languages. You may either specify the 'source dialect' with a value such as en (English) or es (Spanish), or set the value to auto and let iTranslate detect the language automatically. You must also specify a 'target dialect' for translation to work. An API request would look like this:

    data: {
       'source': { 'dialect': 'en', 'text': 'Hello World' },
       'target': { 'dialect': 'es' }
    headers: {
        'Authorization': 'Bearer YOUR-API-KEY'
        'Content-Type': 'application/json'

The result looks like this:

  'source': { 'dialect': 'en', 'text': 'Hello World' },
  'target': { 'dialect': 'es', 'text': 'Hola, Mundo' },
  'times': { 'total_time': 0.051 }

Create A Translation Function

Add the following to the bottom of your index.js file:

async function translate(source, target, text) {
  const url = ''
  const headers = {
    Authorization: 'YOUR ITRANSLATE API KEY',
    'Content-Type': 'application/json',
  const data = {
    source: { dialect: source, text: text },
    target: { dialect: target },

  const result = await fetch(url, {
    method: 'POST',
    body: JSON.stringify(data),
  }).then((r) => r.json())

  return result

Try it out by adding the following code underneath the translate function:

translate('en', 'es', 'Hello world').then((data) => console.log(data))

Run this with node index.js, and you should see the output in your terminal. Once you know it works, delete the line you just wrote.

Pre-Recorded Transcript Translation

To provide transcripts in languages which are different from the source audio, we will first get a transcript with Deepgram. Once the transcript is returned, we will translate the text. An example would look like this:

const url = ''
deepgram.transcription.preRecorded({ url }).then(async (response) => {
  const { transcript } = response.results.channels[0].alternatives[0]
  const translated = await translate('en', 'es', transcript)

Live Transcript Translation

iTranslate does not impose a rate limit at the time of writing, so transcribing live results from Deepgram is possible. This example gets live radio data and transcribes it with Deepgram. Once data is returned, we use the translate function:

const deepgramLive ={ punctuate: true })

const url = ''
  .then((r) => r.body)
  .then((res) => {
    res.on('readable', () => {
      if (deepgramLive.getReadyState() == 1) {

deepgramLive.addListener('transcriptReceived', async (transcript) => {
  const data = JSON.parse(transcript)
  const response =[0]
  if (response.transcript && data.is_final) {
    translate('en', 'es', response.transcript).then((data) => console.log(data))

In Summary

Because iTranslate is such a fast translation service, it is a good pairing with Deepgram's super fast speech recognition API.

If you have any questions, please feel free to reach out on Twitter - we're @DeepgramAI.

If you have any feedback about this post, or anything else around Deepgram, we'd love to hear from you. Please let us know in our GitHub discussions .

Unlock language AI at scale with an API call.

Get conversational intelligence with transcription and understanding on the world's best speech AI platform.

Sign Up FreeBook a Demo