> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipecat.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# RTVI 2.4.0

> Every message of RTVI protocol 2.4.0 by group: what a client sends, what it receives, each message's fields, and the server's rules.

Every message of RTVI protocol 2.4.0, generated from the protocol's [machine-readable AsyncAPI document](https://github.com/pipecat-ai/pipecat/blob/main/src/pipecat/processors/frameworks/rtvi/spec/2.4.0/rtvi.asyncapi.json). See [RTVI](https://docs.pipecat.ai/api-reference/standards/rtvi-standard) for how the protocol works.

## Connection Management

Starting and ending a session, and errors.

### Client sends

#### client-ready

Tells the server the client is ready, with the protocol version it speaks. The server answers with bot-ready.

Typically sent once the transport has connected.

**id** `string` *required*

The message's id. An answer to it carries the same id.

**data.version** `string` *required*

The RTVI protocol version the client speaks, such as `2.3.0`.

**data.about** `AboutClientData` *required*

Information about the client. A server receiving a `client-ready` without it, or with an invalid one, still starts the session, as a client of an unknown library.

**AboutClientData**

**library** `string` *required*

The RTVI library the client uses, such as `@pipecat-ai/client-js`.

**library\_version** `string | null`

The version of that library.

**platform** `string | null`

The platform the client runs on, such as a browser or `iOS`.

**platform\_version** `string | null`

The platform's version.

**platform\_details** `any`

Anything else the client says about its platform.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "client-ready",
  "id": "msg_1",
  "data": {
    "version": "2.4.0",
    "about": {
      "library": "@pipecat-ai/client-js",
      "library_version": "1.16.0"
    }
  }
}
```

#### disconnect-bot

Asks the server to end the session.

Disconnecting from the transport ends the session too. This message is for a client that wants to stay connected to the transport but end its conversation with the bot.

**id** `string` *required*

The message's id. An answer to it carries the same id.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "disconnect-bot",
  "id": "msg_1"
}
```

### Client receives

#### bot-ready

Answers client-ready once the bot is ready to talk, with the protocol version the server speaks to this client, information about the bot, and what it can do. Its id is the client-ready's id.

`about` is the bot's own information: Pipecat's library and version, unless the application replaces it. An application shouldn't put anything sensitive in it.

**id** `string` *required*

The id of the client message this answers.

**data.version** `string` *required*

The RTVI protocol version the bot speaks with this client.

**data.about** `object`

Information about the bot, such as the Pipecat library and version.

**data.capabilities** `BotCapabilities`

What the bot does in this session (media sent and received, metrics), so the client can show only the UI that applies. Added in protocol 2.2.0.

**BotCapabilities**

**audio\_in** `boolean`

Whether the bot receives the user's audio.

**audio\_out** `boolean`

Whether the bot sends audio to the user.

**video\_in** `boolean`

Whether the bot receives the user's video.

**screen\_in** `boolean`

Whether the bot receives the user's screen share. Known when the transport captures its video sources from `video_in_sources`; unknown when the application captures them itself.

**video\_out** `boolean`

Whether the bot sends video to the user.

**metrics** `boolean`

Whether the bot reports metrics.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-ready",
  "id": "msg_1",
  "data": {
    "version": "2.4.0",
    "about": {
      "library": "pipecat-ai",
      "library_version": "1.3.0"
    },
    "capabilities": {
      "audio_in": true,
      "audio_out": true,
      "video_in": false
    }
  }
}
```

#### error

Reports an error in the bot, such as an AI service that failed. When fatal is true, the bot can't go on and the session ends.

**data.error** `string` *required*

What went wrong.

**data.fatal** `boolean` *required*

Whether the bot stopped because of the error.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "error",
  "data": {
    "error": "The LLM service failed",
    "fatal": false
  }
}
```

#### system-log

A line of the server's log, for debugging. Off by default; turned on by the server's `system_logs_enabled` setting.

**data.text** `string` *required*

The text.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "system-log",
  "data": {
    "text": "Pipeline started"
  }
}
```

## Speaking and Transcription

Who is speaking, the user's audio, and what the user and the bot said.

### Client sends

#### raw-audio

A chunk of the user's audio, for transports that don't carry media.

**id** `string` *required*

The message's id. An answer to it carries the same id.

**data.base64Audio** `string` *required*

16-bit PCM audio, base64-encoded.

**data.sampleRate** `integer` *required*

The audio's sample rate, in Hz.

**data.numChannels** `integer` *required*

The audio's number of channels.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "raw-audio",
  "id": "msg_1",
  "data": {
    "base64Audio": "AAAAAA==",
    "sampleRate": 16000,
    "numChannels": 1
  }
}
```

#### raw-audio-batch

Several chunks of the user's audio, for transports that don't carry media.

**id** `string` *required*

The message's id. An answer to it carries the same id.

**data.base64AudioBatch** `string[]` *required*

Chunks of 16-bit PCM audio, each base64-encoded, in order.

**data.sampleRate** `integer` *required*

The audio's sample rate, in Hz.

**data.numChannels** `integer` *required*

The audio's number of channels.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "raw-audio-batch",
  "id": "msg_1",
  "data": {
    "base64AudioBatch": [
      "AAAAAA==",
      "AAAAAA=="
    ],
    "sampleRate": 16000,
    "numChannels": 1
  }
}
```

### Client receives

#### user-started-speaking

The user's turn started: the bot considers the user to be speaking. On by default; turned off by the server's `user_speaking_enabled` setting.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "user-started-speaking"
}
```

#### user-stopped-speaking

The user's turn ended: the bot considers the user done speaking. On by default; turned off by the server's `user_speaking_enabled` setting.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "user-stopped-speaking"
}
```

#### vad-user-started-speaking

Voice activity detection (VAD) heard the user start speaking. It reacts to any voice, sooner than user-started-speaking, which comes when the bot decides the user's turn started. Off by default; turned on by the server's `vad_user_speaking_enabled` setting.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "vad-user-started-speaking"
}
```

#### vad-user-stopped-speaking

Voice activity detection (VAD) heard the user stop speaking. It reacts to any pause, sooner than user-stopped-speaking, which comes when the bot decides the user's turn ended. Off by default; turned on by the server's `vad_user_speaking_enabled` setting.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "vad-user-stopped-speaking"
}
```

#### user-mute-started

The bot stopped listening to the user, for example while it says something that must not be interrupted. On by default; turned off by the server's `user_mute_enabled` setting.

The client should keep sending audio. It may show the user that their input isn't being processed.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "user-mute-started"
}
```

#### user-mute-stopped

The bot listens to the user again. On by default; turned off by the server's `user_mute_enabled` setting.

The client may show the user that their input is being processed again.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "user-mute-stopped"
}
```

#### bot-started-speaking

The bot started speaking: its audio started playing to the user. On by default; turned off by the server's `bot_speaking_enabled` setting.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-started-speaking"
}
```

#### bot-stopped-speaking

The bot stopped speaking. On by default; turned off by the server's `bot_speaking_enabled` setting.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-stopped-speaking"
}
```

#### bot-interrupted

The bot was interrupted and stopped what it was saying. A client should drop the bot's text that hadn't been spoken yet. On by default; turned off by the server's `bot_speaking_enabled` setting.

The user speaking over the bot interrupts it, and so does a send-text with `run_immediately`.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-interrupted"
}
```

#### user-audio-level

How loud the user's audio is, from 0 (quiet) to 1 (loud), sent regularly while the user's audio comes in. Off by default; turned on by the server's `user_audio_level_enabled` setting.

Sent every 0.15 seconds by default, the server's `audio_level_period_secs` setting.

**data.value** `number` *required*

How loud the audio is, from 0 (quiet) to 1 (loud).

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "user-audio-level",
  "data": {
    "value": 0.3
  }
}
```

#### bot-audio-level

How loud the bot's audio is, from 0 (quiet) to 1 (loud), sent regularly while the bot speaks. Off by default; turned on by the server's `bot_audio_level_enabled` setting.

Sent every 0.15 seconds by default, the server's `audio_level_period_secs` setting.

**data.value** `number` *required*

How loud the audio is, from 0 (quiet) to 1 (loud).

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-audio-level",
  "data": {
    "value": 0.5
  }
}
```

#### user-input

What the user said or typed: a transcription of their speech, text the client sent, or a short acknowledgment the user said while the bot talks. On by default; turned off by the server's `user_input_enabled` setting.

Sent for each transcription of the user's speech; for each short acknowledgment the user says while the bot talks, which neither interrupts the bot nor reaches its LLM; and for each send-text message, with the send-text's id in `msg_id`.

**data.text** `string` *required*

What the user said or typed.

**data.input\_type** `string` *required*

What kind of input it is: `"transcription"` for speech transcribed by the STT, `"chat"` for text the client sent, or `"backchannel"` for a short acknowledgment the user said while the bot talks, such as "mhm".

**data.timestamp** `string` *required*

When the user said or sent it.

**data.final** `boolean` *required*

Whether the text is final. Only an interim transcription isn't.

**data.user\_id** `string`

Identifier for the user who spoke or typed. For chat, set only when the transport knows the sender, such as Daily and LiveKit.

**data.msg\_id** `string`

For chat, the id of the client's `send-text` message.

**data.perception** `UserPerceptionSignal[]`

For a transcription, how the user said it, when the STT service reports a reading with it. Part of expressive conversation (alpha).

**UserPerceptionSignal**

**name** `string` *required*

What is read, such as `"tone"`.

**labels** `UserPerceptionLabel[]` *required* (default: \[])

The likeliest labels, likeliest first, for a signal read as labels.

**UserPerceptionLabel**

**label** `string` *required*

The label, such as `"frustrated"`.

**confidence** `number` *required*

How sure the reading is, from 0 to 1.

**value** `number`

The measure, for a signal read as a value.

**data.speaker** `TranscriptionSpeaker`

For a transcription, who said it, when the STT service's diarization tells speakers apart.

**TranscriptionSpeaker**

**label** `string` *required*

The provider's label for the speaker (e.g. `"A"`, `"S1"`, `"2"`).

**number** `integer` *required*

The speaker's place in the order speakers first appeared, starting at `1`.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "user-input",
  "data": {
    "text": "What's the weather like?",
    "input_type": "transcription",
    "timestamp": "2026-01-01T12:00:00.000Z",
    "final": true,
    "user_id": "user_1"
  }
}
```

#### user-transcription

A transcription of the user's speech, including interim transcriptions that may still change. On by default; turned off by the server's `user_transcription_enabled` setting. Deprecated. Use user-input or stt-raw-text instead.

**data.text** `string` *required*

The transcribed text.

**data.user\_id** `string` *required*

Identifier for the user who spoke.

**data.timestamp** `string` *required*

When the user said it.

**data.final** `boolean` *required*

Whether the transcription is final, as opposed to interim.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "user-transcription",
  "data": {
    "text": "What's the",
    "user_id": "user_1",
    "timestamp": "2026-01-01T12:00:00.000Z",
    "final": false
  }
}
```

#### bot-output

Text the bot says or shows, a sentence or another unit at a time, with whether it will be spoken and how much of it has been spoken. On by default; turned off by the server's `bot_output_enabled` setting.

**data.text** `string` *required*

The text.

**data.output\_type** `string` *required*

What form the text is in (e.g., sentence, code, etc.). One of `"backchannel"`, `"expression_sound"`, `"expression_pause"`, `"sentence"`, `"token"`, `"word"`.

**data.text\_type** `string`

What form the text is in, always the same as `output_type`. Deprecated: Use `output_type` instead. One of `"backchannel"`, `"expression_sound"`, `"expression_pause"`, `"sentence"`, `"token"`, `"word"`.

**data.aggregated\_by** `string`

What form the text is in, always the same as `output_type`. Deprecated: Use `output_type` instead. One of `"backchannel"`, `"expression_sound"`, `"expression_pause"`, `"sentence"`, `"token"`, `"word"`.

**data.segment\_id** `integer`

Identifies the segment the text belongs to; every message about one segment, such as its spoken progress, carries the same id.

**data.spoken** `boolean`

**(v1 only)** Whether the text has been spoken by TTS.

**data.will\_be\_spoken** `boolean`

**(v2+)** Whether the text will be spoken by TTS.

**data.spoken\_status** `string`

**(v2+)** Lifecycle status of the segment: `"new"` on its first message, the only one for text that isn't spoken; `"in-progress"` as each of its words is spoken, for TTS services with word timestamps; `"completed"` once its last word is spoken.

**data.spoken\_progress** `SpokenProgressData`

**(v2+)** Accumulated / remaining text breakdown. Present when `will_be_spoken` is `true`.

**SpokenProgressData**

**accumulated\_text** `string` *required*

Text already spoken in this segment, including the current word.

**remaining\_text** `string` *required*

Text not yet spoken in this segment.

**data.delivery** `string[]`

**(2.3.0+)** The delivery of the text just spoken, by its universal names, such as `["warm", "emphasis"]`, empty for the voice's baseline. They change within a segment where its delivery does, so a segment's `"new"` message has none. Present in expressive conversation (alpha).

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-output",
  "data": {
    "text": "It's sunny in Lisbon.",
    "output_type": "sentence",
    "segment_id": 1,
    "will_be_spoken": true,
    "spoken_status": "in-progress",
    "spoken_progress": {
      "accumulated_text": "It's sunny",
      "remaining_text": " in Lisbon."
    }
  }
}
```

#### bot-transcription

The text of the bot's LLM response, a whole sentence at a time. On by default; turned off by the server's `bot_llm_enabled` setting. Deprecated. Use bot-output instead.

It carries no timing. For text as the bot speaks it, use tts-raw-text.

**data.text** `string` *required*

The text.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-transcription",
  "data": {
    "text": "It's sunny in Lisbon."
  }
}
```

## Client-Server Messaging

Messages of the application's own, and the answers to client messages.

### Client sends

#### client-message

A custom message for the application. The server answers with server-response or error-response.

**id** `string` *required*

The message's id. An answer to it carries the same id.

**data.t** `string` *required*

The message's type, one of the application's own.

**data.d** `any`

The message's data, of the application's own.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "client-message",
  "id": "msg_1",
  "data": {
    "t": "get-weather",
    "d": {
      "city": "Lisbon"
    }
  }
}
```

### Client receives

#### error-response

Answers a client message the server couldn't handle, with what went wrong. Its id is the id of the message it answers.

**id** `string` *required*

The id of the client message this answers.

**data.error** `string` *required*

What went wrong.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "error-response",
  "id": "msg_1",
  "data": {
    "error": "Unsupported type foo"
  }
}
```

#### server-response

The bot's answer to a client-message. Its id is the client-message's id, and t is the client-message's t.

**id** `string` *required*

The id of the client message this answers.

**data.t** `string` *required*

The `t` of the client message this answers.

**data.d** `any`

The answer's data, of the application's own.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "server-response",
  "id": "msg_1",
  "data": {
    "t": "get-weather",
    "d": {
      "temperature": 21
    }
  }
}
```

#### server-message

A message from the bot's application to the client, with data of the application's own.

**data** `any` *required*

The application's own data, any JSON value, as the bot's application sent it.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "server-message",
  "data": {
    "event": "order-updated",
    "status": "shipped"
  }
}
```

## Advanced LLM Interactions

Text, files and keypresses for the bot, and the bot's function calls.

### Client sends

#### send-text

Text the user typed, sent to the bot as if the user had said it.

**id** `string` *required*

The message's id. An answer to it carries the same id.

**data.content** `string` *required*

The text.

**data.options** `SendTextOptions | null`

How the bot handles the text.

**SendTextOptions**

**run\_immediately** `boolean` (default: true)

Whether the bot responds to the text right away, interrupting itself if it is speaking. When false, the text waits in the conversation for the bot's next response.

**audio\_response** `boolean` (default: true)

Whether the bot speaks its response. When false, the response is text only.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "send-text",
  "id": "msg_1",
  "data": {
    "content": "What's the weather like?",
    "options": {
      "run_immediately": true
    }
  }
}
```

#### send-file

A file for the bot, with text that goes with it.

**id** `string` *required*

The message's id. An answer to it carries the same id.

**data.content** `string` *required*

Text that goes with the file, such as a question about it.

**data.file** `File` *required*

The file.

**File**

**format** `string` *required*

The file's MIME type, such as `application/pdf` or `image/png`.

**name** `string | null`

The file's name.

**source** `FileBytes | FileUrl` *required*

Where the file's content is: its bytes, or a URL.

**FileBytes**

File source as base64-encoded bytes.

**type** `string` (default: bytes)

Always `"bytes"`. One of `"bytes"`, `"url"`.

**bytes** `string` *required*

The file's content, base64-encoded.

**width** `integer | null`

For an image, its width in pixels.

**height** `integer | null`

For an image, its height in pixels.

**FileUrl**

File source as a URL.

**type** `string` (default: url)

Always `"url"`. One of `"bytes"`, `"url"`.

**url** `string` *required*

The file's URL: whatever the `POST /files` upload endpoint returned (`pipecat:<id>` with the default local storage, or a URL minted by a custom storage backend), a cloud-storage URI (`s3://`, `gs://`), or a plain `http(s)` URL. The URL is resolved at completion time: the LLM provider fetches it itself when it can (public URLs, its own cloud IAM), and otherwise the LLM service's `FileResolver` downloads the bytes and inlines them.

**data.options** `SendFileOptions | null`

How the bot handles the file.

**SendFileOptions**

**run\_immediately** `boolean` (default: true)

Whether the bot responds to the file right away, interrupting itself if it is speaking. When false, the file waits in the conversation for the bot's next response.

**audio\_response** `boolean` (default: true)

Whether the bot speaks its response. When false, the response is text only.

**custom\_options** `object | null`

Options for the LLM provider, such as OpenAI's `detail` or Bedrock's `citations`.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "send-file",
  "id": "msg_1",
  "data": {
    "content": "What is in this picture?",
    "file": {
      "format": "image/png",
      "name": "photo.png",
      "source": {
        "type": "url",
        "url": "https://example.com/photo.png"
      }
    }
  }
}
```

#### dtmf

Keypad presses, delivered in order.

**id** `string` *required*

The message's id. An answer to it carries the same id.

**data.buttons** `string[]` *required*

The keys pressed, in order: `0`-`9`, `*` or `#`.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "dtmf",
  "id": "msg_1",
  "data": {
    "buttons": [
      "1",
      "#"
    ]
  }
}
```

#### llm-function-call-result

The result of a function call the client ran for the bot's LLM.

**id** `string` *required*

The message's id. An answer to it carries the same id.

**data.function\_name** `string` *required*

Name of the function called.

**data.tool\_call\_id** `string` *required*

Unique identifier of the call, as the server reported it.

**data.arguments** `object` *required*

Arguments the function was called with.

**data.result** `object | string` *required*

What the function returned.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "llm-function-call-result",
  "id": "msg_1",
  "data": {
    "function_name": "get_weather",
    "tool_call_id": "call_123",
    "arguments": {
      "city": "Lisbon"
    },
    "result": {
      "temperature": 21
    }
  }
}
```

### Client receives

#### llm-function-call-started

The bot's LLM started calling a function. The server's settings decide whether it includes the function's name.

The server's report level for the function decides whether it carries the function's name: `name`, `arguments` and `full` do, and `none` doesn't. At `disabled`, the server sends no messages about the call.

**data.function\_name** `string`

Name of the function called.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "llm-function-call-started",
  "data": {
    "function_name": "get_weather"
  }
}
```

#### llm-function-call-in-progress

A function call is running, with its id and, as the server's settings decide, the function's name and arguments.

How much it carries depends on the server's report level for the function: `none` sends only the call's id, `name` adds the function's name, `arguments` its arguments, and `full` its result. At `disabled`, the server sends no messages about the call. A client that runs the function itself answers with llm-function-call-result.

**data.tool\_call\_id** `string` *required*

Unique identifier of the call.

**data.function\_name** `string`

Name of the function called.

**data.arguments** `object`

Arguments passed to the function.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "llm-function-call-in-progress",
  "data": {
    "tool_call_id": "call_123",
    "function_name": "get_weather",
    "arguments": {
      "city": "Lisbon"
    }
  }
}
```

#### llm-function-call-stopped

A function call finished or was cancelled, with its id and, as the server's settings decide, the function's name and result.

How much it carries depends on the server's report level for the function: `none` sends only the call's id, `name` adds the function's name, `arguments` its arguments, and `full` its result. At `disabled`, the server sends no messages about the call.

**data.tool\_call\_id** `string` *required*

Unique identifier of the call.

**data.cancelled** `boolean` *required*

Whether the call was cancelled rather than completed.

**data.function\_name** `string`

Name of the function called.

**data.result** `any`

The result, when the call completed with one.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "llm-function-call-stopped",
  "data": {
    "tool_call_id": "call_123",
    "cancelled": false,
    "function_name": "get_weather"
  }
}
```

#### llm-function-call

The bot's LLM called a function, with its name, id and arguments. Deprecated. Use llm-function-call-in-progress instead.

**data.function\_name** `string` *required*

Name of the function called.

**data.tool\_call\_id** `string` *required*

Unique identifier of the call.

**data.args** `object` *required*

Arguments passed to the function.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "llm-function-call",
  "data": {
    "function_name": "get_weather",
    "tool_call_id": "call_123",
    "args": {
      "city": "Lisbon"
    }
  }
}
```

## Service-Specific Insights

What the bot's speech-to-text, LLM and text-to-speech services are doing.

### Client receives

#### user-llm-text

The user's message as the bot's LLM receives it. On by default; turned off by the server's `user_llm_enabled` setting.

**data.text** `string` *required*

The text.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "user-llm-text",
  "data": {
    "text": "What's the weather like?"
  }
}
```

#### stt-raw-text

A transcription of the user's speech as the speech-to-text service produces it, including interim transcriptions that may still change. Off by default; turned on by the server's `stt_raw_text_enabled` setting. Sent to clients of protocol 2.2.0 or later, and to any client before its client-ready.

**data.text** `string` *required*

The transcribed text.

**data.user\_id** `string` *required*

Identifier for the user who spoke.

**data.timestamp** `string` *required*

When the user said it.

**data.final** `boolean` *required*

Whether the transcription is final, as opposed to interim.

**data.speaker** `TranscriptionSpeaker`

Who said it, when the STT service's diarization tells speakers apart.

**TranscriptionSpeaker**

**label** `string` *required*

The provider's label for the speaker (e.g. `"A"`, `"S1"`, `"2"`).

**number** `integer` *required*

The speaker's place in the order speakers first appeared, starting at `1`.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "stt-raw-text",
  "data": {
    "text": "What's the",
    "user_id": "user_1",
    "timestamp": "2026-01-01T12:00:00.000Z",
    "final": false
  }
}
```

#### bot-llm-started

The bot's LLM started generating a response. On by default; turned off by the server's `bot_llm_enabled` setting.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-llm-started"
}
```

#### bot-llm-stopped

The bot's LLM finished generating a response. On by default; turned off by the server's `bot_llm_enabled` setting.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-llm-stopped"
}
```

#### bot-tts-started

The bot's text-to-speech service started turning a response into speech. On by default; turned off by the server's `bot_tts_enabled` setting.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-tts-started"
}
```

#### bot-tts-stopped

The bot's text-to-speech service finished turning a response into speech. On by default; turned off by the server's `bot_tts_enabled` setting.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-tts-stopped"
}
```

#### llm-raw-text

Text exactly as the bot's LLM streams it, a chunk at a time. Off by default; turned on by the server's `llm_raw_text_enabled` setting. Sent to clients of protocol 2.2.0 or later, and to any client before its client-ready.

**data.text** `string` *required*

The text.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "llm-raw-text",
  "data": {
    "text": "It's sunny"
  }
}
```

#### tts-raw-text

Text the bot's text-to-speech service speaks, as it speaks it. Off by default; turned on by the server's `tts_raw_text_enabled` setting. Sent to clients of protocol 2.2.0 or later, and to any client before its client-ready.

**data.text** `string` *required*

The text.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "tts-raw-text",
  "data": {
    "text": "It's"
  }
}
```

#### bot-llm-marker

The marker the bot's LLM put in a response, outside the text it speaks, such as one saying whether the user's turn was complete. Sent once per response, when it ends. Off by default; turned on by the server's `bot_llm_marker_enabled` setting.

It carries the raw text of the whole response, so it's meant for evaluation and debugging rather than for the user.

**data.text** `string` *required*

The marker as the LLM produced it; empty when the response carried none.

**data.kind** `string`

What the marker means, such as `complete`, `short` or `long` for the markers that say whether the user's turn was complete, `silent` for a reply dropped as the wait-reassurance silent mark, or `null` when it means nothing the server knows.

**data.raw** `string` *required*

The response's text as the LLM produced it, markers included.

**data.markers** `string[]` *required*

Every marker the emitter recognizes.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-llm-marker",
  "data": {
    "text": "✓",
    "kind": "complete",
    "raw": "✓ It's sunny in Lisbon.",
    "markers": [
      "✓"
    ]
  }
}
```

#### bot-llm-text

Text as the bot's LLM streams it, a chunk at a time. On by default; turned off by the server's `bot_llm_enabled` setting. Deprecated. Use llm-raw-text instead.

**data.text** `string` *required*

The text.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-llm-text",
  "data": {
    "text": "It's sunny"
  }
}
```

#### bot-tts-text

Text the bot's text-to-speech service speaks, as it speaks it. On by default; turned off by the server's `bot_tts_enabled` setting. Deprecated. Use tts-raw-text instead.

**data.text** `string` *required*

The text.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "bot-tts-text",
  "data": {
    "text": "It's"
  }
}
```

## Metrics and Monitoring

How the bot's services perform.

### Client receives

#### metrics

Performance metrics of the bot's services, such as how long each took to respond and how much it processed. On by default; turned off by the server's `metrics_enabled` setting.

**data.processing** `ProcessingMetricsData[]`

How long each service took to process, in seconds.

**ProcessingMetricsData**

**processor** `string` *required*

Name of the processor generating the metrics.

**model** `string`

Optional model name associated with the metrics.

**value** `number` *required*

Processing time measurement in seconds.

**data.ttfb** `TTFBMetricsData[]`

Each service's time to first byte, in seconds.

**TTFBMetricsData**

**processor** `string` *required*

Name of the processor generating the metrics.

**model** `string`

Optional model name associated with the metrics.

**value** `number` *required*

TTFB measurement in seconds.

**data.ttfa** `TTFAMetricsData[]`

Each TTS service's time to first audio: its time to first byte plus any silence before the first audible sample.

**TTFAMetricsData**

**processor** `string` *required*

Name of the processor generating the metrics.

**model** `string`

Optional model name associated with the metrics.

**ttfa** `number` *required*

TTFA measurement in seconds (`ttfb` plus `leading_silence`).

**ttfb** `number` *required*

Time-to-first-byte that TTFA builds on, in seconds. This mirrors the standalone `TTFBMetricsData` (emitted earlier) for convenience; it is not a separate measurement, so don't aggregate both.

**leading\_silence** `number` *required*

Silence padding before the first audible sample, in seconds (`ttfa` minus `ttfb`).

**data.ttfat** `TTFATMetricsData[]`

Each LLM service's time to first answer token: its time to first byte plus any reasoning it streamed first.

**TTFATMetricsData**

**processor** `string` *required*

Name of the processor generating the metrics.

**model** `string`

Optional model name associated with the metrics.

**ttfat** `number` *required*

TTFAT measurement in seconds (`ttfb` plus `thinking_time`).

**ttfb** `number` *required*

Time-to-first-byte that TTFAT builds on, in seconds. This mirrors the standalone `TTFBMetricsData` (emitted earlier) for convenience; it is not a separate measurement, so don't aggregate both.

**thinking\_time** `number` *required*

Time between the model's first output and the first answer token, in seconds (`ttfat` minus `ttfb`). Reasoning is the usual reason a model streams something before it starts answering, though a model that reasons none still spends a little time here.

**data.tokens** `LLMTokenUsage[]`

The tokens each LLM call used.

**LLMTokenUsage**

**prompt\_tokens** `integer` *required*

Number of tokens in the input prompt, net or gross of the cache counts depending on the service. Includes tool results the provider feeds back to the model, which are billed as input.

**completion\_tokens** `integer` *required*

Number of tokens in the generated completion, including any reasoning tokens.

**total\_tokens** `integer` *required*

Total number of tokens used, including any cached input tokens.

**cache\_read\_input\_tokens** `integer`

Number of tokens read from cache, if applicable. Billed below the input rate.

**cache\_creation\_input\_tokens** `integer`

Number of tokens written to cache, if applicable. Billed at or above the input rate.

**reasoning\_tokens** `integer`

Number of completion tokens used for reasoning, if applicable.

**input\_audio\_tokens** `integer`

Number of prompt tokens that were audio, if applicable.

**output\_audio\_tokens** `integer`

Number of completion tokens that were audio, if applicable.

**cache\_read\_input\_audio\_tokens** `integer`

Number of cache-read tokens that were audio, if applicable.

**data.stt\_usage** `STTUsageMetricsData[]`

How much audio each STT service received.

**STTUsageMetricsData**

**processor** `string` *required*

Name of the processor generating the metrics.

**model** `string`

Optional model name associated with the metrics.

**value** `STTUsage` *required*

Usage statistics for the STT operation.

**STTUsage**

**audio\_seconds** `number` *required*

Client-measured seconds of audio submitted to the service since the last usage report.

**data.characters** `TTSUsageMetricsData[]`

How many characters each TTS service spoke.

**TTSUsageMetricsData**

**processor** `string` *required*

Name of the processor generating the metrics.

**model** `string`

Optional model name associated with the metrics.

**value** `integer` *required*

Number of characters processed by TTS.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "metrics",
  "data": {
    "ttfb": [
      {
        "processor": "OpenAILLMService#0",
        "value": 0.42
      }
    ]
  }
}
```

## Conversation Flows

Where the bot is in a conversation flow.

### Client receives

#### flow-node-entered

The bot's conversation flow entered a node, so a client can follow the conversation through the flow. Sent to clients of protocol 2.4.0 or later, and to any client before its client-ready.

Sent each time a Pipecat Flows conversation enters a node, including its first node and a node it enters again, before the bot responds in that node.

**data.node** `string` *required*

The name of the node the flow entered. A node of a subflow is named `<parent>.<node>`.

**data.previous\_node** `string`

The name of the node the flow left. Absent for the flow's first node.

**data.function** `string`

The name of the function whose call moved the flow to this node. Absent when the bot set the node itself.

**data.metadata** `object`

The entered node's metadata, a JSON object of the application's own. Absent when the node has none.

**data.function\_metadata** `object`

The metadata of `function`, a JSON object of the application's own. Absent when the function has none.

**data.parent** `string`

When the node belongs to a subflow, the name of the node that runs the subflow. Absent otherwise.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "flow-node-entered",
  "data": {
    "node": "verify.check_birthday",
    "previous_node": "greet",
    "function": "wants_to_book",
    "metadata": {
      "step": 2
    },
    "parent": "verify"
  }
}
```

## User Interface

The bot observing and driving the client's UI.

### Client sends

#### ui-event

An event from the client's UI, for a UI worker.

**id** `string` *required*

The message's id. An answer to it carries the same id.

**data.event** `string` *required*

App-defined event.

**data.payload** `any`

App-defined payload, schemaless by design.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "ui-event",
  "id": "msg_1",
  "data": {
    "event": "button-clicked",
    "payload": {
      "id": "checkout"
    }
  }
}
```

#### ui-snapshot

An accessibility snapshot of the client's UI, for a UI worker.

Sent whenever the client's UI changes, so the bot works from what is on screen.

**id** `string` *required*

The message's id. An answer to it carries the same id.

**data.tree** `A11ySnapshot` *required*

The serialized accessibility tree.

**A11ySnapshot**

**root** `A11yNode` *required*

Root accessibility node.

**A11yNode**

**ref** `string` *required*

Stable client-assigned element reference.

**role** `string` *required*

ARIA-style role for the node.

**name** `string | null`

Optional accessible name.

**value** `string | null`

Optional current value for inputs/progress/etc.

**state** `string[] | null`

Optional short state tags (e.g. `"focused"`, `"disabled"`, `"offscreen"`).

**level** `integer | null`

Optional heading level.

**colcount** `integer | null`

Optional column count for grid-like containers.

**rowcount** `integer | null`

Optional row count for grid-like containers.

**children** `A11yNode[] | null`

Optional child nodes.
Same fields as `A11yNode`, above.

**captured\_at** `integer` *required*

Client-side epoch milliseconds when captured.

**selection** `A11ySelection | null`

Optional current text selection.

**A11ySelection**

**ref** `string` *required*

Ref of the element that carries the selection.

**text** `string` *required*

Selected text.

**start\_offset** `integer | null`

Optional selection start offset.

**end\_offset** `integer | null`

Optional selection end offset.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "ui-snapshot",
  "id": "msg_1",
  "data": {
    "tree": {
      "root": {
        "ref": "e1",
        "role": "main",
        "children": [
          {
            "ref": "e2",
            "role": "button"
          }
        ]
      },
      "captured_at": 1767268800000
    }
  }
}
```

#### ui-cancel-job-group

Asks the server to cancel a job group it reported with ui-job-group.

The server cancels the group only if it reported the group as cancellable.

**id** `string` *required*

The message's id. An answer to it carries the same id.

**data.job\_id** `string` *required*

The job group id the client wants cancelled.

**data.reason** `string | null`

Optional human-readable reason.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "ui-cancel-job-group",
  "id": "msg_1",
  "data": {
    "job_id": "job_1",
    "reason": "User closed the panel"
  }
}
```

### Client receives

#### ui-command

A command from the bot to the client's UI, such as showing a notification.

The standard commands each have a payload of their own, and `@pipecat-ai/client-react` has a default handler for each. An application can also send commands of its own.

**data** `UIToastCommand | UINavigateCommand | UIScrollToCommand | UIHighlightCommand | UIFocusCommand | UIClickCommand | UISetInputValueCommand | UISelectTextCommand | UIAppCommand` *required*

**command: toast**

The standard `toast` command: a transient notification surface shown on the client.

**command** `string` *required*

The command's name. Always `"toast"`.

**payload** `Toast` *required*

The command's payload.

**Toast**

**title** `string` *required*

Required headline.

**subtitle** `string`

Optional second line beneath the title.

**description** `string`

Optional body text.

**image\_url** `string`

Optional leading image.

**duration\_ms** `integer`

Optional dismiss timer. Client default applies when None.

**command: navigate**

The standard `navigate` command: client-side navigation to a named view.

**command** `string` *required*

The command's name. Always `"navigate"`.

**payload** `Navigate` *required*

The command's payload.

**Navigate**

**view** `string` *required*

App-defined view name (route, screen id, tab key, etc.).

**params** `object`

Optional view-specific parameters.

**command: scroll\_to**

The standard `scroll_to` command: scroll a target element into view.

**command** `string` *required*

The command's name. Always `"scroll_to"`.

**payload** `ScrollTo` *required*

The command's payload.

**ScrollTo**

**ref** `string`

Snapshot ref from `<ui_state>`.

**target\_id** `string`

Element id registered on the client.

**behavior** `string`

Optional scroll behavior hint. Typical values: `"smooth"` or `"instant"`. Clients may ignore.

**command: highlight**

The standard `highlight` command: briefly emphasize a target element (flash, glow, pulse).

**command** `string` *required*

The command's name. Always `"highlight"`.

**payload** `Highlight` *required*

The command's payload.

**Highlight**

**ref** `string`

Snapshot ref from `<ui_state>`.

**target\_id** `string`

Element id registered on the client.

**duration\_ms** `integer`

Optional highlight duration. Client default applies when None.

**command: focus**

The standard `focus` command: move input focus to a target element.

**command** `string` *required*

The command's name. Always `"focus"`.

**payload** `Focus` *required*

The command's payload.

**Focus**

**ref** `string`

Snapshot ref from `<ui_state>`.

**target\_id** `string`

Element id registered on the client.

**command: click**

The standard `click` command: click an element on the client.

**command** `string` *required*

The command's name. Always `"click"`.

**payload** `Click` *required*

The command's payload.

**Click**

**ref** `string`

Snapshot ref from `<ui_state>`.

**target\_id** `string`

Element id registered on the client. Used as a fallback when `ref` is not set or has gone stale.

**command: set\_input\_value**

The standard `set_input_value` command: write a value into a text input or textarea on the client.

**command** `string` *required*

The command's name. Always `"set_input_value"`.

**payload** `SetInputValue` *required*

The command's payload.

**SetInputValue**

**value** `string` *required*

The text to write.

**ref** `string`

Snapshot ref from `<ui_state>`. Typically the ref of an `<input>` or `<textarea>`.

**target\_id** `string`

Element id registered on the client. Used as a fallback when `ref` is not set or has gone stale.

**replace** `boolean` *required* (default: true)

When True (the default), overwrite the current value. When False, append to it.

**command: select\_text**

The standard `select_text` command: select text on the page so the user can see what the worker means.

**command** `string` *required*

The command's name. Always `"select_text"`.

**payload** `SelectText` *required*

The command's payload.

**SelectText**

**ref** `string`

Snapshot ref from `<ui_state>`. Typically the ref of a paragraph or input element.

**target\_id** `string`

Element id registered on the client. Used as a fallback when `ref` is not set or has gone stale.

**start\_offset** `integer`

Character offset within the target's text where the selection should start. For `<input>` and `<textarea>` this is the value offset; for document elements it is computed against the concatenation of descendant text nodes in document order.

**end\_offset** `integer`

End character offset, exclusive. Same coordinate system as `start_offset`.

**command: any other**

A command of the application's own, with a name and payload it defines.

**command** `string` *required*

The command's name, other than a standard command's.

**payload** `any`

The command's payload, a JSON object.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "ui-command",
  "data": {
    "command": "toast",
    "payload": {
      "title": "Order shipped"
    }
  }
}
```

#### ui-job-group

Progress of work the bot handed to other workers, for the client's UI: the work started, a worker's update or result, or all of it completed.

**data** `UIJobGroupStartedData | UIJobUpdateData | UIJobCompletedData | UIJobGroupCompletedData` *required*

**kind: group\_started**

`data` for a `ui-job-group` envelope with kind `group_started`.

**kind** `string` *required* (default: group\_started)

Always `"group_started"`.

**job\_id** `string` *required*

Shared job-group identifier for the group.

**workers** `string[]`

Names of the workers the work was dispatched to.

**label** `string`

Optional human-readable label for the group.

**cancellable** `boolean` *required* (default: true)

Whether the client may request cancellation.

**at** `integer` *required* (default: 0)

Epoch milliseconds when the group started.

**kind: job\_update**

`data` for a `ui-job-group` envelope with kind `job_update`.

**kind** `string` *required* (default: job\_update)

Always `"job_update"`.

**job\_id** `string` *required*

The shared job-group identifier.

**worker\_name** `string` *required*

The worker that produced the update.

**data** `any`

The worker's update payload, forwarded verbatim.

**at** `integer` *required* (default: 0)

Epoch milliseconds when the update was emitted.

**kind: job\_completed**

`data` for a `ui-job-group` envelope with kind `job_completed`.

**kind** `string` *required* (default: job\_completed)

Always `"job_completed"`.

**job\_id** `string` *required*

The shared job-group identifier.

**worker\_name** `string` *required*

The worker that produced the response.

**status** `string` *required*

Completion status string.

**response** `any`

The worker's response payload.

**at** `integer` *required* (default: 0)

Epoch milliseconds when the response was received.

**kind: group\_completed**

`data` for a `ui-job-group` envelope with kind `group_completed`.

**kind** `string` *required* (default: group\_completed)

Always `"group_completed"`.

**job\_id** `string` *required*

The shared job-group identifier.

**at** `integer` *required* (default: 0)

Epoch milliseconds when the group completed.

```json Example theme={null}
{
  "label": "rtvi-ai",
  "type": "ui-job-group",
  "data": {
    "kind": "group_started",
    "job_id": "job_1",
    "workers": [
      "researcher"
    ],
    "label": "Researching",
    "cancellable": true,
    "at": 1767268800000
  }
}
```

## Server Behaviors

The rules a server follows across messages, beyond the shape of each one.

* **bot-ready-answers-client-ready**: Once the bot is ready, the server answers client-ready with a bot-ready carrying the client-ready's id. (`client-ready`, `bot-ready`)
* **bot-ready-version**: bot-ready's version is the protocol version the server speaks to the client: the server's own for a client of the same major version, and the client's own for a 1.x client. (`client-ready`, `bot-ready`)
* **current-version-before-client-ready**: Until client-ready, the server sends messages as it does to a client of its own protocol version, so what the bot does before the client says its version, such as a greeting, reaches the client. From client-ready on, the client's version decides which messages it gets. (`client-ready`)
* **client-ready-version-check**: A client-ready without a version, with a malformed one, or of a major version the server doesn't speak gets an error-response carrying its id. The session goes on, and the server still answers with bot-ready. (`client-ready`, `error-response`, `bot-ready`)
* **failed-request-gets-error-response**: A client message the server can't handle, of an unknown type or with data that doesn't match its payload, gets an error-response carrying the message's id. (`error-response`)
* **invalid-message-gets-error**: A transport message labeled "rtvi-ai" that isn't an RTVI message, such as one without an id, gets an error, since there is no id to answer. The server ignores a message without the "rtvi-ai" label. (`error`)
* **client-message-answer**: The bot answers a client-message with a server-response or an error-response carrying the client-message's id. A server-response's t is the client-message's t. (`client-message`, `server-response`, `error-response`)
* **disconnect-bot-ends-session**: disconnect-bot ends the bot's session. (`disconnect-bot`)
* **messages-turned-off**: The server sends a message that has x-rtvi-enabled-by only while the server setting it names is on. The settings are fields of Pipecat's RTVIObserverParams.
* **spoken-output-waits-for-speech**: bot-output for text the bot will speak waits for the bot to start speaking: the server sends it after bot-started-speaking, in the order the text came. (`bot-started-speaking`, `bot-output`)
* **interruption-drops-unspoken-output**: On an interruption, the server sends bot-interrupted, and never sends the bot-output it was holding for speech that the interruption cut off. (`bot-interrupted`, `bot-output`)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.