websocket_url="wss://api.rime.ai/coda/ws" in RimeTTSService to use Coda WebSocket v1. The service handles authorization, message encoding, sentence buffering, audio decoding, and connection reuse.
Install the integration
Use Python 3.11 or later, Git, and uv. Create a key on the API Tokens page and setRIME_API_KEY in your server’s environment. The service sends this key to the selected endpoint. Keep it out of browser code and source control.
WebSocket v1 support is in Pipecat PR #5629. The commands below install the fork at a fixed commit that includes this support. A normal release install does not include the changes in that open PR.
uv add command in its directory. Keep any extras your agent already uses, such as openai, silero, webrtc, and runner. The rime extra installs rime-api, which supplies message definitions for both encodings. Commit uv.lock so deployments use the same dependencies.
Use the service in a pipeline
Replace the TTS service in your existing pipeline with this configuration. Keep it between the LLM and the transport output:websocket_protocol="json" to use JSON. Both modes produce mono, signed 16-bit PCM in TTSAudioRawFrame objects. Pipecat passes these frames to your transport for playback.
Because /coda/ws selects Coda, you can omit settings.model, as above, or set it to "coda". A different model raises ValueError. Omitting websocket_url selects the older WS3 interface, even if settings.model="coda".
For browser transport, speech recognition, and an LLM, follow the Pipecat agent guide. Install the fork with that guide’s extras, then use the TTS configuration above.
Run the audio demo
Download the audio demos, extract the archive, and open itscoda-audio-demos directory. With RIME_API_KEY set and a local audio output device available, run:
Playback complete after the last samples play. You don’t need a browser transport, speech recognition provider, or LLM.
For JSON, run RIME_WEBSOCKET_PROTOCOL=json uv run stream_pipecat.py. See the included README for audio-device setup and troubleshooting.
Use Pipecat frames to send text through the service. The demo sends LLMFullResponseStartFrame, TextFrame objects, and LLMFullResponseEndFrame to represent one streamed reply. In an agent, the LLM service supplies these frames. You can also queue a TTSSpeakFrame for a fixed utterance.
Service parameters
These settings apply to both encodings. Pass the fields prefixed withsettings. through RimeTTSService.Settings(...):
Audio format and protocol limits
The adapter requestsaudio/pcm only. Set sample_rate=8000 for 8 kHz PCM, then let your telephony transport encode mu-law if it requires that format. The service has no v1 audio_format option.
For splitStrategy or config.defaults, use a direct client. The adapter does not expose these fields. Coda v1 does not return aligned word timestamps.
Move from WS3 to v1
Usewebsocket_url for the endpoint and settings.timeScaleFactor for speed. Remove the following settings from your configuration. The v1 adapter rejects them.
Stream lifecycle
One Pipecat turn uses one Coda context. The service opens the context when the first sentence is ready, after the connection has receivedready.
Pipecat’s
flush_audio() finishes input for a context. It is not the same as LiveKit’s local text flush(). Let the pipeline call it at the end of a turn, because the context cannot accept more text after end.
The service checks the negotiated subprotocol, ready.protocol, context IDs, and event order. It reports synthesis failures through ErrorFrame.
Timeouts
Each send has a time limit. This includes time spent waiting for an earlier send:
Write limits are separate from response timeouts. After sending
cancel, the service waits up to another second for the context to finish. You cannot change these limits through the RimeTTSService constructor.
If a send times out, the service cannot tell whether the server received the message. It closes the connection, rejects queued sends on that connection, and fails its active contexts. A later request can use a new connection. Connection failures and response timeouts also prevent reuse of that connection.
Use the Coda WebSocket API reference for the wire protocol, or the Pipecat agent guide to connect this service to a browser conversation.
