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://coda.api.rime.ai/ws",
model="coda",
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. Public model endpoints use port 443 and the /ws path.
Pass model="coda" for wss://coda.api.rime.ai/ws, which serves Coda v2.
Pass model="mistv3" for wss://mist.api.rime.ai/ws.
model is required when constructing any WebSocket v1 client. The plugin does not infer
the model from the URL hostname or path.
Dedicated deployment endpoints also require model:
tts = rime.TTS(
websocket_url="wss://voice.customer.example/ws",
model="coda",
allow_custom_endpoint=True,
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.
For HTTP and WS3, an omitted model 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.
If your configuration relied on a model in the URL path, add model to the constructor.
Custom URL paths pass through without model detection.
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://coda.api.rime.ai/ws",
model="coda",
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.
Metadata
Release files for livekit-plugins-rime 1.8.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| livekit_plugins_rime-1.8.9.tar.gz | 20.9 kB | With provenance | Details for livekit_plugins_rime-1.8.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| livekit_plugins_rime-1.8.9-py3-none-any.whl | Python 3 | none | any | Details for livekit_plugins_rime-1.8.9-py3-none-any.whl |
Total release size: 47.8 kB
Release files / livekit_plugins_rime-1.8.9.tar.gz
| Download URL | livekit_plugins_rime-1.8.9.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c7bd89476ad36eac08af64d544f7d61c4967f777958a48ee8d234318d17bfec
|
|
BLAKE2b-256 checksum How to use checksums |
fcf3a043388308d48d2005031d49f2f025aa77e332fd99449af26acbcdfc30c5
|
| 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 Oct 24, 2026.
Transparency logRelease files / livekit_plugins_rime-1.8.9-py3-none-any.whl
| Download URL | livekit_plugins_rime-1.8.9-py3-none-any.whl |
|---|---|
| Size | 26.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
646b0ae0447aaf703ffee1905851231e663edb2656990fe2ff37e541f3f493bf
|
|
BLAKE2b-256 checksum How to use checksums |
5e900bd234301ea21a6a918ff67c857aa171bf1a79d824a88c78d672ee58b98b
|
| 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 Oct 24, 2026.
Transparency logSecurity for livekit-plugins-rime 1.8.9
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for livekit_plugins_rime-1.8.9.tar.gz
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 Oct 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.