Rime
Stream text-to-speech with Rime voices using rime(): conversational voices built for phone calls. No Rime package needed.
rime() is a text-to-speech provider. It streams speech over Rime's WebSocket API and can return telephony audio directly.
Install
npm install voiceai-sdkpnpm add voiceai-sdkyarn add voiceai-sdkbun add voiceai-sdkSet RIME_API_KEY on your server, and keep it out of browser bundles.
Quickstart
import { createSession } from "voiceai-sdk";
import { rime } from "voiceai-sdk/rime";
await using session = await createSession(rime({ voice: process.env.VOICE_ID }));
const speech = await session.speak("Your order has shipped.", { format: "wav" });
await Bun.write("shipped.wav", speech.audio);This writes the spoken sentence to shipped.wav. await using closes the session when the block ends.
What it supports
| Feature | Support | Notes |
|---|---|---|
Speech-to-text (transcribe) | No | Use a pipeline with a speech-to-text provider |
Streaming transcripts (listen) | No | |
Text-to-speech (speak) | Yes | |
| Streaming speech | Yes | |
| Speech-to-speech | No | |
| Word timings | No | Not returned |
| Speaker labels | No | |
| Interruptions | Yes | |
Voice list (listVoices) | Yes | |
pause() and resume() | No |
The capability matrix compares these with every other provider.
Speak
Iterate session.speak to send audio as it is produced. Pass an async iterable of text, such as a model's output, and speech starts before the text is finished.
import { createSession } from "voiceai-sdk";
import { rime } from "voiceai-sdk/rime";
await using session = await createSession(rime({ voice: process.env.VOICE_ID }));
for await (const chunk of session.speak("Let me check that for you.")) {
player.write(chunk.data);
}Voices
listVoices returns the voices you can pass as voice.
import { listVoices } from "voiceai-sdk";
import { rime } from "voiceai-sdk/rime";
const voices = await listVoices(rime());
console.log(voices.filter((v) => v.language.startsWith("en")).map((v) => v.id));Use it in a pipeline
Rime only speaks. For a conversation, combine it with a provider that streams transcripts.
import { createSession } from "voiceai-sdk";
import { rime } from "voiceai-sdk/rime";
import { deepgram } from "voiceai-sdk/deepgram";
await using session = await createSession({ stt: deepgram(), tts: rime({ voice: process.env.VOICE_ID }) });
await session.converse(async (text) => answer(text));Configuration
Pass options to rime(). Options that have an environment variable fall back to it.
| Option | Type | Default | Env var |
|---|---|---|---|
apiKey | string | RIME_API_KEY | |
voice | string | Required | |
model | string | Provider default |
Call the API directly
session.native is the Rime WebSocket while speech is streaming.
import { createSession } from "voiceai-sdk";
import { rime } from "voiceai-sdk/rime";
await using session = await createSession(rime({ voice: process.env.VOICE_ID }));
console.log(session.native.url);Limitations
transcribeandlistenfail withunsupported. Pair Rime with a speech-to-text provider.wordTimingsisfalse, so transcripts of what was spoken come from the text you sent, not from the audio.
How it works
- When the session
encodingismulaw, Rime returns 8 kHz mu-law directly and the SDK doesn't resample. interrupt()sends a clear message and drops queued audio.
Next steps
- Lifecycle and cleanup
- Give your agent a voice
- Compare providers: the same features on every other provider