Skip to main content

pipecat-readaloud

ReadAloud text-to-speech for Pipecat. ReadAloudHttpTTSService streams audio from the ReadAloud API as it is generated, so a voice agent can start speaking within a few hundred milliseconds. It supports 8 kHz output for Twilio and Telnyx calls, runtime voice and speed updates, and stops generation when Pipecat interrupts it.

Maintainer: this integration is written and maintained by the author of ReadAloud, the speech API provider.

Installation

uv add pipecat-readaloud        # or: pip install pipecat-readaloud
export READALOUD_API_KEY=rtts_...

Get an API key at readaloudai.org/developers. New keys include a small free allowance.

Usage

import os
import aiohttp
from pipecat.pipeline.pipeline import Pipeline
from pipecat_readaloud import ReadAloudHttpTTSService

async with aiohttp.ClientSession() as session:
    tts = ReadAloudHttpTTSService(
        api_key=os.environ["READALOUD_API_KEY"],  # or omit and set READALOUD_API_KEY
        aiohttp_session=session,                   # optional; one is created if omitted
        sample_rate=8000,                          # 8000 for Twilio/Telnyx; 24000 native; 16000 also works
        settings=ReadAloudHttpTTSService.Settings(voice="default", speed=1.0),
    )
    pipeline = Pipeline([transport.input(), stt, user_aggregator, llm, tts, transport.output(), assistant_aggregator])

Constructor options: base_url (default https://api.readaloudai.org), engine (piper default, or kokoro), output_format (auto, pcm_24000, pcm_16000, pcm_8000, mulaw_8000, alaw_8000), max_retries, aiohttp_session. auto asks for 8 kHz when the pipeline runs at 8 kHz and 24 kHz otherwise, and lets Pipecat resample. voice and speed can be changed at runtime with a TTSUpdateSettingsFrame. The earlier class name ReadAloudTTSService still works as an alias.

Running the example

examples/readaloud_tts_to_wav.py is a single-file pipeline that speaks a sentence and saves it as a WAV file. It needs only a ReadAloud API key, with no STT, LLM or transport:

uv add pipecat-readaloud
export READALOUD_API_KEY=rtts_...
python examples/readaloud_tts_to_wav.py "Thanks for calling. How can I help you today?"

Behaviour

  • Audio frames are yielded as bytes arrive, sample-aligned.
  • On interruption Pipecat cancels the in-flight synthesis and the connection is closed, which stops generation on the server.
  • "At capacity" (HTTP 503 or 429), 502 and 504 responses are retried with exponential backoff (Retry-After honoured) until the first audio byte arrives. Authentication (401), quota (402), bad request and unknown voice (400, 404) errors surface immediately as an ErrorFrame.
  • The API returns no word timestamps, so TTSTextFrames are not time-aligned.

Compatibility

Tested with Pipecat 1.12.0 and Python 3.14; requires pipecat-ai>=1.12,<2. The tests run against a local fake of the ReadAloud HTTP protocol (pip install -e '.[dev]' && pytest), and the example and service were also run against the live API.

Changelog

See CHANGELOG.md. Licensed under MIT.

Metadata

Release files for pipecat-readaloud 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pipecat-readaloud 0.1.1
File Size Uploaded
pipecat_readaloud-0.1.1.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pipecat-readaloud 0.1.1
File Interpreter ABI Platform
pipecat_readaloud-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / pipecat_readaloud-0.1.1.tar.gz

Download URL pipecat_readaloud-0.1.1.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
90a9a826fae1a6d8f454b0486e64bf21d8a94695433aa909778fa450e03a3989
BLAKE2b-256 checksum
How to use checksums
d1e8e585381da009ef979ce79852c77238a6316aef33547fc3d8ef833913942d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / pipecat_readaloud-0.1.1-py3-none-any.whl

Download URL pipecat_readaloud-0.1.1-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c560dd28fb6a5e81dae7b876dd18fbfd8fffd15e820142023a2e8281b7e98a3
BLAKE2b-256 checksum
How to use checksums
9093755d7e4e594bbb5c2a4ce1cd990965d841afbafebbe35cdc0bda299cd12f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page