gRPC
Soniox provides a gRPC-based API for the entire Soniox Speech Recognition service.
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 almost all Soniox features. This includes speech recogniton with associated features (such as Speaker Diarization, Speaker Identification and Customization).
You only need to use gRPC directly if a Soniox client library is not available for your programming language. When using a Soniox client library, the library abstract away many aspects of gRPC. Please refer to the gRPC Documentation for instructions on how to use the client library.
Soniox Proto File
We have defined all the RPCs and messages in one proto file 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:
Then generate the source files as follows:
This will generate the files service_pb2.py
and service_pb2_grpc.py
, which you will need to import
into your Python application. It will also generate service_pb2.pyi
containing type information.
Soniox API Endpoint
Soniox API endpoint is api.soniox.com:443. Secure channel (SSL/TLS) is required.
Python Example
The example demonstrates how to use Transcribe RPC to transcribe short audio files using gRPC and Soniox API.
SSL and Root Certificates
Soniox gRPC API uses secure connection (SSL/TLS) to ensure security and safety of transmitted data. With recent gRPC versions, you should not need additional setup for this to work.
If it turns out that the secure connection cannot be established due to an authentication error, you should download the root certificates from gRPC GitHub and initialize the gRPC channel with these certificates (see the example above).