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 Soniox Console > Project > API Keys.

A Soniox Account is free of charge and does not require credit card information. You will receive 300 minutes of free credits for Speech Recognition API usage.

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

Enter the directory containing examples for your programming language.

Python Examples

cd soniox_examples/python

3. Install Client Library#

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

Requirements: Python 3.7 or higher.

The Soniox Python client library is published on PyPI: soniox.

Create and activate venv

python3 -m venv venv
source venv/bin/activate

Install packages

python3 -m pip install -U pip
python3 -m pip install -U setuptools wheel
python3 -m pip install -U soniox

4. Authenticate#

To authenticate your requests, you have to specify the API key. You can find your API key under API Keys tab for a given project in Soniox Console.

You can set the API key using the SONIOX_API_KEY environment variable, which will be automatically used by the client library.

export SONIOX_API_KEY=<YOUR_API_KEY>

In your application, you can alternatively specify the API key in code when initializing the SpeechClient, as shown below.

from soniox.speech_service import Client

with SpeechClient(api_key="<YOUR-API-KEY>") as client:
   ...

5. Transcribe#

This example will transcribe a short audio file and print out the recognized words.

transcribe_file_short.py

Run:

python3 transcribe_file_short.py

Output

Text: He was two years out from the East and had not yet forgotten to be homesick at times
Tokens:
    'He' 317 60
    ' ' 617 0
    'was' 617 60
    ' ' 857 0
    'two' 857 60
    ...