# cartesia-js

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

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.

Website: https://github.com/cartesia-ai/cartesia-js

## What it is 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](https://xiry.app/topics/development.md)
- 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](https://x.com/svpino/status/1888320663200604319): For integrating voice into web apps and agents.

## Related

- [2023 JavaScript Rising Stars](https://xiry.app/resources/2023-javascript-rising-stars): Annual overview of the fastest-growing JavaScript GitHub repositories in 2023. (Website, Free)
- [ElevenLabs NextJS Starter](https://xiry.app/resources/elevenlabs-nextjs-starter): Open-source Next.js boilerplate showcasing ElevenLabs audio and voice features (GitHub repo, Open source)
- [Mediabunny](https://xiry.app/resources/mediabunny): Fast, dependency-free JavaScript media toolkit for browser-based video and audio processing (Web app, Open source)
- [Popmotion](https://xiry.app/resources/popmotion): Low-level JavaScript animation library for spring, inertia, and keyframe animations (Website, Open source)
- [Social SDK](https://xiry.app/resources/social-sdk): Typed TypeScript SDK for publishing, analytics, and interactions across social platforms (Web app, Open source)
- [Motion](https://xiry.app/resources/motion): Open-source animation library for React, Vue, and vanilla JavaScript (Website, Freemium)

Updated 10 October 2026. Page: https://xiry.app/resources/cartesia-js

Make your own library: Xiry takes your saved reels, tweets, Reddit bookmarks and Watch Later videos, makes them searchable and pulls the useful stuff out, like this library. It's invite-only for now; join the waitlist at https://xiry.app/#waitlist.
