Cartesia TTS Service Integration (services/cartesia.py)

TomTom101/pipecat · src/pipecat/services/cartesia.py · python · BSD-2-Clause
voice, realtime, lang:python

Python voice service integration for Cartesia text-to-speech within the Pipecat framework, supporting streaming audio and websocket communication. Reuse when adding real-time voice synthesis.

# Source: https://github.com/TomTom101/pipecat | License: BSD-2-Clause | Copyright 2024–2025, Daily
# Provided via justclaw.it.com; keep this notice with the code.
#
# Copyright (c) 2024–2025, Daily
#
# SPDX-License-Identifier: BSD 2-Clause License
#

import base64
import json
import uuid
from typing import AsyncGenerator, List, Optional, Union

from loguru import logger
from pydantic import BaseModel

from pipecat.frames.frames import (
    CancelFrame,
    EndFrame,
    ErrorFrame,
    Frame,
    StartFrame,
    StartInterruptionFrame,
    TTSAudioRawFrame,
    TTSStartedFrame,
    TTSStoppedFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.ai_services import AudioContextWordTTSService, TTSService
from pipecat.transcriptions.language import Lang

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key