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 Transcribe and TranscribeStreaming for you in Python, Node.js, Go, and Rust (with explicit language selection and written or verbatim mode). To call a method yourself, including for automatic language detection or tagged mode, install a packaged gRPC client. You do not need to generate client code.

Transcribe

Transcribe takes one complete WAV file and returns one final transcript. The request carries the file in audio, and optional recognition settings 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. Omit "language" (or pass "und") to detect the language automatically.
For the flight recording, Transcribe returned:
Fixed-frame WAV recordings longer than 30 seconds are split into 30-second pieces automatically, up to 16 MiB and 524 seconds (the duration of 16 MiB of 16 kHz mono PCM16, about 8.7 minutes). The 120-second request deadline covers the entire call. Non-fixed-frame WAV encodings are decoded whole rather than in pieces. Rime never returns a silently truncated transcript in place of an error: For recordings over 16 MiB or 524 seconds, split the recording into parts of at most 16 MiB across Transcribe calls or across append-fragment streams. Within the 16 MiB per-call limit, you can also stream a recording faster than real time with append fragments (using TranscribeStreaming or the WebSocket API) to receive incremental output.

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). When you select a language, both contracts return done.language with source set to LANGUAGE_SOURCE_SELECTED. Under revised hypotheses with automatic language detection (omitted language or a BCP 47 tag whose primary subtag is und), detection locks once a decode of at least 8 seconds of audio yields at least three letters, or on the final decode. done.language then carries source set to LANGUAGE_SOURCE_DETECTED, or is omitted when the audio had no recognizable speech. If the detected language is outside the 13-language catalog or does not allow mode, the stream ends with INVALID_ARGUMENT after accepted. 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:
The published 0.5.0 schema packages already support all 13 languages and automatic language detection (omitting language or passing "und", and reading LANGUAGE_SOURCE_DETECTED). TRANSCRIPTION_MODE_TAGGED (enum value 3) was added to the service contract after 0.5.0. To request tagged mode over gRPC with 0.5.0, pass the integer value 3 for mode, or use the WebSocket JSON API with "mode": "TRANSCRIPTION_MODE_TAGGED".

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. Omit language="en" inside TranscriptionOptions to let the model detect the language.
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. Omit language inside options to let the model detect the language.
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.