1. Documentation
  2. Getting Started
  3. Getting Started with Pre-recorded Audio

Getting Started with Pre-recorded Audio

In this guide, you'll learn how to automatically transcribe pre-recorded audio using Deepgram's SDKs, which are supported for use with the Deepgram API.

Already spoken with our sales team? Your account team should have reached out with a dedicated signup link. If not, talk to sales.

Go to the enterprise docs

Not a developer? Check out the Deepgram Console for a no-code way to get started with Deepgram's API.

Before You Begin

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

Create a Deepgram Account

Before you can use Deepgram products, you'll need to create a Deepgram account. Signup is free and includes:

  • $150 in credit, which gives you access to:
    • all base models
    • pre-recorded and streaming functionality
    • all features

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.

Configure Environment

We provide sample scripts in Python and Node.js and assume you have already configured either a Python or Node development environment.

If you get stuck at any point, help is just a click away! Contact Support.

Transcribe Audio

Once you have your API Key, it's time to transcribe audio! The instructions below will guide you through the process of creating a sample application, installing the Deepgram SDK, configuring code with your own Deepgram API Key and pre-recorded audio to transcribe, and finally, building and running the application.

  1. Choose an audio file

    Download our sample audio file, or record your own using your device’s microphone.

  2. Install the SDK

    Open your terminal, navigate to the location on your drive where you want to create your project, and install the Deepgram SDK:


    # Install the Deepgram Python SDK
    # https://github.com/deepgram/python-sdk
    pip install deepgram-sdk


    # Initialize a new application
    npm init
    # Install the Deepgram Node.js SDK
    # https://github.com/deepgram/node-sdk
    npm install @deepgram/sdk

    Make sure any audio files are in your project directory.

  3. Write the code

    In your terminal, create a new file and populate it with code.


    Create a new file called deepgram_test.py in your project's location. Populate this file:

    from deepgram import Deepgram
    import asyncio, json
    # Your Deepgram API Key
    # Name and extension of the file you downloaded (e.g., sample.wav)
    async def main():
      # Initialize the Deepgram SDK
      dg_client = Deepgram(DEEPGRAM_API_KEY)
      # Open the audio file
      with open(PATH_TO_FILE, 'rb') as audio:
        # Replace mimetype as appropriate
        source = {'buffer': audio, 'mimetype': 'audio/wav'}
        response = await dg_client.transcription.prerecorded(source, {'punctuate': True})
        print(json.dumps(response, indent=4))


    Create a new file called index.js in your project's location. Populate this file:

    const fs = require('fs');
    const { Deepgram } = require('../dist');
    /** Your Deepgram API Key*/
    const deepgramApiKey = 'YOUR_DEEPGRAM_API_KEY';
    /** Name and extension of the file you downloaded (e.g., sample.wav) */
    const pathToFile = 'FILENAME_TO_TRANSCRIBE';
    /** Initialize the Deepgram SDK */
    const deepgram = new Deepgram(deepgramApiKey);
    /** Load file into a buffer */
    const fileBuffer = fs.readFileSync(pathToFile);
      buffer: fileBuffer, 
      mimetype: 'audio/wav' // or appropriate mimetype of your file 
    }, { 
      punctuate: true 
    .then((transcription) => {
    .catch((err) => {

    Be sure to replace YOUR_DEEPGRAM_API_KEY and FILENAME_TO_TRANSCRIBE with your Deepgram API Key and the name of the file you downloaded.

  4. Start the application

    Run the application from the terminal:


    python deepgram_test.py


    node index.js
  5. See results

    Your transcripts will appear in your browser's developer console.

Analyze the Response

When the file is finished processing (often after only a few seconds), you’ll receive a JSON response:

            "transcript":"Yep. I said it before, and I'll say it again. Life moves pretty fast. You don't stop and look around once in a while. You could miss it. Thank.",

In this default response, we see:

  • transcript: the transcript for the audio segment being processed.

  • confidence: a floating point value between 0 and 1 that indicates overall transcript reliability. Larger values indicate higher confidence.

  • words: an object containing each word in the transcript, along with its start time and end time (in seconds) from the beginning of the audio stream, and a confidence value.

    Because we passed the punctuate: true option to the transcription.prerecorded method, each word object also includes its punctuated_word value, which contains the transformed word after punctuation and capitalization are applied.

By default, Deepgram applies its general AI model, which is a good, general purpose model for everyday situations.

What's Next?

Now that you've gotten a transcript for pre-recorded audio, enhance your knowledge by exploring the following areas.

Customize Transcripts

To customize the transcripts you receive, you can send a variety of parameters to the Deepgram API.

For example, if you would like to use the phonecall model rather than the general model, you can pass the model: phonecall option to the transcription.prerecorded method in the previous examples:


        response = await dg_client.transcription.prerecorded(source, {'punctuate': True, 'model': 'phonecall'})


      buffer: fileBuffer, 
      mimetype: 'audio/wav' // or appropriate mimetype of your file 
    }, { 
      punctuate: true,
      model: phonecall 

To learn more about the many ways you can customize your results with Deepgram's API, check out the Deepgram API Reference.

Explore Use Cases

Time to learn about the different ways you can use Deepgram products to help you meet your business objectives. Explore Deepgram's use cases.

Transcribe Streaming Audio

Now that you know how to transcribe pre-recorded audio, check out how you can use Deepgram to transcribe streaming audio in real time. To learn more, see Getting Started with Streaming Audio.