Endpointing
Endpointing decides when an utterance ends: after a pause of endpointing seconds, its final transcript is
sent. It sets the trade-off between fast finals and whole sentences.
At a glance
Section titled “At a glance”| Live API | endpointing |
|---|---|
| Pre-recorded (batch) | Live only |
| Live models | solaria-3 (every live model) |
| Languages | Every language of the model (supported languages) |
| field | range | when omitted |
|---|---|---|
endpointing |
0.01 to 10 s | 0.05 s; 0.64 s with finals: "end_of_turn" and end_of_turn on |
maximum_duration_without_endpointing |
5 to 60 s | 5 s; 60 s when finals closes on a turn or a sentence |
{ "endpointing": 0.3, "maximum_duration_without_endpointing": 15 }In a session, with the SDKs:
# pip install "gladiaio-sdk>=2.2"import osimport sysimport threadingimport wave
from gladiaio_sdk import GladiaClient, LiveV2InitRequest
API_URL = os.environ.get("GLADIA_API_URL", "https://eu1.api.gladia.io")API_KEY = os.environ["GLADIA_API_KEY"]
with wave.open(sys.argv[1]) as wav: # a 16-bit PCM WAV file rate, channels = wav.getframerate(), wav.getnchannels() audio = wav.readframes(wav.getnframes())
config = { "encoding": "wav/pcm", "sample_rate": rate, "bit_depth": 16, "channels": channels, "model": "solaria-3", "language_config": { "languages": [ "en" ] }, "endpointing": 0.3, "maximum_duration_without_endpointing": 15}
client = GladiaClient(api_key=API_KEY, api_url=API_URL)session = client.live_v2().start_session(LiveV2InitRequest.from_dict(config))ended, errors = threading.Event(), []
@session.on("message")def on_message(message): if message.type == "transcript" and message.data.is_final: print(message.data.utterance.text)
session.on("error", errors.append)session.once("ended", lambda _: ended.set())
# Stream once the socket is open: a stop sent while it opens can pass the audio queued until then.connected = threading.Event()session.once("connected", lambda _: connected.set())session.once("ended", lambda _: connected.set()) # a session that never connects endssession.on("error", lambda _: connected.set())if session.status == "connected": # it opened before the listener above connected.set()if not connected.wait(timeout=30) or errors or ended.is_set(): sys.exit(1) # no open session to stream to
step = rate * channels * 2 // 10 # 100 ms of audio per chunkfor start in range(0, len(audio), step): session.send_audio(audio[start : start + step]) # live audio: send each chunk as it is capturedsession.stop_recording()
ended.wait(timeout=60)sys.exit(1 if errors or not ended.is_set() else 0)// npm install @gladiaio/sdkimport { readFileSync } from "node:fs";import { GladiaClient } from "@gladiaio/sdk";
const { sampleRate, channels, pcm } = readWav(process.argv[2]); // a 16-bit PCM WAV file
const config = { encoding: "wav/pcm", sample_rate: sampleRate, bit_depth: 16, channels, model: "solaria-3", language_config: { languages: [ "en" ] }, endpointing: 0.3, maximum_duration_without_endpointing: 15};
const client = new GladiaClient({ apiKey: process.env.GLADIA_API_KEY, apiUrl: process.env.GLADIA_API_URL ?? "https://eu1.api.gladia.io",});const session = client.liveV2().startSession(config);
session.on("message", (message) => { if (message.type === "transcript" && message.data.is_final) { const { text, end, forced } = message.data.utterance; console.log(`${end.toFixed(1)}s ${forced ? "(forced) " : ""}${text}`); }});session.on("error", (error) => { console.error(error); process.exitCode = 1;});session.once("ended", () => process.exit());
const step = (sampleRate * channels * 2) / 10; // 100 ms of audio per chunkfor (let start = 0; start < pcm.length; start += step) { session.sendAudio(pcm.subarray(start, start + step)); // live audio: send each chunk as it is captured}session.stopRecording();
function readWav(path) { const file = readFileSync(path); let fmt, pcm; for (let pos = 12; pos < file.length; ) { const id = file.toString("ascii", pos, pos + 4); const size = file.readUInt32LE(pos + 4); if (id === "fmt ") fmt = { channels: file.readUInt16LE(pos + 10), sampleRate: file.readUInt32LE(pos + 12) }; if (id === "data") pcm = file.subarray(pos + 8, pos + 8 + size); pos += 8 + size + (size % 2); } return { ...fmt, pcm };}Create the session, then stream its audio to the returned url (Live WebSocket):
curl -X POST https://eu1.api.gladia.io/v2/live \ -H "x-gladia-key: $GLADIA_API_KEY" \ -H "content-type: application/json" \ -d '{ "encoding": "wav/pcm", "sample_rate": 16000, "bit_depth": 16, "channels": 1, "model": "solaria-3", "language_config": { "languages": [ "en" ] }, "endpointing": 0.3, "maximum_duration_without_endpointing": 15 }'- A short
endpointing(0.2 to 0.4 s) gives faster finals, and cuts sentences at short hesitations. - A long one (0.8 s and more) gives whole sentences, later.
maximum_duration_without_endpointingforces a final after that much speech without a pause; such an utterance carries"forced": "max_duration", and never runs past the maximum. On solaria-3 the forced final may end up to a few seconds before the maximum, at a short break between two words, so a word is seldom cut in two.
GET /v2/live/defaults returns the values in force for your account.
For a voice agent, keep endpointing for the transcript and use end-of-turn detection to
decide when to answer: a pause in the middle of a sentence is not the end of a turn. An agent that runs its own
VAD sends finalize when it hears the end of speech: the final comes right away, without the
endpointing’s wait.
Limits and gotchas
Section titled “Limits and gotchas”- Too short cuts words. Under 0.2 s, a breath or a hesitation ends the utterance: finals split mid-sentence.
maximum_duration_without_endpointingcuts anywhere. A forced final can end mid-word: keep it for monologues and noisy lines without pauses.- No number hold by default. With
finalsomitted, every pause ofendpointingseconds closes a final, so a number dictated with pauses comes in several finals. To keep it in one, sendfinals: "sentence"or a turn policy. - The latency profile does not change
endpointing. On every profile, a pause ofendpointingseconds ends the utterance at the same place, and a smallerendpointinggives more finals. The profile changes when the final leaves:balancedandprecisetranscribe the audio in larger steps (onsolaria-3, 1.44 s and 2 s against 0.48 s onfast), so their final can come up to one step after the pause. - It is not end of turn. A pause ends an utterance, not the speaker’s turn: voice agents should answer on end of turn.
- Python SDK: an utterance’s
forcedis not in the SDK’s types: read it withgetattr(utterance, "forced", None).
Number hold
Section titled “Number hold”A phone number, an amount or an address dictated in pieces (“my card number is 4970… 1234… 5678”) would be cut
into several finals, one per pause. The number hold keeps the utterance open while the number is still being
dictated, up to 2 seconds without new words, then closes it as usual. A word spelled letter by letter (“my last
name is spelled S M… I T H”), or a code of letters and numbers (“A B… 1 2 3”), is held the same way. When the spelling goes on
across a pause, its letters are written as capitals separated by one space, whatever the model: S M I T H,
A B 123. Anything else, an abbreviation in a sentence (“the U.S.”) included, is written as the model wrote it.
Spelled letters always written one way
Section titled “Spelled letters always written one way”Without a pause, each model writes a spelling its own way: S. M. I. T. H. (solaria-3), S.M.I.T.H. (solaria-1),
S-M-I-T. If your application reads names, references or codes out of the transcript, ask for one form on every
model with:
{ "spelled_letters": "space" }Every run of two capital letters or more is then written in that style, in the partials and the finals, with or without a pause. “My name is S. M. I. T. H.” becomes:
spelled_letters |
Text | Words |
|---|---|---|
space (or canonical) |
My name is S M I T H. |
one per letter, each with its own time |
comma |
My name is S, M, I, T, H. |
one per letter: S, … H. |
dots_space |
My name is S. M. I. T. H. |
one per letter: S. … H. |
dashed |
My name is S-M-I-T-H. |
one word, first letter to last |
dots |
My name is S.M.I.T.H. |
one word, first letter to last |
joined |
My name is SMITH. |
one word, first letter to last |
The period that ends the sentence is never doubled (S.M.I.T.H.). Omitted, or "model" (the default), the
transcript keeps the model’s form: existing sessions are unchanged.
Gotcha, words: with dashed, dots and joined, a run is one entry in words (and one word-level segment),
from the start of its first letter to the end of its last, where the other styles give one entry per letter. If your
client lines its own data up on the words array, expect one entry for the whole run.
Gotcha: the text alone cannot tell a spelling from a list or an acronym, so they are rewritten too: “The options
are A, B, C.” becomes “The options are A B C.” with space and “The options are ABC.” with joined; “N.A.S.A.”
becomes “N A S A.” with space and “NASA.” with joined. A single letter is never touched
(“vitamin D”, “plan B”, the initial “J.”). Use it when your callers spell names and codes (bookings, orders,
identity checks), not when your transcripts are read as prose. Sessions served by the cloud solaria-1 keep the
model’s form.
Under a finals policy that waits for it (sentence, sentence_or_end_of_turn,
end_of_turn) it is on by default where the model supports it (Models);
with finals omitted, finals close on the pause without it. The session is never refused for it. Turn it off with:
{ "turn_router": false }Which event closes a final
Section titled “Which event closes a final”finals picks the event that ends an utterance and sends its final transcript. It is a Gladia Connect
option: do not send it to Gladia’s cloud API.
finals |
a final ends on | the number hold | made for |
|---|---|---|---|
end_of_turn |
the end of the speaker’s turn (end-of-turn detection): a pause inside a turn does not cut | keeps a number, an address or an unfinished sentence open | voice agents that answer on each final |
sentence_or_end_of_turn |
the first of the end of a sentence or the end of the turn | holds a number or an address being dictated only | voice agents that want sentence finals and the end_of_turn message |
sentence |
the end of a sentence: a pause of endpointing seconds, or, with solaria-1, solaria-3 and solaria-4, a short pause right after a sentence ends |
holds a number or an address being dictated only | meeting recorders, subtitles, live translation, note takers |
endpointing |
a pause of endpointing seconds or maximum_duration_without_endpointing, nothing else |
off | the behaviour of Gladia’s cloud API |
{ "finals": "sentence" }When omitted, finals close as with endpointing, as on Gladia’s cloud API: on a pause of endpointing seconds or
at maximum_duration_without_endpointing, without the number hold. With end_of_turn on, the end of the turn is
still sent as its own message; it does not delay the finals. For one final per turn, send finals: "end_of_turn".
Subtitles and live translation: a final on every sentence
Section titled “Subtitles and live translation: a final on every sentence”A talk read at a steady pace rarely pauses as long as a long endpointing (0.6 s and more): its finals then run over several
sentences, and a translation, made from each final, comes late. With solaria-1, solaria-3 and solaria-4 models, sentence (and
sentence_or_end_of_turn) also close a final at a short pause (about a quarter of a second) when the sentence
before it has ended: one final per sentence, without a short endpointing that would also cut hesitations
inside a sentence. A sentence never ends with a number or an address still being dictated. On solaria-2
models, sentence closes on the endpointing pause only for now.
{ "model": "solaria-3", "finals": "sentence" }- Shorter finals than before. Sessions that already sent
sentenceto asolaria-1,solaria-3orsolaria-4model now get one final per sentence on fluent speech, where they used to get several sentences in one. - Long sentences. A final is still bounded by the model’s audio window (about 30 s): a sentence longer than
that is cut, at the last sentence end the model heard when there is one, else where the window ends (its
utterance then carries
forced: "max_duration").
Live captions: a final on every pause
Section titled “Live captions: a final on every pause”Captions shown while the speaker talks need a final at each pause, and a bound on how late it can come. That is
what a session gets when it omits finals; sending finals: "endpointing" makes it explicit.
finals: "endpointing" makes the pause the only rule: every pause of endpointing seconds closes a final, the
number hold is off, and maximum_duration_without_endpointing bounds the rest. This is how Gladia’s cloud API
closes its finals. A session that omits maximum_duration_without_endpointing gets a final forced after 5 s of
speech without a pause, as on the cloud API.
{ "model": "solaria-3", "finals": "endpointing", "endpointing": 0.3, "maximum_duration_without_endpointing": 15}- A number dictated with pauses (“4970… 1234”) comes as several finals: join them in your application if you need it whole.
- End-of-turn detection still sends its
end_of_turnmessages when it is on: it no longer closes the finals. - For captions, prefer
solaria-3orsolaria-3-fast. Thebalancedandpreciseprofiles wait for more audio before each transcription, so their finals come later, whateverfinalssays.
Finals also release the audio acknowledgments: the SDKs keep every chunk until its ack.
With end_of_turn, a two-minute monologue is one final; its audio is acknowledged as it passes 30 seconds,
so the SDK holds about 30 seconds of audio; with sentence or endpointing a final, and its acks, come every few
seconds. A silence is acknowledged about every second once processed, whatever the value.
The SDKs send finals as they send any option. It needs a model that runs it: on a cluster where none does,
the init answers 400 and names it.