# Post-call transcript refinement for live calls (finalization)

Last updated: 2026-11-19

**The problem.** A live transcript is written while people are still talking: each final is decided on what the
model has heard so far, and the speakers are told apart on the fly. A note taker, a meeting recorder or a CRM that
stores the call wants the best transcript of the whole call once it is over, and does not want the words to move
on screen while it runs.

**What finalization does.** With `"finalization": true`, when the session ends, its whole recording goes through
one **post-call pass** of the pre-recorded pipeline: `solaria-3` over the entire call, with pre-recorded
diarization. The live transcript is used as the pass's draft, so the pass mostly checks words the live model already
wrote and only pays where they were wrong. The pass is an ordinary pre-recorded job: you read it with
`GET /v2/pre-recorded/{id}`, and its callback tells you when it is done.

**What it does not do.** Nothing changes during the call: the live finals you receive are never revised. The
better transcript is a separate result, ready a short while after the call ends.

## At a glance

| | |
|---|---|
| Live API | `finalization` |
| Pre-recorded (batch) | `from_session_id` ([how](/features/finalization/#run-the-pass-yourself-after-any-live-session)) |
| Live models | `solaria-3`, `trantoria-1` (every live model) |
| Languages | Every language of the model ([supported languages](/languages/supported-languages/)) |

> **Needs the recording of the call.** The pass transcribes the call's recording: your workspace must record its live audio (ask your administrator). A
session whose audio is not recorded gets no pass, and its result says why (`finalization.error: "not_recorded"`).

## Step by step

### 1. Turn it on

Add `finalization` to the session's init body. To be told when the pass is done, give a callback URL too:

```json
{
  "model": "solaria-3",
  "language_config": { "languages": ["en"] },
  "finalization": true,
  "callback": true,
  "callback_config": { "url": "https://example.com/gladia/callback" }
}
```

### 2. Run the call as usual

Stream the audio and stop the session as you always do. The finals are the usual live finals.

Each program streams a 16-bit WAV file with `finalization` on, prints the live finals, then the session's id: the
pass is found from it once the call has ended. Put your API key in the `GLADIA_API_KEY` environment variable, then run
`python finalization.py call.wav`.

**Python SDK**

```python title="finalization.py"
# pip install -U "gladiaio-sdk>=2.2"
import os
import sys
import threading
import wave

from gladiaio_sdk import GladiaClient

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"]},
    "finalization": True,
}

client = GladiaClient(api_key=API_KEY, api_url=API_URL)
# a dict is sent as is: the Gladia Enterprise options included
session = client.live_v2().start_session(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 ends
session.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 chunk
for start in range(0, len(audio), step):
    session.send_audio(audio[start : start + step])  # live audio: send each chunk as it is captured
session.stop_recording()

ended.wait(timeout=60)
print("session:", session.session_id)  # GET /v2/live/{id} names its pass (step 3)
sys.exit(1 if errors or not ended.is_set() else 0)
```

**JavaScript SDK**

```js title="finalization.mjs"
// npm install @gladiaio/sdk
import { 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"] },
  finalization: true,
};

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) console.log(message.data.utterance.text);
});
session.on("error", (error) => {
  console.error(error);
  process.exitCode = 1;
});
session.once("ended", () => {
  console.log("session:", session.sessionId); // GET /v2/live/{id} names its pass (step 3)
  process.exit();
});

const step = (sampleRate * channels * 2) / 10; // 100 ms of audio per chunk
for (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 };
}
```

**HTTP**

Create the session, then stream its audio to the returned `url` ([Live WebSocket](/api-reference/v2/live/websocket/)):

```bash
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"
      ]
    },
    "finalization": true
  }'
```

### 3. Find the pass in the session's result

Once the session has ended, `GET /v2/live/{id}` names the pass:

```json
{
  "finalization": {
    "id": "0199d7a2-5c3e-7b41-9f0a-3c2d1e4f5a6b",
    "result_url": "https://eu1.api.gladia.io/v2/pre-recorded/0199d7a2-5c3e-7b41-9f0a-3c2d1e4f5a6b"
  }
}
```

### 4. Read the finalized transcript

The pass is a pre-recorded job over the call. When it is done, its callback reaches your `callback_config.url`
(the pre-recorded `transcription.success` event, with the job's `id`), and its result is read like any
pre-recorded job's:

```bash
curl https://eu1.api.gladia.io/v2/pre-recorded/0199d7a2-5c3e-7b41-9f0a-3c2d1e4f5a6b \
  -H "x-gladia-key: $GLADIA_API_KEY"
```

Its `result.transcription.utterances` are the call's utterances with their `speaker`, from the pre-recorded
diarization. Keep the live transcript for the call's own screen, and store this one.

## Run the pass yourself, after any live session

The pass is `POST /v2/pre-recorded` with `from_session_id` in place of `audio_url`: you can run it on any of your
ended live sessions that were recorded, with the options you choose, without `finalization` at its init:

```bash e2e="skip: needs a recorded live session in the history, run by tests/gateway/test_prerecorded_from_session.py"
curl -X POST https://eu1.api.gladia.io/v2/pre-recorded \
  -H "x-gladia-key: $GLADIA_API_KEY" \
  -H "content-type: application/json" \
  -d '{"from_session_id": "0199d7a2-0000-7000-8000-0000000c0a11", "model": "solaria-3", "diarization": true}'
```

## Good to know

- **When the pass is ready.** The recording is archived a few seconds after the session ends; the pass then runs
  like any pre-recorded job of your workspace, in its queue. A long call takes longer, a shorter one less.
- **Billing.** The pass is billed as a pre-recorded job of `solaria-3` with diarization, on the call's duration,
  besides the live session.
- **Why a pass may be missing.** `finalization.error` says why: `not_recorded` (no recording, or a call with no
  audio), `interrupted` (the connection dropped and the session was not resumed), `refused` (no pre-recorded host
  runs it, or your workspace's queue is full: `status` gives the HTTP status), `invalid_options`,
  `no_public_address` or `unavailable`. You can still run it yourself with `from_session_id`.
- **Your options.** The pass keeps the session's `language_config` and `custom_metadata`; the add-ons of the live
  session (translation, named entities, ...) are not run on it. Run the pass yourself with `from_session_id` to
  choose its options.
- **API keys.** `from_session_id` reads a live session: a key needs the live scope (`realtime_stt`) as well as
  the pre-recorded one, and a member's key reaches its own sessions only.

## Related pages

- [Pre-recorded (batch) transcription of an audio file](/pre-recorded/transcribe-a-file/)
- [Audio recordings](/data/audio-recordings/)
- [Speaker diarization](/features/speaker-diarization/)
