1
Install the SDK
The SDK packages are in alpha, so these commands pin the exact versions that this page was tested with. The rime-sdk repository on GitHub has the guides, examples, and options 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. To use your own WAV or MP3 file, convert it first, as Use your own recording shows.4
Save the script
This script sends the recording to Rime in 100-millisecond chunks, as fast as it reads the file. The script prints every update that the SDK returns. A live microphone or call delivers audio in real time, so pass that 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:The partial lines appear first, and the final line follows. 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. In this run, written mode also left out the caller’s “uh” and “um”.6
Switch to word-for-word mode
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
Word-for-word mode kept the caller’s “Uh” and “um”, and it wrote the flight number as the caller said it: “two four seven”. Written mode removed the fillers from this recording, but it does not promise to remove fillers. Use word-for-word mode when you need the exact wording as a record, for example in a quality or compliance review. Recognition settings explains how the two modes differ.
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. This command reads
recording.mp3and writesrecording.pcm. A WAV file works the same way.Renaming a file to.pcmdoes not convert it. -
If the recording is in Spanish, set the language to
"es"in the script. Uselanguagein Python and Node.js,Languagein Go, orTranscriptionOptions::new("es")in Rust. -
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 in one call. The call returns one final transcript and no partial transcripts. It takes the file with its WAV header, so it readsflight.wav as you downloaded it. One call takes a file of up to 16 MiB, with up to about 100 to 120 seconds of speech, 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. The WebSocket reference ends with a complete Python client that streams a WAV file. For a short WAV file 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
Choose word-for-word or written text. Add the names that your callers say.

