Soniox
Docs

Get started

Learn how to setup and run Soniox Speech-to-Text (legacy).

This API is deprecated and is being phased out. Please switch to our new multilingual Speech-to-Text API.

Get API key

Create a free Soniox Account and login into Soniox Console to create an API key.

API keys are bound to projects. Click on "API keys" under "My First Project" section to create one.

Download Examples

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

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

Enter the directory containing examples for your programming language.

Navigate into Python examples folder.

Terminal
cd speech-to-text-legacy/python

Navigate into NodeJS examples folder.

Terminal
cd speech-to-text-legacy/node

Navigate into C# examples folder.

Terminal
cd speech-to-text-legacy/csharp

We provide a Javascript client library that enables you to integrate with Soniox API service directly from your web application.

See Web Library section section for more information.

We provide a WebSocket-based API for Soniox Speech Recognition.

Please refer to the WebSocket section section for more information.

We provide a gRPC-based API for Soniox Speech Recognition.

Please refer to the gRPC section for more information.

Install Client Library

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

Python library requirements: Python 3.7 or higher.

Soniox Python client library is published on PyPI as soniox.

Create and activate venv

Terminal
python3 -m venv venv
source venv/bin/activate

Install packages

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

Node.js library requirements: Node.js v14 or higher.

The Soniox Node client library is published on NPM as @soniox/soniox-node.

Install packages

Terminal
npm install @soniox/soniox-node

C# library requirements: .NET 6 or newer.

The Soniox C# client library is published on NuGet: Soniox.Client.

Add package references to the .csproj file:

Example.csproj
<PackageReference Include="Google.Protobuf" Version="3.22.1" />
<PackageReference Include="Soniox.Client" Version="1.1.0" />

Configure environment

Store the API key in the SONIOX_API_KEY environment variable to prevent accidental exposure.

Terminal
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:
    ...
const { SpeechClient } = require("@soniox/soniox-node");

const speechClient = new SpeechClient({ api_key: "<YOUR-API-KEY>" });
using var client = new SpeechClient(apiKey: "<YOUR-API-KEY>");

Transcribe

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

transcribe_file_short.py

Run

Terminal
python3 transcribe_file_short.py

Output

Terminal
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
    ...

transcribe_file_short.js

Run

Terminal
node transcribe_file_short.js

Output

Terminal
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
    ...

TranscribeFileShort.cs

Run

Terminal
cd TranscribeFileShort
dotnet run

Output

Terminal
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
    ...