Prerequisites
To follow this guide, you need:- A Rime API token: Create a free Rime account and copy your API key from the API Tokens page.
- A language runtime:
- Python 3.10 or later, or
- Node.js 18 or later
Create your script
If you’d rather paste a working file and read along, grab the full script below. Otherwise, continue step-by-step.Full script
Create a file calledrime_hello_world.py or rime_hello_world.js and paste the full script:
Full script (copy/paste)
Full script (copy/paste)
Step-by-step code
Create a file calledrime_hello_world.py or rime_hello_world.js and import the required library modules:
textadds the text that the model converts to speech.speakersets the voice that the agent uses (view your options on our Voices page).modelIdspecifies which model the agent uses. Usearcanafor the most realistic voices, ormistv2for faster synthesis.
POST request to the Rime API and write the streamed audio response to a file:
Test the script
Run your script from the terminal:Choose a voice
Rime offers a range of voices with different personalities. To change the voice, update thespeaker parameter in your request:
Custom pronunciation
Themistv2 model lets you specify the pronunciation of brand names or uncommon words using Rime’s phonetic alphabet. Add the custom pronunciation in curly brackets and set phonemizeBetweenBrackets to true:

