Prerequisites
You need:- A Rime API token: Create a free Rime account and copy your API key from the API Tokens page.
- A language runtime, depending on which tab you follow:
- cURL: a terminal with cURL installed (included with macOS and most Linux distributions).
- Python: Python 3.10 or later.
- JavaScript: Node.js 18 or later.
- TypeScript: Node.js 18+ plus tsx (
npm install -g tsx).
These examples call Rime’s HTTPS API with a standard library or built-in
fetch. Rime does not publish an npm or PyPI SDK. Framework-specific starters are available for Next.js, Vite, Express, plain Node, and FastAPI.Copy the request
Create a file calledrime_hello_world.py, rime_hello_world.js, or rime_hello_world.ts (or run the cURL version directly in your terminal) and paste the full script:
Full script (copy/paste)
Full script (copy/paste)
Run it
The cURL tab runs the request directly. For Python, JavaScript, or TypeScript, run:output.wav and prints:
Confirm it worked
A200 and a file on disk are not proof of success. Two things produce both without producing audio:
- cURL writes error bodies to the file. The example above uses
--output output.wavwithout--fail, so a rejected request leaves a small text file namedoutput.wavcontaining the error message. - An unrecognized
Acceptheader returns JSON rather than audio. Rime falls back to a200response whose body is JSON with anaudioContentfield. The file is not empty and the status is not an error, but no player will open it.
head -c 4 prints { you received JSON, so check your Accept header. If it prints readable English, you received an error message, so open the file and match it below.
If it did not work
Everything here fails before any audio is produced. For the complete list of statuses and messages, see the error reference.How the request works
How the request works
Build the request step by step
Create a file calledrime_hello_world.py, rime_hello_world.js, or rime_hello_world.ts and import the required library modules:textis the content to synthesize.speakerselects a voice from the voice catalog.modelIdselects the model. Usecodafor the flagship voice lineup ormistv3for the lowest time to first audio.
POST request and write the streamed audio response to a file:Choose a voice
Change thespeaker parameter to use another voice:
Custom pronunciation
Custom pronunciation is supported on Mist v1 and Mist v2 only. Coda, Arcana, and Mist v3 do not support
phonemizeBetweenBrackets.mistv2 model lets you specify the pronunciation of brand names or uncommon words using the Rime phonetic alphabet. Add the custom pronunciation in curly brackets and set phonemizeBetweenBrackets to true:
Production choices
The LiveKit quickstart extends the same streaming API into a real-time voice agent. These references cover the main model, voice, latency, and transport decisions:Models
Compare Coda (flagship) and Mist v3 (fast)
Voices
Browse all available voice options
Latency
Optimize for real-time performance
Coda Streaming API
Stream audio with our flagship model

