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

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
Ink 2 only supports English right now.
We expect to add more languages in the coming months.

Connection

Replace the OpenAI WebSocket URL and auth header with Cartesia’s /stt/turns/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 auto-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. To commit all audio and close the session, send a JSON formatted text frame:
Cartesia will transcribe all buffered audio, then close the socket for you.
If you currently commit audio mid-session with OpenAI using input_audio_buffer.commit, consider using Cartesia with manual finalization instead.Take a look at the migration guides page for details.

Sending audio with the SDK

Decoding base64 encoded audio before sending

Closing

Event mapping

OpenAI signals turns with input_audio_buffer.speech_started / speech_stopped / committed, then bursts transcript deltas and a completed event per turn. Cartesia folds the same information into a turn lifecycle: turn.start, turn.update, turn.eager_end, turn.resume, and turn.end. See Turn Detection for the full state machine.

Completed transcripts

An OpenAI conversation.item.input_audio_transcription.completed event:
Becomes a Cartesia turn.end event:
turn.start and turn.resume events do not carry a transcript.

Example Server Messages

OpenAI batches each turn. Ink streams within the turn.

References

API Reference

Cartesia Realtime STT (Auto)

Full Code Example

Using the Cartesia SDK