Skip to main content
This guide covers migrating from ElevenLabs Realtime Speech to Text when used with commit_strategy=manual.

All migration guides

This guide contains both bare API descriptions and SDK code. To install the SDK:
If you’re already using the Cartesia SDK, upgrade to version >=3.2.0

Connection

Replace the ElevenLabs WebSocket URL and auth header with Cartesia’s /stt/websocket.
In browsers, WebSockets do not support request headers. Instead, pass the API version as the cartesia_version query param and use a short-lived access token using the access_token query param instead of an API key. Connect to the manual-finalization WebSocket with the Cartesia SDK:

Query parameters

ElevenLabs bundles the sample format and rate into a single audio_format token. Cartesia splits them into encoding and sample_rate.Cartesia also accepts pcm_s32le, pcm_f16le, pcm_f32le, and pcm_alaw.
All Cartesia encodings support all sample rates.

Sending audio

ElevenLabs wraps each audio chunk in a JSON formatted text frame and base64-encodes the audio bytes.
Cartesia accepts audio chunks as binary frames: send the raw audio bytes directly:
  • No need to supply previous text
  • Sample rate is determined upon connection by the sample_rate query parameter
Cartesia’s control commands are bare text frames, not JSON. To commit buffered audio and emit a transcript without ending the session, send a finalize frame:
It is important to send the finalize command at the right times in the audio stream.Consider using auto finalization if you don’t know when your user is done speaking.
To commit all remaining audio and close the session, send a close frame:
Cartesia will transcribe all buffered audio, then close the socket for you.

Sending audio with the SDK

Decoding base64 encoded audio before sending

Committing and closing

Event mapping

Scribe emits interim partial_transcript events, then a committed_transcript when you commit.
Cartesia emits transcript deltas plus acknowledgments for the finalize and close commands.

Committed transcripts

A Scribe committed_transcript carries the full text of the segment since the last commit:
Becomes one or more Cartesia transcript events, each carrying a delta:
  • Ink 2 does not return duration or words yet
  • Ink 2 and Whisper currently only emit final transcripts (is_final: true)
Followed by a Cartesia flush_done event:
Ignore the is_final property on flush_done and done events
Cartesia’s final transcripts are deltas; concatenate them without stripping or add whitespace.

Example Server Messages

Scribe sends full transcripts. Ink sends deltas and may break words.

References

API Reference

Cartesia Realtime STT (Manual)

Full Code Example

Using the Cartesia SDK