AI · GitHub repo

cartesia-python

Official Python library for Cartesia's real-time text-to-speech API

Visit github.com ↗

cartesia-python is the official client library for interacting with Cartesia's Sonic text-to-speech models in Python. It supports synchronous and asynchronous HTTP requests alongside WebSocket streaming for low-latency audio generation. It is designed for developers building voice agents and real-time speech applications.

What it's for

  • Stream real-time text-to-speech audio from LLM output over WebSockets
  • Generate WAV or PCM voice audio files from text transcripts
  • Integrate voice cloning and custom voice playback into Python applications
  • Manage and paginate through Cartesia voice datasets and profiles

Features

  • Synchronous and asynchronous clients powered by httpx and optional aiohttp backend
  • Full WebSocket streaming support for low-latency chunked audio generation
  • Pydantic response models and TypedDict request parameters for editor autocomplete
  • Built-in automatic pagination for voice and dataset listing
  • Automatic retries with exponential backoff for rate limits and connection errors
  • Granular audio formatting controls including container, encoding, and sample rate

Pricing

Paid. Open-source SDK, requires a paid Cartesia API key

Details

Type
GitHub repo
Category
AI
Topic
Text to Speech
Open source
Yes
Platforms
Code library, API
For
Python developers building voice agents, audio tools, and AI assistants
Alternative to
elevenlabs, deepgram, openai
Tags
tts, text to speech, voice, audio, cartesia, python sdk, websockets

Why it was saved

  • @svpino, 8 February 2025: For integrating voice cloning / voice agents into products in Python.

Compare

Related

  • ElevenLabs

    AI voice generator, voice cloning, and conversational agent platform

  • Cartesia Sonic

    Ultra-low-latency streaming text-to-speech and instant voice cloning model.

  • Dia

    Open-source 1.6B text-to-speech model generating multi-speaker dialogue in one pass.

  • Airy

    Fast, low-cost text-to-speech API and studio for creators and developers

  • AudioPen

    Converts spoken thoughts into structured, polished writing in customizable styles.

  • Chatterbox

    Open-source zero-shot text-to-speech and voice cloning model

All 21 in Text to Speech →

Updated