Skip to main content

pipecat-paxa

Paxa text-to-speech for Pipecat. Paxa's voices speak Thai, English and Mandarin, including sentences that mix them.

  • PaxaTTSService streams speech over Paxa's live WebSocket. One session serves the whole conversation, and an interruption stops the speech in flight without reconnecting.
  • PaxaHttpTTSService synthesizes each sentence with a streamed POST /v1/tts request.

This integration is built and maintained by Paxa Labs, the company behind the Paxa API.

Tested with Pipecat 1.14.0 on Python 3.11, 3.12 and 3.13.

Installation

uv add pipecat-paxa

Prerequisites

Create an API key in the Paxa dashboard and set it as an environment variable:

export PAXA_API_KEY="pxa_..."

Usage

Place the service after your LLM and before the transport output:

from pipecat.pipeline.pipeline import Pipeline

from pipecat_paxa import PaxaTTSService

tts = PaxaTTSService()  # reads PAXA_API_KEY

pipeline = Pipeline(
    [
        transport.input(),
        stt,
        user_aggregator,
        llm,
        tts,
        transport.output(),
        assistant_aggregator,
    ]
)

Choose the voice, language and speed with Settings:

from pipecat.transcriptions.language import Language

tts = PaxaTTSService(
    settings=PaxaTTSService.Settings(voice="massaman", language=Language.TH, speed=1.1),
)

PaxaHttpTTSService takes the same settings and goes in the same place.

Parameters

Parameter Default Description
api_key PAXA_API_KEY Paxa API key.
base_url PAXA_BASE_URL, then https://api.paxalabs.com API origin.
word_timestamps False PaxaTTSService only. Times every spoken word; see Word timestamps.
aiohttp_session None PaxaHttpTTSService only. A session for the requests; without one, the service creates and closes its own.
settings See Settings.

Both services refuse TextAggregationMode.TOKEN: Paxa synthesizes whole sentences.

Settings

Setting Default Description
model "paxa-tts-flash-v2" Every voice on Flash v2 speaks Thai, English and Mandarin and reads direction tags. "paxa-tts-flash-v1" is the legacy model, with regional Thai accents.
voice "foithong" A voice id from GET /v1/voices, such as foithong or massaman, or a designed voice id (voice_...).
language None How digits, codes and symbols are read: Language.TH, Language.EN or Language.ZH. None lets Paxa decide (auto). Words keep the language of their script, so mixed text needs no setting.
speed None Speaking rate, from 0.5 to 1.5. None speaks at the voice's own rate.

Change them during a conversation with a TTSUpdateSettingsFrame. PaxaTTSService opens a new live session to apply them.

Thai replies

Thai is written without sentence punctuation; a space between two Thai words ends a phrase or sentence. Pipecat's sentence aggregation waits for punctuation, so on its own it holds an unpunctuated Thai reply until the LLM has written all of it. Both services also end a sentence at a space between Thai words, once the sentence before it is 20 characters long, so a Thai reply starts speaking after its first phrase. A space after ฯ or ๆ, or next to Latin letters or digits, doesn't end a sentence. With a Pipecat version that ends Thai sentences itself, the services use Pipecat's rule.

Direction tags

Flash v2 voices read direction tags written in the text, such as [whispering] or [laughs], so you can ask the LLM to use them. A direction lasts until the end of the reply. See the text-to-speech docs for the tags.

Word timestamps

PaxaTTSService(word_timestamps=True) times every spoken word, so the conversation context keeps exactly the words spoken before an interruption, and clients can show words as they play. Words of a Thai phrase come as one timed unit, so the text reads as it was written. Paxa bills timed speech at 1.25 times the standard rate.

Running the example

examples/foundational/voice_paxa.py is a voice agent that uses OpenAI for speech recognition and replies and Paxa for speech. It listens for Thai and greets in Thai; change LANGUAGE and GREETING in the file for another language.

cp .env.example .env  # then add OPENAI_API_KEY and PAXA_API_KEY
uv sync --extra examples
uv run examples/foundational/voice_paxa.py

Open http://localhost:7860 in your browser and talk to the bot.

Notes

  • Audio: Both services ask Paxa for raw 16-bit mono pcm at the pipeline's output rate, so the audio plays as it arrives, with no resampling. Flash v2 serves 8, 16, 22.05, 24, 32, 44.1 and 48 kHz, which covers 8 kHz phone calls and 16 kHz pipelines. At any other rate, and on Flash v1, which serves 24 kHz only, the services ask for 24 kHz and Pipecat resamples it. PaxaHttpTTSService checks that each response is pcm at the rate it asked for, and reports an error rather than play anything else.
  • Plan limits: An open live session holds one of your plan's concurrent speech connections for as long as the service runs, and each synthesized segment counts as a request toward the plan's per-minute limit. Speech refused for a limit is reported as an error with ErrorCategory.RATE_LIMIT, and the next reply is spoken normally.
  • Errors: Errors carry Paxa's error code, such as unknown_voice or insufficient_credits. The error reference explains each one.

Development

uv sync --all-extras
uv run pytest
uv run ruff check && uv run ruff format --check && uv run pyright

The tests run against a local stand-in for the Paxa API, so they need no API key.

License

BSD 2-Clause. See LICENSE.

Metadata

Release files for pipecat-paxa 0.1.0

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-paxa 0.1.0
File Size Uploaded Provenance Actions
pipecat_paxa-0.1.0.tar.gz 39.9 kB Without provenance Details for pipecat_paxa-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pipecat-paxa 0.1.0
File Interpreter ABI Platform Actions
pipecat_paxa-0.1.0-py3-none-any.whl Python 3 none any Details for pipecat_paxa-0.1.0-py3-none-any.whl

Total release size: 65.3 kB

Release files / pipecat_paxa-0.1.0.tar.gz

Download URL pipecat_paxa-0.1.0.tar.gz
Size 39.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1426bc1251d45f2d8aebd98f99a481055f488d33a631e245d3b505a061dcc761
BLAKE2b-256 checksum
How to use checksums
7fb7397a6c2aea06c10c174dcd90753a763cbd87c8637fdeca3adc16362d3b47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pipecat_paxa-0.1.0-py3-none-any.whl

Download URL pipecat_paxa-0.1.0-py3-none-any.whl
Size 25.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3579f918d752f649f49f299d6254d0ee37779f3e89bb4efaa73cadef085b98b9
BLAKE2b-256 checksum
How to use checksums
92f6675cd905fa3bfbc9e53fb123475f66c12c1978e6b4910aaa7297cb9e2de0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pipecat-paxa 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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