Skip to main content
Connect to rime.SpeechToText at stt.api.rime.ai:443 from your backend, with gRPC over TLS. Send your API key in the metadata of each call, as authorization: Bearer YOUR_API_KEY. Write the key name in lowercase, because gRPC metadata keys are lowercase. For example, Python’s grpcio rejects Authorization. The Rime SDK calls TranscribeStreaming for you in Python, Node.js, Go, and Rust. To call a method yourself, install a packaged gRPC client. You do not need to generate client code.

Transcribe

Transcribe takes a short recording as one complete WAV file and returns one transcript. The request carries the file in audio, and the language of the recording in options: These commands need grpcurl and the RIME_API_KEY variable. They download the schema and the sample flight recording, transcribe the recording as English, and print the response as JSON. They pass the request through stdin with -d @, which avoids the shell’s limit on argument length for base64 audio.
For the flight recording, Transcribe returned:
The 16 MiB limit is only the transport limit, and a file runs out of model context long before it reaches 16 MiB. The recording and your context terms must fit in the context together. In practice, Transcribe holds about as much speech as a revised-hypotheses stream (limits). Rime never returns a shortened transcript in place of an error: For a longer recording, stream it faster than real time with append fragments over the WebSocket API. TranscribeStreaming accepts the same contract, and Transcribe a long recording has the steps.

TranscribeStreaming

Each call transcribes one utterance. Send and read messages in this order: Your client sets the chunk size by how many bytes it puts in each audio payload, up to 64 KiB. It sets the pace by when it sends each payload. 100 ms of audio is 3,200 bytes, and you can send a recording faster than real time. If you cancel the call, or if either side drops, the backend work stops. A request out of order, a request with no payload, or an invalid setting fails with INVALID_ARGUMENT, as Status codes lists. Set output_contract to one of these values. There is no default. Choose by whether your consumer can replace text that it already has (compare them). Both contracts return the language in done.language, with source set to LANGUAGE_SOURCE_SELECTED. The server applies these deadlines: The limits table has every other limit.

Status codes

Branch on the status code, not on the message text, and retry a status only when Errors and limits says to retry it. Keep the request ID when you report a failure. The server returns x-request-id in the response headers of a successful call, and in the trailers of most failed calls.

Schema

The wire contract for both methods is speech_to_text.proto, in the public rimelabs/rime-api repository. The same file defines the protobuf envelopes of the WebSocket endpoint. These packages contain generated message definitions for this schema, starting with version 0.2.0. Python and Node.js include the gRPC clients starting with version 0.5.0:

Python client

Install version 0.5.0 or newer with the gRPC extra. Python 3.10 or newer is required.
This request reads flight.wav from the current directory and prints its transcript. Set RIME_API_KEY before you run it. The client sends your key as call metadata over TLS.
The same stub accepts a grpc.aio channel for asynchronous calls. For streaming, call TranscribeStreaming and follow the message order. The TTS client is TextToSpeechStub in rime_api.text_to_speech_pb2_grpc.

Node.js client

Install version 0.5.0 or newer and the gRPC runtime. The message constructors use @bufbuild/protobuf.
This request reads flight.wav and prints its transcript. Run it as an ES module on your backend with RIME_API_KEY set. It sends the key over TLS and closes the client after the call.
For streaming, client.transcribeStreaming(metadata, options) returns a native grpc-js duplex stream. Send one config message first, then send audio messages as StreamingTranscriptionRequest values. Follow the required message order, call end() to half-close, and keep reading until the response stream finishes. TextToSpeechClient is available from the same entry point. CommonJS and TypeScript are also supported. The package root remains usable without a gRPC runtime.