Development · GitHub repo

cartesia-js

Official JavaScript and TypeScript client library for Cartesia's text-to-speech API

Visit github.com ↗

cartesia-js is the official TypeScript and JavaScript library for interacting with Cartesia's Sonic text-to-speech API. It provides typed access to speech generation, voice management, and dataset uploads with built-in retries, pagination, and multi-runtime support. It makes it straightforward to integrate real-time voice generation and voice cloning into web and backend applications.

What it's for

  • Generate low-latency speech from text in Node.js or browser apps
  • List and manage custom or cloned voices across user sessions
  • Upload audio datasets and files for voice modeling
  • Stream generated audio into conversational AI agents

Features

  • Full TypeScript definitions for all API request parameters and responses
  • Built-in automatic retries with exponential backoff for network and rate-limit errors
  • Automatic pagination via asynchronous iteration (for await...of)
  • Configurable timeouts, proxy support, and customizable fetch implementations
  • Flexible file uploads supporting fs streams, Blobs, and fetch Responses
  • Broad runtime support including Node.js, Bun, Deno, Cloudflare Workers, and web browsers

Pricing

Open source. Open-source SDK (Apache-2.0); requires Cartesia API credits

Details

Type
GitHub repo
Category
Development
Topic
Speech & Audio APIs
Open source
Yes
Platforms
Code library, API
For
JavaScript and TypeScript developers building voice agents or adding TTS to applications
Alternative to
@elevenlabs/client, deepgram-sdk
Tags
text to speech, voice cloning, typescript, javascript, sdk, cartesia, audio

Why it was saved

  • @svpino, 8 February 2025: For integrating voice into web apps and agents.

Related

  • 2023 JavaScript Rising Stars

    Annual overview of the fastest-growing JavaScript GitHub repositories in 2023.

  • ElevenLabs NextJS Starter

    Open-source Next.js boilerplate showcasing ElevenLabs audio and voice features

  • Mediabunny

    Fast, dependency-free JavaScript media toolkit for browser-based video and audio processing

  • Popmotion

    Low-level JavaScript animation library for spring, inertia, and keyframe animations

  • Social SDK

    Typed TypeScript SDK for publishing, analytics, and interactions across social platforms

  • Motion

    Open-source animation library for React, Vue, and vanilla JavaScript

Updated