SpeechSDK | Universal Text-to-Speech SDK

SpeechSDK

2 min read Original article ↗

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.

ProviderModel StringDefault*
OpenAIopenai/gpt-4o-mini-ttsYes
ElevenLabselevenlabs/eleven_v3Yes
ElevenLabselevenlabs/eleven_flash_v2_5—
ElevenLabselevenlabs/eleven_flash_v2—
Deepgramdeepgram/aura-2Yes
Cartesiacartesia/sonic-3Yes
Humehume/octave-2Yes
Googlegoogle/gemini-3.1-flash-tts-previewYes
Fish Audiofish-audio/s2-proYes
Inworldinworld/inworld-tts-1.5-maxYes
Murfmurf/GEN2Yes
Smallest AIsmallest-ai/lightning_v3.1Yes
Resembleresemble/defaultYes
falfal-ai/*—
Mistralmistral/voxtral-mini-tts-2603Yes
xAIxai/grok-ttsYes

* 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.

SpeechSDK

One SDK, every provider. Add text-to-speech to your app in minutes with a unified, open-source interface.