ElevenLabs realtime transcription
Stream PCM audio and receive ElevenLabs-compatible transcription events with the ElevenLabs SDK.
Connect to the ElevenLabs-compatible realtime endpoint, send PCM audio, and listen for partial and committed transcripts.
Connect with the SDK
wss://api.allmodels.io/el/v1/speech-to-text/realtimeElevenLabsimport { readFile } from "node:fs/promises";
import {
AudioFormat,
CommitStrategy,
ElevenLabsClient,
RealtimeEvents
} from "@elevenlabs/elevenlabs-js";
const client = new ElevenLabsClient({
apiKey: process.env.ALLMODELS_API_KEY,
baseUrl: "https://api.allmodels.io/el"
});
const connection = await client.speechToText.realtime.connect({
modelId: "deepgram/nova-3",
audioFormat: AudioFormat.PCM_16000,
sampleRate: 16000,
languageCode: "en",
includeTimestamps: true,
commitStrategy: CommitStrategy.MANUAL
});
connection.on(RealtimeEvents.PARTIAL_TRANSCRIPT, ({ text }) => {
process.stdout.write(text);
});
connection.on(RealtimeEvents.COMMITTED_TRANSCRIPT, ({ text }) => {
console.log("\nfinal:", text);
});
connection.on(RealtimeEvents.COMMITTED_TRANSCRIPT_WITH_TIMESTAMPS, (event) => {
console.log("\nfinal with timestamps:", event.text, event.words);
});
connection.on(RealtimeEvents.ERROR, console.error);
connection.send({
audioBase64: (await readFile("chunk.pcm")).toString("base64")
});
connection.commit();Events
| Event | Purpose |
|---|---|
session_started | Confirms the effective session configuration. |
partial_transcript | Provides interim transcript text. |
committed_transcript | Provides finalized transcript text. |
committed_transcript_with_timestamps | Provides finalized text with timestamp details. |
error | Reports connection, request, or provider failures. |
Choose the model, audio format, sample rate, language, and commit strategy before sending audio. Use CommitStrategy.MANUAL with connection.commit() when your application determines utterance boundaries. Use CommitStrategy.VAD to let supported providers detect boundaries automatically.
Scribe v3 Live features
With modelId: "scribe_v3_live", the connection also accepts these ElevenLabs options:
| Option | Effect |
|---|---|
diarize=true | Adds diarized_transcript frames (words with speaker_id) and speakers_merged frames. |
multilang_mode=true, secondary_languages | Multilingual recognition. |
entity_detection | Adds committed_transcript_entities frames. |
entity_redaction, entity_redaction_mode | Adds redacted_transcript frames. |
commit_strategy=turn_prediction | Commits automatically at predicted turn ends. After your audio stops, commit the trailing audio yourself. |
keyterm_library | An array on the first input_audio_chunk. Billed at the keyterms rate. |
entity_redaction redacts only the redacted_text field of redacted_transcript. Partial transcripts, committed transcripts, timestamped words, and committed_transcript_entities still contain the original text. Do not treat the stream as free of the redacted entities.
Partial transcripts also carry turn_probability. Realtime keyterms accept up to 50 terms of up to 20 characters each. Sending a Scribe v3 Live-only option with another model returns an invalid_request frame and closes the socket, as ElevenLabs does. transcript_edit is not available through AllModels.
Canonical model names select the provider for realtime connections. For example, deepgram/nova-3 routes the connection to Deepgram without a custom provider header.
See the realtime STT API reference and message-level realtime reference for all connection parameters and events.
