Skip to main content

Maya Research TTS integration for Pipecat

Project description

pipecat-maya

Maya Research TTS integration for Pipecat.

Maya 2 is a text-to-speech model built for Indian languages. It offers two voices — Ananya (female) and Arjun (male) — and both support all ten available languages: Hindi, Bengali, Gujarati, Kannada, Malayalam, Marathi, Odia, Punjabi, Tamil, and Telugu.

This package provides MayaHttpTTSService, a drop-in Pipecat TTS service that streams audio from Maya's HTTP API.

Maintained by the Maya Research team. Tested with Pipecat v1.6.0, verified against the live Maya 2 API.

Installation

uv add pipecat-maya
# or
pip install pipecat-maya

pipecat-ai is pulled in automatically. The service itself needs no extra dependencies beyond aiohttp.

Prerequisites

You need a Maya API key. Contact charan@mayaresearch.ai, bharath@mayaresearch.ai, or dheemanth@mayaresearch.ai to get one.

export MAYA_API_KEY=...

Usage

import os

from pipecat.transcriptions.language import Language
from pipecat_maya import MayaHttpTTSService

tts = MayaHttpTTSService(
    api_key=os.environ["MAYA_API_KEY"],
    settings=MayaHttpTTSService.Settings(
        voice="Ananya",  # or "Arjun"
        language=Language.HI,
        region="IN",  # or "US"
    ),
)

Then drop it into a pipeline exactly like any built-in Pipecat TTS service:

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

Configuration

Constructor parameters:

Parameter Required Default Description
api_key Yes Maya API key.
aiohttp_session No None Reuse an existing aiohttp.ClientSession. If omitted, the service creates and closes its own.
base_url No https://tts.mayaresearch.ai Override for self-hosted or staging endpoints.
sample_rate No pipeline default Output rate in Hz. Maya synthesizes at 24 kHz; anything else is resampled.
settings No see below Runtime-updatable settings.

Runtime settings (MayaHttpTTSService.Settings), all changeable mid-pipeline via TTSUpdateSettingsFrame:

Setting Default Values
voice "Ananya" "Ananya", "Arjun"
language None Any Language enum; the ten Indian languages listed above are verified.
region "IN" "IN", "US"

model is unused — Maya 2 exposes a single model.

Maya validates language strictly: an unsupported code is rejected with 400 invalid 'language'. So if you configure a language Maya doesn't support (English, for example), the service logs a warning and omits the field, letting Maya fall back to its own default — you still get audio instead of a failed turn.

Supported codes: hi, bn, gu, kn, ml, mr, or, pa, ta, te.

Examples

Verify your key without setting up a full pipeline — synthesizes one Hindi sentence to maya-out.wav:

MAYA_API_KEY=... uv run --with pipecat-maya example/synthesize_to_wav.py

Full voice agent (Deepgram STT + OpenAI LLM + Maya TTS over WebRTC). Needs DEEPGRAM_API_KEY and OPENAI_API_KEY in addition to MAYA_API_KEY:

uv run --with "pipecat-maya[example]" example/maya_voice_agent.py

Then open the printed URL in your browser.

Local mic/speaker agent with latency instrumentation — talks through your laptop's mic and speakers, no browser or transport server. Prints per-service TTFB, an end-to-end latency breakdown, transcripts, and LLM activity. Needs SONIOX_API_KEY and OPENAI_API_KEY alongside MAYA_API_KEY:

uv run --with "pipecat-maya[local-agent]" example/local_voice_agent_metrics.py

Set MAYA_VOICE (Ananya/Arjun) and MAYA_LANGUAGE (hi, ta, ...) to switch voice and language.

How it works

Maya's POST /v1/tts streams raw PCM — 16-bit signed little-endian, mono, 24 kHz, no file header. The service reads the response with iter_chunked and pushes TTSAudioRawFrames as bytes arrive rather than buffering the full utterance, so time-to-first-byte stays low. Pipecat's _stream_audio_frames_from_iterator handles resampling to the pipeline rate and keeps chunks sample-aligned.

The HTTP session is reused across requests to avoid repeated TLS handshakes.

Rate limits

Maya's defaults are 120 requests/minute and 16 concurrent requests. Exceeding either returns a 429, which surfaces as an ErrorFrame with the status and body.

Development

uv sync --extra dev
uv run pytest
uv run ruff format . && uv run ruff check .

License

BSD 2-Clause. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pipecat_maya-0.1.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pipecat_maya-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file pipecat_maya-0.1.0.tar.gz.

File metadata

  • Download URL: pipecat_maya-0.1.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for pipecat_maya-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a92a02d56dc6b6dcf47bdbf3d922ee062a623b40fe93349dd30327e1d94c88a8
MD5 6205ac16d2d14ad381813f91b707c6a1
BLAKE2b-256 63d23be9a1076da57df8e7ac72c03af0c7986901b60aea7a81c2110cea1ec363

See more details on using hashes here.

File details

Details for the file pipecat_maya-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pipecat_maya-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee150a01cd461fa3b825be12c12335fb5c693b94e1ce230aed31830b3b2ba0d1
MD5 fa803ffb595e90230155bea044a9492a
BLAKE2b-256 d566150ee6b7a4ca8c236876e50551991b4608649c03ada5e1ff9fd477d6fc3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page