ElevenLabs

Speech synthesis and audio transcription.

ELEVENLABS_API_KEY powers both ElevenLabs model types.

Speech

let result = try await generateSpeech(
  model: ElevenLabsSpeechModel("eleven_multilingual_v2"),
  text: "Welcome to the show.",
  voice: voiceID,
  outputFormat: "mp3"
)

Pass the ElevenLabs model ID to ElevenLabsSpeechModel and the voice ID to voice:. The result contains the audio bytes and media type. See speech generation for all shared options.

Transcription

let result = try await transcribe(
  model: ElevenLabsTranscriptionModel(), // scribe_v2
  audio: audioData,
  mediaType: "audio/mpeg"
)
print(result.text)

ElevenLabsTranscriptionModel defaults to scribe_v2 and uses a synchronous multipart upload. See transcription for the common result shape.

Models

Speech models

Model IDUse
eleven_v3Most expressive speech generation
eleven_multilingual_v2Stable multilingual speech
eleven_flash_v2_5Low-latency multilingual speech

Transcription models

Model IDUse
scribe_v2Current prerecorded speech-to-text model
scribe_v2_realtimeRealtime transcription; not used by this prerecorded pack

See ElevenLabs's live model overview for languages, latency, and availability.