Skip to main content
This guide covers migrating from OpenAI Realtime Transcription when used with turn_detection: null.

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 OpenAI WebSocket URL and auth header with Cartesia’s /stt/websocket, including your desired model and input audio format as query parameters:
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:

Session configuration

OpenAI configures the session in the session.update payload. Cartesia takes the equivalent settings as query parameters.
OpenAI sets the input format under audio.input.format. Cartesia takes encoding and sample_rate as query parameters.OpenAI’s PCM format is 16-bit, 24 kHz, mono. Cartesia accepts that sample_rate directly, so you can stream the same audio without resampling. Cartesia also accepts pcm_s32le, pcm_f16le, and pcm_f32le.

Sending audio

OpenAI 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:
There’s no equivalent for OpenAI’s session.update message; reconnect a new WebSocket to change parameters. Cartesia’s control commands are bare text frames, not JSON. To commit buffered audio and emit a transcript, send a finalize frame in place of input_audio_buffer.commit:
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 transcribe all remaining audio and close the session, send a close frame:

Sending audio with the SDK

Decoding base64 encoded audio before sending

Finalizing and closing

Event mapping

OpenAI streams conversation.item.input_audio_transcription.delta events and a completed event per committed turn.
Cartesia emits transcript deltas plus acknowledgments for the finalize and close commands.

Completed transcripts

An OpenAI conversation.item.input_audio_transcription.completed event carries the full turn:
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)
Cartesia’s final transcripts are deltas; concatenate them without stripping or add whitespace.

Example Server Messages

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

References

API Reference

Cartesia Realtime STT (Manual)

Full Code Example

Using the Cartesia SDK