turn_detection: null.
All migration guides
If you’re already using the Cartesia SDK, upgrade to version
>=3.2.0Connection
Replace the OpenAI WebSocket URL and auth header with Cartesia’s/stt/websocket, including your desired model and input audio format as query parameters:
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 thesession.update payload. Cartesia takes the equivalent settings as query parameters.
encoding
encoding
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:
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:
close frame:
Sending audio with the SDK
Decoding base64 encoded audio before sending
Finalizing and closing
Event mapping
OpenAI streamsconversation.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 OpenAIconversation.item.input_audio_transcription.completed event carries the full turn:
transcript events, each carrying a delta:
- Ink 2 does not return
durationorwordsyet- Ink 2 and Whisper currently only emit final transcripts (
is_final: true)
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