The Unified Text-to-Speech SDK
The SpeechSDK is a free, open-source toolkit for building better AI audio applications with multiple voice providers.
$ npm install @speech-sdk/core
Open Source
Apache 2.0 License
One API, Every Provider
One interface across OpenAI, ElevenLabs, Deepgram, Cartesia, Google, Mistral, Hume, and more. Unified model strings, consistent response format, BYO API keys.
Multi-Speaker Conversations
Generate a multi-speaker conversation with a single API. Mix voices across providers in one call, with automatic volume leveling and turn stitching.
Auto-Chunking & Timestamps
Intelligently splits long inputs on sentence boundaries for providers with max input lengths.
AI Engineering
For Production Voice Applications
Smart retries
Jittered exponential backoff retries 5xx and 429 automatically. 429s honor Retry-After (60s cap) and expose the delay via ApiError.retryAfterMs.
Long inputs, handled
maxInputChars splits at sentence boundaries, stitches chunks into one audio file, and reconnects word-level timestamps end-to-end.
Format conversions
Render wav, mp3, or pcm from any provider. Native pass-through where supported, lossless local conversion otherwise.
Custom fetch & Base URL
Every provider accepts a custom fetch and baseURL — point at OpenAI-compatible proxies, Azure, LiteLLM, or local models.
Words and captions
Word-level timestamps from native provider support or timestamp fallback. timestampsToCaptions ships SRT or WebVTT in a single call.
Streaming
streamSpeech returns a Web ReadableStream of audio bytes, so time-to-first-byte stays low in Node, Edge runtimes, and the browser.
| Provider | Model String | Default* |
|---|---|---|
| OpenAI | openai/gpt-4o-mini-tts | Yes |
| ElevenLabs | elevenlabs/eleven_v3 | Yes |
| ElevenLabs | elevenlabs/eleven_flash_v2_5 | — |
| ElevenLabs | elevenlabs/eleven_flash_v2 | — |
| Deepgram | deepgram/aura-2 | Yes |
| Cartesia | cartesia/sonic-3 | Yes |
| Hume | hume/octave-2 | Yes |
| google/gemini-3.1-flash-tts-preview | Yes | |
| Fish Audio | fish-audio/s2-pro | Yes |
| Inworld | inworld/inworld-tts-1.5-max | Yes |
| Murf | murf/GEN2 | Yes |
| Smallest AI | smallest-ai/lightning_v3.1 | Yes |
| Resemble | resemble/default | Yes |
| fal | fal-ai/* | — |
| Mistral | mistral/voxtral-mini-tts-2603 | Yes |
| xAI | xai/grok-tts | Yes |
* Pass just the provider name to use its default model — e.g. model: 'openai' resolves to openai/gpt-4o-mini-tts.
Frequently asked questions
Each provider has its own SDK, request format, auth pattern, and response shape. SpeechSDK is one API, every provider — same function call, same result type, same error handling. Switch providers by simply changing a model string.
One SDK, every provider. Add text-to-speech to your app in minutes with a unified, open-source interface.