gRPC Introduction

gRPC is an open source high performance RPC (Remote Procedure Call) framework that can run in any environment. It can efficiently connect services in and across data centers. You can read more about it on the gRPC Home Page.

Soniox provides a gRPC-based API for the entire Soniox Speech Service. Please refer to the gRPC Documentation for instructions on using the gRPC in your programming language.

Soniox Proto File

We have defined all the RPCs and messages in one speech_service.proto file. You can compile the .proto file into any of the supported languages and import the generated files into your application.

Generate Protobuf and gRPC Files

You will need the Protocol Buffer compiler to generate source files applicable for your language from the .proto file.

For Python langauge, install the following packages:

pip3 install grpcio
pip3 install grpcio-tools

Then generate the source files as follows:

mkdir soniox
cd soniox
python3 -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ./speech_service.proto

This will generate two files and, which you will need to import into your Python client.

Root Certificate

Soniox Speech Service uses SSL/TLS authentication to ensure security and safety of transmitted data. To access the API, you will need the root certificate. You can download it from gRPC GitHub or with the following command:


Soniox API Endpoint

Soniox API endpoint is Secure channel is required using the root certificate above.

Python Example

The example demonstrates how to use Transcribe RPC to transcribe short audio files using gRPC and Soniox API.

import grpc
from speech_service_pb2 import TranscribeRequest
from speech_service_pb2_grpc import SpeechServiceStub

# Read root certificate for secure client-server connection.
# You can find roots.pem at
with open('roots.pem', 'rb') as f:
    creds = grpc.ssl_channel_credentials(

def run():
    # Create secure channel with the credentials.
    with grpc.secure_channel('', creds) as channel:
        # Create client.
        client = SpeechServiceStub(channel)
        # Create TranscribeRequest object.
        request = TranscribeRequest()
        # Set the API key.
        request.api_key = '<YOUR-API-KEY>'
        # Read the entire audio file.
        with open('<YOUR-AUDIO-FILE>', 'rb') as f:
        # Call Transcribe method with created TranscribeRequest object.
        response = client.Transcribe(request)
        # Print recognized words with start and duration.
        for w in response.result.words:
            print(f'{w.text} , {w.start_ms} , {w.duration_ms}')

if __name__ == '__main__':
cookie Change your cookie preferences