Cartesia

Sonic text-to-speech and Ink transcription.

Both models read CARTESIA_API_KEY, target https://api.cartesia.ai, and send the Cartesia-Version header automatically.

Speech

CartesiaSpeechModel conforms to SpeechModel and works with generateSpeech. Cartesia needs a voice id, so pass one as voice: on the request (or set a default on the model):

let result = try await generateSpeech(
  model: CartesiaSpeechModel("sonic-2"),
  text: "Hello from Swift.",
  voice: "a0e99841-438c-4a64-b679-ae501e7d6091",
  outputFormat: "wav"
)

outputFormat maps to the Cartesia container: mp3 (default), wav, or raw/pcm. Set sampleRate: on the initializer to change the rate.

Transcription

CartesiaTranscriptionModel conforms to TranscriptionModel and works with transcribe:

let text = try await transcribe(
  model: CartesiaTranscriptionModel("ink-whisper"),
  audio: audioData,
  mediaType: "audio/mpeg"
)

Models

As of July 2026:

Model IDKind
sonic-3 / sonic-3.5Newest speech
sonic-2 / sonic-turboSpeech
ink-2Speech
ink-whisperTranscription

Browse voice ids in the Cartesia voice library.