ElevenLabs speech-to-text (Scribe): transcribe uploaded audio or a hosted URL, fetch or delete stored transcripts, and read text and words out of a result.

Values

DEFAULT_MODEL

DEFAULT_MODEL: Str "scribe_v2"

JSON_FIELDS

JSON_FIELDS: Vec [
  "additional_formats",
  "webhook_metadata",
  "entity_detection"
]

QUERY_FIELDS

QUERY_FIELDS: Vec [
  "enable_logging"
]

Functions

delete-transcript

fn (transcription-id: Str): Any
fn (transcription-id: Str, opts: Map): Any

DELETE /v1/speech-to-text/transcripts/{transcription_id}: delete a stored transcript.

Context Vars: elevenlabs.api.key

form-fields

fn (request: SpeechToTextRequest): Vec

The form fields for a request as [[name, value-string]], with model_id defaulted, nulls dropped, Vec keyterms repeated, and JSON fields encoded. Exposed for testing.

get-transcript

fn (transcription-id: Str): Map
fn (transcription-id: Str, opts: Map): Map

GET /v1/speech-to-text/transcripts/{transcription_id}: fetch a stored transcript (for example one produced through a webhook request).

Context Vars: elevenlabs.api.key

mime-for

fn (filename: Str): Str

multipart-body

fn (request: SpeechToTextRequest, audio: Any, filename: Str, boundary: Str): Bytes

The multipart/form-data body for an upload: form fields, then the file part (when audio is non-null) with its bytes concatenated verbatim. Exposed for testing.

post-multipart

fn (request: SpeechToTextRequest, audio: Any, filename: Str, opts: Map): Map

speech-to-text

fn (audio: Bytes): Map
fn (audio: Bytes, request: SpeechToTextRequest): Map
fn (audio: Bytes, request: SpeechToTextRequest, filename: Str): Map
fn (audio: Bytes, request: SpeechToTextRequest, opts: Map): Map
fn (audio: Bytes, request: SpeechToTextRequest, filename: Str, opts: Map): Map

POST /v1/speech-to-text: transcribe audio Bytes (any common audio or video format, up to 5 GB). filename (default "audio") names the upload; its extension sets the part's MIME type (application/octet-stream without one). Returns {language_code, language_probability, text, words: [{text, type, start, end, speaker_id, logprob}]}, or {transcripts: [...]} for multichannel. With webhook: true it returns {message, request_id, transcription_id} at once and delivers the result to your speech-to-text webhook.

Example

::stt ::elevenlabs::stt

audio ::hot::file/read-file-bytes("meeting.mp3")
out ::stt/speech-to-text(audio, ::stt/SpeechToTextRequest({diarize: true, keyterms: ["Hot Dev"]}))
::stt/transcript-text(out)
Context Vars: elevenlabs.api.key

speech-to-text-url

fn (source-url: Str): Map
fn (source-url: Str, request: SpeechToTextRequest): Map
fn (source-url: Str, request: SpeechToTextRequest, opts: Map): Map

POST /v1/speech-to-text with source_url: transcribe a hosted file (HTTPS URL, including YouTube and TikTok links) without uploading it. Same options and result as speech-to-text.

Example

out ::elevenlabs::stt/speech-to-text-url("https://example.com/podcast.mp3")
out.text
Context Vars: elevenlabs.api.key

stt-path

fn (request: SpeechToTextRequest): Str

transcript-text

fn (response: Map): Str

The transcript text of a result; multichannel results join each channel's text with newlines. "" when absent.

words

fn (response: Map): Vec

The spoken words of a result (entries of type "word"; spacing and audio events dropped) as {text, start, end, speaker_id, ...}.

Types

SpeechToTextRequest

SpeechToTextRequest type {
    model_id: Str?,
    language_code: Str?,
    tag_audio_events: Bool?,
    num_speakers: Int?,
    timestamps_granularity: Str?,
    diarize: Bool?,
    diarization_threshold: Dec?,
    file_format: Str?,
    temperature: Dec?,
    seed: Int?,
    use_multi_channel: Bool?,
    multichannel_output_style: Str?,
    keyterms: Vec?,
    additional_formats: Vec?,
    no_verbatim: Bool?,
    entity_detection: Any?,
    webhook: Bool?,
    webhook_id: Str?,
    webhook_metadata: Any?,
    enable_logging: Bool?
}

Options for /v1/speech-to-text. All optional; unset fields are not sent. model_id defaults to "scribe_v2". keyterms is a Vec of words or phrases to bias toward; additional_formats a Vec like [{format: "srt"}]; webhook_metadata a Map echoed back on the webhook; entity_detection "all", a type, or a Vec of types.