SPB Git

Repository Public

client-events.md 91.0 KB 2,905 lines markdown

1# Realtime client events23> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.45These are events that the OpenAI Realtime WebSocket server will accept from the client.67<a id="session.update"></a>89## session.update1011Send this event to update the session’s configuration.12The client may send this event at any time to update any field13except for `voice` and `model`. `voice` can be updated only if there have been no other audio outputs yet.1415When the server receives a `session.update`, it will respond16with a `session.updated` event showing the full, effective configuration.17Only the fields that are present in the `session.update` are updated. To clear a field like18`instructions`, pass an empty string. To clear a field like `tools`, pass an empty array.19To clear a field like `turn_detection`, pass `null`.2021### Schema2223Schema name: `RealtimeClientEventSessionUpdate`2425- `session: RealtimeSessionCreateRequest or RealtimeTranscriptionSessionCreateRequest`2627  Update the Realtime session. Choose either a realtime28  session or a transcription session.2930  - `RealtimeSessionCreateRequest object { type, audio, include, 11 more }`3132    Realtime session object configuration.3334    - `type: "realtime"`3536      The type of session to create. Always `realtime` for the Realtime API.3738      - `"realtime"`3940    - `audio: optional RealtimeAudioConfig`4142      Configuration for input and output audio.4344      - `input: optional RealtimeAudioConfigInput`4546        - `format: optional RealtimeAudioFormats`4748          The format of the input audio.4950          - `PCMAudio object { rate, type }`5152            The PCM audio format. Only a 24kHz sample rate is supported.5354            - `rate: optional 24000`5556              The sample rate of the audio. Always `24000`.5758              - `24000`5960            - `type: optional "audio/pcm"`6162              The audio format. Always `audio/pcm`.6364              - `"audio/pcm"`6566          - `PCMUAudio object { type }`6768            The G.711 μ-law format.6970            - `type: optional "audio/pcmu"`7172              The audio format. Always `audio/pcmu`.7374              - `"audio/pcmu"`7576          - `PCMAAudio object { type }`7778            The G.711 A-law format.7980            - `type: optional "audio/pcma"`8182              The audio format. Always `audio/pcma`.8384              - `"audio/pcma"`8586        - `noise_reduction: optional object { type }`8788          Configuration for input audio noise reduction. This can be set to `null` to turn off.89          Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.90          Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.9192          - `type: optional NoiseReductionType`9394            Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.9596            - `"near_field"`9798            - `"far_field"`99100        - `transcription: optional AudioTranscription`101102          Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.103104          - `delay: optional "minimal" or "low" or "medium" or 2 more`105106            Controls how long the model waits before emitting transcription text.107            Higher values can improve transcription accuracy at the cost of latency.108            Only supported with `gpt-realtime-whisper` in GA Realtime sessions.109110            - `"minimal"`111112            - `"low"`113114            - `"medium"`115116            - `"high"`117118            - `"xhigh"`119120          - `keywords: optional array of string`121122            Words or phrases to guide transcription of the input audio. Supported by `gpt-transcribe` and `gpt-live-transcribe`.123124          - `language: optional string`125126            The language of the input audio. Supplying the input language in127            [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format128            will improve accuracy and latency.129130          - `languages: optional array of string`131132            Possible languages of the input audio, in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. Supported by `gpt-transcribe` and `gpt-live-transcribe`.133134          - `model: optional string or "whisper-1" or "gpt-transcribe" or "gpt-live-transcribe" or 5 more`135136            The model to use for transcription. Current options are `whisper-1`, `gpt-transcribe`, `gpt-live-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.137138            - `string`139140            - `"whisper-1" or "gpt-transcribe" or "gpt-live-transcribe" or 5 more`141142              The model to use for transcription. Current options are `whisper-1`, `gpt-transcribe`, `gpt-live-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and `gpt-realtime-whisper`. Use `gpt-4o-transcribe-diarize` when you need diarization with speaker labels.143144              - `"whisper-1"`145146              - `"gpt-transcribe"`147148              - `"gpt-live-transcribe"`149150              - `"gpt-4o-mini-transcribe"`151152              - `"gpt-4o-mini-transcribe-2025-12-15"`153154              - `"gpt-4o-transcribe"`155156              - `"gpt-4o-transcribe-diarize"`157158              - `"gpt-realtime-whisper"`159160          - `prompt: optional string`161162            An optional text to guide the model's style or continue a previous audio163            segment.164            For `whisper-1`, the [prompt is a list of keywords](https://developers.openai.com/api/docs/guides/speech-to-text#prompting).165            For `gpt-4o-transcribe` models (excluding `gpt-4o-transcribe-diarize`), the prompt is a free text string, for example "expect words related to technology".166            Prompt is not supported with `gpt-realtime-whisper` in GA Realtime sessions.167168        - `turn_detection: optional RealtimeAudioInputTurnDetection or null`169170          Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.171172          Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.173174          Semantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.175176          For `gpt-realtime-whisper` transcription sessions, turn detection must be177          set to `null`; VAD is not supported.178179          - `ServerVad object { type, create_response, idle_timeout_ms, 4 more }`180181            Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.182183            - `type: "server_vad"`184185              Type of turn detection, `server_vad` to turn on simple Server VAD.186187              - `"server_vad"`188189            - `create_response: optional boolean`190191              Whether or not to automatically generate a response when a VAD stop event occurs. If `interrupt_response` is set to `false` this may fail to create a response if the model is already responding.192193              If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.194195            - `idle_timeout_ms: optional number or null`196197              Optional timeout after which a model response will be triggered automatically. This is198              useful for situations in which a long pause from the user is unexpected, such as a phone199              call. The model will effectively prompt the user to continue the conversation based200              on the current context.201202              The timeout value will be applied after the last model response's audio has finished playing,203              i.e. it's set to the `response.done` time plus audio playback duration.204205              An `input_audio_buffer.timeout_triggered` event (plus events206              associated with the Response) will be emitted when the timeout is reached.207              Idle timeout is currently only supported for `server_vad` mode.208209            - `interrupt_response: optional boolean`210211              Whether or not to automatically interrupt (cancel) any ongoing response with output to the default212              conversation (i.e. `conversation` of `auto`) when a VAD start event occurs. If `true` then the response will be cancelled, otherwise it will continue until complete.213214              If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.215216            - `prefix_padding_ms: optional number`217218              Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in219              milliseconds). Defaults to 300ms.220221            - `silence_duration_ms: optional number`222223              Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults224              to 500ms. With shorter values the model will respond more quickly,225              but may jump in on short pauses from the user.226227            - `threshold: optional number`228229              Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A230              higher threshold will require louder audio to activate the model, and231              thus might perform better in noisy environments.232233          - `SemanticVad object { type, create_response, eagerness, interrupt_response }`234235            Server-side semantic turn detection which uses a model to determine when the user has finished speaking.236237            - `type: "semantic_vad"`238239              Type of turn detection, `semantic_vad` to turn on Semantic VAD.240241              - `"semantic_vad"`242243            - `create_response: optional boolean`244245              Whether or not to automatically generate a response when a VAD stop event occurs.246247            - `eagerness: optional "low" or "medium" or "high" or "auto"`248249              Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively.250251              - `"low"`252253              - `"medium"`254255              - `"high"`256257              - `"auto"`258259            - `interrupt_response: optional boolean`260261              Whether or not to automatically interrupt any ongoing response with output to the default262              conversation (i.e. `conversation` of `auto`) when a VAD start event occurs.263264      - `output: optional RealtimeAudioConfigOutput`265266        - `format: optional RealtimeAudioFormats`267268          The format of the output audio.269270        - `speed: optional number`271272          The speed of the model's spoken response as a multiple of the original speed.273          1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress.274275          This parameter is a post-processing adjustment to the audio after it is generated, it's276          also possible to prompt the model to speak faster or slower.277278        - `voice: optional string or "alloy" or "ash" or "ballad" or 7 more or object { id }`279280          The voice the model uses to respond. Supported built-in voices are281          `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,282          `marin`, and `cedar`. You may also provide a custom voice object with283          an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed284          during the session once the model has responded with audio at least once.285          We recommend `marin` and `cedar` for best quality.286287          - `string`288289          - `"alloy" or "ash" or "ballad" or 7 more`290291            - `"alloy"`292293            - `"ash"`294295            - `"ballad"`296297            - `"coral"`298299            - `"echo"`300301            - `"sage"`302303            - `"shimmer"`304305            - `"verse"`306307            - `"marin"`308309            - `"cedar"`310311          - `ID object { id }`312313            Custom voice reference.314315            - `id: string`316317              The custom voice ID, e.g. `voice_1234`.318319    - `include: optional array of "item.input_audio_transcription.logprobs"`320321      Additional fields to include in server outputs.322323      `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.324325      - `"item.input_audio_transcription.logprobs"`326327    - `instructions: optional string`328329      The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.330331      Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.332333    - `max_output_tokens: optional number or "inf"`334335      Maximum number of output tokens for a single assistant response,336      inclusive of tool calls. Provide an integer between 1 and 4096 to337      limit output tokens, or `inf` for the maximum available tokens for a338      given model. Defaults to `inf`.339340      - `number`341342      - `"inf"`343344        - `"inf"`345346    - `model: optional string or "gpt-realtime" or "gpt-realtime-1.5" or "gpt-realtime-2" or 16 more`347348      The Realtime model used for this session.349350      - `string`351352      - `"gpt-realtime" or "gpt-realtime-1.5" or "gpt-realtime-2" or 16 more`353354        The Realtime model used for this session.355356        - `"gpt-realtime"`357358        - `"gpt-realtime-1.5"`359360        - `"gpt-realtime-2"`361362        - `"gpt-realtime-2.1"`363364        - `"gpt-realtime-2.1-mini"`365366        - `"gpt-realtime-2025-08-28"`367368        - `"gpt-4o-realtime-preview"`369370        - `"gpt-4o-realtime-preview-2024-10-01"`371372        - `"gpt-4o-realtime-preview-2024-12-17"`373374        - `"gpt-4o-realtime-preview-2025-06-03"`375376        - `"gpt-4o-mini-realtime-preview"`377378        - `"gpt-4o-mini-realtime-preview-2024-12-17"`379380        - `"gpt-realtime-mini"`381382        - `"gpt-realtime-mini-2025-10-06"`383384        - `"gpt-realtime-mini-2025-12-15"`385386        - `"gpt-audio-1.5"`387388        - `"gpt-audio-mini"`389390        - `"gpt-audio-mini-2025-10-06"`391392        - `"gpt-audio-mini-2025-12-15"`393394    - `output_modalities: optional array of "text" or "audio"`395396      The set of modalities the model can respond with. It defaults to `["audio"]`, indicating397      that the model will respond with audio plus a transcript. `["text"]` can be used to make398      the model respond with text only. It is not possible to request both `text` and `audio` at the same time.399400      - `"text"`401402      - `"audio"`403404    - `parallel_tool_calls: optional boolean`405406      Whether the model may call multiple tools in parallel. Only supported by407      reasoning Realtime models such as `gpt-realtime-2`.408409    - `prompt: optional ResponsePrompt or null`410411      Reference to a prompt template and its variables.412      [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code).413414      - `id: string`415416        The unique identifier of the prompt template to use.417418      - `variables: optional map[string or ResponseInputText or ResponseInputImage or ResponseInputFile] or null`419420        Optional map of values to substitute in for variables in your421        prompt. The substitution values can either be strings, or other422        Response input types like images or files.423424        - `string`425426        - `ResponseInputText object { text, type, prompt_cache_breakpoint }`427428          A text input to the model.429430          - `text: string`431432            The text input to the model.433434          - `type: "input_text"`435436            The type of the input item. Always `input_text`.437438            - `"input_text"`439440          - `prompt_cache_breakpoint: optional object { mode }`441442            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.443444            - `mode: "explicit"`445446              The breakpoint mode. Always `explicit`.447448              - `"explicit"`449450        - `ResponseInputImage object { detail, type, file_id, 2 more }`451452          An image input to the model. Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision).453454          - `detail: ImageDetail`455456            The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.457458            - `"low"`459460            - `"high"`461462            - `"auto"`463464            - `"original"`465466          - `type: "input_image"`467468            The type of the input item. Always `input_image`.469470            - `"input_image"`471472          - `file_id: optional string or null`473474            The ID of the file to be sent to the model.475476          - `image_url: optional string or null`477478            The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.479480          - `prompt_cache_breakpoint: optional object { mode }`481482            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.483484            - `mode: "explicit"`485486              The breakpoint mode. Always `explicit`.487488              - `"explicit"`489490        - `ResponseInputFile object { type, detail, file_data, 4 more }`491492          A file input to the model.493494          - `type: "input_file"`495496            The type of the input item. Always `input_file`.497498            - `"input_file"`499500          - `detail: optional "auto" or "low" or "high"`501502            The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`.503504            - `"auto"`505506            - `"low"`507508            - `"high"`509510          - `file_data: optional string`511512            The content of the file to be sent to the model.513514          - `file_id: optional string or null`515516            The ID of the file to be sent to the model.517518          - `file_url: optional string`519520            The URL of the file to be sent to the model.521522          - `filename: optional string`523524            The name of the file to be sent to the model.525526          - `prompt_cache_breakpoint: optional object { mode }`527528            Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.529530            - `mode: "explicit"`531532              The breakpoint mode. Always `explicit`.533534              - `"explicit"`535536      - `version: optional string or null`537538        Optional version of the prompt template.539540    - `reasoning: optional RealtimeReasoning`541542      Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.543544      - `effort: optional RealtimeReasoningEffort`545546        Constrains effort on reasoning for reasoning-capable Realtime models such as547        `gpt-realtime-2`.548549        - `"minimal"`550551        - `"low"`552553        - `"medium"`554555        - `"high"`556557        - `"xhigh"`558559    - `tool_choice: optional RealtimeToolChoiceConfig`560561      How the model chooses tools. Provide one of the string modes or force a specific562      function/MCP tool.563564      - `ToolChoiceOptions = "none" or "auto" or "required"`565566        Controls which (if any) tool is called by the model.567568        `none` means the model will not call any tool and instead generates a message.569570        `auto` means the model can pick between generating a message or calling one or571        more tools.572573        `required` means the model must call one or more tools.574575        - `"none"`576577        - `"auto"`578579        - `"required"`580581      - `ToolChoiceFunction object { name, type }`582583        Use this option to force the model to call a specific function.584585        - `name: string`586587          The name of the function to call.588589        - `type: "function"`590591          For function calling, the type is always `function`.592593          - `"function"`594595      - `ToolChoiceMcp object { server_label, type, name }`596597        Use this option to force the model to call a specific tool on a remote MCP server.598599        - `server_label: string`600601          The label of the MCP server to use.602603        - `type: "mcp"`604605          For MCP tools, the type is always `mcp`.606607          - `"mcp"`608609        - `name: optional string or null`610611          The name of the tool to call on the server.612613    - `tools: optional RealtimeToolsConfig`614615      Tools available to the model.616617      - `RealtimeFunctionTool object { description, name, parameters, type }`618619        - `description: optional string`620621          The description of the function, including guidance on when and how622          to call it, and guidance about what to tell the user when calling623          (if anything).624625        - `name: optional string`626627          The name of the function.628629        - `parameters: optional unknown`630631          Parameters of the function in JSON Schema.632633        - `type: optional "function"`634635          The type of the tool, i.e. `function`.636637          - `"function"`638639      - `McpTool object { server_label, type, allowed_callers, 9 more }`640641        Give the model access to additional tools via remote Model Context Protocol642        (MCP) servers. [Learn more about MCP](https://developers.openai.com/api/docs/guides/tools-connectors-mcp).643644        - `server_label: string`645646          A label for this MCP server, used to identify it in tool calls.647648        - `type: "mcp"`649650          The type of the MCP tool. Always `mcp`.651652          - `"mcp"`653654        - `allowed_callers: optional array of "direct" or "programmatic" or null`655656          The tool invocation context(s).657658          - `"direct"`659660          - `"programmatic"`661662        - `allowed_tools: optional array of string or object { read_only, tool_names }  or null`663664          List of allowed tool names or a filter object.665666          - `McpAllowedTools = array of string`667668            A string array of allowed tool names669670          - `McpToolFilter object { read_only, tool_names }`671672            A filter object to specify which tools are allowed.673674            - `read_only: optional boolean`675676              Indicates whether or not a tool modifies data or is read-only. If an677              MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),678              it will match this filter.679680            - `tool_names: optional array of string`681682              List of allowed tool names.683684        - `authorization: optional string`685686          An OAuth access token that can be used with a remote MCP server, either687          with a custom MCP server URL or a service connector. Your application688          must handle the OAuth authorization flow and provide the token here.689690        - `connector_id: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 5 more`691692          Identifier for service connectors, like those available in ChatGPT. One of693          `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more694          about service connectors [here](https://developers.openai.com/api/docs/guides/tools-connectors-mcp#connectors).695696          This field is deprecated for models released after September 1, 2026.697          Use `server_url` to connect to a remote MCP server, or `tunnel_id` to698          connect through a Secure MCP Tunnel.699700          Currently supported `connector_id` values are:701702          - Dropbox: `connector_dropbox`703          - Gmail: `connector_gmail`704          - Google Calendar: `connector_googlecalendar`705          - Google Drive: `connector_googledrive`706          - Microsoft Teams: `connector_microsoftteams`707          - Outlook Calendar: `connector_outlookcalendar`708          - Outlook Email: `connector_outlookemail`709          - SharePoint: `connector_sharepoint`710711          - `"connector_dropbox"`712713          - `"connector_gmail"`714715          - `"connector_googlecalendar"`716717          - `"connector_googledrive"`718719          - `"connector_microsoftteams"`720721          - `"connector_outlookcalendar"`722723          - `"connector_outlookemail"`724725          - `"connector_sharepoint"`726727        - `defer_loading: optional boolean`728729          Whether this MCP tool is deferred and discovered via tool search.730731        - `headers: optional map[string] or null`732733          Optional HTTP headers to send to the MCP server. Use for authentication734          or other purposes.735736        - `require_approval: optional object { always, never }  or "always" or "never" or null`737738          Specify which of the MCP server's tools require approval.739740          - `McpToolApprovalFilter object { always, never }`741742            Specify which of the MCP server's tools require approval. Can be743            `always`, `never`, or a filter object associated with tools744            that require approval.745746            - `always: optional object { read_only, tool_names }`747748              A filter object to specify which tools are allowed.749750              - `read_only: optional boolean`751752                Indicates whether or not a tool modifies data or is read-only. If an753                MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),754                it will match this filter.755756              - `tool_names: optional array of string`757758                List of allowed tool names.759760            - `never: optional object { read_only, tool_names }`761762              A filter object to specify which tools are allowed.763764              - `read_only: optional boolean`765766                Indicates whether or not a tool modifies data or is read-only. If an767                MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),768                it will match this filter.769770              - `tool_names: optional array of string`771772                List of allowed tool names.773774          - `McpToolApprovalSetting = "always" or "never"`775776            Specify a single approval policy for all tools. One of `always` or777            `never`. When set to `always`, all tools will require approval. When778            set to `never`, all tools will not require approval.779780            - `"always"`781782            - `"never"`783784        - `server_description: optional string`785786          Optional description of the MCP server, used to provide more context.787788        - `server_url: optional string`789790          The URL for the MCP server. One of `server_url`, `connector_id`, or791          `tunnel_id` must be provided.792793        - `tunnel_id: optional string`794795          The Secure MCP Tunnel ID to use instead of a direct server URL. One of796          `server_url`, `connector_id`, or `tunnel_id` must be provided.797798    - `tracing: optional RealtimeTracingConfig or null`799800      Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once801      tracing is enabled for a session, the configuration cannot be modified.802803      `auto` will create a trace for the session with default values for the804      workflow name, group id, and metadata.805806      - `Auto = "auto"`807808        Enables tracing and sets default values for tracing configuration options. Always `auto`.809810        - `"auto"`811812      - `TracingConfiguration object { group_id, metadata, workflow_name }`813814        Granular configuration for tracing.815816        - `group_id: optional string`817818          The group id to attach to this trace to enable filtering and819          grouping in the Traces Dashboard.820821        - `metadata: optional unknown`822823          The arbitrary metadata to attach to this trace to enable824          filtering in the Traces Dashboard.825826        - `workflow_name: optional string`827828          The name of the workflow to attach to this trace. This is used to829          name the trace in the Traces Dashboard.830831    - `truncation: optional RealtimeTruncation`832833      When the number of tokens in a conversation exceeds the model's input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model's context. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs.834835      Clients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost.836837      Truncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context. However, clients can also configure truncation to retain messages up to a fraction of the maximum context size, which will reduce the need for future truncations and thus improve the cache rate.838839      Truncation can be disabled entirely, which means the server will never truncate but would instead return an error if the conversation exceeds the model's input token limit.840841      - `"auto" or "disabled"`842843        The truncation strategy to use for the session. `auto` is the default truncation strategy. `disabled` will disable truncation and emit errors when the conversation exceeds the input token limit.844845        - `"auto"`846847        - `"disabled"`848849      - `RetentionRatioTruncation object { retention_ratio, type, token_limits }`850851        Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage.852853        - `retention_ratio: number`854855          Fraction of post-instruction conversation tokens to retain (`0.0` - `1.0`) when the conversation exceeds the input token limit. Setting this to `0.8` means that messages will be dropped until 80% of the maximum allowed tokens are used. This helps reduce the frequency of truncations and improve cache rates.856857        - `type: "retention_ratio"`858859          Use retention ratio truncation.860861          - `"retention_ratio"`862863        - `token_limits: optional object { post_instructions }`864865          Optional custom token limits for this truncation strategy. If not provided, the model's default token limits will be used.866867          - `post_instructions: optional number`868869            Maximum tokens allowed in the conversation after instructions (which including tool definitions). For example, setting this to 5,000 would mean that truncation would occur when the conversation exceeds 5,000 tokens after instructions. This cannot be higher than the model's context window size minus the maximum output tokens.870871  - `RealtimeTranscriptionSessionCreateRequest object { type, audio, include }`872873    Realtime transcription session object configuration.874875    - `type: "transcription"`876877      The type of session to create. Always `transcription` for transcription sessions.878879      - `"transcription"`880881    - `audio: optional RealtimeTranscriptionSessionAudio`882883      Configuration for input and output audio.884885      - `input: optional RealtimeTranscriptionSessionAudioInput`886887        - `format: optional RealtimeAudioFormats`888889          The PCM audio format. Only a 24kHz sample rate is supported.890891        - `noise_reduction: optional object { type }`892893          Configuration for input audio noise reduction. This can be set to `null` to turn off.894          Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model.895          Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.896897          - `type: optional NoiseReductionType`898899            Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones.900901        - `transcription: optional AudioTranscription`902903          Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.904905        - `turn_detection: optional RealtimeTranscriptionSessionAudioInputTurnDetection or null`906907          Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response.908909          Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.910911          Semantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.912913          For `gpt-realtime-whisper` transcription sessions, turn detection must be914          set to `null`; VAD is not supported.915916          - `ServerVad object { type, create_response, idle_timeout_ms, 4 more }`917918            Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence.919920            - `type: "server_vad"`921922              Type of turn detection, `server_vad` to turn on simple Server VAD.923924              - `"server_vad"`925926            - `create_response: optional boolean`927928              Whether or not to automatically generate a response when a VAD stop event occurs. If `interrupt_response` is set to `false` this may fail to create a response if the model is already responding.929930              If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.931932            - `idle_timeout_ms: optional number or null`933934              Optional timeout after which a model response will be triggered automatically. This is935              useful for situations in which a long pause from the user is unexpected, such as a phone936              call. The model will effectively prompt the user to continue the conversation based937              on the current context.938939              The timeout value will be applied after the last model response's audio has finished playing,940              i.e. it's set to the `response.done` time plus audio playback duration.941942              An `input_audio_buffer.timeout_triggered` event (plus events943              associated with the Response) will be emitted when the timeout is reached.944              Idle timeout is currently only supported for `server_vad` mode.945946            - `interrupt_response: optional boolean`947948              Whether or not to automatically interrupt (cancel) any ongoing response with output to the default949              conversation (i.e. `conversation` of `auto`) when a VAD start event occurs. If `true` then the response will be cancelled, otherwise it will continue until complete.950951              If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted.952953            - `prefix_padding_ms: optional number`954955              Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in956              milliseconds). Defaults to 300ms.957958            - `silence_duration_ms: optional number`959960              Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults961              to 500ms. With shorter values the model will respond more quickly,962              but may jump in on short pauses from the user.963964            - `threshold: optional number`965966              Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A967              higher threshold will require louder audio to activate the model, and968              thus might perform better in noisy environments.969970          - `SemanticVad object { type, create_response, eagerness, interrupt_response }`971972            Server-side semantic turn detection which uses a model to determine when the user has finished speaking.973974            - `type: "semantic_vad"`975976              Type of turn detection, `semantic_vad` to turn on Semantic VAD.977978              - `"semantic_vad"`979980            - `create_response: optional boolean`981982              Whether or not to automatically generate a response when a VAD stop event occurs.983984            - `eagerness: optional "low" or "medium" or "high" or "auto"`985986              Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively.987988              - `"low"`989990              - `"medium"`991992              - `"high"`993994              - `"auto"`995996            - `interrupt_response: optional boolean`997998              Whether or not to automatically interrupt any ongoing response with output to the default999              conversation (i.e. `conversation` of `auto`) when a VAD start event occurs.10001001    - `include: optional array of "item.input_audio_transcription.logprobs"`10021003      Additional fields to include in server outputs.10041005      `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription.10061007      - `"item.input_audio_transcription.logprobs"`10081009- `type: "session.update"`10101011  The event type, must be `session.update`.10121013  - `"session.update"`10141015- `event_id: optional string`10161017  Optional client-generated ID used to identify this event. This is an arbitrary string that a client may assign. It will be passed back if there is an error with the event, but the corresponding `session.updated` event will not include it.10181019### Example10201021```json1022{1023  "type": "session.update",1024  "session": {1025    "type": "realtime",1026    "instructions": "You are a creative assistant that helps with design tasks.",1027    "tools": [1028      {1029        "type": "function",1030        "name": "display_color_palette",1031        "description": "Call this function when a user asks for a color palette.",1032        "parameters": {1033          "type": "object",1034          "properties": {1035            "theme": {1036              "type": "string",1037              "description": "Description of the theme for the color scheme."1038            },1039            "colors": {1040              "type": "array",1041              "description": "Array of five hex color codes based on the theme.",1042              "items": {1043                "type": "string",1044                "description": "Hex color code"1045              }1046            }1047          },1048          "required": [1049            "theme",1050            "colors"1051          ]1052        }1053      }1054    ],1055    "tool_choice": "auto"1056  }1057}1058```10591060<a id="input_audio_buffer.append"></a>10611062## input_audio_buffer.append10631064Send this event to append audio bytes to the input audio buffer. The audio1065buffer is temporary storage you can write to and later commit. A "commit" will create a new1066user message item in the conversation history from the buffer content and clear the buffer.1067Input audio transcription (if enabled) will be generated when the buffer is committed.10681069If VAD is enabled the audio buffer is used to detect speech and the server will decide1070when to commit. When Server VAD is disabled, you must commit the audio buffer1071manually. Input audio noise reduction operates on writes to the audio buffer.10721073The client may choose how much audio to place in each event up to a maximum1074of 15 MiB, for example streaming smaller chunks from the client may allow the1075VAD to be more responsive. Unlike most other client events, the server will1076not send a confirmation response to this event.10771078### Schema10791080Schema name: `RealtimeClientEventInputAudioBufferAppend`10811082- `audio: string`10831084  Base64-encoded audio bytes. This must be in the format specified by the1085  `input_audio_format` field in the session configuration.10861087- `type: "input_audio_buffer.append"`10881089  The event type, must be `input_audio_buffer.append`.10901091  - `"input_audio_buffer.append"`10921093- `event_id: optional string`10941095  Optional client-generated ID used to identify this event.10961097### Example10981099```json1100{1101    "event_id": "event_456",1102    "type": "input_audio_buffer.append",1103    "audio": "Base64EncodedAudioData"1104}1105```11061107<a id="input_audio_buffer.commit"></a>11081109## input_audio_buffer.commit11101111Send this event to commit the user input audio buffer, which will create a  new user message item in the conversation. This event will produce an error  if the input audio buffer is empty. When in Server VAD mode, the client does  not need to send this event, the server will commit the audio buffer  automatically.11121113Committing the input audio buffer will trigger input audio transcription  (if enabled in session configuration), but it will not create a response  from the model. The server will respond with an `input_audio_buffer.committed` event.11141115### Schema11161117Schema name: `RealtimeClientEventInputAudioBufferCommit`11181119- `type: "input_audio_buffer.commit"`11201121  The event type, must be `input_audio_buffer.commit`.11221123  - `"input_audio_buffer.commit"`11241125- `event_id: optional string`11261127  Optional client-generated ID used to identify this event.11281129### Example11301131```json1132{1133    "event_id": "event_789",1134    "type": "input_audio_buffer.commit"1135}1136```11371138<a id="input_audio_buffer.clear"></a>11391140## input_audio_buffer.clear11411142Send this event to clear the audio bytes in the buffer. The server will1143respond with an `input_audio_buffer.cleared` event.11441145### Schema11461147Schema name: `RealtimeClientEventInputAudioBufferClear`11481149- `type: "input_audio_buffer.clear"`11501151  The event type, must be `input_audio_buffer.clear`.11521153  - `"input_audio_buffer.clear"`11541155- `event_id: optional string`11561157  Optional client-generated ID used to identify this event.11581159### Example11601161```json1162{1163    "event_id": "event_012",1164    "type": "input_audio_buffer.clear"1165}1166```11671168<a id="conversation.item.create"></a>11691170## conversation.item.create11711172Add a new Item to the Conversation's context, including messages, function1173calls, and function call responses. This event can be used both to populate a1174"history" of the conversation and to add new items mid-stream, but has the1175current limitation that it cannot populate assistant audio messages.11761177If successful, the server will emit a `conversation.item.added` event and,1178when the item is finalized, a `conversation.item.done` event. Otherwise, an1179`error` event will be sent.11801181### Schema11821183Schema name: `RealtimeClientEventConversationItemCreate`11841185- `item: ConversationItem`11861187  A single item within a Realtime conversation.11881189  - `RealtimeConversationItemSystemMessage object { content, role, type, 3 more }`11901191    A system message in a Realtime conversation can be used to provide additional context or instructions to the model. This is similar but distinct from the instruction prompt provided at the start of a conversation, as system messages can be added at any point in the conversation. For major changes to the conversation's behavior, use instructions, but for smaller updates (e.g. "the user is now asking about a different topic"), use system messages.11921193    - `content: array of object { text, type }`11941195      The content of the message.11961197      - `text: optional string`11981199        The text content.12001201      - `type: optional "input_text"`12021203        The content type. Always `input_text` for system messages.12041205        - `"input_text"`12061207    - `role: "system"`12081209      The role of the message sender. Always `system`.12101211      - `"system"`12121213    - `type: "message"`12141215      The type of the item. Always `message`.12161217      - `"message"`12181219    - `id: optional string`12201221      The unique ID of the item. This may be provided by the client or generated by the server.12221223    - `object: optional "realtime.item"`12241225      Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.12261227      - `"realtime.item"`12281229    - `status: optional "completed" or "incomplete" or "in_progress"`12301231      The status of the item. Has no effect on the conversation.12321233      - `"completed"`12341235      - `"incomplete"`12361237      - `"in_progress"`12381239  - `RealtimeConversationItemUserMessage object { content, role, type, 3 more }`12401241    A user message item in a Realtime conversation.12421243    - `content: array of object { audio, detail, image_url, 3 more }`12441245      The content of the message.12461247      - `audio: optional string`12481249        Base64-encoded audio bytes (for `input_audio`), these will be parsed as the format specified in the session input audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified.12501251      - `detail: optional "auto" or "low" or "high"`12521253        The detail level of the image (for `input_image`). `auto` will default to `high`.12541255        - `"auto"`12561257        - `"low"`12581259        - `"high"`12601261      - `image_url: optional string`12621263        Base64-encoded image bytes (for `input_image`) as a data URI. For example `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...`. Supported formats are PNG and JPEG.12641265      - `text: optional string`12661267        The text content (for `input_text`).12681269      - `transcript: optional string`12701271        Transcript of the audio (for `input_audio`). This is not sent to the model, but will be attached to the message item for reference.12721273      - `type: optional "input_text" or "input_audio" or "input_image"`12741275        The content type (`input_text`, `input_audio`, or `input_image`).12761277        - `"input_text"`12781279        - `"input_audio"`12801281        - `"input_image"`12821283    - `role: "user"`12841285      The role of the message sender. Always `user`.12861287      - `"user"`12881289    - `type: "message"`12901291      The type of the item. Always `message`.12921293      - `"message"`12941295    - `id: optional string`12961297      The unique ID of the item. This may be provided by the client or generated by the server.12981299    - `object: optional "realtime.item"`13001301      Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.13021303      - `"realtime.item"`13041305    - `status: optional "completed" or "incomplete" or "in_progress"`13061307      The status of the item. Has no effect on the conversation.13081309      - `"completed"`13101311      - `"incomplete"`13121313      - `"in_progress"`13141315  - `RealtimeConversationItemAssistantMessage object { content, role, type, 3 more }`13161317    An assistant message item in a Realtime conversation.13181319    - `content: array of object { audio, text, transcript, type }`13201321      The content of the message.13221323      - `audio: optional string`13241325        Base64-encoded audio bytes, these will be parsed as the format specified in the session output audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified.13261327      - `text: optional string`13281329        The text content.13301331      - `transcript: optional string`13321333        The transcript of the audio content, this will always be present if the output type is `audio`.13341335      - `type: optional "output_text" or "output_audio"`13361337        The content type, `output_text` or `output_audio` depending on the session `output_modalities` configuration.13381339        - `"output_text"`13401341        - `"output_audio"`13421343    - `role: "assistant"`13441345      The role of the message sender. Always `assistant`.13461347      - `"assistant"`13481349    - `type: "message"`13501351      The type of the item. Always `message`.13521353      - `"message"`13541355    - `id: optional string`13561357      The unique ID of the item. This may be provided by the client or generated by the server.13581359    - `object: optional "realtime.item"`13601361      Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.13621363      - `"realtime.item"`13641365    - `status: optional "completed" or "incomplete" or "in_progress"`13661367      The status of the item. Has no effect on the conversation.13681369      - `"completed"`13701371      - `"incomplete"`13721373      - `"in_progress"`13741375  - `RealtimeConversationItemFunctionCall object { arguments, name, type, 4 more }`13761377    A function call item in a Realtime conversation.13781379    - `arguments: string`13801381      The arguments of the function call. This is a JSON-encoded string representing the arguments passed to the function, for example `{"arg1": "value1", "arg2": 42}`.13821383    - `name: string`13841385      The name of the function being called.13861387    - `type: "function_call"`13881389      The type of the item. Always `function_call`.13901391      - `"function_call"`13921393    - `id: optional string`13941395      The unique ID of the item. This may be provided by the client or generated by the server.13961397    - `call_id: optional string`13981399      The ID of the function call.14001401    - `object: optional "realtime.item"`14021403      Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.14041405      - `"realtime.item"`14061407    - `status: optional "completed" or "incomplete" or "in_progress"`14081409      The status of the item. Has no effect on the conversation.14101411      - `"completed"`14121413      - `"incomplete"`14141415      - `"in_progress"`14161417  - `RealtimeConversationItemFunctionCallOutput object { call_id, output, type, 3 more }`14181419    A function call output item in a Realtime conversation.14201421    - `call_id: string`14221423      The ID of the function call this output is for.14241425    - `output: string`14261427      The output of the function call, this is free text and can contain any information or simply be empty.14281429    - `type: "function_call_output"`14301431      The type of the item. Always `function_call_output`.14321433      - `"function_call_output"`14341435    - `id: optional string`14361437      The unique ID of the item. This may be provided by the client or generated by the server.14381439    - `object: optional "realtime.item"`14401441      Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.14421443      - `"realtime.item"`14441445    - `status: optional "completed" or "incomplete" or "in_progress"`14461447      The status of the item. Has no effect on the conversation.14481449      - `"completed"`14501451      - `"incomplete"`14521453      - `"in_progress"`14541455  - `RealtimeMcpApprovalResponse object { id, approval_request_id, approve, 2 more }`14561457    A Realtime item responding to an MCP approval request.14581459    - `id: string`14601461      The unique ID of the approval response.14621463    - `approval_request_id: string`14641465      The ID of the approval request being answered.14661467    - `approve: boolean`14681469      Whether the request was approved.14701471    - `type: "mcp_approval_response"`14721473      The type of the item. Always `mcp_approval_response`.14741475      - `"mcp_approval_response"`14761477    - `reason: optional string or null`14781479      Optional reason for the decision.14801481  - `RealtimeMcpListTools object { server_label, tools, type, id }`14821483    A Realtime item listing tools available on an MCP server.14841485    - `server_label: string`14861487      The label of the MCP server.14881489    - `tools: array of object { input_schema, name, annotations, description }`14901491      The tools available on the server.14921493      - `input_schema: unknown`14941495        The JSON schema describing the tool's input.14961497      - `name: string`14981499        The name of the tool.15001501      - `annotations: optional unknown or null`15021503        Additional annotations about the tool.15041505      - `description: optional string or null`15061507        The description of the tool.15081509    - `type: "mcp_list_tools"`15101511      The type of the item. Always `mcp_list_tools`.15121513      - `"mcp_list_tools"`15141515    - `id: optional string`15161517      The unique ID of the list.15181519  - `RealtimeMcpToolCall object { id, arguments, name, 5 more }`15201521    A Realtime item representing an invocation of a tool on an MCP server.15221523    - `id: string`15241525      The unique ID of the tool call.15261527    - `arguments: string`15281529      A JSON string of the arguments passed to the tool.15301531    - `name: string`15321533      The name of the tool that was run.15341535    - `server_label: string`15361537      The label of the MCP server running the tool.15381539    - `type: "mcp_call"`15401541      The type of the item. Always `mcp_call`.15421543      - `"mcp_call"`15441545    - `approval_request_id: optional string or null`15461547      The ID of an associated approval request, if any.15481549    - `error: optional RealtimeMcpProtocolError or RealtimeMcpToolExecutionError or RealtimeMcphttpError or null`15501551      The error from the tool call, if any.15521553      - `RealtimeMcpProtocolError object { code, message, type }`15541555        - `code: number`15561557        - `message: string`15581559        - `type: "protocol_error"`15601561          - `"protocol_error"`15621563      - `RealtimeMcpToolExecutionError object { message, type }`15641565        - `message: string`15661567        - `type: "tool_execution_error"`15681569          - `"tool_execution_error"`15701571      - `RealtimeMcphttpError object { code, message, type }`15721573        - `code: number`15741575        - `message: string`15761577        - `type: "http_error"`15781579          - `"http_error"`15801581    - `output: optional string or null`15821583      The output from the tool call.15841585  - `RealtimeMcpApprovalRequest object { id, arguments, name, 2 more }`15861587    A Realtime item requesting human approval of a tool invocation.15881589    - `id: string`15901591      The unique ID of the approval request.15921593    - `arguments: string`15941595      A JSON string of arguments for the tool.15961597    - `name: string`15981599      The name of the tool to run.16001601    - `server_label: string`16021603      The label of the MCP server making the request.16041605    - `type: "mcp_approval_request"`16061607      The type of the item. Always `mcp_approval_request`.16081609      - `"mcp_approval_request"`16101611- `type: "conversation.item.create"`16121613  The event type, must be `conversation.item.create`.16141615  - `"conversation.item.create"`16161617- `event_id: optional string`16181619  Optional client-generated ID used to identify this event.16201621- `previous_item_id: optional string`16221623  The ID of the preceding item after which the new item will be inserted. If not set, the new item will be appended to the end of the conversation.16241625  If set to `root`, the new item will be added to the beginning of the conversation.16261627  If set to an existing ID, it allows an item to be inserted mid-conversation. If the ID cannot be found, an error will be returned and the item will not be added.16281629### Example16301631```json1632{1633  "type": "conversation.item.create",1634  "item": {1635    "type": "message",1636    "role": "user",1637    "content": [1638      {1639        "type": "input_text",1640        "text": "hi"1641      }1642    ]1643  }1644}1645```16461647<a id="conversation.item.retrieve"></a>16481649## conversation.item.retrieve16501651Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.1652The server will respond with a `conversation.item.retrieved` event,1653unless the item does not exist in the conversation history, in which case the1654server will respond with an error.16551656### Schema16571658Schema name: `RealtimeClientEventConversationItemRetrieve`16591660- `item_id: string`16611662  The ID of the item to retrieve.16631664- `type: "conversation.item.retrieve"`16651666  The event type, must be `conversation.item.retrieve`.16671668  - `"conversation.item.retrieve"`16691670- `event_id: optional string`16711672  Optional client-generated ID used to identify this event.16731674### Example16751676```json1677{1678    "event_id": "event_901",1679    "type": "conversation.item.retrieve",1680    "item_id": "item_003"1681}1682```16831684<a id="conversation.item.truncate"></a>16851686## conversation.item.truncate16871688Send this event to truncate a previous assistant message’s audio. The server1689will produce audio faster than realtime, so this event is useful when the user1690interrupts to truncate audio that has already been sent to the client but not1691yet played. This will synchronize the server's understanding of the audio with1692the client's playback.16931694Truncating audio will delete the server-side text transcript to ensure there1695is not text in the context that hasn't been heard by the user.16961697If successful, the server will respond with a `conversation.item.truncated`1698event.16991700### Schema17011702Schema name: `RealtimeClientEventConversationItemTruncate`17031704- `audio_end_ms: number`17051706  Inclusive duration up to which audio is truncated, in milliseconds. If1707  the audio_end_ms is greater than the actual audio duration, the server1708  will respond with an error.17091710- `content_index: number`17111712  The index of the content part to truncate. Set this to `0`.17131714- `item_id: string`17151716  The ID of the assistant message item to truncate. Only assistant message1717  items can be truncated.17181719- `type: "conversation.item.truncate"`17201721  The event type, must be `conversation.item.truncate`.17221723  - `"conversation.item.truncate"`17241725- `event_id: optional string`17261727  Optional client-generated ID used to identify this event.17281729### Example17301731```json1732{1733    "event_id": "event_678",1734    "type": "conversation.item.truncate",1735    "item_id": "item_002",1736    "content_index": 0,1737    "audio_end_ms": 15001738}1739```17401741<a id="conversation.item.delete"></a>17421743## conversation.item.delete17441745Send this event when you want to remove any item from the conversation1746history. The server will respond with a `conversation.item.deleted` event,1747unless the item does not exist in the conversation history, in which case the1748server will respond with an error.17491750### Schema17511752Schema name: `RealtimeClientEventConversationItemDelete`17531754- `item_id: string`17551756  The ID of the item to delete.17571758- `type: "conversation.item.delete"`17591760  The event type, must be `conversation.item.delete`.17611762  - `"conversation.item.delete"`17631764- `event_id: optional string`17651766  Optional client-generated ID used to identify this event.17671768### Example17691770```json1771{1772    "event_id": "event_901",1773    "type": "conversation.item.delete",1774    "item_id": "item_003"1775}1776```17771778<a id="response.create"></a>17791780## response.create17811782This event instructs the server to create a Response, which means triggering1783model inference. When in Server VAD mode, the server will create Responses1784automatically.17851786A Response will include at least one Item, and may have two, in which case1787the second will be a function call. These Items will be appended to the1788conversation history by default.17891790The server will respond with a `response.created` event, events for Items1791and content created, and finally a `response.done` event to indicate the1792Response is complete.17931794The `response.create` event includes inference configuration like1795`instructions` and `tools`. If these are set, they will override the Session's1796configuration for this Response only.17971798Responses can be created out-of-band of the default Conversation, meaning that they can1799have arbitrary input, and it's possible to disable writing the output to the Conversation.1800Only one Response can write to the default Conversation at a time, but otherwise multiple1801Responses can be created in parallel. The `metadata` field is a good way to disambiguate1802multiple simultaneous Responses.18031804Clients can set `conversation` to `none` to create a Response that does not write to the default1805Conversation. Arbitrary input can be provided with the `input` field, which is an array accepting1806raw Items and references to existing Items.18071808### Schema18091810Schema name: `RealtimeClientEventResponseCreate`18111812- `type: "response.create"`18131814  The event type, must be `response.create`.18151816  - `"response.create"`18171818- `event_id: optional string`18191820  Optional client-generated ID used to identify this event.18211822- `response: optional RealtimeResponseCreateParams`18231824  Create a new Realtime response with these parameters18251826  - `audio: optional RealtimeResponseCreateAudioOutput`18271828    Configuration for audio input and output.18291830    - `output: optional object { format, voice }`18311832      - `format: optional RealtimeAudioFormats`18331834        The format of the output audio.18351836        - `PCMAudio object { rate, type }`18371838          The PCM audio format. Only a 24kHz sample rate is supported.18391840          - `rate: optional 24000`18411842            The sample rate of the audio. Always `24000`.18431844            - `24000`18451846          - `type: optional "audio/pcm"`18471848            The audio format. Always `audio/pcm`.18491850            - `"audio/pcm"`18511852        - `PCMUAudio object { type }`18531854          The G.711 μ-law format.18551856          - `type: optional "audio/pcmu"`18571858            The audio format. Always `audio/pcmu`.18591860            - `"audio/pcmu"`18611862        - `PCMAAudio object { type }`18631864          The G.711 A-law format.18651866          - `type: optional "audio/pcma"`18671868            The audio format. Always `audio/pcma`.18691870            - `"audio/pcma"`18711872      - `voice: optional string or "alloy" or "ash" or "ballad" or 7 more or object { id }`18731874        The voice the model uses to respond. Supported built-in voices are1875        `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`,1876        `marin`, and `cedar`. You may also provide a custom voice object with1877        an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed1878        during the session once the model has responded with audio at least once.1879        We recommend `marin` and `cedar` for best quality.18801881        - `string`18821883        - `"alloy" or "ash" or "ballad" or 7 more`18841885          - `"alloy"`18861887          - `"ash"`18881889          - `"ballad"`18901891          - `"coral"`18921893          - `"echo"`18941895          - `"sage"`18961897          - `"shimmer"`18981899          - `"verse"`19001901          - `"marin"`19021903          - `"cedar"`19041905        - `ID object { id }`19061907          Custom voice reference.19081909          - `id: string`19101911            The custom voice ID, e.g. `voice_1234`.19121913  - `conversation: optional string or "auto" or "none"`19141915    Controls which conversation the response is added to. Currently supports1916    `auto` and `none`, with `auto` as the default value. The `auto` value1917    means that the contents of the response will be added to the default1918    conversation. Set this to `none` to create an out-of-band response which1919    will not add items to default conversation.19201921    - `string`19221923    - `"auto" or "none"`19241925      Controls which conversation the response is added to. Currently supports1926      `auto` and `none`, with `auto` as the default value. The `auto` value1927      means that the contents of the response will be added to the default1928      conversation. Set this to `none` to create an out-of-band response which1929      will not add items to default conversation.19301931      - `"auto"`19321933      - `"none"`19341935  - `input: optional array of ConversationItem`19361937    Input items to include in the prompt for the model. Using this field1938    creates a new context for this Response instead of using the default1939    conversation. An empty array `[]` will clear the context for this Response.1940    Note that this can include references to items that previously appeared in the session1941    using their id.19421943    - `RealtimeConversationItemSystemMessage object { content, role, type, 3 more }`19441945      A system message in a Realtime conversation can be used to provide additional context or instructions to the model. This is similar but distinct from the instruction prompt provided at the start of a conversation, as system messages can be added at any point in the conversation. For major changes to the conversation's behavior, use instructions, but for smaller updates (e.g. "the user is now asking about a different topic"), use system messages.19461947      - `content: array of object { text, type }`19481949        The content of the message.19501951        - `text: optional string`19521953          The text content.19541955        - `type: optional "input_text"`19561957          The content type. Always `input_text` for system messages.19581959          - `"input_text"`19601961      - `role: "system"`19621963        The role of the message sender. Always `system`.19641965        - `"system"`19661967      - `type: "message"`19681969        The type of the item. Always `message`.19701971        - `"message"`19721973      - `id: optional string`19741975        The unique ID of the item. This may be provided by the client or generated by the server.19761977      - `object: optional "realtime.item"`19781979        Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.19801981        - `"realtime.item"`19821983      - `status: optional "completed" or "incomplete" or "in_progress"`19841985        The status of the item. Has no effect on the conversation.19861987        - `"completed"`19881989        - `"incomplete"`19901991        - `"in_progress"`19921993    - `RealtimeConversationItemUserMessage object { content, role, type, 3 more }`19941995      A user message item in a Realtime conversation.19961997      - `content: array of object { audio, detail, image_url, 3 more }`19981999        The content of the message.20002001        - `audio: optional string`20022003          Base64-encoded audio bytes (for `input_audio`), these will be parsed as the format specified in the session input audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified.20042005        - `detail: optional "auto" or "low" or "high"`20062007          The detail level of the image (for `input_image`). `auto` will default to `high`.20082009          - `"auto"`20102011          - `"low"`20122013          - `"high"`20142015        - `image_url: optional string`20162017          Base64-encoded image bytes (for `input_image`) as a data URI. For example `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...`. Supported formats are PNG and JPEG.20182019        - `text: optional string`20202021          The text content (for `input_text`).20222023        - `transcript: optional string`20242025          Transcript of the audio (for `input_audio`). This is not sent to the model, but will be attached to the message item for reference.20262027        - `type: optional "input_text" or "input_audio" or "input_image"`20282029          The content type (`input_text`, `input_audio`, or `input_image`).20302031          - `"input_text"`20322033          - `"input_audio"`20342035          - `"input_image"`20362037      - `role: "user"`20382039        The role of the message sender. Always `user`.20402041        - `"user"`20422043      - `type: "message"`20442045        The type of the item. Always `message`.20462047        - `"message"`20482049      - `id: optional string`20502051        The unique ID of the item. This may be provided by the client or generated by the server.20522053      - `object: optional "realtime.item"`20542055        Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.20562057        - `"realtime.item"`20582059      - `status: optional "completed" or "incomplete" or "in_progress"`20602061        The status of the item. Has no effect on the conversation.20622063        - `"completed"`20642065        - `"incomplete"`20662067        - `"in_progress"`20682069    - `RealtimeConversationItemAssistantMessage object { content, role, type, 3 more }`20702071      An assistant message item in a Realtime conversation.20722073      - `content: array of object { audio, text, transcript, type }`20742075        The content of the message.20762077        - `audio: optional string`20782079          Base64-encoded audio bytes, these will be parsed as the format specified in the session output audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified.20802081        - `text: optional string`20822083          The text content.20842085        - `transcript: optional string`20862087          The transcript of the audio content, this will always be present if the output type is `audio`.20882089        - `type: optional "output_text" or "output_audio"`20902091          The content type, `output_text` or `output_audio` depending on the session `output_modalities` configuration.20922093          - `"output_text"`20942095          - `"output_audio"`20962097      - `role: "assistant"`20982099        The role of the message sender. Always `assistant`.21002101        - `"assistant"`21022103      - `type: "message"`21042105        The type of the item. Always `message`.21062107        - `"message"`21082109      - `id: optional string`21102111        The unique ID of the item. This may be provided by the client or generated by the server.21122113      - `object: optional "realtime.item"`21142115        Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.21162117        - `"realtime.item"`21182119      - `status: optional "completed" or "incomplete" or "in_progress"`21202121        The status of the item. Has no effect on the conversation.21222123        - `"completed"`21242125        - `"incomplete"`21262127        - `"in_progress"`21282129    - `RealtimeConversationItemFunctionCall object { arguments, name, type, 4 more }`21302131      A function call item in a Realtime conversation.21322133      - `arguments: string`21342135        The arguments of the function call. This is a JSON-encoded string representing the arguments passed to the function, for example `{"arg1": "value1", "arg2": 42}`.21362137      - `name: string`21382139        The name of the function being called.21402141      - `type: "function_call"`21422143        The type of the item. Always `function_call`.21442145        - `"function_call"`21462147      - `id: optional string`21482149        The unique ID of the item. This may be provided by the client or generated by the server.21502151      - `call_id: optional string`21522153        The ID of the function call.21542155      - `object: optional "realtime.item"`21562157        Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.21582159        - `"realtime.item"`21602161      - `status: optional "completed" or "incomplete" or "in_progress"`21622163        The status of the item. Has no effect on the conversation.21642165        - `"completed"`21662167        - `"incomplete"`21682169        - `"in_progress"`21702171    - `RealtimeConversationItemFunctionCallOutput object { call_id, output, type, 3 more }`21722173      A function call output item in a Realtime conversation.21742175      - `call_id: string`21762177        The ID of the function call this output is for.21782179      - `output: string`21802181        The output of the function call, this is free text and can contain any information or simply be empty.21822183      - `type: "function_call_output"`21842185        The type of the item. Always `function_call_output`.21862187        - `"function_call_output"`21882189      - `id: optional string`21902191        The unique ID of the item. This may be provided by the client or generated by the server.21922193      - `object: optional "realtime.item"`21942195        Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item.21962197        - `"realtime.item"`21982199      - `status: optional "completed" or "incomplete" or "in_progress"`22002201        The status of the item. Has no effect on the conversation.22022203        - `"completed"`22042205        - `"incomplete"`22062207        - `"in_progress"`22082209    - `RealtimeMcpApprovalResponse object { id, approval_request_id, approve, 2 more }`22102211      A Realtime item responding to an MCP approval request.22122213      - `id: string`22142215        The unique ID of the approval response.22162217      - `approval_request_id: string`22182219        The ID of the approval request being answered.22202221      - `approve: boolean`22222223        Whether the request was approved.22242225      - `type: "mcp_approval_response"`22262227        The type of the item. Always `mcp_approval_response`.22282229        - `"mcp_approval_response"`22302231      - `reason: optional string or null`22322233        Optional reason for the decision.22342235    - `RealtimeMcpListTools object { server_label, tools, type, id }`22362237      A Realtime item listing tools available on an MCP server.22382239      - `server_label: string`22402241        The label of the MCP server.22422243      - `tools: array of object { input_schema, name, annotations, description }`22442245        The tools available on the server.22462247        - `input_schema: unknown`22482249          The JSON schema describing the tool's input.22502251        - `name: string`22522253          The name of the tool.22542255        - `annotations: optional unknown or null`22562257          Additional annotations about the tool.22582259        - `description: optional string or null`22602261          The description of the tool.22622263      - `type: "mcp_list_tools"`22642265        The type of the item. Always `mcp_list_tools`.22662267        - `"mcp_list_tools"`22682269      - `id: optional string`22702271        The unique ID of the list.22722273    - `RealtimeMcpToolCall object { id, arguments, name, 5 more }`22742275      A Realtime item representing an invocation of a tool on an MCP server.22762277      - `id: string`22782279        The unique ID of the tool call.22802281      - `arguments: string`22822283        A JSON string of the arguments passed to the tool.22842285      - `name: string`22862287        The name of the tool that was run.22882289      - `server_label: string`22902291        The label of the MCP server running the tool.22922293      - `type: "mcp_call"`22942295        The type of the item. Always `mcp_call`.22962297        - `"mcp_call"`22982299      - `approval_request_id: optional string or null`23002301        The ID of an associated approval request, if any.23022303      - `error: optional RealtimeMcpProtocolError or RealtimeMcpToolExecutionError or RealtimeMcphttpError or null`23042305        The error from the tool call, if any.23062307        - `RealtimeMcpProtocolError object { code, message, type }`23082309          - `code: number`23102311          - `message: string`23122313          - `type: "protocol_error"`23142315            - `"protocol_error"`23162317        - `RealtimeMcpToolExecutionError object { message, type }`23182319          - `message: string`23202321          - `type: "tool_execution_error"`23222323            - `"tool_execution_error"`23242325        - `RealtimeMcphttpError object { code, message, type }`23262327          - `code: number`23282329          - `message: string`23302331          - `type: "http_error"`23322333            - `"http_error"`23342335      - `output: optional string or null`23362337        The output from the tool call.23382339    - `RealtimeMcpApprovalRequest object { id, arguments, name, 2 more }`23402341      A Realtime item requesting human approval of a tool invocation.23422343      - `id: string`23442345        The unique ID of the approval request.23462347      - `arguments: string`23482349        A JSON string of arguments for the tool.23502351      - `name: string`23522353        The name of the tool to run.23542355      - `server_label: string`23562357        The label of the MCP server making the request.23582359      - `type: "mcp_approval_request"`23602361        The type of the item. Always `mcp_approval_request`.23622363        - `"mcp_approval_request"`23642365  - `instructions: optional string`23662367    The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior.2368    Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session.23692370  - `max_output_tokens: optional number or "inf"`23712372    Maximum number of output tokens for a single assistant response,2373    inclusive of tool calls. Provide an integer between 1 and 4096 to2374    limit output tokens, or `inf` for the maximum available tokens for a2375    given model. Defaults to `inf`.23762377    - `number`23782379    - `"inf"`23802381      - `"inf"`23822383  - `metadata: optional Metadata or null`23842385    Set of 16 key-value pairs that can be attached to an object. This can be2386    useful for storing additional information about the object in a structured2387    format, and querying for objects via API or the dashboard.23882389    Keys are strings with a maximum length of 64 characters. Values are strings2390    with a maximum length of 512 characters.23912392  - `output_modalities: optional array of "text" or "audio"`23932394    The set of modalities the model used to respond, currently the only possible values are2395    `[\"audio\"]`, `[\"text\"]`. Audio output always include a text transcript. Setting the2396    output to mode `text` will disable audio output from the model.23972398    - `"text"`23992400    - `"audio"`24012402  - `parallel_tool_calls: optional boolean`24032404    Whether the model may call multiple tools in parallel. Only supported by2405    reasoning Realtime models such as `gpt-realtime-2`.24062407  - `prompt: optional ResponsePrompt or null`24082409    Reference to a prompt template and its variables.2410    [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code).24112412    - `id: string`24132414      The unique identifier of the prompt template to use.24152416    - `variables: optional map[string or ResponseInputText or ResponseInputImage or ResponseInputFile] or null`24172418      Optional map of values to substitute in for variables in your2419      prompt. The substitution values can either be strings, or other2420      Response input types like images or files.24212422      - `string`24232424      - `ResponseInputText object { text, type, prompt_cache_breakpoint }`24252426        A text input to the model.24272428        - `text: string`24292430          The text input to the model.24312432        - `type: "input_text"`24332434          The type of the input item. Always `input_text`.24352436          - `"input_text"`24372438        - `prompt_cache_breakpoint: optional object { mode }`24392440          Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.24412442          - `mode: "explicit"`24432444            The breakpoint mode. Always `explicit`.24452446            - `"explicit"`24472448      - `ResponseInputImage object { detail, type, file_id, 2 more }`24492450        An image input to the model. Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision).24512452        - `detail: ImageDetail`24532454          The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`.24552456          - `"low"`24572458          - `"high"`24592460          - `"auto"`24612462          - `"original"`24632464        - `type: "input_image"`24652466          The type of the input item. Always `input_image`.24672468          - `"input_image"`24692470        - `file_id: optional string or null`24712472          The ID of the file to be sent to the model.24732474        - `image_url: optional string or null`24752476          The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.24772478        - `prompt_cache_breakpoint: optional object { mode }`24792480          Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.24812482          - `mode: "explicit"`24832484            The breakpoint mode. Always `explicit`.24852486            - `"explicit"`24872488      - `ResponseInputFile object { type, detail, file_data, 4 more }`24892490        A file input to the model.24912492        - `type: "input_file"`24932494          The type of the input item. Always `input_file`.24952496          - `"input_file"`24972498        - `detail: optional "auto" or "low" or "high"`24992500          The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`.25012502          - `"auto"`25032504          - `"low"`25052506          - `"high"`25072508        - `file_data: optional string`25092510          The content of the file to be sent to the model.25112512        - `file_id: optional string or null`25132514          The ID of the file to be sent to the model.25152516        - `file_url: optional string`25172518          The URL of the file to be sent to the model.25192520        - `filename: optional string`25212522          The name of the file to be sent to the model.25232524        - `prompt_cache_breakpoint: optional object { mode }`25252526          Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.25272528          - `mode: "explicit"`25292530            The breakpoint mode. Always `explicit`.25312532            - `"explicit"`25332534    - `version: optional string or null`25352536      Optional version of the prompt template.25372538  - `reasoning: optional RealtimeReasoning`25392540    Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`.25412542    - `effort: optional RealtimeReasoningEffort`25432544      Constrains effort on reasoning for reasoning-capable Realtime models such as2545      `gpt-realtime-2`.25462547      - `"minimal"`25482549      - `"low"`25502551      - `"medium"`25522553      - `"high"`25542555      - `"xhigh"`25562557  - `tool_choice: optional ToolChoiceOptions or ToolChoiceFunction or ToolChoiceMcp`25582559    How the model chooses tools. Provide one of the string modes or force a specific2560    function/MCP tool.25612562    - `ToolChoiceOptions = "none" or "auto" or "required"`25632564      Controls which (if any) tool is called by the model.25652566      `none` means the model will not call any tool and instead generates a message.25672568      `auto` means the model can pick between generating a message or calling one or2569      more tools.25702571      `required` means the model must call one or more tools.25722573      - `"none"`25742575      - `"auto"`25762577      - `"required"`25782579    - `ToolChoiceFunction object { name, type }`25802581      Use this option to force the model to call a specific function.25822583      - `name: string`25842585        The name of the function to call.25862587      - `type: "function"`25882589        For function calling, the type is always `function`.25902591        - `"function"`25922593    - `ToolChoiceMcp object { server_label, type, name }`25942595      Use this option to force the model to call a specific tool on a remote MCP server.25962597      - `server_label: string`25982599        The label of the MCP server to use.26002601      - `type: "mcp"`26022603        For MCP tools, the type is always `mcp`.26042605        - `"mcp"`26062607      - `name: optional string or null`26082609        The name of the tool to call on the server.26102611  - `tools: optional array of RealtimeFunctionTool or object { server_label, type, allowed_callers, 9 more }`26122613    Tools available to the model.26142615    - `RealtimeFunctionTool object { description, name, parameters, type }`26162617      - `description: optional string`26182619        The description of the function, including guidance on when and how2620        to call it, and guidance about what to tell the user when calling2621        (if anything).26222623      - `name: optional string`26242625        The name of the function.26262627      - `parameters: optional unknown`26282629        Parameters of the function in JSON Schema.26302631      - `type: optional "function"`26322633        The type of the tool, i.e. `function`.26342635        - `"function"`26362637    - `McpTool object { server_label, type, allowed_callers, 9 more }`26382639      Give the model access to additional tools via remote Model Context Protocol2640      (MCP) servers. [Learn more about MCP](https://developers.openai.com/api/docs/guides/tools-connectors-mcp).26412642      - `server_label: string`26432644        A label for this MCP server, used to identify it in tool calls.26452646      - `type: "mcp"`26472648        The type of the MCP tool. Always `mcp`.26492650        - `"mcp"`26512652      - `allowed_callers: optional array of "direct" or "programmatic" or null`26532654        The tool invocation context(s).26552656        - `"direct"`26572658        - `"programmatic"`26592660      - `allowed_tools: optional array of string or object { read_only, tool_names }  or null`26612662        List of allowed tool names or a filter object.26632664        - `McpAllowedTools = array of string`26652666          A string array of allowed tool names26672668        - `McpToolFilter object { read_only, tool_names }`26692670          A filter object to specify which tools are allowed.26712672          - `read_only: optional boolean`26732674            Indicates whether or not a tool modifies data or is read-only. If an2675            MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),2676            it will match this filter.26772678          - `tool_names: optional array of string`26792680            List of allowed tool names.26812682      - `authorization: optional string`26832684        An OAuth access token that can be used with a remote MCP server, either2685        with a custom MCP server URL or a service connector. Your application2686        must handle the OAuth authorization flow and provide the token here.26872688      - `connector_id: optional "connector_dropbox" or "connector_gmail" or "connector_googlecalendar" or 5 more`26892690        Identifier for service connectors, like those available in ChatGPT. One of2691        `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more2692        about service connectors [here](https://developers.openai.com/api/docs/guides/tools-connectors-mcp#connectors).26932694        This field is deprecated for models released after September 1, 2026.2695        Use `server_url` to connect to a remote MCP server, or `tunnel_id` to2696        connect through a Secure MCP Tunnel.26972698        Currently supported `connector_id` values are:26992700        - Dropbox: `connector_dropbox`2701        - Gmail: `connector_gmail`2702        - Google Calendar: `connector_googlecalendar`2703        - Google Drive: `connector_googledrive`2704        - Microsoft Teams: `connector_microsoftteams`2705        - Outlook Calendar: `connector_outlookcalendar`2706        - Outlook Email: `connector_outlookemail`2707        - SharePoint: `connector_sharepoint`27082709        - `"connector_dropbox"`27102711        - `"connector_gmail"`27122713        - `"connector_googlecalendar"`27142715        - `"connector_googledrive"`27162717        - `"connector_microsoftteams"`27182719        - `"connector_outlookcalendar"`27202721        - `"connector_outlookemail"`27222723        - `"connector_sharepoint"`27242725      - `defer_loading: optional boolean`27262727        Whether this MCP tool is deferred and discovered via tool search.27282729      - `headers: optional map[string] or null`27302731        Optional HTTP headers to send to the MCP server. Use for authentication2732        or other purposes.27332734      - `require_approval: optional object { always, never }  or "always" or "never" or null`27352736        Specify which of the MCP server's tools require approval.27372738        - `McpToolApprovalFilter object { always, never }`27392740          Specify which of the MCP server's tools require approval. Can be2741          `always`, `never`, or a filter object associated with tools2742          that require approval.27432744          - `always: optional object { read_only, tool_names }`27452746            A filter object to specify which tools are allowed.27472748            - `read_only: optional boolean`27492750              Indicates whether or not a tool modifies data or is read-only. If an2751              MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),2752              it will match this filter.27532754            - `tool_names: optional array of string`27552756              List of allowed tool names.27572758          - `never: optional object { read_only, tool_names }`27592760            A filter object to specify which tools are allowed.27612762            - `read_only: optional boolean`27632764              Indicates whether or not a tool modifies data or is read-only. If an2765              MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),2766              it will match this filter.27672768            - `tool_names: optional array of string`27692770              List of allowed tool names.27712772        - `McpToolApprovalSetting = "always" or "never"`27732774          Specify a single approval policy for all tools. One of `always` or2775          `never`. When set to `always`, all tools will require approval. When2776          set to `never`, all tools will not require approval.27772778          - `"always"`27792780          - `"never"`27812782      - `server_description: optional string`27832784        Optional description of the MCP server, used to provide more context.27852786      - `server_url: optional string`27872788        The URL for the MCP server. One of `server_url`, `connector_id`, or2789        `tunnel_id` must be provided.27902791      - `tunnel_id: optional string`27922793        The Secure MCP Tunnel ID to use instead of a direct server URL. One of2794        `server_url`, `connector_id`, or `tunnel_id` must be provided.27952796### Example27972798```json2799// Trigger a response with the default Conversation and no special parameters2800{2801  "type": "response.create",2802}28032804// Trigger an out-of-band response that does not write to the default Conversation2805{2806  "type": "response.create",2807  "response": {2808    "instructions": "Provide a concise answer.",2809    "tools": [], // clear any session tools2810    "conversation": "none",2811    "output_modalities": ["text"],2812    "metadata": {2813      "response_purpose": "summarization"2814    },2815    "input": [2816      {2817        "type": "item_reference",2818        "id": "item_12345"2819      },2820      {2821        "type": "message",2822        "role": "user",2823        "content": [2824          {2825            "type": "input_text",2826            "text": "Summarize the above message in one sentence."2827          }2828        ]2829      }2830    ]2831  }2832}2833```28342835<a id="response.cancel"></a>28362837## response.cancel28382839Send this event to cancel an in-progress response. The server will respond2840with a `response.done` event with a status of `response.status=cancelled`. If2841there is no response to cancel, the server will respond with an error. It's safe2842to call `response.cancel` even if no response is in progress, an error will be2843returned the session will remain unaffected.28442845### Schema28462847Schema name: `RealtimeClientEventResponseCancel`28482849- `type: "response.cancel"`28502851  The event type, must be `response.cancel`.28522853  - `"response.cancel"`28542855- `event_id: optional string`28562857  Optional client-generated ID used to identify this event.28582859- `response_id: optional string`28602861  A specific response ID to cancel - if not provided, will cancel an2862  in-progress response in the default conversation.28632864### Example28652866```json2867{2868    "type": "response.cancel",2869    "response_id": "resp_12345"2870}2871```28722873<a id="output_audio_buffer.clear"></a>28742875## output_audio_buffer.clear28762877**WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to2878stop generating audio and emit a `output_audio_buffer.cleared` event. This2879event should be preceded by a `response.cancel` client event to stop the2880generation of the current response.2881[Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc).28822883### Schema28842885Schema name: `RealtimeClientEventOutputAudioBufferClear`28862887- `type: "output_audio_buffer.clear"`28882889  The event type, must be `output_audio_buffer.clear`.28902891  - `"output_audio_buffer.clear"`28922893- `event_id: optional string`28942895  The unique ID of the client event used for error handling.28962897### Example28982899```json2900{2901    "event_id": "optional_client_event_id",2902    "type": "output_audio_buffer.clear"2903}2904```2905
Files main
Menu

Theme