Rime plugin for LiveKit Agents
Support for voice synthesis with the Rime API.
See https://docs.livekit.io/agents/integrations/tts/rime/ for more information.
Installation
pip install livekit-plugins-rime
Pre-requisites
You'll need an API key from Rime. It can be set as an environment variable: RIME_API_KEY
Streaming WebSocket v1 API
The Rime v1 WebSocket protocol accepts streaming text and returns audio before the input turn is complete. The plugin aggregates input fragments into complete sentences before it sends them to Rime. All sentences in one LiveKit output turn use one continuous synthesis context.
import os
from livekit.plugins import rime
tts = rime.TTS(
websocket_url="wss://api.rime.ai/coda/ws",
speaker="lyra",
api_key=os.environ["RIME_API_KEY"],
)
Pass the active model WebSocket endpoint explicitly. The presence of websocket_url selects
WebSocket v1 streaming. For a route such as /coda/ws, the plugin reads the model from the path
segment before /ws. Do not also pass model for this type of route.
Some dedicated Rime endpoints end with /ws and do not contain a model path segment. Pass
model for these endpoints:
tts = rime.TTS(
websocket_url="wss://tigerstripe-dialpad.aws-us-east-1.whiteglove.rime.ai/ws",
model="coda",
api_key=os.environ["RIME_API_KEY"],
)
The plugin sends the Rime API key to the endpoint. It trusts rime.ai and its subdomains by
default. To use an endpoint on a different domain, confirm that you trust it and set
allow_custom_endpoint=True. This opt-in also applies to base_url.
The websocket_protocol option accepts binary or json. It defaults to binary, which uses the
rime.v1.binary subprotocol and protobuf binary frames. Set websocket_protocol="json" to use the
rime.v1.json subprotocol and canonical proto3 JSON text frames.
The speaker defaults to lyra for Coda and cove for Mist across all transports. This also
applies when the model is omitted and defaults to Coda. An explicit speaker is preserved.
The plugin uses
livekit.agents.tokenize.blingfire.SentenceTokenizer by default and configures it to emit one
complete sentence at a time. Pass tokenizer to select another LiveKit sentence tokenizer. A
custom tokenizer must emit complete sentence units that are safe for Rime text normalization.
The plugin sends the resolved sample rate in every HTTP, WS3, and WebSocket v1 request so it
matches the audio emitter's rate. Pass sample_rate to override the model default.
The public WebSocket v1 endpoint currently supports Coda. The future Mist route will use
/mist/ws, not /mistv3/ws.
Select the Rime output format with audio_format. It defaults to audio/pcm. The adapter supports
all canonical formats from the Rime interface:
audio/pcmaudio/wavaudio/mpegaudio/ogg;codecs=opusaudio/webm;codecs=opusaudio/pcmu
Both WebSocket protocols support every format. The binary protocol sends the encoded audio bytes directly. The JSON protocol sends the same bytes as base64 text.
PCMU uses the selected sample rate. Choosing audio/pcmu keeps the model default, which is
24,000 Hz for Coda. The plugin decodes PCMU to 16-bit PCM at the same rate. To request 8,000 Hz,
set sample_rate explicitly:
tts = rime.TTS(
websocket_url="wss://api.rime.ai/coda/ws",
audio_format="audio/pcmu",
sample_rate=8000,
api_key=os.environ["RIME_API_KEY"],
)
The v1 interface uses time_scale_factor for speed control. The deprecated speed_alpha option
applies only to the older Rime interfaces.
One LiveKit stream uses one continuous Rime synthesis context. These stream methods map to the Rime lifecycle as follows:
| LiveKit method | Local action | Rime operation |
|---|---|---|
stream.push_text() |
Buffer and sentence-tokenize text. | Send text for each completed sentence. |
stream.flush() |
Release the current tokenizer buffer and keep the context open. | Send released content as text; no flush operation exists. |
stream.end_input() |
Drain final text and finalize input. | Send end. |
stream.aclose() |
Stop active synthesis. | Send cancel when needed. |
You can send more text after flush(). The same Rime context remains active, and an input pause
needs no wire message. Only end_input() ends normal input and causes Rime to send done.
Each outgoing text value must be a stable sentence-sized unit. Calling flush() drains any
buffered fragment, so call it only after a complete sentence or a stable clause.
The v1 implementation has these limits:
- It does not provide aligned word timestamps.
- The adapter reuses WebSocket connections between sequential LiveKit streams. It does not run concurrent contexts on one WebSocket. Concurrent LiveKit streams use separate pooled WebSocket connections.
Release files for livekit-plugins-rime 1.8.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| livekit_plugins_rime-1.8.2.tar.gz | 21.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| livekit_plugins_rime-1.8.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.1 kB
Release files / livekit_plugins_rime-1.8.2.tar.gz
| Download URL | livekit_plugins_rime-1.8.2.tar.gz |
|---|---|
| Size | 21.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
823e7ea9d6710fa6a351a66b19d6f19ceda938adc5a59ef02ddddc7dee7393f2
|
|
BLAKE2b-256 checksum How to use checksums |
95b09b7bbed900cbe3cfbde82acfa95fe71f6466cfda136b87124a713e162d84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency logRelease files / livekit_plugins_rime-1.8.2-py3-none-any.whl
| Download URL | livekit_plugins_rime-1.8.2-py3-none-any.whl |
|---|---|
| Size | 27.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61e130b362e1b7b74c1c2794d5ec2880dcb9147b153d395275f5409cf1396549
|
|
BLAKE2b-256 checksum How to use checksums |
53673411c50c5c683ac34a21e0fc71d4575ce6ce32ebca4915ac098c8658595c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency log