# Summarization

Last updated: 2026-11-12

**The problem.** A one-hour call is a lot to read, and the agent who took it has the next one waiting. Summarization
writes a summary of the whole call as soon as it ends: paste it into the CRM, the ticket or the follow-up e-mail.
For your own questions about a recorded call, see [Audio to LLM](/features/audio-to-llm/).

**How it works.** When the session ends, a large language model (LLM) summarizes the call's transcript. Gladia
Enterprise does not host that LLM itself: your cluster's operator connects one (OpenRouter, OpenAI, Anthropic,
Blade, OVHcloud AI Endpoints, or any OpenAI-compatible server), or your workspace brings its own. The summary comes
in a `post_summarization` message, right before `post_final_transcript`, and stays in the session's result.

> **Use the SDK.** The Gladia SDKs stream the audio, keep it until the API has transcribed it, and reconnect after a network drop
without losing a word. Most integration issues come from hand-written WebSocket clients: start from the SDK
examples below.

## At a glance

| | |
|---|---|
| Live API | `post_processing.summarization`, its shape in `summarization_config.type` |
| Pre-recorded (batch) | `summarization` ([how](/pre-recorded/add-ons/#summarization)) |
| Needs | An LLM connected by your cluster's operator or your workspace (`GET /v2/features`: `addons.summarization`) |
| Result | The `post_summarization` message at the end of the session, and the session's result |

## Step by step

### 1. Turn it on

```json
{ "post_processing": { "summarization": true, "summarization_config": { "type": "bullet_points" } } }
```

`summarization_config.type` picks the summary's shape: `general` (the default, a few paragraphs), `bullet_points`
(the key points, one per line) or `concise` (a few sentences).

### 2. Start a session with it

Each program streams a 16-bit WAV file and prints the summary once the session ends. Put your API key in the
`GLADIA_API_KEY` environment variable, then run `python summary.py meeting.wav`.

**Python SDK**

```python title="summary.py"
# pip install "gladiaio-sdk>=2.2"
import os
import sys
import threading
import 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"
        ]
    },
    "post_processing": {
        "summarization": True,
        "summarization_config": {
            "type": "bullet_points"
        }
    }
}

client = GladiaClient(api_key=API_KEY, api_url=API_URL)
session = client.live_v2().start_session(LiveV2InitRequest.from_dict(config))
ended, errors, summaries = threading.Event(), [], []

@session.on("message")
def on_message(message):
    if message.type == "transcript" and message.data.is_final:
        print(message.data.utterance.text)
    elif message.type == "post_summarization":
        summaries.append(message)
        if message.error:
            print(f"no summary: {message.error.message}")
        else:
            print(f"Summary:\n{message.data.results}")

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=90)  # the summary comes at the end: up to 30 s after the last word
sys.exit(1 if errors or not ended.is_set() or not summaries else 0)
```

**JavaScript SDK**

```js title="summary.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"
    ]
  },
  post_processing: {
    summarization: true,
    summarization_config: {
      type: "bullet_points"
    }
  }
};

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);
let summarized = false;

session.on("message", (message) => {
  if (message.type === "transcript" && message.data.is_final) console.log(message.data.utterance.text);
  if (message.type === "post_summarization") {
    summarized = true;
    if (message.error) console.log(`no summary: ${message.error.message}`);
    else console.log(`Summary:\n${message.data.results}`);
  }
});
session.on("error", (error) => {
  console.error(error);
  process.exitCode = 1;
});
session.once("ended", () => process.exit(summarized ? process.exitCode : 1));

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"
      ]
    },
    "post_processing": {
      "summarization": true,
      "summarization_config": {
        "type": "bullet_points"
      }
    }
  }'
```

### 3. Read the summary

After `stop_recording`, once the last final is out, comes `post_transcript`, then `post_summarization`:

```json
{
  "type": "post_summarization",
  "session_id": "4a39145c-2844-4557-8f34-34883f7be7d9",
  "created_at": "2026-11-09T14:02:11.000Z",
  "error": null,
  "data": {
    "results": "- The caller asks to move the delivery to Friday.\n- The agent confirms and sends a new tracking link."
  }
}
```

Then `post_final_transcript`, whose `data` carries the same summary as an add-on entry, `summarization`.
`GET /v2/live/{id}` returns that entry too, in its `result`:

```json
{
  "type": "post_final_transcript",
  "session_id": "4a39145c-2844-4557-8f34-34883f7be7d9",
  "created_at": "2026-11-09T14:02:11.000Z",
  "data": {
    "metadata": { "audio_duration": 3540, "billing_time": 3540, "number_of_distinct_channels": 1, "transcription_time": 3542.1 },
    "transcription": { "languages": ["en"], "utterances": [], "full_transcript": "Hello, I am calling about my delivery." },
    "summarization": {
      "success": true,
      "is_empty": false,
      "exec_time": 2.4,
      "error": null,
      "results": "- The caller asks to move the delivery to Friday.\n- The agent confirms and sends a new tracking link."
    }
  }
}
```

With a [callback](/live/callbacks/), the same message comes as `live.post_summarization`
(`callback_config.receive_post_processing_events`).

## Limits and gotchas

- **Refused until an LLM is connected.** On a cluster with no LLM for summarization (none connected by its
  operator, none of your workspace's own), `POST /v2/live` answers `400`, `validation_errors`:
  `post_processing.summarization: not supported: no LLM is configured on this gateway`. Nothing is dropped silently: remove the option,
  or ask your operator. `GET /v2/features` says whether your cluster serves it (`addons.summarization`).
- **It comes at the end.** The summary is written once the session ends: `end_session` waits for it, 30 seconds at
  most (5 to 15 seconds for a one-hour call on a hosted model). The finals are never delayed.
- **A failed summary never fails the session.** An LLM that does not answer in 30 seconds, refuses or is
  unreachable gives `data: null` and an `error` in `post_summarization`, `success: false` in the entry; the
  transcript is complete.
- **`summarization: true` is the switch.** `summarization_config` alone asks for nothing, as on Gladia's cloud API.
- **It reads what you receive.** The summary is written from the finals as they were sent to you: after the custom
  spelling and the PII redaction, so the personal data you asked to hide never reaches the LLM.
- **One language.** The summary is written in the language most of the call is in.
- **After a reconnection or a move to another GPU**, the summary covers the transcript since that move only,
  and its entry says so: `"partial": true`.
- **Which LLM writes it**: your workspace's own LLM when it has one, else the one your cluster's operator routed
  summarization to, else the cluster's default. Your transcript is sent to that LLM only for this summary.
- **No post-processing events?** With `messages_config.receive_post_processing_events: false` no `post_*` message is
  sent, but the summary is still in `GET /v2/live/{id}`.

## Troubleshooting

| symptom | cause | fix |
|---|---|---|
| `400`: `post_processing.summarization: not supported: no LLM is configured on this gateway` | no LLM serves summarization for your workspace | ask your operator to connect one, or remove the option |
| no `post_summarization` message | `receive_post_processing_events: false`, or the session did not end normally | keep the post-processing events on; end with `stop_recording` |
| `post_summarization` with `data: null` | the LLM failed, refused or took over 30 s | read `error.message`; the transcript is in `post_final_transcript` |
| `end_session` comes a few seconds after the last final | the summary is being written | expected: up to 30 s |

## Related pages

- [Audio to LLM](/features/audio-to-llm/)
- [Pre-recorded (batch) transcription add-ons](/pre-recorded/add-ons/)
- [Live transcription callbacks (webhooks)](/live/callbacks/)
