> 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`. GPT Live sessions use `OpenAI.createLiveAPIClient(...)`, which returns `OpenAI.LiveAPIClient`. Call `sessionStart` and wait for `OpenAI.LiveAPIEvents.SessionStarted` before sending media. ## Related guides #### [OpenAI connector overview](/voice-ai-orchestration/openai/overview) Learn how OpenAI fits into VoxEngine voice AI scenarios. #### [GPT Live](/voice-ai-orchestration/openai/gpt-live) Answer a call with OpenAI GPT Live and delegate tool work to a backend model. #### [Answer an inbound call](/voice-ai-orchestration/openai/inbound) Start from a complete inbound OpenAI realtime scenario. #### [Function calling](/voice-ai-orchestration/openai/function-calling) Use tool calls and function-call events in an OpenAI scenario. #### [Half-cascade with Inworld](/voice-ai-orchestration/openai/half-cascade-inworld) Combine OpenAI with a separate realtime TTS provider. ## Contents * [Usage](#usage): required module import and high-level client flow. * [Factory functions](#factory-functions): create chat completions, responses, realtime, or GPT Live clients. * [Parameter types](#parameter-types): configuration objects used by OpenAI client factories. * [Client methods](#client-methods): methods grouped by client type. * [Events](#events): WebSocket media bridge events. * [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. GPT Live scenarios use `createLiveAPIClient` and `sessionStart`. ## 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, Realtime for voice scenarios over WebSocket, or GPT Live for Live API voice sessions. #### Chat Completions Creates a client for the Chat Completions API. ### createChatCompletionsAPIClient Creates a new [OpenAI.ChatCompletionsAPIClient](/api-reference/voxengine/openai#chatcompletionsapiclient) instance. ```ts createChatCompletionsAPIClient(parameters: { statistics?: boolean; trace?: boolean; privacy?: boolean; apiKey: string; storeContext?: boolean; baseUrl?: string; project?: string; summaryModel?: string; summaryPrompt?: string; }): Promise ``` The required `parameters` object is typed as OpenAI.ChatCompletionsAPIClientParameters. **Parameters** | Parameter | Type | Req. | Description | | ----------------------------------- | -------------------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `parameters` | ChatCompletionsAPIClientParameters | ✓ | [OpenAI.ChatCompletionsAPIClient](/api-reference/voxengine/openai#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 investigate 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 to connect an OpenAI-compatible connector (for example, Azure). | | ↳ `project` | `string` | ✗ | Project for the OpenAI API. | | ↳ `summaryModel` | `string` | ✗ | Model for the summary generation. The default value is **gpt-4o**. | | ↳ summaryPrompt | `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 | | ------------------------------------------ | ---------------------------------------------------------------------------------------- | | `Promise` | Resolves to the [`OpenAI.ChatCompletionsAPIClient`](#chatcompletionsapiclient) instance. | #### Responses Creates a client for the Responses API. ### createResponsesAPIClient Creates a new [OpenAI.ResponsesAPIClient](/api-reference/voxengine/openai#responsesapiclient) instance. ```ts createResponsesAPIClient(parameters: { statistics?: boolean; trace?: boolean; privacy?: boolean; apiKey: string; storeContext?: boolean; baseUrl?: string; project?: string; }): Promise ``` The required `parameters` object is typed as OpenAI.ResponsesAPIClientParameters. **Parameters** | Parameter | Type | Req. | Description | | ---------------- | ------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `parameters` | ResponsesAPIClientParameters | ✓ | [OpenAI.ResponsesAPIClient](/api-reference/voxengine/openai#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 investigate 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 | | ------------------------------------ | ---------------------------------------------------------------------------- | | `Promise` | Resolves to the [`OpenAI.ResponsesAPIClient`](#responsesapiclient) instance. | #### Realtime Creates a client for realtime voice sessions over WebSocket. ### createRealtimeAPIClient Creates a new [OpenAI.RealtimeAPIClient](/api-reference/voxengine/openai#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 ``` The required `parameters` object is typed as OpenAI.RealtimeAPIClientParameters. **Parameters** | Parameter | Type | Req. | Description | | -------------------------------------- | ------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `parameters` | RealtimeAPIClientParameters | ✓ | [OpenAI.RealtimeAPIClient](/api-reference/voxengine/openai#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 investigate 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**. | | ↳ onWebSocketClose | `(event: object) => void` | ✗ | A callback function that is called when the [WebSocket](/api-reference/voxengine/websocket) 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** for `OpenAI.RealtimeAPIClientType.REALTIME` and **gpt-realtime-translate** for `OpenAI.RealtimeAPIClientType.TRANSLATION`. | | ↳ `type` | OpenAI.RealtimeAPIClientType | ✗ | The type of the client. The default value is **OpenAI.RealtimeAPIClientType.REALTIME**. Use `OpenAI.RealtimeAPIClientType.TRANSLATION` for realtime translation sessions. GPT-Live sessions use `OpenAI.createLiveAPIClient`. | | ↳ `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 | | ----------------------------------- | -------------------------------------------------------------------------- | | `Promise` | Resolves to the [`OpenAI.RealtimeAPIClient`](#realtimeapiclient) instance. | #### GPT Live Creates a client for GPT Live voice sessions. ### createLiveAPIClient Creates a new [OpenAI.LiveAPIClient](/api-reference/voxengine/openai#liveapiclient) instance. ```ts createLiveAPIClient(parameters: { statistics?: boolean; trace?: boolean; privacy?: boolean; onWebSocketClose?: (event: object) => void; apiKey: string; baseUrl?: string; }): Promise ``` The required `parameters` object is typed as OpenAI.LiveAPIClientParameters. **Parameters** | Parameter | Type | Req. | Description | | -------------------------------------- | -------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `parameters` | LiveAPIClientParameters | ✓ | [OpenAI.LiveAPIClient](/api-reference/voxengine/openai#liveapiclient) parameters. Can be passed as arguments to the `OpenAI.createLiveAPIClient` 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 investigate 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**. | | ↳ onWebSocketClose | `(event: object) => void` | ✗ | A callback function that is called when the [WebSocket](/api-reference/voxengine/websocket) connection is closed. | | ↳ `apiKey` | `string` | ✓ | The API key for the OpenAI Live API. | | ↳ `baseUrl` | `string` | ✗ | The base URL for the OpenAI Live API. | **Returns** | Type | Description | | ------------------------------- | ------------------------------------------------------------------ | | `Promise` | Resolves to the [`OpenAI.LiveAPIClient`](#liveapiclient) instance. | ## Parameter types These parameter objects match the same four API families as the factory functions. #### Chat Completions [OpenAI.ChatCompletionsAPIClient](/api-reference/voxengine/openai#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 to connect an OpenAI-compatible connector (for example, Azure). | | `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**. | | summaryPrompt | `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 investigate issues. | #### Responses [OpenAI.ResponsesAPIClient](/api-reference/voxengine/openai#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 investigate issues. | #### Realtime [OpenAI.RealtimeAPIClient](/api-reference/voxengine/openai#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** for `OpenAI.RealtimeAPIClientType.REALTIME` and **gpt-realtime-translate** for `OpenAI.RealtimeAPIClientType.TRANSLATION`. | | onWebSocketClose | `(event: object) => void` | ✗ | \_inherited from *VoiceAIClientParameters* A callback function that is called when the [WebSocket](/api-reference/voxengine/websocket) 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 investigate issues. | | `type` | OpenAI.RealtimeAPIClientType | ✗ | The type of the client. The default value is **OpenAI.RealtimeAPIClientType.REALTIME**. Use `OpenAI.RealtimeAPIClientType.TRANSLATION` for realtime translation sessions. GPT-Live sessions use `OpenAI.createLiveAPIClient`. | #### GPT Live [OpenAI.LiveAPIClient](/api-reference/voxengine/openai#liveapiclient) parameters. Can be passed as arguments to the `OpenAI.createLiveAPIClient` method. | Property | Type | Req. | Description | | ------------------------------------- | ------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `apiKey` | `string` | ✓ | The API key for the OpenAI Live API. | | `baseUrl` | `string` | ✗ | The base URL for the OpenAI Live API. | | onWebSocketClose | `(event: object) => void` | ✗ | \_inherited from *VoiceAIClientParameters* A callback function that is called when the [WebSocket](/api-reference/voxengine/websocket) 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 investigate issues. | ## Client methods Use the tabs to switch between Chat Completions, Responses, Realtime, and GPT Live client methods. #### Chat Completions ### ChatCompletionsAPIClient.addEventListener Adds a handler for the specified [OpenAI.ChatCompletionsAPIEvents](/api-reference/voxengine/openai#chatcompletionsapievents) or [OpenAI.Events](/api-reference/voxengine/openai#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` | OpenAI.Events \| OpenAI.ChatCompletionsAPIEvents \| string | ✓ | Event constant or event name to subscribe to. | | `callback` | `(event: object) => any` | ✓ | Function called when the event is emitted. | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### ChatCompletionsAPIClient.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. | ### ChatCompletionsAPIClient.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) You can use this API not only with OpenAI, but also with other OpenAI-compatible providers (configure the connector via `OpenAI.ChatCompletionsAPIClientParameters.baseUrl`). Third-party providers often pass custom model settings through the **chat\_template\_kwargs** request parameter. ```ts createChatCompletions(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### ChatCompletionsAPIClient.id Returns the ChatCompletionsAPIClient id. ```ts id(): string ``` **Parameters** This method does not accept parameters. **Returns** | Type | Description | | -------- | --------------------------- | | `string` | The requested string value. | ### ChatCompletionsAPIClient.removeEventListener Removes a handler for the specified [OpenAI.ChatCompletionsAPIEvents](/api-reference/voxengine/openai#chatcompletionsapievents) or [OpenAI.Events](/api-reference/voxengine/openai#events) event. ```ts removeEventListener(event: OpenAI.Events | OpenAI.ChatCompletionsAPIEvents | string, callback?: (event: object) => any): void ``` **Parameters** | Parameter | Type | Req. | Description | | ---------- | --------------------------------------------------------------------------------------------------- | ---- | --------------------------------------------- | | `event` | OpenAI.Events \| OpenAI.ChatCompletionsAPIEvents \| string | ✓ | Event constant or event name to subscribe to. | | `callback` | `(event: object) => any` | ✗ | Function called when the event is emitted. | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### ChatCompletionsAPIClient.webSocketId Returns the OpenAI WebSocket id. ```ts webSocketId(): string ``` **Parameters** This method does not accept parameters. **Returns** | Type | Description | | -------- | --------------------------- | | `string` | The requested string value. | #### Responses ### ResponsesAPIClient.addEventListener Adds a handler for the specified [OpenAI.ResponsesAPIEvents](/api-reference/voxengine/openai#responsesapievents) or [OpenAI.Events](/api-reference/voxengine/openai#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` | OpenAI.Events \| OpenAI.ResponsesAPIEvents \| string | ✓ | Event constant or event name to subscribe to. | | `callback` | `(event: object) => any` | ✓ | Function called when the event is emitted. | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### ResponsesAPIClient.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. | ### ResponsesAPIClient.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. | ### ResponsesAPIClient.id Returns the ResponsesAPIClient id. ```ts id(): string ``` **Parameters** This method does not accept parameters. **Returns** | Type | Description | | -------- | --------------------------- | | `string` | The requested string value. | ### ResponsesAPIClient.removeEventListener Removes a handler for the specified [OpenAI.ResponsesAPIEvents](/api-reference/voxengine/openai#responsesapievents) or [OpenAI.Events](/api-reference/voxengine/openai#events) event. ```ts removeEventListener(event: OpenAI.Events | OpenAI.ResponsesAPIEvents | string, callback?: (event: object) => any): void ``` **Parameters** | Parameter | Type | Req. | Description | | ---------- | -------------------------------------------------------------------------------------- | ---- | --------------------------------------------- | | `event` | OpenAI.Events \| OpenAI.ResponsesAPIEvents \| string | ✓ | Event constant or event name to subscribe to. | | `callback` | `(event: object) => any` | ✗ | Function called when the event is emitted. | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### ResponsesAPIClient.webSocketId Returns the OpenAI WebSocket id. ```ts webSocketId(): string ``` **Parameters** This method does not accept parameters. **Returns** | Type | Description | | -------- | --------------------------- | | `string` | The requested string value. | #### Realtime ### RealtimeAPIClient.addEventListener Adds a handler for the specified [OpenAI.RealtimeAPIEvents](/api-reference/voxengine/openai#realtimeapievents) or [OpenAI.Events](/api-reference/voxengine/openai#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` | OpenAI.Events \| OpenAI.RealtimeAPIEvents \| string | ✓ | Event constant or event name to subscribe to. | | `callback` | `(event: object) => any` | ✓ | Function called when the event is emitted. | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.clearMediaBuffer Clears the OpenAI WebSocket media buffer. ```ts clearMediaBuffer(parameters?: ClearMediaBufferParameters): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | ----------------------------------------------------- | ---- | ----------- | | `parameters` | ClearMediaBufferParameters | ✗ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.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. | ### RealtimeAPIClient.conversationItemCreate Add a new Item to the Conversation's context. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) ```ts conversationItemCreate(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.conversationItemDelete Send this event when you want to remove any item from the conversation history. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) ```ts conversationItemDelete(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.conversationItemRetrieve Send this event when you want to retrieve the server's representation of a specific item in the conversation history. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) ```ts conversationItemRetrieve(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.conversationItemTruncate Send this event to truncate a previous assistant message’s audio. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) ```ts conversationItemTruncate(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.id Returns the RealtimeAPIClient id. ```ts id(): string ``` **Parameters** This method does not accept parameters. **Returns** | Type | Description | | -------- | --------------------------- | | `string` | The requested string value. | ### RealtimeAPIClient.inputAudioBufferClear Send this event to clear the audio bytes in the buffer. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) ```ts inputAudioBufferClear(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.inputAudioBufferCommit Send this event to commit the user input audio buffer, which will create a new user message item in the conversation. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) ```ts inputAudioBufferCommit(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.removeEventListener Removes a handler for the specified [OpenAI.RealtimeAPIEvents](/api-reference/voxengine/openai#realtimeapievents) or [OpenAI.Events](/api-reference/voxengine/openai#events) event. ```ts removeEventListener(event: OpenAI.Events | OpenAI.RealtimeAPIEvents | string, callback?: (event: object) => any): void ``` **Parameters** | Parameter | Type | Req. | Description | | ---------- | ------------------------------------------------------------------------------------- | ---- | --------------------------------------------- | | `event` | OpenAI.Events \| OpenAI.RealtimeAPIEvents \| string | ✓ | Event constant or event name to subscribe to. | | `callback` | `(event: object) => any` | ✗ | Function called when the event is emitted. | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.responseCancel Send this event to cancel an in-progress response. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) ```ts responseCancel(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.responseCreate This event instructs the server to create a Response, which means triggering model inference. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) ```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" } ``` ### RealtimeAPIClient.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` | SendMediaParameters | ✗ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.sessionClose Gracefully close a realtime translation session. The server flushes pending input audio and emits remaining output before sending `OpenAI.RealtimeAPIEvents.SessionClosed`. Supported for `OpenAI.RealtimeAPIClientType.TRANSLATION`. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) ```ts sessionClose(parameters?: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✗ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### RealtimeAPIClient.sessionUpdate Send this event to update the session’s configuration. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) ```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" } ``` ### RealtimeAPIClient.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. | ### RealtimeAPIClient.webSocketId Returns the OpenAI WebSocket id. ```ts webSocketId(): string ``` **Parameters** This method does not accept parameters. **Returns** | Type | Description | | -------- | --------------------------- | | `string` | The requested string value. | #### GPT Live ### LiveAPIClient.addEventListener Adds a handler for the specified [OpenAI.LiveAPIEvents](/api-reference/voxengine/openai#liveapievents) or [OpenAI.Events](/api-reference/voxengine/openai#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.LiveAPIEvents | string, callback: (event: object) => any): void ``` **Parameters** | Parameter | Type | Req. | Description | | ---------- | --------------------------------------------------------------------------------- | ---- | --------------------------------------------- | | `event` | OpenAI.Events \| OpenAI.LiveAPIEvents \| string | ✓ | Event constant or event name to subscribe to. | | `callback` | `(event: object) => any` | ✓ | Function called when the event is emitted. | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.clearMediaBuffer Clears the OpenAI WebSocket media buffer. ```ts clearMediaBuffer(parameters?: ClearMediaBufferParameters): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | ----------------------------------------------------- | ---- | ----------- | | `parameters` | ClearMediaBufferParameters | ✗ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.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. | ### LiveAPIClient.id Returns the LiveAPIClient id. ```ts id(): string ``` **Parameters** This method does not accept parameters. **Returns** | Type | Description | | -------- | --------------------------- | | `string` | The requested string value. | ### LiveAPIClient.removeEventListener Removes a handler for the specified [OpenAI.LiveAPIEvents](/api-reference/voxengine/openai#liveapievents) or [OpenAI.Events](/api-reference/voxengine/openai#events) event. ```ts removeEventListener(event: OpenAI.Events | OpenAI.LiveAPIEvents | string, callback?: (event: object) => any): void ``` **Parameters** | Parameter | Type | Req. | Description | | ---------- | --------------------------------------------------------------------------------- | ---- | --------------------------------------------- | | `event` | OpenAI.Events \| OpenAI.LiveAPIEvents \| string | ✓ | Event constant or event name to subscribe to. | | `callback` | `(event: object) => any` | ✗ | Function called when the event is emitted. | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.responseCreate Request a response from the Live session's Responses backend, or continue a delegated response that is waiting for tool results. Requires Responses delegation. This does not grant the voice model permission to speak. [https://developers.openai.com/api/reference/resources/live/primary-websocket#response.create](https://developers.openai.com/api/reference/resources/live/primary-websocket#response.create) ```ts responseCreate(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.responseItemCreate Add an input item to the Live session's Responses backend, such as a `function_call_output`. Requires Responses delegation. Send `OpenAI.LiveAPIClient.responseCreate` after the required results to continue backend work. [https://developers.openai.com/api/reference/resources/live/primary-websocket#response.item.create](https://developers.openai.com/api/reference/resources/live/primary-websocket#response.item.create) ```ts responseItemCreate(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.sendMediaTo Starts sending media from the OpenAI Live session (via WebSocket) to the media unit. ```ts sendMediaTo(mediaUnit: VoxMediaUnit, parameters?: SendMediaParameters): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | --------------------------------------- | ---- | ----------- | | `mediaUnit` | `VoxMediaUnit` | ✓ | | | `parameters` | SendMediaParameters | ✗ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.sessionClose Request that the Live session close. The terminal `OpenAI.LiveAPIEvents.SessionClosed` event contains the close reason and final usage. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.close](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.close) ```ts sessionClose(parameters?: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✗ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.sessionCommentaryAppend Append a verified result the user should hear. Always include `delegation_id` (`null` for session-wide context). Content is a plain string of at most 500 tokens. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.commentary.append](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.commentary.append) ```ts sessionCommentaryAppend(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.sessionInputAudioMute Mute audio input to the Live model without closing the session. Muting input does not stop the assistant's output. The server acknowledges with `OpenAI.LiveAPIEvents.SessionInputAudioMuted`. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.input\_audio.mute](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.input_audio.mute) ```ts sessionInputAudioMute(parameters?: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✗ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.sessionInputAudioUnmute Unmute audio input so it is sent to the Live model again. The server acknowledges with `OpenAI.LiveAPIEvents.SessionInputAudioUnmuted`. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.input\_audio.unmute](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.input_audio.unmute) ```ts sessionInputAudioUnmute(parameters?: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✗ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.sessionInstructionsAppend Append instructions to the Live conversation while it is running. Always include `delegation_id` (`null` for session-wide context). Content is a plain string of at most 500 tokens. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.instructions.append](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.instructions.append) ```ts sessionInstructionsAppend(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.sessionStart Start a Live session. Send this as the first custom event after `OpenAI.createLiveAPIClient`. Wait for `OpenAI.LiveAPIEvents.SessionStarted` before sending media or other commands. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.start](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.start) ```ts sessionStart(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.sessionThinkingAppend Provide silent reasoning or progress context to the Live model. Always include `delegation_id` (`null` for session-wide context). Content is a plain string of at most 500 tokens. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.thinking.append](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.thinking.append) ```ts sessionThinkingAppend(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.sessionUpdate Update the delegation settings of an active Live session. The server acknowledges accepted changes with `OpenAI.LiveAPIEvents.SessionUpdated`. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.update](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.update) ```ts sessionUpdate(parameters: Object): void ``` **Parameters** | Parameter | Type | Req. | Description | | ------------ | -------- | ---- | ----------- | | `parameters` | `Object` | ✓ | | **Returns** | Type | Description | | ------ | ------------------------ | | `void` | Does not return a value. | ### LiveAPIClient.stopMediaTo Stops sending media from the OpenAI Live session (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. | ### LiveAPIClient.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 Chat Completions, Responses, Realtime, and GPT Live. #### Media bridge ### Media bridge events These events describe audio received through the OpenAI WebSocket media bridge. #### Events.WebSocketMediaStarted Triggered when the audio stream sent by a third party through an OpenAI WebSocket starts playing. Event constant: `Events.WebSocketMediaStarted` **Payload** | Field | Type | Req. | Description | | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `client` | RealtimeAPIClient \| LiveAPIClient \| ResponsesAPIClient \| ChatCompletionsAPIClient | ✓ | The [OpenAI.RealtimeAPIClient](/api-reference/voxengine/openai#realtimeapiclient), [OpenAI.LiveAPIClient](/api-reference/voxengine/openai#liveapiclient), [OpenAI.ResponsesAPIClient](/api-reference/voxengine/openai#responsesapiclient), or [OpenAI.ChatCompletionsAPIClient](/api-reference/voxengine/openai#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. | | customParameters | `{ [key: string]: string }` | ✗ | Custom parameters. | #### Events.WebSocketMediaEnded Triggered 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` | RealtimeAPIClient \| LiveAPIClient \| ResponsesAPIClient \| ChatCompletionsAPIClient | ✓ | The [OpenAI.RealtimeAPIClient](/api-reference/voxengine/openai#realtimeapiclient), [OpenAI.LiveAPIClient](/api-reference/voxengine/openai#liveapiclient), [OpenAI.ResponsesAPIClient](/api-reference/voxengine/openai#responsesapiclient), or [OpenAI.ChatCompletionsAPIClient](/api-reference/voxengine/openai#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` | WebSocketMediaInfo | ✗ | Information about the audio stream that can be obtained after the stream stops or pauses (**1 second of silence**). | #### Chat Completions ### ChatCompletionsAPIEvents These events describe responses from the Chat Completions API client. **All ChatCompletionsAPIEvents callbacks receive these common fields:** | Field | Type | Description | | -------- | ----------------------------------------------------------------- | --------------------------------------------- | | `client` | OpenAI.ChatCompletionsAPIClient | 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`). #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### Responses ### ResponsesAPIEvents These events describe responses from the Responses API client. **All ResponsesAPIEvents callbacks receive these common fields:** | Field | Type | Description | | -------- | ---------------------------------------------------- | --------------------------------------- | | `client` | OpenAI.ResponsesAPIClient | 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`). #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### 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.* #### Realtime ### 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` | OpenAI.RealtimeAPIClient | 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`). #### 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.* #### 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.* #### Error Returned when an error occurs, which could be a client problem or a server problem. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.Error` **Payload** | Field | Type | Req. | Description | | --------------- | ---------------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | RealtimeError | ✓ | 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" } ``` #### SessionCreated Returned when a Session is created. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.SessionCreated` **Payload** | Field | Type | Req. | Description | | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | RealtimeSessionCreateRequest \| RealtimeTranscriptionSessionCreateRequest | ✓ | The session configuration. | | `data.type` | "session.created" | ✓ | The event type, must be `session.created`. | Example `data`: ```json { "type": "session.created", "event_id": "string", "session": {} } ``` #### SessionUpdated Returned when a session is updated with a session.update event, unless there is an error. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.SessionUpdated` **Payload** | Field | Type | Req. | Description | | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | RealtimeSessionCreateRequest \| RealtimeTranscriptionSessionCreateRequest | ✓ | The session configuration. | | `data.type` | "session.updated" | ✓ | The event type, must be `session.updated`. | Example `data`: ```json { "type": "session.updated", "event_id": "string", "session": {} } ``` #### SessionClosed Returned when a realtime translation session is closed after `OpenAI.RealtimeAPIClient.sessionClose`. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.SessionClosed` **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.* #### SessionInputTranscriptDelta Returned when source-language transcript text is available in a realtime translation session. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.SessionInputTranscriptDelta` **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.* #### SessionOutputTranscriptDelta Returned when translated transcript text is available in a realtime translation session. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.SessionOutputTranscriptDelta` **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.* #### ConversationItemAdded Sent by the server when an Item is added to the default Conversation. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ConversationItemAdded` **Payload** | Field | Type | Req. | Description | | ----------------------- | ---------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `data` | \{ customEvent?: string; payload?: 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` | ConversationItem | ✓ | A single item within a Realtime conversation. | | `data.type` | "conversation.item.added" | ✓ | The event type, must be `conversation.item.added`. | | `data.previous_item_id` | `string \| null` | ✓ | 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": {} } ``` #### ConversationItemDone Returned when a conversation item is finalized. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ConversationItemDone` **Payload** | Field | Type | Req. | Description | | ----------------------- | ---------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | ConversationItem | ✓ | A single item within a Realtime conversation. | | `data.type` | "conversation.item.done" | ✓ | The event type, must be `conversation.item.done`. | | `data.previous_item_id` | `string \| null` | ✓ | 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": {} } ``` #### ConversationItemRetrieved Returned when a conversation item is retrieved with conversation.item.retrieve. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ConversationItemRetrieved` **Payload** #### ConversationItemInputAudioTranscriptionCompleted This event is the output of audio transcription for user audio written to the user audio buffer. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ConversationItemInputAudioTranscriptionCompleted` **Payload** | Field | Type | Req. | Description | | -------------------- | ------------------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "conversation.item.input\_audio\_transcription.completed" | ✓ | The event type, must be `conversation.item.input_audio_transcription.completed`. | | `data.usage` | TranscriptTextUsageTokens \| TranscriptTextUsageDuration | ✓ | Usage statistics for the transcription, this is billed according to the ASR model's pricing rather than the realtime model's pricing. | | `data.logprobs` | LogProbProperties\[] \| null | ✓ | 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": {} } ``` #### ConversationItemInputAudioTranscriptionDelta Returned when the text value of an input audio transcription content part is updated with incremental transcription results. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ConversationItemInputAudioTranscriptionDelta` **Payload** | Field | Type | Req. | Description | | -------------------- | --------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "conversation.item.input\_audio\_transcription.delta" | ✓ | 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` | LogProbProperties\[] \| null | ✓ | 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" } ``` #### ConversationItemInputAudioTranscriptionSegment Returned when an input audio transcription segment is identified for an item. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ConversationItemInputAudioTranscriptionSegment` **Payload** | Field | Type | Req. | Description | | -------------------- | ----------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `data` | \{ customEvent?: string; payload?: 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` | "conversation.item.input\_audio\_transcription.segment" | ✓ | 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" } ``` #### ConversationItemInputAudioTranscriptionFailed Returned when input audio transcription is configured, and a transcription request for a user message failed. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ConversationItemInputAudioTranscriptionFailed` **Payload** | Field | Type | Req. | Description | | -------------------- | ---------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "conversation.item.input\_audio\_transcription.failed" | ✓ | 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" } ``` #### ConversationItemTruncated Returned when an earlier assistant audio message item is truncated by the client with a conversation.item.truncate event. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ConversationItemTruncated` **Payload** | Field | Type | Req. | Description | | -------------------- | ---------------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "conversation.item.truncated" | ✓ | 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" } ``` #### ConversationItemDeleted Returned when an item in the conversation is deleted by the client with a conversation.item.delete event. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ConversationItemDeleted` **Payload** | Field | Type | Req. | Description | | --------------- | ---------------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "conversation.item.deleted" | ✓ | The event type, must be `conversation.item.deleted`. | Example `data`: ```json { "type": "conversation.item.deleted", "event_id": "string", "item_id": "string" } ``` #### InputAudioBufferCommitted Returned when an input audio buffer is committed. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.InputAudioBufferCommitted` **Payload** | Field | Type | Req. | Description | | ----------------------- | ---------------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "input\_audio\_buffer.committed" | ✓ | The event type, must be `input_audio_buffer.committed`. | | `data.previous_item_id` | `string \| null` | ✓ | 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" } ``` #### InputAudioBufferCleared Returned when the input audio buffer is cleared by the client with an input\_audio\_buffer.clear event. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.InputAudioBufferCleared` **Payload** | Field | Type | Req. | Description | | --------------- | ---------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `data` | \{ customEvent?: string; payload?: 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` | "input\_audio\_buffer.cleared" | ✓ | The event type, must be `input_audio_buffer.cleared`. | Example `data`: ```json { "type": "input_audio_buffer.cleared", "event_id": "string" } ``` #### InputAudioBufferSpeechStarted Sent by the server when in server\_vad mode to indicate that speech has been detected in the audio buffer. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.InputAudioBufferSpeechStarted` **Payload** | Field | Type | Req. | Description | | --------------------- | ---------------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "input\_audio\_buffer.speech\_started" | ✓ | 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" } ``` #### InputAudioBufferSpeechStopped Returned in server\_vad mode when the server detects the end of speech in the audio buffer. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.InputAudioBufferSpeechStopped` **Payload** | Field | Type | Req. | Description | | ------------------- | ---------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `data` | \{ customEvent?: string; payload?: 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` | "input\_audio\_buffer.speech\_stopped" | ✓ | 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" } ``` #### InputAudioBufferTimeoutTriggered Returned when the Server VAD timeout is triggered for the input audio buffer. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.InputAudioBufferTimeoutTriggered` **Payload** | Field | Type | Req. | Description | | --------------------- | ---------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "input\_audio\_buffer.timeout\_triggered" | ✓ | 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" } ``` #### ResponseCreated Returned when a new Response is created. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseCreated` **Payload** | Field | Type | Req. | Description | | --------------- | ---------------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | RealtimeResponse | ✓ | The response resource. | | `data.type` | "response.created" | ✓ | The event type, must be `response.created`. | Example `data`: ```json { "type": "response.created", "event_id": "string", "response": {} } ``` #### ResponseDone Returned when a Response is done streaming. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseDone` **Payload** | Field | Type | Req. | Description | | --------------- | ---------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | RealtimeResponse | ✓ | The response resource. | | `data.type` | "response.done" | ✓ | The event type, must be `response.done`. | Example `data`: ```json { "type": "response.done", "event_id": "string", "response": {} } ``` #### ResponseOutputItemAdded Returned when a new Item is created during Response generation. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseOutputItemAdded` **Payload** | Field | Type | Req. | Description | | ------------------- | ---------------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | ConversationItem | ✓ | 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` | "response.output\_item.added" | ✓ | 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" } ``` #### ResponseOutputItemDone Returned when an Item is done streaming. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseOutputItemDone` **Payload** | Field | Type | Req. | Description | | ------------------- | ---------------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | ConversationItem | ✓ | 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` | "response.output\_item.done" | ✓ | 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" } ``` #### ResponseContentPartAdded Returned when a new content part is added to an assistant message item during response generation. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseContentPartAdded` **Payload** | Field | Type | Req. | Description | | -------------------- | ---------------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "response.content\_part.added" | ✓ | 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" } ``` #### ResponseContentPartDone Returned when a content part is done streaming in an assistant message item. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseContentPartDone` **Payload** | Field | Type | Req. | Description | | -------------------- | ---------------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "response.content\_part.done" | ✓ | 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" } ``` #### ResponseOutputTextDelta Returned when the text value of an "output\_text" content part is updated. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseOutputTextDelta` **Payload** | Field | Type | Req. | Description | | -------------------- | ---------------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "response.output\_text.delta" | ✓ | 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" } ``` #### ResponseOutputTextDone Returned when the text value of an "output\_text" content part is done streaming. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseOutputTextDone` **Payload** | Field | Type | Req. | Description | | -------------------- | ---------------------------------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "response.output\_text.done" | ✓ | 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" } ``` #### ResponseOutputAudioTranscriptDelta Returned when the model-generated transcription of audio output is updated. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseOutputAudioTranscriptDelta` **Payload** | Field | Type | Req. | Description | | -------------------- | --------------------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "response.output\_audio\_transcript.delta" | ✓ | 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" } ``` #### ResponseOutputAudioTranscriptDone Returned when the model-generated transcription of audio output is done streaming. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseOutputAudioTranscriptDone` **Payload** | Field | Type | Req. | Description | | -------------------- | -------------------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "response.output\_audio\_transcript.done" | ✓ | 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" } ``` #### ResponseOutputAudioDone Returned when the model-generated audio is done. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseOutputAudioDone` **Payload** | Field | Type | Req. | Description | | -------------------- | ---------------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "response.output\_audio.done" | ✓ | 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" } ``` #### ResponseFunctionCallArgumentsDelta Returned when the model-generated function call arguments are updated. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseFunctionCallArgumentsDelta` **Payload** | Field | Type | Req. | Description | | ------------------- | --------------------------------------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "response.function\_call\_arguments.delta" | ✓ | 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" } ``` #### ResponseFunctionCallArgumentsDone Returned when the model-generated function call arguments are done streaming. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.ResponseFunctionCallArgumentsDone` **Payload** | Field | Type | Req. | Description | | ------------------- | -------------------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: 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` | "response.function\_call\_arguments.done" | ✓ | 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" } ``` #### ResponseMCPCallArgumentsDelta Returned when MCP tool call arguments are updated during response generation. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) 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.* #### ResponseMCPCallArgumentsDone Returned when MCP tool call arguments are finalized during response generation. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) 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.* #### ResponseMCPCallInProgress Returned when an MCP tool call has started and is in progress. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) 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.* #### ResponseMCPCallCompleted Returned when an MCP tool call has completed successfully. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) 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.* #### ResponseMCPCallFailed Returned when an MCP tool call has failed. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) 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.* #### MCPListToolsInProgress Returned when listing MCP tools is in progress for an item. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) 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.* #### MCPListToolsCompleted Returned when listing MCP tools has completed for an item. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) 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.* #### MCPListToolsFailed Returned when listing MCP tools has failed for an item. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) 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.* #### RateLimitsUpdated Emitted at the beginning of a Response to indicate the updated rate limits. [https://developers.openai.com/api/reference/overview](https://developers.openai.com/api/reference/overview) Event constant: `RealtimeAPIEvents.RateLimitsUpdated` **Payload** | Field | Type | Req. | Description | | ------------------ | ---------------------------------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `data` | \{ customEvent?: string; payload?: Object; } | ✗ | Emitted at the beginning of a Response to indicate the updated rate limits. When a Response is created some tokens will be "reserved" for the output tokens, the rate limits shown here reflect that reservation, which is then adjusted accordingly once the Response is completed. See the [partner event documentation](https://developers.openai.com/api/reference/resources/realtime/server-events#rate-limits-updated). | | `data.event_id` | `string` | ✓ | The unique ID of the server event. | | `data.rate_limits` | `RateLimit[]` | ✓ | List of rate limit information. | | `data.type` | "rate\_limits.updated" | ✓ | The event type, must be `rate_limits.updated`. | Example `data`: ```json { "type": "rate_limits.updated", "event_id": "string", "rate_limits": [] } ``` #### 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.* #### 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.* #### GPT Live ### LiveAPIEvents These events mirror server messages from the OpenAI Live API. The `data` field contains the provider event payload. **All LiveAPIEvents callbacks receive these common fields:** | Field | Type | Description | | -------- | ----------------------------------------------- | ----------------------------------------------- | | `client` | OpenAI.LiveAPIClient | The OpenAI.LiveAPIClient instance. | | `data` | `Object` | Pass-through OpenAI Live session event payload. | Per-event payload tables below show only event-specific fields (and any provider payload enrichment for `data`). #### Unknown The unknown event. Event constant: `LiveAPIEvents.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.* #### HTTPResponse The HTTP response event. Event constant: `LiveAPIEvents.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.* #### Error Reports an error in the Live session, such as an invalid client command. Use `error.client_event_id`, when present, to identify the command that caused the error. [https://developers.openai.com/api/reference/resources/live/primary-websocket#error](https://developers.openai.com/api/reference/resources/live/primary-websocket#error) Event constant: `LiveAPIEvents.Error` **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.* #### SessionStarted Returned when a Live session has started. Contains the resolved session configuration, including server defaults. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.started](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.started) Event constant: `LiveAPIEvents.SessionStarted` **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.* #### SessionUpdated Returned when a Live session update is accepted. Contains the resolved session configuration after the update. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.updated](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.updated) Event constant: `LiveAPIEvents.SessionUpdated` **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.* #### SessionClosed Returned after the Live session finishes finalizing, with the close reason, final session snapshot, and cumulative audio usage. A connection that closes without this event does not confirm successful finalization. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.closed](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.closed) Event constant: `LiveAPIEvents.SessionClosed` **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.* #### SessionInputTranscriptDelta A transcript fragment for user input audio. Append each fragment in delivery order. These events do not define complete turns and have no transcript-done event. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.input\_transcript.delta](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.input_transcript.delta) Event constant: `LiveAPIEvents.SessionInputTranscriptDelta` **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.* #### SessionOutputTranscriptDelta A transcript fragment for assistant output audio. Append each fragment in delivery order. These events do not define complete turns and have no transcript-done event. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.output\_transcript.delta](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.output_transcript.delta) Event constant: `LiveAPIEvents.SessionOutputTranscriptDelta` **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.* #### AgentStartedSpeaking Emitted when the agent started speaking. Derived by AI Connector from output audio. Marks when audio enters the media path, before the caller hears it. Event constant: `LiveAPIEvents.AgentStartedSpeaking` **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.* #### AgentStoppedSpeaking Emitted when the agent stopped speaking. Derived by AI Connector from output audio. Marks when audio stops entering the media path, before the caller hears the speech end. Event constant: `LiveAPIEvents.AgentStoppedSpeaking` **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.* #### SessionDelegationCreated Returned when the Live model delegates work to your application or a Responses backend. The payload carries delegation metadata and timeline position, not the task text or tool arguments. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.delegation.created](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.delegation.created) Event constant: `LiveAPIEvents.SessionDelegationCreated` **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.* #### ResponseEvent A streaming Responses API event from a backend delegated to by the Live session. Unwrap `data.payload.event` and preserve the outer `delegation_id`. [https://developers.openai.com/api/reference/resources/live/primary-websocket#response.event](https://developers.openai.com/api/reference/resources/live/primary-websocket#response.event) Event constant: `LiveAPIEvents.ResponseEvent` **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.* #### SessionInstructionsAppended Returned when a `OpenAI.LiveAPIClient.sessionInstructionsAppend` command is accepted into the Live session timeline. Match the command through `client_event_id`. This acknowledges the instructions and does not guarantee that the model has acted on them. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.instructions.appended](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.instructions.appended) Event constant: `LiveAPIEvents.SessionInstructionsAppended` **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.* #### SessionThinkingAppended Returned when a `OpenAI.LiveAPIClient.sessionThinkingAppend` command is accepted into the Live session timeline. Match the command through `client_event_id`. This acknowledges the reasoning context and does not guarantee spoken output. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.thinking.appended](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.thinking.appended) Event constant: `LiveAPIEvents.SessionThinkingAppended` **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.* #### SessionCommentaryAppended Returned when a `OpenAI.LiveAPIClient.sessionCommentaryAppend` command is accepted into the Live session timeline. Match the command through `client_event_id`. This acknowledges the commentary and does not guarantee exact wording or completed audio playback. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.commentary.appended](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.commentary.appended) Event constant: `LiveAPIEvents.SessionCommentaryAppended` **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.* #### SessionInputAudioMuted Returned when a `OpenAI.LiveAPIClient.sessionInputAudioMute` command is accepted. Input audio is no longer sent to the model. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.input\_audio.muted](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.input_audio.muted) Event constant: `LiveAPIEvents.SessionInputAudioMuted` **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.* #### SessionInputAudioUnmuted Returned when a `OpenAI.LiveAPIClient.sessionInputAudioUnmute` command is accepted. Input audio is sent to the model again. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.input\_audio.unmuted](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.input_audio.unmuted) Event constant: `LiveAPIEvents.SessionInputAudioUnmuted` **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.* #### SessionUsageUpdated Reports cumulative Live audio usage and, when available, the most recent context-window usage. Do not sum `usage.seconds` across events. Delegated Responses token usage is reported separately in `OpenAI.LiveAPIEvents.ResponseEvent`. [https://developers.openai.com/api/reference/resources/live/primary-websocket#session.usage.updated](https://developers.openai.com/api/reference/resources/live/primary-websocket#session.usage.updated) Event constant: `LiveAPIEvents.SessionUsageUpdated` **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.* #### WebSocketError The WebSocket error response event. Event constant: `LiveAPIEvents.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.* #### ConnectorInformation Contains information about connector. Event constant: `LiveAPIEvents.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.* > API clients for OpenAI chat completions, responses, realtime, and GPT Live voice scenarios.