Using the Nova Model (Deprecated)

Get up and running with Nova, Deepgram's most powerful model.

Nova-2 is Deepgram's most powerful and affordable speech-to-text model. Training on this model spans over 100 domains and 47 billion tokens, making it the deepest-trained automatic speech recognition (ASR) model to date. Nova-2 doesn't just excel in one specific domain — it is ideal for a wide array of voice applications that require high accuracy in diverse contexts.

Here's how you can get started with Nova.

If you are a premium customer who would like access to Deepgram’s Nova or Whisper models, please reach out to your customer support team to gain access.

Before You Begin

Before you run the code, you'll need to do a few things.

Create a Deepgram Account

You'll need to create a Deepgram account. Signup is free and no credit card is needed.

Create a Deepgram API Key

To access Deepgram’s API, you'll need to create a Deepgram API Key. Make note of your API Key; you will need it later.

Transcribe Pre-recorded Audio

Transcribe a pre-recorded audio file using Nova with the following request.

ℹ️

The Node.js and Python examples below use the Deepgram SDKs. Check out our SDKs & Tools to learn more.

curl \
  --request POST \
  --header 'Authorization: Token YOUR_DEEPGRAM_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"url":"https://static.deepgram.com/examples/interview_speech-analytics.wav"}' \
  --url 'https://api.deepgram.com/v1/listen?model=nova-2'

# Example filename: deepgram_test.py

from deepgram import Deepgram
import asyncio, json

# Your Deepgram API Key
DEEPGRAM_API_KEY = 'YOUR_DEEPGRAM_API_KEY'

# Location of the file you want to transcribe. Should include filename and extension.
# Example of a local file: ../../Audio/life-moves-pretty-fast.wav
# Example of a remote file: https://static.deepgram.com/examples/interview_speech-analytics.wav
FILE = 'YOUR_FILE_LOCATION'

# Mimetype for the file you want to transcribe
# Include this line only if transcribing a local file
# Example: audio/wav
MIMETYPE = 'YOUR_FILE_MIME_TYPE'

async def main():

  # Initialize the Deepgram SDK
  deepgram = Deepgram(DEEPGRAM_API_KEY)

  # Check whether requested file is local or remote, and prepare source
  if FILE.startswith('http'):
    # file is remote
    # Set the source
    source = {
      'url': FILE
    }
  else:
    # file is local
    # Open the audio file
    audio = open(FILE, 'rb')

    # Set the source
    source = {
      'buffer': audio,
      'mimetype': MIMETYPE
    }

  # Send the audio to Deepgram and get the response
  response = await asyncio.create_task(
    deepgram.transcription.prerecorded(
      source,
      {
        'punctuate': True,
        'model': 'nova',
      }
    )
  )

  # Write the response to the console
  print(json.dumps(response, indent=4))

  # Write only the transcript to the console
  #print(response["results"]["channels"][0]["alternatives"][0]["transcript"])

try:
  # If running in a Jupyter notebook, Jupyter is already running an event loop, so run main with this line instead:
  #await main()
  asyncio.run(main())
except Exception as e:
  exception_type, exception_object, exception_traceback = sys.exc_info()
  line_number = exception_traceback.tb_lineno
  print(f'line {line_number}: {exception_type} - {e}')
// index.js (Node example)

import { createClient } from "@deepgram/sdk";
import fs from "fs";

const options = {
  smart_format: true,
  model: "nova",
}

const file = "YOUR FILE"; // url or file path relative to the script
let response;

const deepgram = createClient("DEEPGRAM_API_KEY");

if (file.startsWith("http")) {
  response = deepgram.listen.prerecorded.transcribeUrl({ url: file }, options)
} else {
  response = deepgram.listen.prerecorded.transcribeFile(fs.readFileSync(file), options)
}
                                                              
const { result, error } = await response;

if (error) {
  console.error(error);
}

console.dir(result, { depth: null });

Transcribe Streaming Audio

Transcribe real-time audio using Nova with the following request.

⚠️

Streaming audio transcription cannot be done with curl.

 # Example filename: deepgram_test.py

from deepgram import Deepgram
import asyncio
import aiohttp

# Your Deepgram API Key
DEEPGRAM_API_KEY = 'YOUR_DEEPGRAM_API_KEY'

# URL for the realtime streaming audio you would like to transcribe
URL = 'http://stream.live.vc.bbcmedia.co.uk/bbc_world_service'

async def main():
  # Initialize the Deepgram SDK
  deepgram = Deepgram(DEEPGRAM_API_KEY)

  # Create a websocket connection to Deepgram
  # In this example, punctuation is turned on, interim results are turned off, and language is set to UK English.
  try:
    deepgramLive = await deepgram.transcription.live({
      'punctuate': True,
      'interim_results': False,
      'language': 'en-US',
      'model': 'nova-2',
    })
  except Exception as e:
    print(f'Could not open socket: {e}')
    return

  # Listen for the connection to close
  deepgramLive.registerHandler(deepgramLive.event.CLOSE, lambda c: print(f'Connection closed with code {c}.'))

  # Listen for any transcripts received from Deepgram and write them to the console
  deepgramLive.registerHandler(deepgramLive.event.TRANSCRIPT_RECEIVED, print)

  # Listen for the connection to open and send streaming audio from the URL to Deepgram
  async with aiohttp.ClientSession() as session:
    async with session.get(URL) as audio:
      while True:
        data = await audio.content.readany()
        deepgramLive.send(data)

        # If no data is being sent from the live stream, then break out of the loop.
        if not data:
            break

  # Indicate that we've finished sending data by sending the customary zero-byte message to the Deepgram streaming endpoint, and wait until we get back the final summary metadata object
  await deepgramLive.finish()

# If running in a Jupyter notebook, Jupyter is already running an event loop, so run main with this line instead:
#await main()
asyncio.run(main())
// Example filename: index.js

const { createClient, LiveTranscriptionEvents } = require("@deepgram/sdk");
const fetch = require("cross-fetch");

const live = async () => {
  const url = "http://stream.live.vc.bbcmedia.co.uk/bbc_world_service";

  const deepgram = createClient(process.env.DEEPGRAM_API_KEY);

  const connection = deepgram.listen.live({ model: "nova", smart_format: true });

  connection.on(LiveTranscriptionEvents.Open, () => {
    connection.on(LiveTranscriptionEvents.Close, () => {
      console.log("Connection closed.");
    });

    connection.on(LiveTranscriptionEvents.Metadata, (data) => {
      console.log(data);
    });

    connection.on(LiveTranscriptionEvents.Transcript, (data) => {
      console.log(data);
    });

    fetch(url)
      .then((r) => r.body)
      .then((res) => {
        res.on("readable", () => {
          connection.send(res.read());
        });
      });
  });
};

live();

API Examples

The url to use Nova is the following:

https://api.deepgram.com/v1/listen?model=nova-2

Nova supports a number of use cases, which can be accessed with the following syntax:

https://api.deepgram.com/v1/listen?model=nova-2-phonecall

If you use the following url, it will give the same results as using model=nova-2:

https://api.deepgram.com/v1/listen?model=nova-2-general