1
Install the SDK
The SDK packages are in alpha, so these commands pin the current published releases. The STT SDK reference lists every option, and the rime-sdk repository on GitHub has the guides and examples for each language.
- Python
- Node.js
- Go
- Rust
Install uv. Then create a project and add the SDK:
2
Set your API key
The SDK reads your key from
RIME_API_KEY when it creates the client, and it does not read .env files. If you need a key, create one. Then set the variable in the terminal where you will run the script:- macOS and Linux
- Windows PowerShell
3
Download the sample recording
This command saves a 9-second recording of a caller to your project folder. Rime text-to-speech made the recording (Coda, voice hesse). The caller says “Uh, hi. I’m calling about flight two four seven to Denver. Can I, um, move it to Friday?”The command downloads
- macOS and Linux
- Windows PowerShell
flight.wav. It removes the 44-byte WAV header and saves the audio as flight.pcm. This file has raw 16-bit samples at 16 kHz, mono, which is the default input format of the SDK.To listen to the recording, open flight.wav in your browser.4
Save the script
This script sends the recording to Rime as fast as it reads the file, not at live speed. Pass live audio to the SDK as it arrives.Save the script in your project folder.The SDK sends audio and reads updates at the same time. At the end of the file, the SDK tells Rime that the utterance is over. The loop ends when the final transcript arrives.
- Python
- Node.js
- Go
- Rust
transcribe.py
5
Run it
Run the script with the file name of the recording:This is the output from one run:The output has three kinds of lines:
- Python
- Node.js
- Go
- Rust
partial: the whole transcript at that time. Eachpartialline replaces the line before it. Do not write code that depends on the number of partials or on the text of each partial.final: the complete transcript. If the script raises an error and prints no final line, find the error in Errors and limits.Request: the request ID, which identifies this stream. Give it to Rime support if you have a question about the stream.
247) and one to nine as words. In this run, written mode also left out the caller’s “uh” and “um”.6
Switch to word-for-word mode
Verbatim (word-for-word) mode asks for the exact words of the speaker, including fillers such as “uh” and numbers as spoken words. Change the mode line in your script, and run the script on the same recording again:These are the final lines from the two runs:
- Python
- Node.js
- Go
- Rust
Use verbatim mode when you need the exact wording as a record, for example in a quality or compliance review. Transcription modes compares written, verbatim, and tagged mode (available over WebSocket and gRPC).
Use your own recording
The stream call reads headerless PCM16 samples, not audio files. Convert your recording first.- Install FFmpeg.
-
Convert the recording to 16 kHz mono PCM16. A WAV file works the same way.
Renaming a file to
.pcmdoes not convert it. -
Set
languagein the script to any of the 13 supported language tags, such as"es"for Spanish,"fr"for French,"ja"for Japanese, or"cmn"for Mandarin. -
Run the script with
recording.pcmin place offlight.pcm.
Transcribe a whole file in one call
For a recording that you already have, such as a voicemail, the SDK can send the whole WAV file, with its header, in one call. The call returns one final transcript and no partial transcripts. One call takes a fixed-frame WAV file up to 16 MiB and 524 seconds (about 8.7 minutes). The service transcribes files longer than 30 seconds in 30-second pieces within the 120-second request deadline, as Limits explains. Save this script next to the first one:- Python
- Node.js
- Go
- Rust
transcribe_file.py
Use the API without the SDK
Without the SDK
Without the SDK
Choose how to connect helps you choose WebSocket or gRPC, including when you need automatic language detection or tagged mode. The WebSocket reference ends with a complete Python client that streams a WAV file. For a WAV file up to 16 MiB and 524 seconds in one request, use gRPC
Transcribe. For a longer recording, see Transcribe a long recording.Next
Stream live audio
Replace the file with your live audio source. The stream call does not change.
Recognition settings
Browse all 13 languages, automatic language detection, verbatim and tagged modes, and context terms.

