Quickstart

1. Create Soniox Account

Create a free Soniox Account to obtain an API key. The API key gives you free access to Soniox API services. You can find your API key under the Manage API Keys tab in Soniox Cloud.

Soniox Account is free of charge and does not require credit card information. You get 300 minutes/month of free speech recognition AI services through Soniox API. If you require additional free usage, contact us, and we will assign you additional free minutes.

2. Download Examples

Clone our soniox_examples GitHub repository with all the code examples and test audio files. We will refer to these examples and audio files throughout our how-to guides.

git clone https://github.com/soniox/soniox_examples.git

3. Install Client Library

Choose any of our available client libraries to ease the integration of Soniox API into your application.

The package includes core functionality for accessing Soniox API.

pip3 install --upgrade pip
pip3 install --upgrade setuptools
pip3 install --upgrade soniox

4. Transcribe

In this example, we will transcribe a short audio file using the transcribe_file_short() function and print out the recognized words. Do not forget to set your API key.

transcribe_file_short.py

from soniox.transcribe_file import transcribe_file_short
from soniox.speech_service import SpeechClient, set_api_key

set_api_key("<YOUR-API-KEY>")


def main():
    with SpeechClient() as client:
        result = transcribe_file_short("../test_data/test_audio.flac", client)
        for word in result.words:
            print(f"{word.text} {word.start_ms} {word.duration_ms}")


if __name__ == "__main__":
    main()    

Run

python3 transcribe_file_short.py

Output

He 170 60
was 350 60
two 650 60
...

The package includes core functionality for accessing Soniox API.

cd soniox_examples/node
npm install

4. Transcribe

In this example, we will transcribe a short audio file using the transcribe_file_short() function and print out the recognized words. Do not forget to set your API key.

transcribe_file_short.js

const { SpeechClient } = require("@soniox/soniox-node");

/**
 * Set your Soniox API key:
 * from command line: export SONIOX_API_KEY=<YOUR-API-KEY>
 * or
 * pass config object: new SpeechClient({ api_key: "<YOUR-API-KEY>" })
 */
const speechClient = new SpeechClient();

(async function () {
    const result = await speechClient.transcribeFileShort(
        "../test_data/test_audio.flac"
    );

    for (const word of result.words) {
        console.log(`${word.text} ${word.start_ms} ${word.duration_ms}`);
    }
})();

Run

node transcribe_file_short.js

Output

He 170 60
was 350 60
two 650 60
...

If the client library is not yet available for your programming language, see gRPC section on how to use Soniox API in almost any programming language.

cookie Change your cookie preferences