Skip to main content

Overview

Rime AI provides three TTS service implementations: RimeTTSService (WebSocket-based) with word-level timing and interruption support, RimeV1TTSService (WebSocket v1 API) with interruption support and no word timing, and RimeHttpTTSService (HTTP-based) for simpler use cases. RimeTTSService and RimeV1TTSService are recommended for real-time interactive applications.

Rime TTS API Reference

Pipecat’s API methods for Rime TTS integration

Example Implementation

Complete example with word timestamps

Rime Documentation

Official Rime WebSocket and HTTP API documentation

Voice Models

Explore available voice models and features

Installation

To use Rime services, install the required dependencies:

Prerequisites

Rime Account Setup

Before using Rime TTS services, you need:
  1. Rime Account: Sign up at Rime AI
  2. API Key: Generate an API key from your account dashboard
  3. Voice Selection: Choose from available voice models

Required Environment Variables

  • RIME_API_KEY: Your Rime API key for authentication

Configuration

RimeTTSService

str
required
Rime API key for authentication.
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=RimeTTSService.Settings(voice=...) instead.
str
default:"wss://users-ws.rime.ai/ws3"
Rime WebSocket API endpoint.
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=RimeTTSService.Settings(model=...) instead.
int
default:"None"
Output audio sample rate in Hz. When None, uses the pipeline’s configured sample rate.
TextAggregationMode
default:"None"
Controls how incoming text is aggregated before synthesis. SENTENCE (used when None) buffers text until sentence boundaries, producing more natural speech. TOKEN streams tokens directly for lower latency. Import from pipecat.services.tts_service.
bool
default:"None"
deprecated
Deprecated since 0.0.104, removed in 2.0.0. Use text_aggregation_mode instead.
InputParams
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=RimeTTSService.Settings(...) instead.
RimeTTSService.Settings
default:"None"
Runtime-configurable settings. See RimeTTSService Settings below.

RimeHttpTTSService

str
required
Rime API key for authentication.
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=RimeHttpTTSService.Settings(voice=...) instead.
aiohttp.ClientSession
required
An aiohttp session for HTTP requests.
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=RimeHttpTTSService.Settings(model=...) instead.
int
default:"None"
Output audio sample rate in Hz. When None, uses the pipeline’s configured sample rate.
InputParams
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=RimeHttpTTSService.Settings(...) instead.
RimeHttpTTSService.Settings
default:"None"
Runtime-configurable settings. See RimeTTSService Settings below; the HTTP service defaults language to "eng".

RimeV1TTSService

str
required
Rime API key for authentication.
str
default:"wss://api.rime.ai/coda/ws"
Rime WebSocket v1 endpoint. The path must end with /ws and selects the model: /coda/ws uses coda, /mist/ws uses mistv3, and /{model}/ws uses that model. A dedicated endpoint whose path is only /ws requires settings=RimeV1TTSService.Settings(model=...). Raises ValueError when the path does not end with /ws, when a dedicated endpoint has no model, or when model differs from the endpoint’s model.
Literal["binary", "json"]
default:"\"binary\""
Encoding of the protobuf messages exchanged with Rime. Raises ValueError for any other value.
int | None
default:"None"
Output audio sample rate in Hz. When None, uses the pipeline’s configured sample rate.
TextAggregationMode | None
default:"None"
Controls how incoming text is aggregated before synthesis. SENTENCE (used when None) sends whole sentences. TOKEN sends LLM tokens as they arrive, and Rime accumulates them into sentences. Import from pipecat.services.tts_service.
RimeV1TTSService.Settings
default:"None"
Runtime-configurable settings. See RimeV1TTSService Settings below.

RimeNonJsonTTSService

Deprecated since 0.0.102, removed in 2.0.0. A non-JSON WebSocket service that uses plain-text messages and raw audio responses. Use RimeTTSService instead.
str
required
Rime API key for authentication.
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=RimeNonJsonTTSService.Settings(voice=...) instead.
str
default:"wss://users.rime.ai/ws"
Rime WebSocket API endpoint.
str
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=RimeNonJsonTTSService.Settings(model=...) instead.
str
default:"pcm"
Audio output format.
int
default:"None"
Output audio sample rate in Hz. When None, uses the pipeline’s configured sample rate.
TextAggregationMode
default:"None"
Controls how incoming text is aggregated before synthesis. SENTENCE (used when None) buffers text until sentence boundaries. TOKEN streams tokens directly for lower latency. Import from pipecat.services.tts_service.
bool
default:"None"
deprecated
Deprecated since 0.0.104, removed in 2.0.0. Use text_aggregation_mode instead.
InputParams
default:"None"
deprecated
Deprecated since 0.0.105, removed in 2.0.0. Use settings=RimeNonJsonTTSService.Settings(...) instead.
RimeNonJsonTTSService.Settings
default:"None"
Runtime-configurable settings. See RimeNonJsonTTSService Settings below.

RimeTTSService Settings

Runtime-configurable settings passed via the settings constructor argument using RimeTTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. See Service Settings for details.

RimeV1TTSService Settings

Runtime-configurable settings passed via the settings constructor argument using RimeV1TTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame, and each synthesis context uses the settings in effect when it starts. See Service Settings for details. A setting the endpoint’s model does not accept is left out of the request and logs a warning. None leaves a setting unsent, so Rime’s default applies.

RimeNonJsonTTSService Settings

Runtime-configurable settings passed via the settings constructor argument using RimeNonJsonTTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. See Service Settings for details.

Usage

Basic Setup (WebSocket)

With Customization (WebSocket)

WebSocket v1 Service

HTTP Service

Customizing Speech

RimeTTSService provides a set of helper methods for implementing Rime-specific customizations, meant to be used as part of text transformers. These include methods for spelling out text, inserting pauses, setting custom pronunciations, and adjusting speech rate. See the Text Transformers for TTS section in the Text-to-Speech guide for usage examples.

RimeTTSService.SPELL(text: str) -> str

Static method that implements Rime’s spell function to spell out text character by character. Call this method on the class, not on an instance. RimeV1TTSService.SPELL() works the same way.

RimeTTSService.PAUSE_TAG(seconds: float) -> str

Static method that implements Rime’s custom pause functionality to generate a properly formatted pause tag you can insert into the text. Call this method on the class, not on an instance. RimeV1TTSService.PAUSE_TAG() works the same way.

PRONOUNCE(self, text: str, word: str, phoneme: str) -> str:

Convenience method to support Rime’s custom pronunciations feature. It returns the text with every occurrence of word replaced by phoneme wrapped in curly braces, and turns on phonemizeBetweenBrackets for the next message. Pass the phoneme string without braces. Call it on the service instance, not on the class.

INLINE_SPEED(self, text: str, speed: float) -> str:

A convenience method to support Rime’s inline speed adjustment feature. It wraps the provided text in [] and appends the provided speed to the inlineSpeedAlpha field of the next message. Call it on the service instance, not on the class.

Notes

  • Word-level timestamps: RimeTTSService provides word-level timing information, enabling synchronized text highlighting.
  • WebSocket vs HTTP: The WebSocket service supports word-level timestamps, interruption handling, and maintains context across messages within a turn. The HTTP service is simpler but lacks these features.
  • WebSocket v1: RimeV1TTSService does not provide word-level timestamps. Interruptions cancel the current synthesis context without reconnecting.
  • Non-JSON WebSocket: RimeNonJsonTTSService is the deprecated plain-text and raw-audio WebSocket implementation. It does not support word-level timestamps.

Event Handlers

Rime WebSocket TTS services support the standard service connection events: