Skip to main content
This guide covers migrating from Deepgram’s Turn-based Audio (Flux) API. Both Cartesia and Deepgram Flux emit turn-based events over a WebSocket, so migrating to Ink is mostly a matter of renaming fields and updating a few connection parameters.

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 Deepgram WebSocket URL and auth header with Cartesia’s.
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 turn-detection WebSocket with the Cartesia SDK:

Query parameters

Turn detection

turn_end_timeout_ms is the direct equivalent of eot_timeout_ms. turn_eager_end_threshold and turn_end_threshold offer similar functionality to eager_eot_threshold and eot_threshold, but their directionality is inverted. In Deepgram, higher values require more certainty before firing; in Cartesia, lower values require more certainty before firing. Don’t reuse your Deepgram values directly. See Configuring turn detection for each threshold’s behavior, range, and default.

Sending audio

Both APIs accept raw PCM audio as binary WebSocket frames in the same way.
Cartesia does not support these encodings: opus, ogg-opus
To close the session, send a JSON encoded WebSocket text frame:
Cartesia has no equivalent of Deepgram’s Configure control message since there’s no need to configure end-of-turn.

Event mapping

Deepgram wraps all turn events in a single TurnInfo message with an event discriminator. Cartesia emits one message type per event, with the type on the top-level type field. A Deepgram TurnInfo message:
Becomes a Cartesia turn.* event:
Like Deepgram, the transcript is cumulative within a turn.

Event handler

The branching structure of your handler is unchanged — just the message shape.

Example Server Messages

Flux’s transcripts are joined with spaces. Ink’s are not.

References

API Reference

Cartesia Realtime STT (Auto)

Full Code Example

Using the Cartesia SDK