Nova Quickstart
Get up and running with Nova, Deepgram's most powerful model.
Nova 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 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'
# 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}')
// Example filename: index.js
const fs = require("fs");
const { Deepgram } = require("@deepgram/sdk");
// Your Deepgram API Key
const deepgramApiKey = "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
const file = "YOUR_FILE_LOCATION";
// Mimetype for the file you want to transcribe
// Only necessary if transcribing a local file
// Example: audio/wav
const mimetype = "YOUR_FILE_MIME_TYPE";
// Initialize the Deepgram SDK
const deepgram = new Deepgram(deepgramApiKey);
// Check whether requested file is local or remote, and prepare accordingly
if (file.startsWith("http")) {
// File is remote
// Set the source
source = {
url: file,
};
} else {
// File is local
// Open the audio file
const audio = fs.readFileSync(file);
// Set the source
source = {
buffer: audio,
mimetype: mimetype,
};
}
// Send the audio to Deepgram and get the response
deepgram.transcription
.preRecorded(source, {
punctuate: true,
model: "nova",
})
.then((response) => {
// Write the response to the console
console.dir(response, { depth: null });
// Write only the transcript to the console
//console.dir(response.results.channels[0].alternatives[0].transcript, { depth: null });
})
.catch((err) => {
console.log(err);
});
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
# The URL for the sample resource changes depending on whether the user is outside or inside the UK
# Outside the UK
URL = 'http://stream.live.vc.bbcmedia.co.uk/bbc_radio_fourlw_online_nonuk'
# Inside the UK
# URL = 'http://stream.live.vc.bbcmedia.co.uk/bbc_radio_fourfm'
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',
})
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 { Deepgram } = require("@deepgram/sdk");
const fetch = require("cross-fetch");
// Your Deepgram API Key
const deepgramApiKey = "YOUR_DEEPGRAM_API_KEY";
// URL for the audio you would like to stream
// URL for the example resource will change depending on whether user is outside or inside the UK
// Outside the UK
const url = "http://stream.live.vc.bbcmedia.co.uk/bbc_radio_fourlw_online_nonuk";
// Inside the UK
// const url = 'http://stream.live.vc.bbcmedia.co.uk/bbc_radio_fourfm';
// Initialize the Deepgram SDK
const deepgram = new Deepgram(deepgramApiKey);
// 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.
const deepgramLive = deepgram.transcription.live({
punctuate: true,
interim_results: false,
language: "en-US",
model: "nova",
});
// Listen for the connection to open and send streaming audio from the URL to Deepgram
fetch(url)
.then((r) => r.body)
.then((res) => {
res.on("readable", () => {
if (deepgramLive.getReadyState() == 1) {
deepgramLive.send(res.read());
}
});
});
// Listen for the connection to close
deepgramLive.addListener("close", () => {
console.log("Connection closed.");
});
// Listen for any transcripts received from Deepgram and write them to the console
deepgramLive.addListener("transcriptReceived", (message) => {
const data = JSON.parse(message);
// Write the entire response to the console
console.dir(data.channel, { depth: null });
// Write only the transcript to the console
//console.dir(data.channel.alternatives[0].transcript, { depth: null });
});
API Examples
The url to use Nova is the following:
https://api.deepgram.com/v1/listen?model=nova
Nova can also be used with the phonecall model as a tier:
https://api.deepgram.com/v1/listen?model=phonecall&tier=nova
If you use the following url, it will give the same results as using model=nova
:
https://api.deepgram.com/v1/listen?model=general&tier=nova
Do not use
tier=enhanced
ortier=base
with the Nova model. Using a url such ashttps://api.deepgram.com/v1/listen?model=nova&tier=enhanced
orhttps://api.deepgram.com/v1/listen?model=nova&tier=base
throws an error.
Updated 6 days ago