> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# OpenAI

OpenAI provides VoxEngine clients for chat completions, the Responses API, and the Realtime API. Use this page as the consolidated API surface for creating clients, configuring parameters, sending media, and handling provider events.

For real-time voice scenarios, create an `OpenAI.RealtimeAPIClient`, bridge call media to it, and listen for `OpenAI.Events` plus `OpenAI.RealtimeAPIEvents`.

## Related guides

Learn how OpenAI fits into VoxEngine voice AI scenarios.

Start from a complete inbound OpenAI realtime scenario.

Use tool calls and function-call events in an OpenAI scenario.

Combine OpenAI with a separate realtime TTS provider.

## Contents

* &#x20;[Usage](#usage): required module import and high-level client flow.
* &#x20;[Factory functions](#factory-functions): create chat completions, responses, or realtime clients.
* &#x20;[Parameter types](#parameter-types): configuration objects used by OpenAI client factories.
* &#x20;[Client methods](#client-methods): methods grouped by client type.
* &#x20;[Events](#events): WebSocket media bridge events.
* &#x20;[RealtimeAPIEvents](#realtimeapievents): OpenAI Realtime server events and provider payload fields.

## Usage

Add the module before using the namespace:

```js
require(Modules.OpenAI);
```

Create the client for the API style you need, then call methods on that client instance. Realtime voice scenarios typically use `createRealtimeAPIClient`, `sendMediaTo`, and event listeners for Realtime API server messages.

## Factory functions

Use the tabs to choose the OpenAI API surface you are creating: Chat Completions for text chat completions, Responses for the newer Responses API, or Realtime for voice scenarios over WebSocket.

Creates a client for the Chat Completions API.

### &#x20;createChatCompletionsAPIClient

Creates a new [OpenAI.ChatCompletionsAPIClient](/api-reference/voxengine/open-ai#chatcompletionsapiclient) instance.

```ts
createChatCompletionsAPIClient(parameters: {
  statistics?: boolean;
  trace?: boolean;
  privacy?: boolean;
  apiKey: string;
  storeContext?: boolean;
  baseUrl?: string;
  project?: string;
  summaryModel?: string;
  summaryPrompt?: string;
}): Promise<OpenAI.ChatCompletionsAPIClient>
```

The required `parameters` object is typed as <code>OpenAI.Chat<wbr />Completions<wbr />APIClient<wbr />Parameters</code>.

**Parameters**

| Parameter                           | Type                                                                 | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ----------------------------------- | -------------------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `parameters`                        | <code>Chat<wbr />Completions<wbr />APIClient<wbr />Parameters</code> | ✓    | [OpenAI.ChatCompletionsAPIClient](/api-reference/voxengine/open-ai#chatcompletionsapiclient) parameters. Can be passed as arguments to the `OpenAI.createChatCompletionsAPIClient` method.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ↳ `statistics`                      | `boolean`                                                            | ✗    | Enables statistics functionality.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ↳ `trace`                           | `boolean`                                                            | ✗    | Whether to enable the tracing functionality. If tracing is enabled, a URL to the trace file appears in the 'websocket.created' message. The file contains all sent and received WebSocket messages in the plain text format. The file is uploaded to the S3 storage. NOTE: enable this only for diagnostic purposes. You can provide the trace file to our support team to help investigating issues.                                                                                                                                                                                                                                                                                                             |
| ↳ `privacy`                         | `boolean`                                                            | ✗    | Whether to enable the privacy functionality. If privacy is enabled, the logging for the WebSocket connection is disabled. NOTE: the default value is **false**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ↳ `apiKey`                          | `string`                                                             | ✓    | API key for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ↳ `storeContext`                    | `boolean`                                                            | ✗    | Whether to store the context in the client. The default value is **false**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ↳ `baseUrl`                         | `string`                                                             | ✗    | Base URL for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ↳ `project`                         | `string`                                                             | ✗    | Project for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ↳ `summaryModel`                    | `string`                                                             | ✗    | Model for the summary generation. The default value is **gpt-4o**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ↳ <code>summary<wbr />Prompt</code> | `string`                                                             | ✗    | Prompt for the summary generation. If not specified, the default prompt is used. The API Client automatically inserts the previous summary here. The default prompt is: `You are maintaining a running summary of an ongoing conversation. Below is: 1. The previous summary 2. The messages between user and assistant you need to summarize Provide a summary to reflect the information. ### Instructions: - Preserve important existing context from the previous summary - Integrate new key information, decisions, and developments - Remove outdated or redundant details - Avoid repeating unchanged information - Keep the summary concise and context-efficient - Maintain a neutral and factual tone` |

**Returns**

| Type                                                   | Description                                                                              |
| ------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
| <code>Promise\<OpenAI.ChatCompletionsAPIClient></code> | Resolves to the [`OpenAI.ChatCompletionsAPIClient`](#chatcompletionsapiclient) instance. |

Creates a client for the Responses API.

### &#x20;createResponsesAPIClient

Creates a new [OpenAI.ResponsesAPIClient](/api-reference/voxengine/open-ai#responsesapiclient) instance.

```ts
createResponsesAPIClient(parameters: {
  statistics?: boolean;
  trace?: boolean;
  privacy?: boolean;
  apiKey: string;
  storeContext?: boolean;
  baseUrl?: string;
  project?: string;
}): Promise<OpenAI.ResponsesAPIClient>
```

The required `parameters` object is typed as <code>OpenAI.ResponsesAPI<wbr />Client<wbr />Parameters</code>.

**Parameters**

| Parameter        | Type                                                    | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                           |
| ---------------- | ------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `parameters`     | <code>ResponsesAPI<wbr />Client<wbr />Parameters</code> | ✓    | [OpenAI.ResponsesAPIClient](/api-reference/voxengine/open-ai#responsesapiclient) parameters. Can be passed as arguments to the `OpenAI.createResponsesAPIClient` method.                                                                                                                                                                                                                              |
| ↳ `statistics`   | `boolean`                                               | ✗    | Enables statistics functionality.                                                                                                                                                                                                                                                                                                                                                                     |
| ↳ `trace`        | `boolean`                                               | ✗    | Whether to enable the tracing functionality. If tracing is enabled, a URL to the trace file appears in the 'websocket.created' message. The file contains all sent and received WebSocket messages in the plain text format. The file is uploaded to the S3 storage. NOTE: enable this only for diagnostic purposes. You can provide the trace file to our support team to help investigating issues. |
| ↳ `privacy`      | `boolean`                                               | ✗    | Whether to enable the privacy functionality. If privacy is enabled, the logging for the WebSocket connection is disabled. NOTE: the default value is **false**.                                                                                                                                                                                                                                       |
| ↳ `apiKey`       | `string`                                                | ✓    | The API key for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                       |
| ↳ `storeContext` | `boolean`                                               | ✗    | Whether to store the context in the client. The default value is **false**.                                                                                                                                                                                                                                                                                                                           |
| ↳ `baseUrl`      | `string`                                                | ✗    | The base URL for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                      |
| ↳ `project`      | `string`                                                | ✗    | The project for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                       |

**Returns**

| Type                                             | Description                                                                  |
| ------------------------------------------------ | ---------------------------------------------------------------------------- |
| <code>Promise\<OpenAI.ResponsesAPIClient></code> | Resolves to the [`OpenAI.ResponsesAPIClient`](#responsesapiclient) instance. |

Creates a client for realtime voice sessions over WebSocket.

### &#x20;createRealtimeAPIClient

Creates a new [OpenAI.RealtimeAPIClient](/api-reference/voxengine/open-ai#realtimeapiclient) instance.

```ts
createRealtimeAPIClient(parameters: {
  statistics?: boolean;
  trace?: boolean;
  privacy?: boolean;
  onWebSocketClose?: (event: object) => void;
  apiKey: string;
  model?: string;
  type?: OpenAI.RealtimeAPIClientType;
  baseUrl?: string;
}): Promise<OpenAI.RealtimeAPIClient>
```

The required `parameters` object is typed as <code>OpenAI.RealtimeAPI<wbr />Client<wbr />Parameters</code>.

**Parameters**

| Parameter                              | Type                                                    | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                           |
| -------------------------------------- | ------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `parameters`                           | <code>RealtimeAPI<wbr />Client<wbr />Parameters</code>  | ✓    | [OpenAI.RealtimeAPIClient](/api-reference/voxengine/open-ai#realtimeapiclient) parameters. Can be passed as arguments to the `OpenAI.createRealtimeAPIClient` method.                                                                                                                                                                                                                                 |
| ↳ `statistics`                         | `boolean`                                               | ✗    | Enables statistics functionality.                                                                                                                                                                                                                                                                                                                                                                     |
| ↳ `trace`                              | `boolean`                                               | ✗    | Whether to enable the tracing functionality. If tracing is enabled, a URL to the trace file appears in the 'websocket.created' message. The file contains all sent and received WebSocket messages in the plain text format. The file is uploaded to the S3 storage. NOTE: enable this only for diagnostic purposes. You can provide the trace file to our support team to help investigating issues. |
| ↳ `privacy`                            | `boolean`                                               | ✗    | Whether to enable the privacy functionality. If privacy is enabled, the logging for the WebSocket connection is disabled. NOTE: the default value is **false**.                                                                                                                                                                                                                                       |
| ↳ <code>onWebSocket<wbr />Close</code> | <code>(event: object) => void</code>                    | ✗    | A callback function that is called when the [WebSocket](/api-reference/voxengine/web-socket) connection is closed.                                                                                                                                                                                                                                                                                    |
| ↳ `apiKey`                             | `string`                                                | ✓    | The API key for the OpenAI Realtime API.                                                                                                                                                                                                                                                                                                                                                              |
| ↳ `model`                              | `string`                                                | ✗    | The model to use for OpenAI Realtime API processing. The default value is **gpt-realtime**.                                                                                                                                                                                                                                                                                                           |
| ↳ `type`                               | <code>OpenAI.<wbr />RealtimeAPI<wbr />ClientType</code> | ✗    | The type of the client. The default value is **OpenAI.RealtimeAPIClientType.REALTIME**.                                                                                                                                                                                                                                                                                                               |
| ↳ `baseUrl`                            | `string`                                                | ✗    | The base URL for the OpenAI Realtime API. The default value is **[https://api.openai.com/](https://api.openai.com/)**.                                                                                                                                                                                                                                                                                |

**Returns**

| Type                                            | Description                                                                |
| ----------------------------------------------- | -------------------------------------------------------------------------- |
| <code>Promise\<OpenAI.RealtimeAPIClient></code> | Resolves to the [`OpenAI.RealtimeAPIClient`](#realtimeapiclient) instance. |

## Parameter types

These parameter objects match the same three API families as the factory functions.

[OpenAI.ChatCompletionsAPIClient](/api-reference/voxengine/open-ai#chatcompletionsapiclient) parameters. Can be passed as arguments to the `OpenAI.createChatCompletionsAPIClient` method.

| Property                          | Type      | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------------------------- | --------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `apiKey`                          | `string`  | ✓    | API key for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `baseUrl`                         | `string`  | ✗    | Base URL for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `privacy`                         | `boolean` | ✗    | \_inherited from *WebSocketBasedClientParameters* Whether to enable the privacy functionality. If privacy is enabled, the logging for the WebSocket connection is disabled. NOTE: the default value is **false**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `project`                         | `string`  | ✗    | Project for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `statistics`                      | `boolean` | ✗    | \_inherited from *WebSocketBasedClientParameters* Enables statistics functionality.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `storeContext`                    | `boolean` | ✗    | Whether to store the context in the client. The default value is **false**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `summaryModel`                    | `string`  | ✗    | Model for the summary generation. The default value is **gpt-4o**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <code>summary<wbr />Prompt</code> | `string`  | ✗    | Prompt for the summary generation. If not specified, the default prompt is used. The API Client automatically inserts the previous summary here. The default prompt is: `You are maintaining a running summary of an ongoing conversation. Below is: 1. The previous summary 2. The messages between user and assistant you need to summarize Provide a summary to reflect the information. ### Instructions: - Preserve important existing context from the previous summary - Integrate new key information, decisions, and developments - Remove outdated or redundant details - Avoid repeating unchanged information - Keep the summary concise and context-efficient - Maintain a neutral and factual tone` |
| `trace`                           | `boolean` | ✗    | \_inherited from *WebSocketBasedClientParameters* Whether to enable the tracing functionality. If tracing is enabled, a URL to the trace file appears in the 'websocket.created' message. The file contains all sent and received WebSocket messages in the plain text format. The file is uploaded to the S3 storage. NOTE: enable this only for diagnostic purposes. You can provide the trace file to our support team to help investigating issues.                                                                                                                                                                                                                                                           |

[OpenAI.ResponsesAPIClient](/api-reference/voxengine/open-ai#responsesapiclient) parameters. Can be passed as arguments to the `OpenAI.createResponsesAPIClient` method.

| Property       | Type      | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| -------------- | --------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `apiKey`       | `string`  | ✓    | The API key for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `baseUrl`      | `string`  | ✗    | The base URL for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `privacy`      | `boolean` | ✗    | \_inherited from *WebSocketBasedClientParameters* Whether to enable the privacy functionality. If privacy is enabled, the logging for the WebSocket connection is disabled. NOTE: the default value is **false**.                                                                                                                                                                                                                                       |
| `project`      | `string`  | ✗    | The project for the OpenAI API.                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `statistics`   | `boolean` | ✗    | \_inherited from *WebSocketBasedClientParameters* Enables statistics functionality.                                                                                                                                                                                                                                                                                                                                                                     |
| `storeContext` | `boolean` | ✗    | Whether to store the context in the client. The default value is **false**.                                                                                                                                                                                                                                                                                                                                                                             |
| `trace`        | `boolean` | ✗    | \_inherited from *WebSocketBasedClientParameters* Whether to enable the tracing functionality. If tracing is enabled, a URL to the trace file appears in the 'websocket.created' message. The file contains all sent and received WebSocket messages in the plain text format. The file is uploaded to the S3 storage. NOTE: enable this only for diagnostic purposes. You can provide the trace file to our support team to help investigating issues. |

[OpenAI.RealtimeAPIClient](/api-reference/voxengine/open-ai#realtimeapiclient) parameters. Can be passed as arguments to the `OpenAI.createRealtimeAPIClient` method.

| Property                             | Type                                                    | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------------------------ | ------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `apiKey`                             | `string`                                                | ✓    | The API key for the OpenAI Realtime API.                                                                                                                                                                                                                                                                                                                                                                                                                |
| `baseUrl`                            | `string`                                                | ✗    | The base URL for the OpenAI Realtime API. The default value is **[https://api.openai.com/](https://api.openai.com/)**.                                                                                                                                                                                                                                                                                                                                  |
| `model`                              | `string`                                                | ✗    | The model to use for OpenAI Realtime API processing. The default value is **gpt-realtime**.                                                                                                                                                                                                                                                                                                                                                             |
| <code>onWebSocket<wbr />Close</code> | <code>(event: object) => void</code>                    | ✗    | \_inherited from *VoiceAIClientParameters* A callback function that is called when the [WebSocket](/api-reference/voxengine/web-socket) connection is closed.                                                                                                                                                                                                                                                                                           |
| `privacy`                            | `boolean`                                               | ✗    | \_inherited from *WebSocketBasedClientParameters* Whether to enable the privacy functionality. If privacy is enabled, the logging for the WebSocket connection is disabled. NOTE: the default value is **false**.                                                                                                                                                                                                                                       |
| `statistics`                         | `boolean`                                               | ✗    | \_inherited from *WebSocketBasedClientParameters* Enables statistics functionality.                                                                                                                                                                                                                                                                                                                                                                     |
| `trace`                              | `boolean`                                               | ✗    | \_inherited from *WebSocketBasedClientParameters* Whether to enable the tracing functionality. If tracing is enabled, a URL to the trace file appears in the 'websocket.created' message. The file contains all sent and received WebSocket messages in the plain text format. The file is uploaded to the S3 storage. NOTE: enable this only for diagnostic purposes. You can provide the trace file to our support team to help investigating issues. |
| `type`                               | <code>OpenAI.<wbr />RealtimeAPI<wbr />ClientType</code> | ✗    | The type of the client. The default value is **OpenAI.RealtimeAPIClientType.REALTIME**.                                                                                                                                                                                                                                                                                                                                                                 |

## Client methods

Use the tabs to switch between Chat Completions, Responses, and Realtime client methods.

### &#x20;addEventListener

Adds a handler for the specified [OpenAI.ChatCompletionsAPIEvents](/api-reference/voxengine/open-ai#chatcompletionsapievents) or [OpenAI.Events](/api-reference/voxengine/open-ai#events) event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.

```ts
addEventListener(event: OpenAI.Events | OpenAI.ChatCompletionsAPIEvents | string, callback: (event: object) => any): void
```

**Parameters**

| Parameter  | Type                                                                                                | Req. | Description                                   |
| ---------- | --------------------------------------------------------------------------------------------------- | ---- | --------------------------------------------- |
| `event`    | <code>OpenAI.<wbr />Events \| OpenAI.<wbr />Chat<wbr />Completions<wbr />APIEvents \| string</code> | ✓    | Event constant or event name to subscribe to. |
| `callback` | <code>(event: object) => any</code>                                                                 | ✓    | Function called when the event is emitted.    |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;close

Closes the OpenAI connection (over WebSocket) or connection attempt.

```ts
close(): void
```

**Parameters**

This method does not accept parameters.

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;createChatCompletions

Creates a model response for the given chat conversation. [https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create](https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create)

```ts
createChatCompletions(parameters: Object): void
```

**Parameters**

| Parameter    | Type     | Req. | Description |
| ------------ | -------- | ---- | ----------- |
| `parameters` | `Object` | ✓    |             |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;id

Returns the ChatCompletionsAPIClient id.

```ts
id(): string
```

**Parameters**

This method does not accept parameters.

**Returns**

| Type     | Description                 |
| -------- | --------------------------- |
| `string` | The requested string value. |

### &#x20;removeEventListener

Removes a handler for the specified [OpenAI.ChatCompletionsAPIEvents](/api-reference/voxengine/open-ai#chatcompletionsapievents) or [OpenAI.Events](/api-reference/voxengine/open-ai#events) event.

```ts
removeEventListener(event: OpenAI.Events | OpenAI.ChatCompletionsAPIEvents | string, callback?: (event: object) => any): void
```

**Parameters**

| Parameter  | Type                                                                                                | Req. | Description                                   |
| ---------- | --------------------------------------------------------------------------------------------------- | ---- | --------------------------------------------- |
| `event`    | <code>OpenAI.<wbr />Events \| OpenAI.<wbr />Chat<wbr />Completions<wbr />APIEvents \| string</code> | ✓    | Event constant or event name to subscribe to. |
| `callback` | <code>(event: object) => any</code>                                                                 | ✗    | Function called when the event is emitted.    |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;webSocketId

Returns the OpenAI WebSocket id.

```ts
webSocketId(): string
```

**Parameters**

This method does not accept parameters.

**Returns**

| Type     | Description                 |
| -------- | --------------------------- |
| `string` | The requested string value. |

### &#x20;addEventListener

Adds a handler for the specified [OpenAI.ResponsesAPIEvents](/api-reference/voxengine/open-ai#responsesapievents) or [OpenAI.Events](/api-reference/voxengine/open-ai#events) event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.

```ts
addEventListener(event: OpenAI.Events | OpenAI.ResponsesAPIEvents | string, callback: (event: object) => any): void
```

**Parameters**

| Parameter  | Type                                                                                   | Req. | Description                                   |
| ---------- | -------------------------------------------------------------------------------------- | ---- | --------------------------------------------- |
| `event`    | <code>OpenAI.<wbr />Events \| OpenAI.<wbr />ResponsesAPI<wbr />Events \| string</code> | ✓    | Event constant or event name to subscribe to. |
| `callback` | <code>(event: object) => any</code>                                                    | ✓    | Function called when the event is emitted.    |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;close

Closes the OpenAI connection (over WebSocket) or connection attempt.

```ts
close(): void
```

**Parameters**

This method does not accept parameters.

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;createResponses

Creates a model response. [https://developers.openai.com/api/reference/resources/responses/methods/create](https://developers.openai.com/api/reference/resources/responses/methods/create)

```ts
createResponses(parameters: Object): void
```

**Parameters**

| Parameter    | Type     | Req. | Description |
| ------------ | -------- | ---- | ----------- |
| `parameters` | `Object` | ✓    |             |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;id

Returns the ResponsesAPIClient id.

```ts
id(): string
```

**Parameters**

This method does not accept parameters.

**Returns**

| Type     | Description                 |
| -------- | --------------------------- |
| `string` | The requested string value. |

### &#x20;removeEventListener

Removes a handler for the specified [OpenAI.ResponsesAPIEvents](/api-reference/voxengine/open-ai#responsesapievents) or [OpenAI.Events](/api-reference/voxengine/open-ai#events) event.

```ts
removeEventListener(event: OpenAI.Events | OpenAI.ResponsesAPIEvents | string, callback?: (event: object) => any): void
```

**Parameters**

| Parameter  | Type                                                                                   | Req. | Description                                   |
| ---------- | -------------------------------------------------------------------------------------- | ---- | --------------------------------------------- |
| `event`    | <code>OpenAI.<wbr />Events \| OpenAI.<wbr />ResponsesAPI<wbr />Events \| string</code> | ✓    | Event constant or event name to subscribe to. |
| `callback` | <code>(event: object) => any</code>                                                    | ✗    | Function called when the event is emitted.    |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;webSocketId

Returns the OpenAI WebSocket id.

```ts
webSocketId(): string
```

**Parameters**

This method does not accept parameters.

**Returns**

| Type     | Description                 |
| -------- | --------------------------- |
| `string` | The requested string value. |

### &#x20;addEventListener

Adds a handler for the specified [OpenAI.RealtimeAPIEvents](/api-reference/voxengine/open-ai#realtimeapievents) or [OpenAI.Events](/api-reference/voxengine/open-ai#events) event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.

```ts
addEventListener(event: OpenAI.Events | OpenAI.RealtimeAPIEvents | string, callback: (event: object) => any): void
```

**Parameters**

| Parameter  | Type                                                                                  | Req. | Description                                   |
| ---------- | ------------------------------------------------------------------------------------- | ---- | --------------------------------------------- |
| `event`    | <code>OpenAI.<wbr />Events \| OpenAI.<wbr />RealtimeAPI<wbr />Events \| string</code> | ✓    | Event constant or event name to subscribe to. |
| `callback` | <code>(event: object) => any</code>                                                   | ✓    | Function called when the event is emitted.    |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;clearMediaBuffer

Clears the OpenAI WebSocket media buffer.

```ts
clearMediaBuffer(parameters?: ClearMediaBufferParameters): void
```

**Parameters**

| Parameter    | Type                                                  | Req. | Description |
| ------------ | ----------------------------------------------------- | ---- | ----------- |
| `parameters` | <code>ClearMedia<wbr />Buffer<wbr />Parameters</code> | ✗    |             |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;close

Closes the OpenAI connection (over WebSocket) or connection attempt.

```ts
close(): void
```

**Parameters**

This method does not accept parameters.

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;conversationItemCreate

Add a new Item to the Conversation's context. [https://platform.openai.com/docs/api-reference/realtime-client-events/conversation/item/create](https://platform.openai.com/docs/api-reference/realtime-client-events/conversation/item/create)

```ts
conversationItemCreate(parameters: Object): void
```

**Parameters**

| Parameter    | Type     | Req. | Description |
| ------------ | -------- | ---- | ----------- |
| `parameters` | `Object` | ✓    |             |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;conversationItemDelete

Send this event when you want to remove any item from the conversation history. [https://platform.openai.com/docs/api-reference/realtime-client-events/conversation/item/delete](https://platform.openai.com/docs/api-reference/realtime-client-events/conversation/item/delete)

```ts
conversationItemDelete(parameters: Object): void
```

**Parameters**

| Parameter    | Type     | Req. | Description |
| ------------ | -------- | ---- | ----------- |
| `parameters` | `Object` | ✓    |             |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;conversationItemRetrieve

Send this event when you want to retrieve the server's representation of a specific item in the conversation history. [https://platform.openai.com/docs/api-reference/realtime-client-events/conversation/item/retrieve](https://platform.openai.com/docs/api-reference/realtime-client-events/conversation/item/retrieve)

```ts
conversationItemRetrieve(parameters: Object): void
```

**Parameters**

| Parameter    | Type     | Req. | Description |
| ------------ | -------- | ---- | ----------- |
| `parameters` | `Object` | ✓    |             |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;conversationItemTruncate

Send this event to truncate a previous assistant message’s audio. [https://platform.openai.com/docs/api-reference/realtime-client-events/conversation/item/truncate](https://platform.openai.com/docs/api-reference/realtime-client-events/conversation/item/truncate)

```ts
conversationItemTruncate(parameters: Object): void
```

**Parameters**

| Parameter    | Type     | Req. | Description |
| ------------ | -------- | ---- | ----------- |
| `parameters` | `Object` | ✓    |             |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;id

Returns the RealtimeAPIClient id.

```ts
id(): string
```

**Parameters**

This method does not accept parameters.

**Returns**

| Type     | Description                 |
| -------- | --------------------------- |
| `string` | The requested string value. |

### &#x20;inputAudioBufferClear

Send this event to clear the audio bytes in the buffer. [https://platform.openai.com/docs/api-reference/realtime-client-events/input\_audio\_buffer/clear](https://platform.openai.com/docs/api-reference/realtime-client-events/input_audio_buffer/clear)

```ts
inputAudioBufferClear(parameters: Object): void
```

**Parameters**

| Parameter    | Type     | Req. | Description |
| ------------ | -------- | ---- | ----------- |
| `parameters` | `Object` | ✓    |             |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;removeEventListener

Removes a handler for the specified [OpenAI.RealtimeAPIEvents](/api-reference/voxengine/open-ai#realtimeapievents) or [OpenAI.Events](/api-reference/voxengine/open-ai#events) event.

```ts
removeEventListener(event: OpenAI.Events | OpenAI.RealtimeAPIEvents | string, callback?: (event: object) => any): void
```

**Parameters**

| Parameter  | Type                                                                                  | Req. | Description                                   |
| ---------- | ------------------------------------------------------------------------------------- | ---- | --------------------------------------------- |
| `event`    | <code>OpenAI.<wbr />Events \| OpenAI.<wbr />RealtimeAPI<wbr />Events \| string</code> | ✓    | Event constant or event name to subscribe to. |
| `callback` | <code>(event: object) => any</code>                                                   | ✗    | Function called when the event is emitted.    |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;responseCancel

Send this event to cancel an in-progress response. [https://platform.openai.com/docs/api-reference/realtime-client-events/response/cancel](https://platform.openai.com/docs/api-reference/realtime-client-events/response/cancel)

```ts
responseCancel(parameters: Object): void
```

**Parameters**

| Parameter    | Type     | Req. | Description |
| ------------ | -------- | ---- | ----------- |
| `parameters` | `Object` | ✓    |             |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;responseCreate

This event instructs the server to create a Response, which means triggering model inference. [https://platform.openai.com/docs/api-reference/realtime-client-events/response/create](https://platform.openai.com/docs/api-reference/realtime-client-events/response/create)

```ts
responseCreate(parameters: Object): void
```

**Parameters**

| Parameter    | Type     | Req. | Description                                                                                                                                                                                            |
| ------------ | -------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `parameters` | `Object` | ✓    | OpenAI Realtime response.create client event. Triggers model inference for a new assistant response.  See the [partner API reference](https://developers.openai.com/api/reference/resources/realtime). |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

Example `parameters`:

```json
{
  "type": "response.create"
}
```

### &#x20;sendMediaTo

Starts sending media from the OpenAI (via WebSocket) to the media unit. OpenAI works in real time.

```ts
sendMediaTo(mediaUnit: VoxMediaUnit, parameters?: SendMediaParameters): void
```

**Parameters**

| Parameter    | Type                                    | Req. | Description |
| ------------ | --------------------------------------- | ---- | ----------- |
| `mediaUnit`  | `VoxMediaUnit`                          | ✓    |             |
| `parameters` | <code>SendMedia<wbr />Parameters</code> | ✗    |             |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;sessionUpdate

Send this event to update the session’s configuration. [https://platform.openai.com/docs/api-reference/realtime-client-events/session/update](https://platform.openai.com/docs/api-reference/realtime-client-events/session/update)

```ts
sessionUpdate(parameters: Object): void
```

**Parameters**

| Parameter    | Type     | Req. | Description                                                                                                                                                                                                          |
| ------------ | -------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `parameters` | `Object` | ✓    | OpenAI Realtime session.update client event. Updates session configuration such as model, instructions, and tools.  See the [partner API reference](https://developers.openai.com/api/reference/resources/realtime). |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

Example `parameters`:

```json
{
  "type": "session.update"
}
```

### &#x20;stopMediaTo

Stops sending media from the OpenAI (via WebSocket) to the media unit.

```ts
stopMediaTo(mediaUnit: VoxMediaUnit): void
```

**Parameters**

| Parameter   | Type           | Req. | Description |
| ----------- | -------------- | ---- | ----------- |
| `mediaUnit` | `VoxMediaUnit` | ✓    |             |

**Returns**

| Type   | Description              |
| ------ | ------------------------ |
| `void` | Does not return a value. |

### &#x20;webSocketId

Returns the OpenAI WebSocket id.

```ts
webSocketId(): string
```

**Parameters**

This method does not accept parameters.

**Returns**

| Type     | Description                 |
| -------- | --------------------------- |
| `string` | The requested string value. |

## Events

Event tabs mirror the same API families: media bridge events apply to realtime WebSocket media, while the API-specific tabs document provider responses for each client type.

### Media bridge events

These events describe audio received through the OpenAI WebSocket media bridge.

#### &#x20;WebSocketMediaStarted

Triggered when the audio stream sent by a third party through an OpenAI WebSocket is started playing.

Event constant: `Events.WebSocketMediaStarted`

**Payload**

| Field                                | Type                                                                                                         | Req. | Description                                                                                                                                                                                                                                                                      |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `client`                             | <code>RealtimeAPI<wbr />Client \| ResponsesAPI<wbr />Client \| Chat<wbr />Completions<wbr />APIClient</code> | ✓    | The [OpenAI.RealtimeAPIClient](/api-reference/voxengine/open-ai#realtimeapiclient) or [OpenAI.ResponsesAPIClient](/api-reference/voxengine/open-ai#responsesapiclient) \| [OpenAI.ChatCompletionsAPIClient](/api-reference/voxengine/open-ai#chatcompletionsapiclient) instance. |
| `tag`                                | `string`                                                                                                     | ✗    | Special tag to name audio streams sent over one WebSocket connection. With it, one can send 2 audios to 2 different media units at the same time.                                                                                                                                |
| `encoding`                           | `string`                                                                                                     | ✗    | Audio encoding formats.                                                                                                                                                                                                                                                          |
| <code>custom<wbr />Parameters</code> | <code>\{ \[key: string]: string }</code>                                                                     | ✗    | Custom parameters.                                                                                                                                                                                                                                                               |

#### &#x20;WebSocketMediaEnded

Triggers after the end of the audio stream sent by a third party through an OpenAI WebSocket (**1 second of silence**).

Event constant: `Events.WebSocketMediaEnded`

**Payload**

| Field       | Type                                                                                                         | Req. | Description                                                                                                                                                                                                                                                                      |
| ----------- | ------------------------------------------------------------------------------------------------------------ | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `client`    | <code>RealtimeAPI<wbr />Client \| ResponsesAPI<wbr />Client \| Chat<wbr />Completions<wbr />APIClient</code> | ✓    | The [OpenAI.RealtimeAPIClient](/api-reference/voxengine/open-ai#realtimeapiclient) or [OpenAI.ResponsesAPIClient](/api-reference/voxengine/open-ai#responsesapiclient) \| [OpenAI.ChatCompletionsAPIClient](/api-reference/voxengine/open-ai#chatcompletionsapiclient) instance. |
| `tag`       | `string`                                                                                                     | ✗    | Special tag to name audio streams sent over one WebSocket connection. With it, one can send 2 audios to 2 different media units at the same time.                                                                                                                                |
| `mediaInfo` | <code>WebSocket<wbr />MediaInfo</code>                                                                       | ✗    | Information about the audio stream that can be obtained after the stream stops or pauses (**1 second of silence**).                                                                                                                                                              |

### ChatCompletionsAPIEvents

These events describe responses from the Chat Completions API client.

**All ChatCompletionsAPIEvents callbacks receive these common fields:**

| Field    | Type                                                              | Description                                   |
| -------- | ----------------------------------------------------------------- | --------------------------------------------- |
| `client` | <code>OpenAI.<wbr />Chat<wbr />Completions<wbr />APIClient</code> | The OpenAI.ChatCompletionsAPIClient instance. |
| `data`   | `Object`                                                          | Pass-through provider event payload.          |

Per-event payload tables below show only event-specific fields (and any provider payload enrichment for `data`).

<a id="-unknown" />

The unknown event.

Event constant: `ChatCompletionsAPIEvents.Unknown`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-chunk" />

Represents a streamed chunk of a chat completion response returned by the model, based on the provided input. [https://developers.openai.com/api/reference/resources/chat/subresources/completions#(resource)%20chat.completions%20%3E%20(model)%20chat\_completion\_chunk%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/chat/subresources/completions#\(resource\)%20chat.completions%20%3E%20\(model\)%20chat_completion_chunk%20%3E%20\(schema\))

Event constant: `ChatCompletionsAPIEvents.Chunk`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-content" />

The chat completion content event.

Event constant: `ChatCompletionsAPIEvents.Content`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-contentdelta" />

The chat completion content delta event.

Event constant: `ChatCompletionsAPIEvents.ContentDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-contentdone" />

The chat completion content done event.

Event constant: `ChatCompletionsAPIEvents.ContentDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-refusaldelta" />

The chat completion refusal delta event.

Event constant: `ChatCompletionsAPIEvents.RefusalDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-refusaldone" />

The chat completion refusal done event.

Event constant: `ChatCompletionsAPIEvents.RefusalDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-functiontoolcallargumentsdelta" />

The chat completion function tool call arguments delta event.

Event constant: `ChatCompletionsAPIEvents.FunctionToolCallArgumentsDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-functiontoolcallargumentsdone" />

The chat completion function tool call arguments done event.

Event constant: `ChatCompletionsAPIEvents.FunctionToolCallArgumentsDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-logprobscontentdelta" />

The chat completion log probs content delta event.

Event constant: `ChatCompletionsAPIEvents.LogProbsContentDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-logprobscontentdone" />

The chat completion log probs content done event.

Event constant: `ChatCompletionsAPIEvents.LogProbsContentDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-logprobsrefusaldelta" />

The chat completion log probs refusal delta event.

Event constant: `ChatCompletionsAPIEvents.LogProbsRefusalDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-logprobsrefusaldone" />

The chat completion log probs refusal done event.

Event constant: `ChatCompletionsAPIEvents.LogProbsRefusalDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-chatcompletionsapierror" />

Contains Chat Completions API error.

Event constant: `ChatCompletionsAPIEvents.ChatCompletionsAPIError`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-connectorinformation" />

Contains information about connector.

Event constant: `ChatCompletionsAPIEvents.ConnectorInformation`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

### ResponsesAPIEvents

These events describe responses from the Responses API client.

**All ResponsesAPIEvents callbacks receive these common fields:**

| Field    | Type                                                 | Description                             |
| -------- | ---------------------------------------------------- | --------------------------------------- |
| `client` | <code>OpenAI.<wbr />ResponsesAPI<wbr />Client</code> | The OpenAI.ResponsesAPIClient instance. |
| `data`   | `Object`                                             | Pass-through provider event payload.    |

Per-event payload tables below show only event-specific fields (and any provider payload enrichment for `data`).

<a id="-unknown" />

The unknown event.

Event constant: `ResponsesAPIEvents.Unknown`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsecodeinterpretercallcodedelta" />

Emitted when a partial code snippet is streamed by the code interpreter. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseCodeInterpreterCallCodeDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsecodeinterpretercallcodedone" />

Emitted when the code snippet is finalized by the code interpreter. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseCodeInterpreterCallCodeDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsecodeinterpretercallcompleted" />

Emitted when the code interpreter call is completed. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseCodeInterpreterCallCompleted`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsecodeinterpretercallinprogress" />

Emitted when a code interpreter call is in progress. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseCodeInterpreterCallInProgress`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsecodeinterpretercallinterpreting" />

Emitted when the code interpreter is actively interpreting the code snippet. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseCodeInterpreterCallInterpreting`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsecompleted" />

Emitted when the model response is complete. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseCompleted`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsecontentpartadded" />

Emitted when a new content part is added. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseContentPartAdded`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsecontentpartdone" />

Emitted when a content part is done. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseContentPartDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsecreated" />

An event that is emitted when a response is created. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseCreated`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responseerror" />

Emitted when an error occurs. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseError`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsefilesearchcallcompleted" />

Emitted when a file search call is completed (results found). [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseFileSearchCallCompleted`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsefilesearchcallinprogress" />

Emitted when a file search call is initiated. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseFileSearchCallInProgress`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsefilesearchcallsearching" />

Emitted when a file search is currently searching. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseFileSearchCallSearching`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsefunctioncallargumentsdelta" />

Emitted when there is a partial function-call arguments delta. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseFunctionCallArgumentsDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsefunctioncallargumentsdone" />

Emitted when function-call arguments are finalized. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseFunctionCallArgumentsDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responseinprogress" />

Emitted when the response is in progress. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseInProgress`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsefailed" />

An event that is emitted when a response fails. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseFailed`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responseincomplete" />

An event that is emitted when a response finishes as incomplete. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseIncomplete`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responseoutputitemadded" />

Emitted when a new output item is added. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseOutputItemAdded`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responseoutputitemdone" />

Emitted when an output item is marked done. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseOutputItemDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsereasoningsummarypartadded" />

Emitted when a new reasoning summary part is added. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseReasoningSummaryPartAdded`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsereasoningsummarypartdone" />

Emitted when a reasoning summary part is completed. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseReasoningSummaryPartDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsereasoningsummarytextdelta" />

Emitted when a delta is added to a reasoning summary text. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseReasoningSummaryTextDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsereasoningsummarytextdone" />

Emitted when a reasoning summary text is completed. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseReasoningSummaryTextDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsereasoningtextdelta" />

Emitted when a delta is added to a reasoning text. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseReasoningTextDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsereasoningtextdone" />

Emitted when a reasoning text is completed. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseReasoningTextDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responserefusaldelta" />

Emitted when there is a partial refusal text. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseRefusalDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responserefusaldone" />

Emitted when refusal text is finalized. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseRefusalDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsetextdelta" />

Emitted when there is an additional text delta. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseTextDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsetextdone" />

Emitted when text content is finalized. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseTextDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsewebsearchcallcompleted" />

Emitted when a web search call is completed. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseWebSearchCallCompleted`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsewebsearchcallinprogress" />

Emitted when a web search call is initiated. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseWebSearchCallInProgress`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsewebsearchcallsearching" />

Emitted when a web search call is executing. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseWebSearchCallSearching`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responseimagegencallcompleted" />

Emitted when an image generation tool call has completed and the final image is available. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseImageGenCallCompleted`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responseimagegencallgenerating" />

Emitted when an image generation tool call is actively generating an image (intermediate state). [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseImageGenCallGenerating`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responseimagegencallinprogress" />

Emitted when an image generation tool call is in progress. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseImageGenCallInProgress`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responseimagegencallpartialimage" />

Emitted when a partial image is available during image generation streaming. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseImageGenCallPartialImage`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcpcallargumentsdelta" />

Emitted when there is a delta (partial update) to the arguments of an MCP tool call. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseMCPCallArgumentsDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcpcallargumentsdone" />

Emitted when the arguments for an MCP tool call are finalized. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseMCPCallArgumentsDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcpcallcompleted" />

Emitted when an MCP tool call has completed successfully. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseMCPCallCompleted`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcpcallfailed" />

Emitted when an MCP tool call has failed. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseMCPCallFailed`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcpcallinprogress" />

Emitted when an MCP tool call is in progress. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseMCPCallInProgress`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcplisttoolscompleted" />

Emitted when the list of available MCP tools has been successfully retrieved. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseMCPListToolsCompleted`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcplisttoolsfailed" />

Emitted when the attempt to list available MCP tools has failed. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseMCPListToolsFailed`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcplisttoolsinprogress" />

Emitted when the system is in the process of retrieving the list of available MCP tools. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseMCPListToolsInProgress`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responseoutputtextannotationadded" />

Emitted when an annotation is added to output text content. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseOutputTextAnnotationAdded`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsequeued" />

Emitted when a response is queued and waiting to be processed. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseQueued`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsecustomtoolcallinputdelta" />

Event representing a delta (partial update) to the input of a custom tool call. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseCustomToolCallInputDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsecustomtoolcallinputdone" />

Event indicating that input for a custom tool call is complete. [https://developers.openai.com/api/reference/resources/responses#(resource)%20responses%20%3E%20(model)%20response\_stream\_event%20%3E%20(schema)](https://developers.openai.com/api/reference/resources/responses#\(resource\)%20responses%20%3E%20\(model\)%20response_stream_event%20%3E%20\(schema\))

Event constant: `ResponsesAPIEvents.ResponseCustomToolCallInputDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsesapierror" />

Contains Responses API error.

Event constant: `ResponsesAPIEvents.ResponsesAPIError`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-connectorinformation" />

Contains information about connector.

Event constant: `ResponsesAPIEvents.ConnectorInformation`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

### RealtimeAPIEvents

These events mirror server messages from the OpenAI Realtime API. The `data` field contains the provider event payload.

**All RealtimeAPIEvents callbacks receive these common fields:**

| Field    | Type                                                | Description                                        |
| -------- | --------------------------------------------------- | -------------------------------------------------- |
| `client` | <code>OpenAI.<wbr />RealtimeAPI<wbr />Client</code> | The OpenAI.RealtimeAPIClient instance.             |
| `data`   | `Object`                                            | Pass-through OpenAI Realtime server event payload. |

Per-event payload tables below show only event-specific fields (and any provider payload enrichment for `data`).

<a id="-unknown" />

The unknown event.

Event constant: `RealtimeAPIEvents.Unknown`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-httpresponse" />

The HTTP response event.

Event constant: `RealtimeAPIEvents.HTTPResponse`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-error" />

Returned when an error occurs, which could be a client problem or a server problem. [https://platform.openai.com/docs/api-reference/realtime-server-events/error](https://platform.openai.com/docs/api-reference/realtime-server-events/error)

Event constant: `RealtimeAPIEvents.Error`

**Payload**

| Field           | Type                              | Req. | Description                                                                                                                                                                                                                                                                                                                                           |
| --------------- | --------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`          | `Object`                          | ✗    | Returned when an error occurs, which could be a client problem or a server problem. Most errors are recoverable and the session will stay open, we recommend to implementors to monitor and log error messages by default. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#error). |
| `data.error`    | <code>Realtime<wbr />Error</code> | ✓    | Details of the error.                                                                                                                                                                                                                                                                                                                                 |
| `data.event_id` | `string`                          | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                    |
| `data.type`     | `"error"`                         | ✓    | The event type, must be `error`.                                                                                                                                                                                                                                                                                                                      |

Example `data`:

```json
{
  "type": "error",
  "error": {},
  "event_id": "string"
}
```

<a id="-sessioncreated" />

Returned when a Session is created. [https://platform.openai.com/docs/api-reference/realtime-server-events/session/created](https://platform.openai.com/docs/api-reference/realtime-server-events/session/created)

Event constant: `RealtimeAPIEvents.SessionCreated`

**Payload**

| Field           | Type                                                                                                                                    | Req. | Description                                                                                                                                                                                                                                                                                                               |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`          | `Object`                                                                                                                                | ✗    | Returned when a Session is created. Emitted automatically when a new connection is established as the first server event. This event will contain the default Session configuration. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#session-created). |
| `data.event_id` | `string`                                                                                                                                | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                        |
| `data.session`  | <code>Realtime<wbr />Session<wbr />Create<wbr />Request \| Realtime<wbr />Transcription<wbr />Session<wbr />Create<wbr />Request</code> | ✓    | The session configuration.                                                                                                                                                                                                                                                                                                |
| `data.type`     | <code>"session.<wbr />created"</code>                                                                                                   | ✓    | The event type, must be `session.created`.                                                                                                                                                                                                                                                                                |

Example `data`:

```json
{
  "type": "session.created",
  "event_id": "string",
  "session": {}
}
```

<a id="-sessionupdated" />

Returned when a session is updated with a session.update event, unless there is an error. [https://platform.openai.com/docs/api-reference/realtime-server-events/session/updated](https://platform.openai.com/docs/api-reference/realtime-server-events/session/updated)

Event constant: `RealtimeAPIEvents.SessionUpdated`

**Payload**

| Field           | Type                                                                                                                                    | Req. | Description                                                                                                                                                                                                                      |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`          | `Object`                                                                                                                                | ✗    | Returned when a session is updated with a `session.update` event, unless there is an error. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#session-updated). |
| `data.event_id` | `string`                                                                                                                                | ✓    | The unique ID of the server event.                                                                                                                                                                                               |
| `data.session`  | <code>Realtime<wbr />Session<wbr />Create<wbr />Request \| Realtime<wbr />Transcription<wbr />Session<wbr />Create<wbr />Request</code> | ✓    | The session configuration.                                                                                                                                                                                                       |
| `data.type`     | <code>"session.<wbr />updated"</code>                                                                                                   | ✓    | The event type, must be `session.updated`.                                                                                                                                                                                       |

Example `data`:

```json
{
  "type": "session.updated",
  "event_id": "string",
  "session": {}
}
```

<a id="-conversationitemadded" />

Sent by the server when an Item is added to the default Conversation. [https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/added](https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/added)

Event constant: `RealtimeAPIEvents.ConversationItemAdded`

**Payload**

| Field                   | Type                                                 | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ----------------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `data`                  | `Object`                                             | ✗    | Sent by the server when an Item is added to the default Conversation. This can happen in several cases: - When the client sends a `conversation.item.create` event. - When the input audio buffer is committed. In this case the item will be a user message containing the audio from the buffer. - When the model is generating a Response. In this case the `conversation.item.added` event will be sent when the model starts generating a specific Item, and thus it will not yet have any content (and `status` will be `in_progress`). The event will include the full content of the Item (except when model is generating a Response) except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if necessary. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#conversation-item-added). |
| `data.event_id`         | `string`                                             | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `data.item`             | <code>Conversation<wbr />Item</code>                 | ✓    | A single item within a Realtime conversation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `data.type`             | <code>"conversation.<wbr />item.<wbr />added"</code> | ✓    | The event type, must be `conversation.item.added`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `data.previous_item_id` | <code>string \| null</code>                          | ✓    | The ID of the item that precedes this one, if any. This is used to maintain ordering when items are inserted.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

Example `data`:

```json
{
  "type": "conversation.item.added",
  "event_id": "string",
  "item": {}
}
```

<a id="-conversationitemdone" />

Returned when a conversation item is finalized. [https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/done](https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/done)

Event constant: `RealtimeAPIEvents.ConversationItemDone`

**Payload**

| Field                   | Type                                                | Req. | Description                                                                                                                                                                                                                                                                                                                                                   |
| ----------------------- | --------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`                  | `Object`                                            | ✗    | Returned when a conversation item is finalized. The event will include the full content of the Item except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if needed. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#conversation-item-done). |
| `data.event_id`         | `string`                                            | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                            |
| `data.item`             | <code>Conversation<wbr />Item</code>                | ✓    | A single item within a Realtime conversation.                                                                                                                                                                                                                                                                                                                 |
| `data.type`             | <code>"conversation.<wbr />item.<wbr />done"</code> | ✓    | The event type, must be `conversation.item.done`.                                                                                                                                                                                                                                                                                                             |
| `data.previous_item_id` | <code>string \| null</code>                         | ✓    | The ID of the item that precedes this one, if any. This is used to maintain ordering when items are inserted.                                                                                                                                                                                                                                                 |

Example `data`:

```json
{
  "type": "conversation.item.done",
  "event_id": "string",
  "item": {}
}
```

<a id="-conversationitemretrieved" />

Returned when a conversation item is retrieved with conversation.item.retrieve. [https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/retrieved](https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/retrieved)

Event constant: `RealtimeAPIEvents.ConversationItemRetrieved`

**Payload**

| Field           | Type                                                     | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| --------------- | -------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`          | `Object`                                                 | ✗    | Returned when a conversation item is retrieved with `conversation.item.retrieve`. This is provided as a way to fetch the server's representation of an item, for example to get access to the post-processed audio data after noise cancellation and VAD. It includes the full content of the Item, including audio data. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#conversation-item-retrieved). |
| `data.event_id` | `string`                                                 | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `data.item`     | <code>Conversation<wbr />Item</code>                     | ✓    | A single item within a Realtime conversation.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `data.type`     | <code>"conversation.<wbr />item.<wbr />retrieved"</code> | ✓    | The event type, must be `conversation.item.retrieved`.                                                                                                                                                                                                                                                                                                                                                                                                                     |

Example `data`:

```json
{
  "type": "conversation.item.retrieved",
  "event_id": "string",
  "item": {}
}
```

<a id="-conversationiteminputaudiotranscriptioncompleted" />

This event is the output of audio transcription for user audio written to the user audio buffer. [https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/input\_audio\_transcription/completed](https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/input_audio_transcription/completed)

Event constant: `RealtimeAPIEvents.ConversationItemInputAudioTranscriptionCompleted`

**Payload**

| Field                | Type                                                                                              | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| -------------------- | ------------------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`               | `Object`                                                                                          | ✗    | This event is the output of audio transcription for user audio written to the user audio buffer. Transcription begins when the input audio buffer is committed by the client or server (when VAD is enabled). Transcription runs asynchronously with Response creation, so this event may come before or after the Response events. Realtime API models accept audio natively, and thus input transcription is a separate process run on a separate ASR (Automatic Speech Recognition) model. The transcript may diverge somewhat from the model's interpretation, and should be treated as a rough guide. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#conversation-item-input-audio-transcription-completed). |
| `data.content_index` | `number`                                                                                          | ✓    | The index of the content part containing the audio.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `data.event_id`      | `string`                                                                                          | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `data.item_id`       | `string`                                                                                          | ✓    | The ID of the item containing the audio that is being transcribed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `data.transcript`    | `string`                                                                                          | ✓    | The transcribed text.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `data.type`          | <code>"conversation.<wbr />item.<wbr />input\_audio\_transcription.<wbr />completed"</code>       | ✓    | The event type, must be `conversation.item.input_audio_transcription.completed`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `data.usage`         | <code>Transcript<wbr />TextUsage<wbr />Tokens \| Transcript<wbr />TextUsage<wbr />Duration</code> | ✓    | Usage statistics for the transcription, this is billed according to the ASR model's pricing rather than the realtime model's pricing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `data.logprobs`      | <code>LogProb<wbr />Properties\[] \| null</code>                                                  | ✓    | The log probabilities of the transcription.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

Example `data`:

```json
{
  "type": "conversation.item.input_audio_transcription.completed",
  "content_index": 0,
  "event_id": "string",
  "item_id": "string",
  "transcript": "string",
  "usage": {}
}
```

<a id="-conversationiteminputaudiotranscriptiondelta" />

Returned when the text value of an input audio transcription content part is updated with incremental transcription results. [https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/input\_audio\_transcription/delta](https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/input_audio_transcription/delta)

Event constant: `RealtimeAPIEvents.ConversationItemInputAudioTranscriptionDelta`

**Payload**

| Field                | Type                                                                                    | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                             |
| -------------------- | --------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`               | `Object`                                                                                | ✗    | Returned when the text value of an input audio transcription content part is updated with incremental transcription results. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#conversation-item-input-audio-transcription-delta).                                                                                                     |
| `data.event_id`      | `string`                                                                                | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                                                      |
| `data.item_id`       | `string`                                                                                | ✓    | The ID of the item containing the audio that is being transcribed.                                                                                                                                                                                                                                                                                                                                      |
| `data.type`          | <code>"conversation.<wbr />item.<wbr />input\_audio\_transcription.<wbr />delta"</code> | ✓    | The event type, must be `conversation.item.input_audio_transcription.delta`.                                                                                                                                                                                                                                                                                                                            |
| `data.content_index` | `number`                                                                                | ✓    | The index of the content part in the item's content array.                                                                                                                                                                                                                                                                                                                                              |
| `data.delta`         | `string`                                                                                | ✓    | The text delta.                                                                                                                                                                                                                                                                                                                                                                                         |
| `data.logprobs`      | <code>LogProb<wbr />Properties\[] \| null</code>                                        | ✓    | The log probabilities of the transcription. These can be enabled by configurating the session with `"include": ["item.input_audio_transcription.logprobs"]`. Each entry in the array corresponds a log probability of which token would be selected for this chunk of transcription. This can help to identify if it was possible there were multiple valid options for a given chunk of transcription. |

Example `data`:

```json
{
  "type": "conversation.item.input_audio_transcription.delta",
  "event_id": "string",
  "item_id": "string"
}
```

<a id="-conversationiteminputaudiotranscriptionsegment" />

Returned when an input audio transcription segment is identified for an item. [https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/input\_audio\_transcription/segment](https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/input_audio_transcription/segment)

Event constant: `RealtimeAPIEvents.ConversationItemInputAudioTranscriptionSegment`

**Payload**

| Field                | Type                                                                                      | Req. | Description                                                                                                                                                                                                                                            |
| -------------------- | ----------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `data`               | `Object`                                                                                  | ✗    | Returned when an input audio transcription segment is identified for an item. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#conversation-item-input-audio-transcription-segment). |
| `data.id`            | `string`                                                                                  | ✓    | The segment identifier.                                                                                                                                                                                                                                |
| `data.content_index` | `number`                                                                                  | ✓    | The index of the input audio content part within the item.                                                                                                                                                                                             |
| `data.end`           | `number`                                                                                  | ✓    | End time of the segment in seconds.                                                                                                                                                                                                                    |
| `data.event_id`      | `string`                                                                                  | ✓    | The unique ID of the server event.                                                                                                                                                                                                                     |
| `data.item_id`       | `string`                                                                                  | ✓    | The ID of the item containing the input audio content.                                                                                                                                                                                                 |
| `data.speaker`       | `string`                                                                                  | ✓    | The detected speaker label for this segment.                                                                                                                                                                                                           |
| `data.start`         | `number`                                                                                  | ✓    | Start time of the segment in seconds.                                                                                                                                                                                                                  |
| `data.text`          | `string`                                                                                  | ✓    | The text for this segment.                                                                                                                                                                                                                             |
| `data.type`          | <code>"conversation.<wbr />item.<wbr />input\_audio\_transcription.<wbr />segment"</code> | ✓    | The event type, must be `conversation.item.input_audio_transcription.segment`.                                                                                                                                                                         |

Example `data`:

```json
{
  "type": "conversation.item.input_audio_transcription.segment",
  "id": "string",
  "content_index": 0,
  "end": 0,
  "event_id": "string",
  "item_id": "string",
  "speaker": "string",
  "start": 0,
  "text": "string"
}
```

<a id="-conversationiteminputaudiotranscriptionfailed" />

Returned when input audio transcription is configured, and a transcription request for a user message failed.  [https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/input\_audio\_transcription/failed](https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/input_audio_transcription/failed)

Event constant: `RealtimeAPIEvents.ConversationItemInputAudioTranscriptionFailed`

**Payload**

| Field                | Type                                                                                     | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                 |
| -------------------- | ---------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`               | `Object`                                                                                 | ✗    | Returned when input audio transcription is configured, and a transcription request for a user message failed. These events are separate from other `error` events so that the client can identify the related Item. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#conversation-item-input-audio-transcription-failed). |
| `data.content_index` | `number`                                                                                 | ✓    | The index of the content part containing the audio.                                                                                                                                                                                                                                                                                                                                         |
| `data.error`         | `Error`                                                                                  | ✓    | Details of the transcription error.                                                                                                                                                                                                                                                                                                                                                         |
| `data.event_id`      | `string`                                                                                 | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                                          |
| `data.item_id`       | `string`                                                                                 | ✓    | The ID of the user message item.                                                                                                                                                                                                                                                                                                                                                            |
| `data.type`          | <code>"conversation.<wbr />item.<wbr />input\_audio\_transcription.<wbr />failed"</code> | ✓    | The event type, must be `conversation.item.input_audio_transcription.failed`.                                                                                                                                                                                                                                                                                                               |

Example `data`:

```json
{
  "type": "conversation.item.input_audio_transcription.failed",
  "content_index": 0,
  "error": {},
  "event_id": "string",
  "item_id": "string"
}
```

<a id="-conversationitemtruncated" />

Returned when an earlier assistant audio message item is truncated by the client with a conversation.item.truncate event. [https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/truncated](https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/truncated)

Event constant: `RealtimeAPIEvents.ConversationItemTruncated`

**Payload**

| Field                | Type                                                     | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| -------------------- | -------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`               | `Object`                                                 | ✗    | Returned when an earlier assistant audio message item is truncated by the client with a `conversation.item.truncate` event. This event is used to synchronize the server's understanding of the audio with the client's playback. This action will truncate the audio and remove the server-side text transcript to ensure there is no text in the context that hasn't been heard by the user. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#conversation-item-truncated). |
| `data.audio_end_ms`  | `number`                                                 | ✓    | The duration up to which the audio was truncated, in milliseconds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `data.content_index` | `number`                                                 | ✓    | The index of the content part that was truncated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `data.event_id`      | `string`                                                 | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `data.item_id`       | `string`                                                 | ✓    | The ID of the assistant message item that was truncated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `data.type`          | <code>"conversation.<wbr />item.<wbr />truncated"</code> | ✓    | The event type, must be `conversation.item.truncated`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

Example `data`:

```json
{
  "type": "conversation.item.truncated",
  "audio_end_ms": 0,
  "content_index": 0,
  "event_id": "string",
  "item_id": "string"
}
```

<a id="-conversationitemdeleted" />

Returned when an item in the conversation is deleted by the client with a conversation.item.delete event. [https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/deleted](https://platform.openai.com/docs/api-reference/realtime-server-events/conversation/item/deleted)

Event constant: `RealtimeAPIEvents.ConversationItemDeleted`

**Payload**

| Field           | Type                                                   | Req. | Description                                                                                                                                                                                                                                                                                                                                                                 |
| --------------- | ------------------------------------------------------ | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`          | `Object`                                               | ✗    | Returned when an item in the conversation is deleted by the client with a `conversation.item.delete` event. This event is used to synchronize the server's understanding of the conversation history with the client's view. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#conversation-item-deleted). |
| `data.event_id` | `string`                                               | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                          |
| `data.item_id`  | `string`                                               | ✓    | The ID of the item that was deleted.                                                                                                                                                                                                                                                                                                                                        |
| `data.type`     | <code>"conversation.<wbr />item.<wbr />deleted"</code> | ✓    | The event type, must be `conversation.item.deleted`.                                                                                                                                                                                                                                                                                                                        |

Example `data`:

```json
{
  "type": "conversation.item.deleted",
  "event_id": "string",
  "item_id": "string"
}
```

<a id="-inputaudiobuffercommitted" />

Returned when an input audio buffer is committed. [https://platform.openai.com/docs/api-reference/realtime-server-events/input\_audio\_buffer/committed](https://platform.openai.com/docs/api-reference/realtime-server-events/input_audio_buffer/committed)

Event constant: `RealtimeAPIEvents.InputAudioBufferCommitted`

**Payload**

| Field                   | Type                                                 | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                             |
| ----------------------- | ---------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`                  | `Object`                                             | ✗    | Returned when an input audio buffer is committed, either by the client or automatically in server VAD mode. The `item_id` property is the ID of the user message item that will be created, thus a `conversation.item.created` event will also be sent to the client. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#input-audio-buffer-committed). |
| `data.event_id`         | `string`                                             | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                                                                      |
| `data.item_id`          | `string`                                             | ✓    | The ID of the user message item that will be created.                                                                                                                                                                                                                                                                                                                                                                   |
| `data.type`             | <code>"input\_audio\_buffer.<wbr />committed"</code> | ✓    | The event type, must be `input_audio_buffer.committed`.                                                                                                                                                                                                                                                                                                                                                                 |
| `data.previous_item_id` | <code>string \| null</code>                          | ✓    | The ID of the preceding item after which the new item will be inserted. Can be `null` if the item has no predecessor.                                                                                                                                                                                                                                                                                                   |

Example `data`:

```json
{
  "type": "input_audio_buffer.committed",
  "event_id": "string",
  "item_id": "string"
}
```

<a id="-inputaudiobuffercleared" />

Returned when the input audio buffer is cleared by the client with an input\_audio\_buffer.clear event. [https://platform.openai.com/docs/api-reference/realtime-server-events/input\_audio\_buffer/cleared](https://platform.openai.com/docs/api-reference/realtime-server-events/input_audio_buffer/cleared)

Event constant: `RealtimeAPIEvents.InputAudioBufferCleared`

**Payload**

| Field           | Type                                               | Req. | Description                                                                                                                                                                                                                                            |
| --------------- | -------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `data`          | `Object`                                           | ✗    | Returned when the input audio buffer is cleared by the client with a `input_audio_buffer.clear` event. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#input-audio-buffer-cleared). |
| `data.event_id` | `string`                                           | ✓    | The unique ID of the server event.                                                                                                                                                                                                                     |
| `data.type`     | <code>"input\_audio\_buffer.<wbr />cleared"</code> | ✓    | The event type, must be `input_audio_buffer.cleared`.                                                                                                                                                                                                  |

Example `data`:

```json
{
  "type": "input_audio_buffer.cleared",
  "event_id": "string"
}
```

<a id="-inputaudiobufferspeechstarted" />

Sent by the server when in server\_vad mode to indicate that speech has been detected in the audio buffer. [https://platform.openai.com/docs/api-reference/realtime-server-events/input\_audio\_buffer/speech\_started](https://platform.openai.com/docs/api-reference/realtime-server-events/input_audio_buffer/speech_started)

Event constant: `RealtimeAPIEvents.InputAudioBufferSpeechStarted`

**Payload**

| Field                 | Type                                                       | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| --------------------- | ---------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`                | `Object`                                                   | ✗    | Sent by the server when in `server_vad` mode to indicate that speech has been detected in the audio buffer. This can happen any time audio is added to the buffer (unless speech is already detected). The client may want to use this event to interrupt audio playback or provide visual feedback to the user. The client should expect to receive a `input_audio_buffer.speech_stopped` event when speech stops. The `item_id` property is the ID of the user message item that will be created when speech stops and will also be included in the `input_audio_buffer.speech_stopped` event (unless the client manually commits the audio buffer during VAD activation). See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#input-audio-buffer-speech-started). |
| `data.audio_start_ms` | `number`                                                   | ✓    | Milliseconds from the start of all audio written to the buffer during the session when speech was first detected. This will correspond to the beginning of audio sent to the model, and thus includes the `prefix_padding_ms` configured in the Session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `data.event_id`       | `string`                                                   | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `data.item_id`        | `string`                                                   | ✓    | The ID of the user message item that will be created when speech stops.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `data.type`           | <code>"input\_audio\_buffer.<wbr />speech\_started"</code> | ✓    | The event type, must be `input_audio_buffer.speech_started`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

Example `data`:

```json
{
  "type": "input_audio_buffer.speech_started",
  "audio_start_ms": 0,
  "event_id": "string",
  "item_id": "string"
}
```

<a id="-inputaudiobufferspeechstopped" />

Returned in server\_vad mode when the server detects the end of speech in the audio buffer. [https://platform.openai.com/docs/api-reference/realtime-server-events/input\_audio\_buffer/speech\_stopped](https://platform.openai.com/docs/api-reference/realtime-server-events/input_audio_buffer/speech_stopped)

Event constant: `RealtimeAPIEvents.InputAudioBufferSpeechStopped`

**Payload**

| Field               | Type                                                       | Req. | Description                                                                                                                                                                                                                                                                                                                                                                          |
| ------------------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `data`              | `Object`                                                   | ✗    | Returned in `server_vad` mode when the server detects the end of speech in the audio buffer. The server will also send an `conversation.item.created` event with the user message item that is created from the audio buffer. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#input-audio-buffer-speech-stopped). |
| `data.audio_end_ms` | `number`                                                   | ✓    | Milliseconds since the session started when speech stopped. This will correspond to the end of audio sent to the model, and thus includes the `min_silence_duration_ms` configured in the Session.                                                                                                                                                                                   |
| `data.event_id`     | `string`                                                   | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                                   |
| `data.item_id`      | `string`                                                   | ✓    | The ID of the user message item that will be created.                                                                                                                                                                                                                                                                                                                                |
| `data.type`         | <code>"input\_audio\_buffer.<wbr />speech\_stopped"</code> | ✓    | The event type, must be `input_audio_buffer.speech_stopped`.                                                                                                                                                                                                                                                                                                                         |

Example `data`:

```json
{
  "type": "input_audio_buffer.speech_stopped",
  "audio_end_ms": 0,
  "event_id": "string",
  "item_id": "string"
}
```

<a id="-inputaudiobuffertimeouttriggered" />

Returned when the Server VAD timeout is triggered for the input audio buffer. [https://platform.openai.com/docs/api-reference/realtime-server-events/input\_audio\_buffer/timeout\_triggered](https://platform.openai.com/docs/api-reference/realtime-server-events/input_audio_buffer/timeout_triggered)

Event constant: `RealtimeAPIEvents.InputAudioBufferTimeoutTriggered`

**Payload**

| Field                 | Type                                                          | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| --------------------- | ------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`                | `Object`                                                      | ✗    | Returned when the Server VAD timeout is triggered for the input audio buffer. This is configured with `idle_timeout_ms` in the `turn_detection` settings of the session, and it indicates that there hasn't been any speech detected for the configured duration. The `audio_start_ms` and `audio_end_ms` fields indicate the segment of audio after the last model response up to the triggering time, as an offset from the beginning of audio written to the input audio buffer. This means it demarcates the segment of audio that was silent and the difference between the start and end values will roughly match the configured timeout. The empty audio will be committed to the conversation as an `input_audio` item (there will be a `input_audio_buffer.committed` event) and a model response will be generated. There may be speech that didn't trigger VAD but is still detected by the model, so the model may respond with something relevant to the conversation or a prompt to continue speaking. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#input-audio-buffer-timeout-triggered). |
| `data.audio_end_ms`   | `number`                                                      | ✓    | Millisecond offset of audio written to the input audio buffer at the time the timeout was triggered.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `data.audio_start_ms` | `number`                                                      | ✓    | Millisecond offset of audio written to the input audio buffer that was after the playback time of the last model response.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `data.event_id`       | `string`                                                      | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `data.item_id`        | `string`                                                      | ✓    | The ID of the item associated with this segment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `data.type`           | <code>"input\_audio\_buffer.<wbr />timeout\_triggered"</code> | ✓    | The event type, must be `input_audio_buffer.timeout_triggered`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

Example `data`:

```json
{
  "type": "input_audio_buffer.timeout_triggered",
  "audio_end_ms": 0,
  "audio_start_ms": 0,
  "event_id": "string",
  "item_id": "string"
}
```

<a id="-responsecreated" />

Returned when a new Response is created. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/created](https://platform.openai.com/docs/api-reference/realtime-server-events/response/created)

Event constant: `RealtimeAPIEvents.ResponseCreated`

**Payload**

| Field           | Type                                   | Req. | Description                                                                                                                                                                                                                                                                      |
| --------------- | -------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`          | `Object`                               | ✗    | Returned when a new Response is created. The first event of response creation, where the response is in an initial state of `in_progress`. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-created). |
| `data.event_id` | `string`                               | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                               |
| `data.response` | <code>Realtime<wbr />Response</code>   | ✓    | The response resource.                                                                                                                                                                                                                                                           |
| `data.type`     | <code>"response.<wbr />created"</code> | ✓    | The event type, must be `response.created`.                                                                                                                                                                                                                                      |

Example `data`:

```json
{
  "type": "response.created",
  "event_id": "string",
  "response": {}
}
```

<a id="-responsedone" />

Returned when a Response is done streaming. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/done](https://platform.openai.com/docs/api-reference/realtime-server-events/response/done)

Event constant: `RealtimeAPIEvents.ResponseDone`

**Payload**

| Field           | Type                                 | Req. | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| --------------- | ------------------------------------ | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`          | `Object`                             | ✗    | Returned when a Response is done streaming. Always emitted, no matter the final state. The Response object included in the `response.done` event will include all output Items in the Response but will omit the raw audio data. Clients should check the `status` field of the Response to determine if it was successful (`completed`) or if there was another outcome: `cancelled`, `failed`, or `incomplete`. A response will contain all output items that were generated during the response, excluding any audio content. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-done). |
| `data.event_id` | `string`                             | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `data.response` | <code>Realtime<wbr />Response</code> | ✓    | The response resource.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `data.type`     | <code>"response.<wbr />done"</code>  | ✓    | The event type, must be `response.done`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

Example `data`:

```json
{
  "type": "response.done",
  "event_id": "string",
  "response": {}
}
```

<a id="-responseoutputitemadded" />

Returned when a new Item is created during Response generation. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/output\_item/added](https://platform.openai.com/docs/api-reference/realtime-server-events/response/output_item/added)

Event constant: `RealtimeAPIEvents.ResponseOutputItemAdded`

**Payload**

| Field               | Type                                                     | Req. | Description                                                                                                                                                                                                     |
| ------------------- | -------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`              | `Object`                                                 | ✗    | Returned when a new Item is created during Response generation. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-output-item-added). |
| `data.event_id`     | `string`                                                 | ✓    | The unique ID of the server event.                                                                                                                                                                              |
| `data.item`         | <code>Conversation<wbr />Item</code>                     | ✓    | A single item within a Realtime conversation.                                                                                                                                                                   |
| `data.output_index` | `number`                                                 | ✓    | The index of the output item in the Response.                                                                                                                                                                   |
| `data.response_id`  | `string`                                                 | ✓    | The ID of the Response to which the item belongs.                                                                                                                                                               |
| `data.type`         | <code>"response.<wbr />output\_item.<wbr />added"</code> | ✓    | The event type, must be `response.output_item.added`.                                                                                                                                                           |

Example `data`:

```json
{
  "type": "response.output_item.added",
  "event_id": "string",
  "item": {},
  "output_index": 0,
  "response_id": "string"
}
```

<a id="-responseoutputitemdone" />

Returned when an Item is done streaming. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/output\_item/done](https://platform.openai.com/docs/api-reference/realtime-server-events/response/output_item/done)

Event constant: `RealtimeAPIEvents.ResponseOutputItemDone`

**Payload**

| Field               | Type                                                    | Req. | Description                                                                                                                                                                                                                                                    |
| ------------------- | ------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`              | `Object`                                                | ✗    | Returned when an Item is done streaming. Also emitted when a Response is interrupted, incomplete, or cancelled. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-output-item-done). |
| `data.event_id`     | `string`                                                | ✓    | The unique ID of the server event.                                                                                                                                                                                                                             |
| `data.item`         | <code>Conversation<wbr />Item</code>                    | ✓    | A single item within a Realtime conversation.                                                                                                                                                                                                                  |
| `data.output_index` | `number`                                                | ✓    | The index of the output item in the Response.                                                                                                                                                                                                                  |
| `data.response_id`  | `string`                                                | ✓    | The ID of the Response to which the item belongs.                                                                                                                                                                                                              |
| `data.type`         | <code>"response.<wbr />output\_item.<wbr />done"</code> | ✓    | The event type, must be `response.output_item.done`.                                                                                                                                                                                                           |

Example `data`:

```json
{
  "type": "response.output_item.done",
  "event_id": "string",
  "item": {},
  "output_index": 0,
  "response_id": "string"
}
```

<a id="-responsecontentpartadded" />

Returned when a new content part is added to an assistant message item during response generation. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/content\_part/added](https://platform.openai.com/docs/api-reference/realtime-server-events/response/content_part/added)

Event constant: `RealtimeAPIEvents.ResponseContentPartAdded`

**Payload**

| Field                | Type                                                      | Req. | Description                                                                                                                                                                                                                                         |
| -------------------- | --------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`               | `Object`                                                  | ✗    | Returned when a new content part is added to an assistant message item during response generation. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-content-part-added). |
| `data.content_index` | `number`                                                  | ✓    | The index of the content part in the item's content array.                                                                                                                                                                                          |
| `data.event_id`      | `string`                                                  | ✓    | The unique ID of the server event.                                                                                                                                                                                                                  |
| `data.item_id`       | `string`                                                  | ✓    | The ID of the item to which the content part was added.                                                                                                                                                                                             |
| `data.output_index`  | `number`                                                  | ✓    | The index of the output item in the response.                                                                                                                                                                                                       |
| `data.part`          | `Part`                                                    | ✓    | The content part that was added.                                                                                                                                                                                                                    |
| `data.response_id`   | `string`                                                  | ✓    | The ID of the response.                                                                                                                                                                                                                             |
| `data.type`          | <code>"response.<wbr />content\_part.<wbr />added"</code> | ✓    | The event type, must be `response.content_part.added`.                                                                                                                                                                                              |

Example `data`:

```json
{
  "type": "response.content_part.added",
  "content_index": 0,
  "event_id": "string",
  "item_id": "string",
  "output_index": 0,
  "part": {},
  "response_id": "string"
}
```

<a id="-responsecontentpartdone" />

Returned when a content part is done streaming in an assistant message item. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/content\_part/done](https://platform.openai.com/docs/api-reference/realtime-server-events/response/content_part/done)

Event constant: `RealtimeAPIEvents.ResponseContentPartDone`

**Payload**

| Field                | Type                                                     | Req. | Description                                                                                                                                                                                                                                                                                         |
| -------------------- | -------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`               | `Object`                                                 | ✗    | Returned when a content part is done streaming in an assistant message item. Also emitted when a Response is interrupted, incomplete, or cancelled. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-content-part-done). |
| `data.content_index` | `number`                                                 | ✓    | The index of the content part in the item's content array.                                                                                                                                                                                                                                          |
| `data.event_id`      | `string`                                                 | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                  |
| `data.item_id`       | `string`                                                 | ✓    | The ID of the item.                                                                                                                                                                                                                                                                                 |
| `data.output_index`  | `number`                                                 | ✓    | The index of the output item in the response.                                                                                                                                                                                                                                                       |
| `data.part`          | `Part`                                                   | ✓    | The content part that is done.                                                                                                                                                                                                                                                                      |
| `data.response_id`   | `string`                                                 | ✓    | The ID of the response.                                                                                                                                                                                                                                                                             |
| `data.type`          | <code>"response.<wbr />content\_part.<wbr />done"</code> | ✓    | The event type, must be `response.content_part.done`.                                                                                                                                                                                                                                               |

Example `data`:

```json
{
  "type": "response.content_part.done",
  "content_index": 0,
  "event_id": "string",
  "item_id": "string",
  "output_index": 0,
  "part": {},
  "response_id": "string"
}
```

<a id="-responseoutputtextdelta" />

Returned when the text value of an "output\_text" content part is updated. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/output\_text/delta](https://platform.openai.com/docs/api-reference/realtime-server-events/response/output_text/delta)

Event constant: `RealtimeAPIEvents.ResponseOutputTextDelta`

**Payload**

| Field                | Type                                                     | Req. | Description                                                                                                                                                                                                                |
| -------------------- | -------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`               | `Object`                                                 | ✗    | Returned when the text value of an "output\_text" content part is updated. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-output-text-delta). |
| `data.content_index` | `number`                                                 | ✓    | The index of the content part in the item's content array.                                                                                                                                                                 |
| `data.delta`         | `string`                                                 | ✓    | The text delta.                                                                                                                                                                                                            |
| `data.event_id`      | `string`                                                 | ✓    | The unique ID of the server event.                                                                                                                                                                                         |
| `data.item_id`       | `string`                                                 | ✓    | The ID of the item.                                                                                                                                                                                                        |
| `data.output_index`  | `number`                                                 | ✓    | The index of the output item in the response.                                                                                                                                                                              |
| `data.response_id`   | `string`                                                 | ✓    | The ID of the response.                                                                                                                                                                                                    |
| `data.type`          | <code>"response.<wbr />output\_text.<wbr />delta"</code> | ✓    | The event type, must be `response.output_text.delta`.                                                                                                                                                                      |

Example `data`:

```json
{
  "type": "response.output_text.delta",
  "content_index": 0,
  "delta": "string",
  "event_id": "string",
  "item_id": "string",
  "output_index": 0,
  "response_id": "string"
}
```

<a id="-responseoutputtextdone" />

Returned when the text value of an "output\_text" content part is done streaming. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/output\_text/done](https://platform.openai.com/docs/api-reference/realtime-server-events/response/output_text/done)

Event constant: `RealtimeAPIEvents.ResponseOutputTextDone`

**Payload**

| Field                | Type                                                    | Req. | Description                                                                                                                                                                                                                                                                                             |
| -------------------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`               | `Object`                                                | ✗    | Returned when the text value of an "output\_text" content part is done streaming. Also emitted when a Response is interrupted, incomplete, or cancelled. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-output-text-done). |
| `data.content_index` | `number`                                                | ✓    | The index of the content part in the item's content array.                                                                                                                                                                                                                                              |
| `data.event_id`      | `string`                                                | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                      |
| `data.item_id`       | `string`                                                | ✓    | The ID of the item.                                                                                                                                                                                                                                                                                     |
| `data.output_index`  | `number`                                                | ✓    | The index of the output item in the response.                                                                                                                                                                                                                                                           |
| `data.response_id`   | `string`                                                | ✓    | The ID of the response.                                                                                                                                                                                                                                                                                 |
| `data.text`          | `string`                                                | ✓    | The final text content.                                                                                                                                                                                                                                                                                 |
| `data.type`          | <code>"response.<wbr />output\_text.<wbr />done"</code> | ✓    | The event type, must be `response.output_text.done`.                                                                                                                                                                                                                                                    |

Example `data`:

```json
{
  "type": "response.output_text.done",
  "content_index": 0,
  "event_id": "string",
  "item_id": "string",
  "output_index": 0,
  "response_id": "string",
  "text": "string"
}
```

<a id="-responseoutputaudiotranscriptdelta" />

Returned when the model-generated transcription of audio output is updated. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/output\_audio\_transcript/delta](https://platform.openai.com/docs/api-reference/realtime-server-events/response/output_audio_transcript/delta)

Event constant: `RealtimeAPIEvents.ResponseOutputAudioTranscriptDelta`

**Payload**

| Field                | Type                                                                  | Req. | Description                                                                                                                                                                                                                             |
| -------------------- | --------------------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`               | `Object`                                                              | ✗    | Returned when the model-generated transcription of audio output is updated. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-output-audio-transcript-delta). |
| `data.content_index` | `number`                                                              | ✓    | The index of the content part in the item's content array.                                                                                                                                                                              |
| `data.delta`         | `string`                                                              | ✓    | The transcript delta.                                                                                                                                                                                                                   |
| `data.event_id`      | `string`                                                              | ✓    | The unique ID of the server event.                                                                                                                                                                                                      |
| `data.item_id`       | `string`                                                              | ✓    | The ID of the item.                                                                                                                                                                                                                     |
| `data.output_index`  | `number`                                                              | ✓    | The index of the output item in the response.                                                                                                                                                                                           |
| `data.response_id`   | `string`                                                              | ✓    | The ID of the response.                                                                                                                                                                                                                 |
| `data.type`          | <code>"response.<wbr />output\_audio\_transcript.<wbr />delta"</code> | ✓    | The event type, must be `response.output_audio_transcript.delta`.                                                                                                                                                                       |

Example `data`:

```json
{
  "type": "response.output_audio_transcript.delta",
  "content_index": 0,
  "delta": "string",
  "event_id": "string",
  "item_id": "string",
  "output_index": 0,
  "response_id": "string"
}
```

<a id="-responseoutputaudiotranscriptdone" />

Returned when the model-generated transcription of audio output is done streaming. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/output\_audio\_transcript/done](https://platform.openai.com/docs/api-reference/realtime-server-events/response/output_audio_transcript/done)

Event constant: `RealtimeAPIEvents.ResponseOutputAudioTranscriptDone`

**Payload**

| Field                | Type                                                                 | Req. | Description                                                                                                                                                                                                                                                                                                          |
| -------------------- | -------------------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`               | `Object`                                                             | ✗    | Returned when the model-generated transcription of audio output is done streaming. Also emitted when a Response is interrupted, incomplete, or cancelled. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-output-audio-transcript-done). |
| `data.content_index` | `number`                                                             | ✓    | The index of the content part in the item's content array.                                                                                                                                                                                                                                                           |
| `data.event_id`      | `string`                                                             | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                                   |
| `data.item_id`       | `string`                                                             | ✓    | The ID of the item.                                                                                                                                                                                                                                                                                                  |
| `data.output_index`  | `number`                                                             | ✓    | The index of the output item in the response.                                                                                                                                                                                                                                                                        |
| `data.response_id`   | `string`                                                             | ✓    | The ID of the response.                                                                                                                                                                                                                                                                                              |
| `data.transcript`    | `string`                                                             | ✓    | The final transcript of the audio.                                                                                                                                                                                                                                                                                   |
| `data.type`          | <code>"response.<wbr />output\_audio\_transcript.<wbr />done"</code> | ✓    | The event type, must be `response.output_audio_transcript.done`.                                                                                                                                                                                                                                                     |

Example `data`:

```json
{
  "type": "response.output_audio_transcript.done",
  "content_index": 0,
  "event_id": "string",
  "item_id": "string",
  "output_index": 0,
  "response_id": "string",
  "transcript": "string"
}
```

<a id="-responseoutputaudiodone" />

Returned when the model-generated audio is done. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/output\_audio/done](https://platform.openai.com/docs/api-reference/realtime-server-events/response/output_audio/done)

Event constant: `RealtimeAPIEvents.ResponseOutputAudioDone`

**Payload**

| Field                | Type                                                     | Req. | Description                                                                                                                                                                                                                                                             |
| -------------------- | -------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`               | `Object`                                                 | ✗    | Returned when the model-generated audio is done. Also emitted when a Response is interrupted, incomplete, or cancelled. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-output-audio-done). |
| `data.content_index` | `number`                                                 | ✓    | The index of the content part in the item's content array.                                                                                                                                                                                                              |
| `data.event_id`      | `string`                                                 | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                      |
| `data.item_id`       | `string`                                                 | ✓    | The ID of the item.                                                                                                                                                                                                                                                     |
| `data.output_index`  | `number`                                                 | ✓    | The index of the output item in the response.                                                                                                                                                                                                                           |
| `data.response_id`   | `string`                                                 | ✓    | The ID of the response.                                                                                                                                                                                                                                                 |
| `data.type`          | <code>"response.<wbr />output\_audio.<wbr />done"</code> | ✓    | The event type, must be `response.output_audio.done`.                                                                                                                                                                                                                   |

Example `data`:

```json
{
  "type": "response.output_audio.done",
  "content_index": 0,
  "event_id": "string",
  "item_id": "string",
  "output_index": 0,
  "response_id": "string"
}
```

<a id="-responsefunctioncallargumentsdelta" />

Returned when the model-generated function call arguments are updated. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/function\_call\_arguments/delta](https://platform.openai.com/docs/api-reference/realtime-server-events/response/function_call_arguments/delta)

Event constant: `RealtimeAPIEvents.ResponseFunctionCallArgumentsDelta`

**Payload**

| Field               | Type                                                                  | Req. | Description                                                                                                                                                                                                                        |
| ------------------- | --------------------------------------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`              | `Object`                                                              | ✗    | Returned when the model-generated function call arguments are updated. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-function-call-arguments-delta). |
| `data.call_id`      | `string`                                                              | ✓    | The ID of the function call.                                                                                                                                                                                                       |
| `data.delta`        | `string`                                                              | ✓    | The arguments delta as a JSON string.                                                                                                                                                                                              |
| `data.event_id`     | `string`                                                              | ✓    | The unique ID of the server event.                                                                                                                                                                                                 |
| `data.item_id`      | `string`                                                              | ✓    | The ID of the function call item.                                                                                                                                                                                                  |
| `data.output_index` | `number`                                                              | ✓    | The index of the output item in the response.                                                                                                                                                                                      |
| `data.response_id`  | `string`                                                              | ✓    | The ID of the response.                                                                                                                                                                                                            |
| `data.type`         | <code>"response.<wbr />function\_call\_arguments.<wbr />delta"</code> | ✓    | The event type, must be `response.function_call_arguments.delta`.                                                                                                                                                                  |

Example `data`:

```json
{
  "type": "response.function_call_arguments.delta",
  "call_id": "string",
  "delta": "string",
  "event_id": "string",
  "item_id": "string",
  "output_index": 0,
  "response_id": "string"
}
```

<a id="-responsefunctioncallargumentsdone" />

Returned when the model-generated function call arguments are done streaming. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/function\_call\_arguments/done](https://platform.openai.com/docs/api-reference/realtime-server-events/response/function_call_arguments/done)

Event constant: `RealtimeAPIEvents.ResponseFunctionCallArgumentsDone`

**Payload**

| Field               | Type                                                                 | Req. | Description                                                                                                                                                                                                                                                                                                     |
| ------------------- | -------------------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data`              | `Object`                                                             | ✗    | Returned when the model-generated function call arguments are done streaming. Also emitted when a Response is interrupted, incomplete, or cancelled. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#response-function-call-arguments-done). |
| `data.arguments`    | `string`                                                             | ✓    | The final arguments as a JSON string.                                                                                                                                                                                                                                                                           |
| `data.call_id`      | `string`                                                             | ✓    | The ID of the function call.                                                                                                                                                                                                                                                                                    |
| `data.event_id`     | `string`                                                             | ✓    | The unique ID of the server event.                                                                                                                                                                                                                                                                              |
| `data.item_id`      | `string`                                                             | ✓    | The ID of the function call item.                                                                                                                                                                                                                                                                               |
| `data.name`         | `string`                                                             | ✓    | The name of the function that was called.                                                                                                                                                                                                                                                                       |
| `data.output_index` | `number`                                                             | ✓    | The index of the output item in the response.                                                                                                                                                                                                                                                                   |
| `data.response_id`  | `string`                                                             | ✓    | The ID of the response.                                                                                                                                                                                                                                                                                         |
| `data.type`         | <code>"response.<wbr />function\_call\_arguments.<wbr />done"</code> | ✓    | The event type, must be `response.function_call_arguments.done`.                                                                                                                                                                                                                                                |

Example `data`:

```json
{
  "type": "response.function_call_arguments.done",
  "arguments": "string",
  "call_id": "string",
  "event_id": "string",
  "item_id": "string",
  "name": "string",
  "output_index": 0,
  "response_id": "string"
}
```

<a id="-responsemcpcallargumentsdelta" />

Returned when MCP tool call arguments are updated during response generation. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/mcp\_call\_arguments/delta](https://platform.openai.com/docs/api-reference/realtime-server-events/response/mcp_call_arguments/delta)

Event constant: `RealtimeAPIEvents.ResponseMCPCallArgumentsDelta`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcpcallargumentsdone" />

Returned when MCP tool call arguments are finalized during response generation. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/mcp\_call\_arguments/done](https://platform.openai.com/docs/api-reference/realtime-server-events/response/mcp_call_arguments/done)

Event constant: `RealtimeAPIEvents.ResponseMCPCallArgumentsDone`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcpcallinprogress" />

Returned when an MCP tool call has started and is in progress. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/mcp\_call/in\_progress](https://platform.openai.com/docs/api-reference/realtime-server-events/response/mcp_call/in_progress)

Event constant: `RealtimeAPIEvents.ResponseMCPCallInProgress`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcpcallcompleted" />

Returned when an MCP tool call has completed successfully. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/mcp\_call/completed](https://platform.openai.com/docs/api-reference/realtime-server-events/response/mcp_call/completed)

Event constant: `RealtimeAPIEvents.ResponseMCPCallCompleted`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-responsemcpcallfailed" />

Returned when an MCP tool call has failed. [https://platform.openai.com/docs/api-reference/realtime-server-events/response/mcp\_call/failed](https://platform.openai.com/docs/api-reference/realtime-server-events/response/mcp_call/failed)

Event constant: `RealtimeAPIEvents.ResponseMCPCallFailed`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-mcplisttoolsinprogress" />

Returned when listing MCP tools is in progress for an item. [https://platform.openai.com/docs/api-reference/realtime-server-events/mcp\_list\_tools/in\_progress](https://platform.openai.com/docs/api-reference/realtime-server-events/mcp_list_tools/in_progress)

Event constant: `RealtimeAPIEvents.MCPListToolsInProgress`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-mcplisttoolscompleted" />

Returned when listing MCP tools has completed for an item. [https://platform.openai.com/docs/api-reference/realtime-server-events/mcp\_list\_tools/completed](https://platform.openai.com/docs/api-reference/realtime-server-events/mcp_list_tools/completed)

Event constant: `RealtimeAPIEvents.MCPListToolsCompleted`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-mcplisttoolsfailed" />

Returned when listing MCP tools has failed for an item. [https://platform.openai.com/docs/api-reference/realtime-server-events/mcp\_list\_tools/failed](https://platform.openai.com/docs/api-reference/realtime-server-events/mcp_list_tools/failed)

Event constant: `RealtimeAPIEvents.MCPListToolsFailed`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-ratelimitsupdated" />

Emitted at the beginning of a Response to indicate the updated rate limits. [https://platform.openai.com/docs/api-reference/realtime-server-events/rate\_limits/updated](https://platform.openai.com/docs/api-reference/realtime-server-events/rate_limits/updated)

Event constant: `RealtimeAPIEvents.RateLimitsUpdated`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-websocketerror" />

The WebSocket error response event.

Event constant: `RealtimeAPIEvents.WebSocketError`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*

<a id="-connectorinformation" />

Contains information about connector.

Event constant: `RealtimeAPIEvents.ConnectorInformation`

**Payload**

*No event-specific payload columns are listed here; this callback still receives the common `client` and `data` fields. For `data`, see the partner documentation for the exact JSON shape.*