From 549ee55a7c39431c1bfe1565de2f7f1b9e1458d9 Mon Sep 17 00:00:00 2001 From: CLowbrow <647504+CLowbrow@users.noreply.github.com> Date: Mon, 13 Jul 2026 11:08:30 +0000 Subject: [PATCH] Update openai provider types --- .../lingua/src/providers/openai/generated.rs | 6707 +- specs/openai/openapi.yml | 87477 +++++++++------- 2 files changed, 51312 insertions(+), 42872 deletions(-) diff --git a/crates/lingua/src/providers/openai/generated.rs b/crates/lingua/src/providers/openai/generated.rs index 01dc2fa7..a9003ace 100644 --- a/crates/lingua/src/providers/openai/generated.rs +++ b/crates/lingua/src/providers/openai/generated.rs @@ -1,6706 +1 @@ -// Generated OpenAI types using quicktype -// Essential types for Elmir OpenAI integration -#![allow(clippy::large_enum_variant)] -#![allow(clippy::doc_lazy_continuation)] - -// Example code that deserializes and serializes the model. -// extern crate serde; -// #[macro_use] -// extern crate serde_derive; -// extern crate serde_json; -// -// use generated_module::openai_schemas; -// -// fn main() { -// let json = r#"{"answer": 42}"#; -// let model: openai_schemas = serde_json::from_str(&json).unwrap(); -// } - -use crate::serde_json; -use crate::universal::message::ToolCaller; -use serde::{Deserialize, Serialize}; -use std::collections::HashMap; -use ts_rs::TS; - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct OpenaiSchemas { - #[serde(skip_serializing_if = "Option::is_none")] - pub chat_request: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub chat_response: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub chat_stream_response: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub responses_request: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub responses_response: Option, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CreateChatCompletionRequestClass { - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option>, - /// Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. - /// Replaces the `user` field. [Learn more](/docs/guides/prompt-caching). - #[serde(skip_serializing_if = "Option::is_none")] - pub prompt_cache_key: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub prompt_cache_retention: Option, - /// A stable identifier used to help detect users of your application that may be violating - /// OpenAI's usage policies. - /// The IDs should be a string that uniquely identifies each user, with a maximum length of - /// 64 characters. We recommend hashing their username or email address, in order to avoid - /// sending us any identifying information. [Learn - /// more](/docs/guides/safety-best-practices#safety-identifiers). - #[serde(skip_serializing_if = "Option::is_none")] - pub safety_identifier: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub service_tier: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub temperature: Option, - /// An integer between 0 and 20 specifying the maximum number of most likely - /// tokens to return at each token position, each with an associated log - /// probability. In some cases, the number of returned tokens may be fewer than - /// requested. - /// - /// - /// An integer between 0 and 20 specifying the maximum number of most likely - /// tokens to return at each token position, each with an associated log - /// probability. In some cases, the number of returned tokens may be fewer than - /// requested. - /// `logprobs` must be set to `true` if this parameter is used. - #[serde(skip_serializing_if = "Option::is_none")] - pub top_logprobs: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub top_p: Option, - /// This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use - /// `prompt_cache_key` instead to maintain caching optimizations. - /// A stable identifier for your end-users. - /// Used to boost cache hit rates by better bucketing similar requests and to help OpenAI - /// detect and prevent abuse. [Learn - /// more](/docs/guides/safety-best-practices#safety-identifiers). - #[serde(skip_serializing_if = "Option::is_none")] - pub user: Option, - /// Parameters for audio output. Required when audio output is requested with - /// `modalities: ["audio"]`. [Learn more](/docs/guides/audio). - #[serde(skip_serializing_if = "Option::is_none")] - pub audio: Option, - /// Number between -2.0 and 2.0. Positive values penalize new tokens based on - /// their existing frequency in the text so far, decreasing the model's - /// likelihood to repeat the same line verbatim. - #[serde(skip_serializing_if = "Option::is_none")] - pub frequency_penalty: Option, - /// Deprecated in favor of `tool_choice`. - /// - /// Controls which (if any) function is called by the model. - /// - /// `none` means the model will not call a function and instead generates a - /// message. - /// - /// `auto` means the model can pick between generating a message or calling a - /// function. - /// - /// Specifying a particular function via `{"name": "my_function"}` forces the - /// model to call that function. - /// - /// `none` is the default when no functions are present. `auto` is the default - /// if functions are present. - #[serde(skip_serializing_if = "Option::is_none")] - pub function_call: Option, - /// Deprecated in favor of `tools`. - /// - /// A list of functions the model may generate JSON inputs for. - #[serde(skip_serializing_if = "Option::is_none")] - pub functions: Option>, - /// Modify the likelihood of specified tokens appearing in the completion. - /// - /// Accepts a JSON object that maps tokens (specified by their token ID in the - /// tokenizer) to an associated bias value from -100 to 100. Mathematically, - /// the bias is added to the logits generated by the model prior to sampling. - /// The exact effect will vary per model, but values between -1 and 1 should - /// decrease or increase likelihood of selection; values like -100 or 100 - /// should result in a ban or exclusive selection of the relevant token. - #[serde(skip_serializing_if = "Option::is_none")] - pub logit_bias: Option>, - /// Whether to return log probabilities of the output tokens or not. If true, - /// returns the log probabilities of each output token returned in the - /// `content` of `message`. - #[serde(skip_serializing_if = "Option::is_none")] - pub logprobs: Option, - /// An upper bound for the number of tokens that can be generated for a completion, including - /// visible output tokens and [reasoning tokens](/docs/guides/reasoning). - #[serde(skip_serializing_if = "Option::is_none")] - pub max_completion_tokens: Option, - /// The maximum number of [tokens](/tokenizer) that can be generated in the - /// chat completion. This value can be used to control - /// [costs](https://openai.com/api/pricing/) for text generated via API. - /// - /// This value is now deprecated in favor of `max_completion_tokens`, and is - /// not compatible with [o-series models](/docs/guides/reasoning). - #[serde(skip_serializing_if = "Option::is_none")] - pub max_tokens: Option, - /// A list of messages comprising the conversation so far. Depending on the - /// [model](/docs/models) you use, different message types (modalities) are - /// supported, like [text](/docs/guides/text-generation), - /// [images](/docs/guides/vision), and [audio](/docs/guides/audio). - pub messages: Vec, - #[serde(skip_serializing_if = "Option::is_none")] - pub modalities: Option>, - /// Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI - /// offers a wide range of models with different capabilities, performance - /// characteristics, and price points. Refer to the [model guide](/docs/models) - /// to browse and compare available models. - pub model: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub moderation: Option, - /// How many chat completion choices to generate for each input message. Note that you will - /// be charged based on the number of generated tokens across all of the choices. Keep `n` as - /// `1` to minimize costs. - #[serde(skip_serializing_if = "Option::is_none")] - pub n: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub parallel_tool_calls: Option, - /// Configuration for a [Predicted Output](/docs/guides/predicted-outputs), - /// which can greatly improve response times when large parts of the model - /// response are known ahead of time. This is most common when you are - /// regenerating a file with only minor changes to most of the content. - #[serde(skip_serializing_if = "Option::is_none")] - pub prediction: Option, - /// Number between -2.0 and 2.0. Positive values penalize new tokens based on - /// whether they appear in the text so far, increasing the model's likelihood - /// to talk about new topics. - #[serde(skip_serializing_if = "Option::is_none")] - pub presence_penalty: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_effort: Option, - /// An object specifying the format that the model must output. - /// - /// Setting to `{ "type": "json_schema", "json_schema": {...} }` enables - /// Structured Outputs which ensures the model will match your supplied JSON - /// schema. Learn more in the [Structured Outputs - /// guide](/docs/guides/structured-outputs). - /// - /// Setting to `{ "type": "json_object" }` enables the older JSON mode, which - /// ensures the message the model generates is valid JSON. Using `json_schema` - /// is preferred for models that support it. - #[serde(skip_serializing_if = "Option::is_none")] - pub response_format: Option, - /// This feature is in Beta. - /// If specified, our system will make a best effort to sample deterministically, such that - /// repeated requests with the same `seed` and parameters should return the same result. - /// Determinism is not guaranteed, and you should refer to the `system_fingerprint` response - /// parameter to monitor changes in the backend. - #[serde(skip_serializing_if = "Option::is_none")] - pub seed: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub stop: Option, - /// Whether or not to store the output of this chat completion request for - /// use in our [model distillation](/docs/guides/distillation) or - /// [evals](/docs/guides/evals) products. - /// - /// Supports text and image inputs. Note: image inputs over 8MB will be dropped. - #[serde(skip_serializing_if = "Option::is_none")] - pub store: Option, - /// If set to true, the model response data will be streamed to the client - /// as it is generated using [server-sent - /// events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). - /// See the [Streaming section below](/docs/api-reference/chat/streaming) - /// for more information, along with the [streaming - /// responses](/docs/guides/streaming-responses) - /// guide for more information on how to handle the streaming events. - #[serde(skip_serializing_if = "Option::is_none")] - pub stream: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub stream_options: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_choice: Option, - /// A list of tools the model may call. You can provide either - /// [custom tools](/docs/guides/function-calling#custom-tools) or - /// [function tools](/docs/guides/function-calling). - #[serde(skip_serializing_if = "Option::is_none")] - pub tools: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub verbosity: Option, - /// This tool searches the web for relevant results to use in a response. - /// Learn more about the [web search tool](/docs/guides/tools-web-search?api-mode=chat). - #[serde(skip_serializing_if = "Option::is_none")] - pub web_search_options: Option, -} - -/// Parameters for audio output. Required when audio output is requested with -/// `modalities: ["audio"]`. [Learn more](/docs/guides/audio). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CreateChatCompletionRequestAudio { - /// Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, - /// `opus`, or `pcm16`. - pub format: AudioFormat, - /// The voice the model uses to respond. Supported built-in voices are - /// `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, - /// `sage`, `shimmer`, `marin`, and `cedar`. You may also provide a - /// custom voice object with an `id`, for example `{ "id": "voice_1234" }`. - pub voice: Voice, -} - -/// Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, -/// `opus`, or `pcm16`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum AudioFormat { - Aac, - Flac, - Mp3, - Opus, - Pcm16, - Wav, -} - -/// The voice the model uses to respond. Supported built-in voices are -/// `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, -/// `sage`, `shimmer`, `marin`, and `cedar`. You may also provide a -/// custom voice object with an `id`, for example `{ "id": "voice_1234" }`. -/// -/// -/// A built-in voice name or a custom voice reference. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum Voice { - String(String), - VoiceClass(VoiceClass), -} - -/// Custom voice reference. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct VoiceClass { - /// The custom voice ID, e.g. `voice_1234`. - pub id: String, -} - -/// Deprecated in favor of `tool_choice`. -/// -/// Controls which (if any) function is called by the model. -/// -/// `none` means the model will not call a function and instead generates a -/// message. -/// -/// `auto` means the model can pick between generating a message or calling a -/// function. -/// -/// Specifying a particular function via `{"name": "my_function"}` forces the -/// model to call that function. -/// -/// `none` is the default when no functions are present. `auto` is the default -/// if functions are present. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum FunctionCallUnion { - ChatCompletionFunctionCallOption(ChatCompletionFunctionCallOption), - Enum(FunctionCallEnum), -} - -/// Specifying a particular function via `{"name": "my_function"}` forces the model to call -/// that function. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatCompletionFunctionCallOption { - /// The name of the function to call. - pub name: String, -} - -/// `none` means the model will not call a function and instead generates a message. `auto` -/// means the model can pick between generating a message or calling a function. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum FunctionCallEnum { - Auto, - None, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatCompletionFunctions { - /// A description of what the function does, used by the model to choose when and how to call - /// the function. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and - /// dashes, with a maximum length of 64. - pub name: String, - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub parameters: Option>, -} - -/// Developer-provided instructions that the model should follow, regardless of -/// messages sent by the user. With o1 models and newer, `developer` messages -/// replace the previous `system` messages. -/// -/// -/// Developer-provided instructions that the model should follow, regardless of -/// messages sent by the user. With o1 models and newer, use `developer` messages -/// for this purpose instead. -/// -/// -/// Messages sent by an end user, containing prompts or additional context -/// information. -/// -/// -/// Messages sent by the model in response to user messages. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export, export_to = "openai/")] -pub struct ChatCompletionRequestMessage { - /// The contents of the developer message. - /// - /// The contents of the system message. - /// - /// The contents of the user message. - /// - /// - /// The contents of the tool message. - #[serde(skip_serializing_if = "Option::is_none")] - pub content: Option, - /// An optional name for the participant. Provides the model information to differentiate - /// between participants of the same role. - /// - /// The name of the function to call. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// The role of the messages author, in this case `developer`. - /// - /// The role of the messages author, in this case `system`. - /// - /// The role of the messages author, in this case `user`. - /// - /// The role of the messages author, in this case `assistant`. - /// - /// The role of the messages author, in this case `tool`. - /// - /// The role of the messages author, in this case `function`. - pub role: ChatCompletionRequestMessageRole, - #[serde(skip_serializing_if = "Option::is_none")] - pub audio: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub function_call: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub refusal: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_calls: Option>, - /// Tool call that this message is responding to. - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_call_id: Option, -} - -/// Data about a previous audio response from the model. -/// [Learn more](/docs/guides/audio). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatCompletionRequestMessageAudio { - /// Unique identifier for a previous audio response from the model. - pub id: String, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum ChatCompletionRequestMessageContent { - ChatCompletionRequestMessageContentPartArray(Vec), - String(String), -} - -/// An array of content parts with a defined type. For developer messages, only type `text` -/// is supported. -/// -/// Learn about [text inputs](/docs/guides/text-generation). -/// -/// -/// An array of content parts with a defined type. Supported options differ based on the -/// [model](/docs/models) being used to generate the response. Can contain text inputs. -/// -/// An array of content parts with a defined type. For system messages, only type `text` is -/// supported. -/// -/// An array of content parts with a defined type. For tool messages, only type `text` is -/// supported. -/// -/// An array of content parts with a defined type. Supported options differ based on the -/// [model](/docs/models) being used to generate the response. Can contain text, image, or -/// audio inputs. -/// -/// Learn about [image inputs](/docs/guides/vision). -/// -/// -/// Learn about [audio inputs](/docs/guides/audio). -/// -/// -/// Learn about [file inputs](/docs/guides/text) for text generation. -/// -/// -/// An array of content parts with a defined type. Can be one or more of type `text`, or -/// exactly one of type `refusal`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatCompletionRequestMessageContentPart { - /// The text content. - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - /// The type of the content part. - /// - /// The type of the content part. Always `input_audio`. - /// - /// The type of the content part. Always `file`. - #[serde(rename = "type")] - pub chat_completion_request_message_content_part_type: PurpleType, - #[serde(skip_serializing_if = "Option::is_none")] - pub image_url: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub input_audio: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub file: Option, - /// The refusal message generated by the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub refusal: Option, -} - -/// The type of the content part. -/// -/// The type of the content part. Always `input_audio`. -/// -/// The type of the content part. Always `file`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum PurpleType { - File, - #[serde(rename = "image_url")] - ImageUrl, - #[serde(rename = "input_audio")] - InputAudio, - Refusal, - Text, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct File { - /// The base64 encoded file data, used when passing the file to the model - /// as a string. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_data: Option, - /// The ID of an uploaded file to use as input. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_id: Option, - /// The name of the file, used when passing the file to the model as a - /// string. - #[serde(skip_serializing_if = "Option::is_none")] - pub filename: Option, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ImageUrl { - /// Specifies the detail level of the image. Learn more in the [Vision - /// guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). - #[serde(skip_serializing_if = "Option::is_none")] - pub detail: Option, - /// Either a URL of the image or the base64 encoded image data. - pub url: String, -} - -/// Specifies the detail level of the image. Learn more in the [Vision -/// guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum Detail { - Auto, - High, - Low, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct InputAudio { - /// Base64 encoded audio data. - pub data: String, - /// The format of the encoded audio data. Currently supports "wav" and "mp3". - pub format: InputAudioFormat, -} - -/// The format of the encoded audio data. Currently supports "wav" and "mp3". -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum InputAudioFormat { - Mp3, - Wav, -} - -/// Deprecated and replaced by `tool_calls`. The name and arguments of a function that should -/// be called, as generated by the model. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatCompletionRequestMessageFunctionCall { - /// The arguments to call the function with, as generated by the model in JSON format. Note - /// that the model does not always generate valid JSON, and may hallucinate parameters not - /// defined by your function schema. Validate the arguments in your code before calling your - /// function. - pub arguments: String, - /// The name of the function to call. - pub name: String, -} - -/// The role of the messages author, in this case `developer`. -/// -/// The role of the messages author, in this case `system`. -/// -/// The role of the messages author, in this case `user`. -/// -/// The role of the messages author, in this case `assistant`. -/// -/// The role of the messages author, in this case `tool`. -/// -/// The role of the messages author, in this case `function`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ChatCompletionRequestMessageRole { - Assistant, - Developer, - Function, - System, - Tool, - User, -} - -/// The tool calls generated by the model, such as function calls. -/// -/// A call to a function tool created by the model. -/// -/// -/// A call to a custom tool created by the model. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ToolCall { - /// The function that the model called. - #[serde(skip_serializing_if = "Option::is_none")] - pub function: Option, - /// The ID of the tool call. - pub id: String, - /// The type of the tool. Currently, only `function` is supported. - /// - /// The type of the tool. Always `custom`. - #[serde(rename = "type")] - pub tool_call_type: FluffyType, - /// The custom tool that the model called. - #[serde(skip_serializing_if = "Option::is_none")] - pub custom: Option, -} - -/// The custom tool that the model called. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ToolCallCustom { - /// The input for the custom tool call generated by the model. - pub input: String, - /// The name of the custom tool to call. - pub name: String, -} - -/// The function that the model called. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct PurpleFunction { - /// The arguments to call the function with, as generated by the model in JSON format. Note - /// that the model does not always generate valid JSON, and may hallucinate parameters not - /// defined by your function schema. Validate the arguments in your code before calling your - /// function. - pub arguments: String, - /// The name of the function to call. - pub name: String, -} - -/// The type of the tool. Currently, only `function` is supported. -/// -/// The type of the tool. Always `custom`. -/// -/// The type of the custom tool. Always `custom`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum FluffyType { - Custom, - Function, -} - -/// Output types that you would like the model to generate. -/// Most models are capable of generating text, which is the default: -/// -/// `["text"]` -/// -/// The `gpt-4o-audio-preview` model can also be used to -/// [generate audio](/docs/guides/audio). To request that this model generate -/// both text and audio responses, you can use: -/// -/// `["text", "audio"]` -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ResponseModality { - Audio, - Text, -} - -/// Configuration for running moderation on the request input and generated output. -/// -/// -/// Configuration for running moderation on the input and output of this response. -/// -/// Configuration for running moderation on the input and output of this response. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ModerationParam { - /// The moderation model to use for moderated completions, e.g. 'omni-moderation-latest'. - pub model: String, -} - -/// Configuration for a [Predicted Output](/docs/guides/predicted-outputs), -/// which can greatly improve response times when large parts of the model -/// response are known ahead of time. This is most common when you are -/// regenerating a file with only minor changes to most of the content. -/// -/// -/// Static predicted output content, such as the content of a text file that is -/// being regenerated. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct StaticContent { - /// The content that should be matched when generating a model response. - /// If generated tokens would match this content, the entire model response - /// can be returned much more quickly. - pub content: PredictionContent, - /// The type of the predicted content you want to provide. This type is - /// currently always `content`. - #[serde(rename = "type")] - pub static_content_type: PredictionType, -} - -/// The contents of the system message. -/// -/// The contents of the tool message. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum PredictionContent { - ContentPartArray(Vec), - String(String), -} - -/// An array of content parts with a defined type. For developer messages, only type `text` -/// is supported. -/// -/// Learn about [text inputs](/docs/guides/text-generation). -/// -/// -/// An array of content parts with a defined type. Supported options differ based on the -/// [model](/docs/models) being used to generate the response. Can contain text inputs. -/// -/// An array of content parts with a defined type. For system messages, only type `text` is -/// supported. -/// -/// An array of content parts with a defined type. For tool messages, only type `text` is -/// supported. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ContentPart { - /// The text content. - pub text: String, - /// The type of the content part. - #[serde(rename = "type")] - pub content_part_type: TentacledType, -} - -/// The type of the content part. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum TentacledType { - Text, -} - -/// The type of the predicted content you want to provide. This type is -/// currently always `content`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum PredictionType { - Content, -} - -/// The retention policy for the prompt cache. Set to `24h` to enable extended prompt -/// caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. -/// [Learn more](/docs/guides/prompt-caching#prompt-cache-retention). -/// For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. -/// -/// For older models that support both `in_memory` and `24h`, the default depends on your -/// organization's data retention policy: -/// - Organizations without ZDR enabled default to `24h`. -/// - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is -/// not specified. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum PromptCacheRetention { - #[serde(rename = "in_memory")] - InMemory, - #[serde(rename = "24h")] - The24H, -} - -/// Constrains effort on reasoning for -/// [reasoning models](https://platform.openai.com/docs/guides/reasoning). -/// Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. -/// Reducing -/// reasoning effort can result in faster responses and fewer tokens used -/// on reasoning in a response. -/// -/// - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning -/// values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported -/// for all reasoning values in gpt-5.1. -/// - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support -/// `none`. -/// - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. -/// - `xhigh` is supported for all models after `gpt-5.1-codex-max`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ReasoningEffort { - High, - Low, - Medium, - Minimal, - None, - Xhigh, - Max, -} - -/// An object specifying the format that the model must output. -/// -/// Setting to `{ "type": "json_schema", "json_schema": {...} }` enables -/// Structured Outputs which ensures the model will match your supplied JSON -/// schema. Learn more in the [Structured Outputs -/// guide](/docs/guides/structured-outputs). -/// -/// Setting to `{ "type": "json_object" }` enables the older JSON mode, which -/// ensures the message the model generates is valid JSON. Using `json_schema` -/// is preferred for models that support it. -/// -/// -/// Default response format. Used to generate text responses. -/// -/// -/// JSON Schema response format. Used to generate structured JSON responses. -/// Learn more about [Structured Outputs](/docs/guides/structured-outputs). -/// -/// -/// JSON object response format. An older method of generating JSON responses. -/// Using `json_schema` is recommended for models that support it. Note that the -/// model will not generate JSON without a system or user message instructing it -/// to do so. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct Text { - /// The type of response format being defined. Always `text`. - /// - /// The type of response format being defined. Always `json_schema`. - /// - /// The type of response format being defined. Always `json_object`. - #[serde(rename = "type")] - pub text_type: ResponseFormatType, - /// Structured Outputs configuration options, including a JSON Schema. - #[serde(skip_serializing_if = "Option::is_none")] - pub json_schema: Option, -} - -/// Structured Outputs configuration options, including a JSON Schema. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct JsonSchema { - /// A description of what the response format is for, used by the model to - /// determine how to respond in the format. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The name of the response format. Must be a-z, A-Z, 0-9, or contain - /// underscores and dashes, with a maximum length of 64. - pub name: String, - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub schema: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub strict: Option, -} - -/// The type of response format being defined. Always `text`. -/// -/// The type of response format being defined. Always `json_schema`. -/// -/// The type of response format being defined. Always `json_object`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ResponseFormatType { - #[serde(rename = "json_object")] - JsonObject, - #[serde(rename = "json_schema")] - JsonSchema, - Text, -} - -/// Specifies the processing type used for serving the request. -/// - If set to 'auto', then the request will be processed with the service tier configured -/// in the Project settings. Unless otherwise configured, the Project will use 'default'. -/// - If set to 'default', then the request will be processed with the standard pricing and -/// performance for the selected model. -/// - If set to '[flex](/docs/guides/flex-processing)' or -/// '[priority](https://openai.com/api-priority-processing/)', then the request will be -/// processed with the corresponding service tier. -/// - When not set, the default behavior is 'auto'. -/// -/// When the `service_tier` parameter is set, the response body will include the -/// `service_tier` value based on the processing mode actually used to serve the request. -/// This response value may be different from the value set in the parameter. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ServiceTier { - Auto, - Default, - Flex, - Priority, - Scale, -} - -/// Not supported with latest reasoning models `o3` and `o4-mini`. -/// -/// Up to 4 sequences where the API will stop generating further tokens. The -/// returned text will not contain the stop sequence. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum StopConfiguration { - String(String), - StringArray(Vec), -} - -/// Options for streaming response. Only set this when you set `stream: true`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatCompletionStreamOptions { - /// When true, stream obfuscation will be enabled. Stream obfuscation adds - /// random characters to an `obfuscation` field on streaming delta events to - /// normalize payload sizes as a mitigation to certain side-channel attacks. - /// These obfuscation fields are included by default, but add a small amount - /// of overhead to the data stream. You can set `include_obfuscation` to - /// false to optimize for bandwidth if you trust the network links between - /// your application and the OpenAI API. - #[serde(skip_serializing_if = "Option::is_none")] - pub include_obfuscation: Option, - /// If set, an additional chunk will be streamed before the `data: [DONE]` - /// message. The `usage` field on this chunk shows the token usage statistics - /// for the entire request, and the `choices` field will always be an empty - /// array. - /// - /// All other chunks will also include a `usage` field, but with a null - /// value. **NOTE:** If the stream is interrupted, you may not receive the - /// final usage chunk which contains the total token usage for the request. - #[serde(skip_serializing_if = "Option::is_none")] - pub include_usage: Option, -} - -/// Controls which (if any) tool is called by the model. -/// `none` means the model will not call any tool and instead generates a message. -/// `auto` means the model can pick between generating a message or calling one or more -/// tools. -/// `required` means the model must call one or more tools. -/// Specifying a particular tool via `{"type": "function", "function": {"name": -/// "my_function"}}` forces the model to call that tool. -/// -/// `none` is the default when no tools are present. `auto` is the default if tools are -/// present. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum ChatCompletionToolChoiceOption { - Enum(ToolChoiceMode), - FunctionToolChoiceClass(FunctionToolChoiceClass), -} - -/// Constrains the tools available to the model to a pre-defined set. -/// -/// -/// Specifies a tool the model should use. Use to force the model to call a specific -/// function. -/// -/// Specifies a tool the model should use. Use to force the model to call a specific custom -/// tool. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct FunctionToolChoiceClass { - #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_tools: Option, - /// Allowed tool configuration type. Always `allowed_tools`. - /// - /// For function calling, the type is always `function`. - /// - /// For custom tool calling, the type is always `custom`. - #[serde(rename = "type")] - pub allowed_tools_type: FunctionToolChoiceType, - #[serde(skip_serializing_if = "Option::is_none")] - pub function: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub custom: Option, -} - -/// Constrains the tools available to the model to a pre-defined set. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct AllowedTools { - /// Constrains the tools available to the model to a pre-defined set. - /// - /// `auto` allows the model to pick from among the allowed tools and generate a - /// message. - /// - /// `required` requires the model to call one or more of the allowed tools. - pub mode: Mode, - /// A list of tool definitions that the model should be allowed to call. - /// - /// For the Chat Completions API, the list of tool definitions might look like: - /// ```json - /// [ - /// { "type": "function", "function": { "name": "get_weather" } }, - /// { "type": "function", "function": { "name": "get_time" } } - /// ] - /// ``` - #[ts(type = "unknown")] - pub tools: Vec>, -} - -/// Constrains the tools available to the model to a pre-defined set. -/// -/// `auto` allows the model to pick from among the allowed tools and generate a -/// message. -/// -/// `required` requires the model to call one or more of the allowed tools. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum Mode { - Auto, - Required, -} - -/// Allowed tool configuration type. Always `allowed_tools`. -/// -/// For function calling, the type is always `function`. -/// -/// For custom tool calling, the type is always `custom`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum FunctionToolChoiceType { - #[serde(rename = "allowed_tools")] - AllowedTools, - Custom, - Function, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct AllowedToolsCustom { - /// The name of the custom tool to call. - pub name: String, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct AllowedToolsFunction { - /// The name of the function to call. - pub name: String, -} - -/// `none` means the model will not call any tool and instead generates a message. `auto` -/// means the model can pick between generating a message or calling one or more tools. -/// `required` means the model must call one or more tools. -/// -/// -/// Controls which (if any) tool is called by the model. -/// -/// `none` means the model will not call any tool and instead generates a message. -/// -/// `auto` means the model can pick between generating a message or calling one or -/// more tools. -/// -/// `required` means the model must call one or more tools. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ToolChoiceMode { - Auto, - None, - Required, -} - -/// A function tool that can be used to generate a response. -/// -/// -/// A custom tool that processes input using a specified format. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CreateChatCompletionRequestTool { - #[serde(skip_serializing_if = "Option::is_none")] - pub function: Option, - /// The type of the tool. Currently, only `function` is supported. - /// - /// The type of the custom tool. Always `custom`. - #[serde(rename = "type")] - pub tool_type: FluffyType, - /// Properties of the custom tool. - #[serde(skip_serializing_if = "Option::is_none")] - pub custom: Option, -} - -/// Properties of the custom tool. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CustomToolProperties { - /// Optional description of the custom tool, used to provide more context. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The input format for the custom tool. Default is unconstrained text. - #[serde(skip_serializing_if = "Option::is_none")] - pub format: Option, - /// The name of the custom tool, used to identify it in tool calls. - pub name: String, -} - -/// The input format for the custom tool. Default is unconstrained text. -/// -/// -/// Unconstrained free-form text. -/// -/// A grammar defined by the user. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CustomFormat { - /// Unconstrained text format. Always `text`. - /// - /// Grammar format. Always `grammar`. - #[serde(rename = "type")] - pub format_type: FormatType, - /// Your chosen grammar. - #[serde(skip_serializing_if = "Option::is_none")] - pub grammar: Option, -} - -/// Unconstrained text format. Always `text`. -/// -/// Grammar format. Always `grammar`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum FormatType { - Grammar, - Text, -} - -/// Your chosen grammar. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct GrammarFormat { - /// The grammar definition. - pub definition: String, - /// The syntax of the grammar definition. One of `lark` or `regex`. - pub syntax: GrammarSyntax1, -} - -/// The syntax of the grammar definition. One of `lark` or `regex`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum GrammarSyntax1 { - Lark, - Regex, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct FunctionObject { - /// A description of what the function does, used by the model to choose when and how to call - /// the function. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and - /// dashes, with a maximum length of 64. - pub name: String, - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub parameters: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub strict: Option, -} - -/// Constrains the verbosity of the model's response. Lower values will result in -/// more concise responses, while higher values will result in more verbose responses. -/// Currently supported values are `low`, `medium`, and `high`. -/// -/// -/// High level guidance for the amount of context window space to use for the -/// search. One of `low`, `medium`, or `high`. `medium` is the default. -/// -/// -/// High level guidance for the amount of context window space to use for the search. One of -/// `low`, `medium`, or `high`. `medium` is the default. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum WebSearchContextSize { - High, - Low, - Medium, -} - -/// This tool searches the web for relevant results to use in a response. -/// Learn more about the [web search tool](/docs/guides/tools-web-search?api-mode=chat). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct WebSearch { - #[serde(skip_serializing_if = "Option::is_none")] - pub search_context_size: Option, - /// Approximate location parameters for the search. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_location: Option, -} - -/// Approximate location parameters for the search. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct UserLocation { - pub approximate: WebSearchLocation, - /// The type of location approximation. Always `approximate`. - #[serde(rename = "type")] - pub user_location_type: UserLocationType, -} - -/// Approximate location parameters for the search. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct WebSearchLocation { - /// Free text input for the city of the user, e.g. `San Francisco`. - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option, - /// The two-letter - /// [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, - /// e.g. `US`. - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option, - /// Free text input for the region of the user, e.g. `California`. - #[serde(skip_serializing_if = "Option::is_none")] - pub region: Option, - /// The [IANA timezone](https://timeapi.io/documentation/iana-timezones) - /// of the user, e.g. `America/Los_Angeles`. - #[serde(skip_serializing_if = "Option::is_none")] - pub timezone: Option, -} - -/// The type of location approximation. Always `approximate`. -/// -/// -/// The type of location approximation. Always `approximate`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum UserLocationType { - Approximate, -} - -/// Represents a chat completion response returned by model, based on the provided input. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CreateChatCompletionResponse { - /// A list of chat completion choices. Can be more than one if `n` is greater than 1. - pub choices: Vec, - /// The Unix timestamp (in seconds) of when the chat completion was created. - pub created: i64, - /// A unique identifier for the chat completion. - pub id: String, - /// The model used for the chat completion. - pub model: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub moderation: Option, - /// The object type, which is always `chat.completion`. - pub object: ChatResponseObject, - #[serde(skip_serializing_if = "Option::is_none")] - pub service_tier: Option, - /// This fingerprint represents the backend configuration that the model runs with. - /// - /// Can be used in conjunction with the `seed` request parameter to understand when backend - /// changes have been made that might impact determinism. - #[serde(skip_serializing_if = "Option::is_none")] - pub system_fingerprint: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub usage: Option, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatResponseChoice { - /// The reason the model stopped generating tokens. This will be `stop` if the model hit a - /// natural stop point or a provided stop sequence, - /// `length` if the maximum number of tokens specified in the request was reached, - /// `content_filter` if content was omitted due to a flag from our content filters, - /// `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model - /// called a function. - /// Read the [Model Spec](https://model-spec.openai.com/2025-12-18.html) for more. - pub finish_reason: FinishReason, - /// The index of the choice in the list of choices. - pub index: i64, - #[serde(skip_serializing_if = "Option::is_none")] - pub logprobs: Option, - pub message: ChatCompletionResponseMessage, -} - -/// The reason the model stopped generating tokens. This will be `stop` if the model hit a -/// natural stop point or a provided stop sequence, -/// `length` if the maximum number of tokens specified in the request was reached, -/// `content_filter` if content was omitted due to a flag from our content filters, -/// `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model -/// called a function. -/// Read the [Model Spec](https://model-spec.openai.com/2025-12-18.html) for more. -/// -/// -/// The reason the model stopped generating tokens. This will be `stop` if the model hit a -/// natural stop point or a provided stop sequence, -/// `length` if the maximum number of tokens specified in the request was reached, -/// `content_filter` if content was omitted due to a flag from our content filters, -/// `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model -/// called a function. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum FinishReason { - #[serde(rename = "content_filter")] - ContentFilter, - #[serde(rename = "function_call")] - FunctionCall, - Length, - Stop, - #[serde(rename = "tool_calls")] - ToolCalls, -} - -/// Log probability information for the choice. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct PurpleLogprobs { - #[serde(skip_serializing_if = "Option::is_none")] - pub content: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub refusal: Option>, -} - -/// A list of message content tokens with log probability information. -/// -/// A list of message refusal tokens with log probability information. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatCompletionTokenLogprob { - #[serde(skip_serializing_if = "Option::is_none")] - pub bytes: Option>, - /// The log probability of this token, if it is within the top 20 most likely tokens. - /// Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. - pub logprob: f64, - /// The token. - pub token: String, - /// List of the most likely tokens and their log probability, at this token position. The - /// number of entries may be fewer than the requested `top_logprobs`. - pub top_logprobs: Vec, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct TopLogprob { - #[serde(skip_serializing_if = "Option::is_none")] - pub bytes: Option>, - /// The log probability of this token, if it is within the top 20 most likely tokens. - /// Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. - pub logprob: f64, - /// The token. - pub token: String, -} - -/// A chat completion message generated by the model. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatCompletionResponseMessage { - /// Annotations for the message, when applicable, as when using the - /// [web search tool](/docs/guides/tools-web-search?api-mode=chat). - #[serde(skip_serializing_if = "Option::is_none")] - pub annotations: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub audio: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub content: Option, - /// Deprecated and replaced by `tool_calls`. The name and arguments of a function that should - /// be called, as generated by the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub function_call: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub refusal: Option, - /// The role of the author of this message. - pub role: MessageRole, - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_calls: Option>, -} - -/// A URL citation when using web search. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct AnnotationElement { - /// The type of the URL citation. Always `url_citation`. - #[serde(rename = "type")] - pub annotation_type: AnnotationType, - /// A URL citation when using web search. - pub url_citation: UrlCitation, -} - -/// The type of the URL citation. Always `url_citation`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum AnnotationType { - #[serde(rename = "url_citation")] - UrlCitation, -} - -/// A URL citation when using web search. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct UrlCitation { - /// The index of the last character of the URL citation in the message. - pub end_index: i64, - /// The index of the first character of the URL citation in the message. - pub start_index: i64, - /// The title of the web resource. - pub title: String, - /// The URL of the web resource. - pub url: String, -} - -/// If the audio output modality is requested, this object contains data -/// about the audio response from the model. [Learn more](/docs/guides/audio). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct MessageAudio { - /// Base64 encoded audio bytes generated by the model, in the format - /// specified in the request. - pub data: String, - /// The Unix timestamp (in seconds) for when this audio response will - /// no longer be accessible on the server for use in multi-turn - /// conversations. - pub expires_at: i64, - /// Unique identifier for this audio response. - pub id: String, - /// Transcript of the audio generated by the model. - pub transcript: String, -} - -/// Deprecated and replaced by `tool_calls`. The name and arguments of a function that should -/// be called, as generated by the model. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct MessageFunctionCall { - /// The arguments to call the function with, as generated by the model in JSON format. Note - /// that the model does not always generate valid JSON, and may hallucinate parameters not - /// defined by your function schema. Validate the arguments in your code before calling your - /// function. - pub arguments: String, - /// The name of the function to call. - pub name: String, -} - -/// The role of the author of this message. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum MessageRole { - Assistant, -} - -/// Moderation results for the request input and generated output, if moderated -/// completions were requested. -/// -/// -/// Moderation results or errors for the request input and generated output. -/// -/// Moderation results for the request input and generated output. Present -/// on the moderation chunk when moderated completions are requested. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatCompletionModeration { - /// Moderation for the request input. - pub input: InputClass, - /// Moderation for the generated output. - pub output: InputClass, -} - -/// Moderation for the request input. -/// -/// Moderation for the generated output. -/// -/// Successful moderation results for the request input or generated output. -/// -/// An error produced while attempting moderation. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct InputClass { - /// The moderation model used to generate the results. - #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, - /// A list of moderation results. - #[serde(skip_serializing_if = "Option::is_none")] - pub results: Option>, - /// The object type, which is always `moderation_results`. - /// - /// The object type, which is always `error`. - #[serde(rename = "type")] - pub chat_completion_moderation_type: StickyType, - /// The error code. - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option, - /// The error message. - #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, -} - -/// The object type, which is always `moderation_results`. -/// -/// The object type, which is always `error`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum StickyType { - Error, - #[serde(rename = "moderation_results")] - ModerationResults, -} - -/// A moderation result produced for the response input or output. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ModerationResult { - /// A dictionary of moderation categories to booleans, True if the input is flagged under - /// this category. - pub categories: HashMap, - /// Which modalities of input are reflected by the score for each category. - pub category_applied_input_types: HashMap>, - /// A dictionary of moderation categories to scores. - pub category_scores: HashMap, - /// A boolean indicating whether the content was flagged by any category. - pub flagged: bool, - /// The moderation model that produced this result. - pub model: String, - /// The object type, which was always `moderation_result` for successful moderation results. - #[serde(rename = "type")] - pub moderation_result_type: ResultType, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum TType { - Image, - Text, -} - -/// The object type, which was always `moderation_result` for successful moderation results. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ResultType { - #[serde(rename = "moderation_result")] - ModerationResult, -} - -/// The object type, which is always `chat.completion`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub enum ChatResponseObject { - #[serde(rename = "chat.completion")] - ChatCompletion, -} - -/// Usage statistics for the completion request. -/// -/// An optional field that will only be present when you set -/// `stream_options: {"include_usage": true}` in your request. When present, it -/// contains a null value **except for the last chunk** which contains the -/// token usage statistics for the entire request. -/// -/// **NOTE:** If the stream is interrupted or cancelled, you may not -/// receive the final usage chunk which contains the total token usage for -/// the request. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CompletionUsage { - /// Number of tokens in the generated completion. - pub completion_tokens: i64, - /// Breakdown of tokens used in a completion. - #[serde(skip_serializing_if = "Option::is_none")] - pub completion_tokens_details: Option, - /// Number of tokens in the prompt. - pub prompt_tokens: i64, - /// Breakdown of tokens used in the prompt. - #[serde(skip_serializing_if = "Option::is_none")] - pub prompt_tokens_details: Option, - /// Total number of tokens used in the request (prompt + completion). - pub total_tokens: i64, -} - -/// Breakdown of tokens used in a completion. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CompletionTokensDetails { - /// When using Predicted Outputs, the number of tokens in the - /// prediction that appeared in the completion. - #[serde(skip_serializing_if = "Option::is_none")] - pub accepted_prediction_tokens: Option, - /// Audio input tokens generated by the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub audio_tokens: Option, - /// Tokens generated by the model for reasoning. - #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_tokens: Option, - /// When using Predicted Outputs, the number of tokens in the - /// prediction that did not appear in the completion. However, like - /// reasoning tokens, these tokens are still counted in the total - /// completion tokens for purposes of billing, output, and context window - /// limits. - #[serde(skip_serializing_if = "Option::is_none")] - pub rejected_prediction_tokens: Option, -} - -/// Breakdown of tokens used in the prompt. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct PromptTokensDetails { - /// Audio input tokens present in the prompt. - #[serde(skip_serializing_if = "Option::is_none")] - pub audio_tokens: Option, - /// Cached tokens present in the prompt. - #[serde(skip_serializing_if = "Option::is_none")] - pub cached_tokens: Option, -} - -/// Represents a streamed chunk of a chat completion response returned -/// by the model, based on the provided input. -/// [Learn more](/docs/guides/streaming-responses). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CreateChatCompletionStreamResponse { - /// A list of chat completion choices. Can contain more than one elements if `n` is greater - /// than 1. Can also be empty for the - /// last chunk if you set `stream_options: {"include_usage": true}`. - pub choices: Vec, - /// The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has - /// the same timestamp. - pub created: i64, - /// A unique identifier for the chat completion. Each chunk has the same ID. - pub id: String, - /// The model to generate the completion. - pub model: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub moderation: Option, - /// The object type, which is always `chat.completion.chunk`. - pub object: ChatStreamResponseObject, - #[serde(skip_serializing_if = "Option::is_none")] - pub service_tier: Option, - /// This fingerprint represents the backend configuration that the model runs with. - /// Can be used in conjunction with the `seed` request parameter to understand when backend - /// changes have been made that might impact determinism. - #[serde(skip_serializing_if = "Option::is_none")] - pub system_fingerprint: Option, - /// An optional field that will only be present when you set - /// `stream_options: {"include_usage": true}` in your request. When present, it - /// contains a null value **except for the last chunk** which contains the - /// token usage statistics for the entire request. - /// - /// **NOTE:** If the stream is interrupted or cancelled, you may not - /// receive the final usage chunk which contains the total token usage for - /// the request. - #[serde(skip_serializing_if = "Option::is_none")] - pub usage: Option, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatStreamResponseChoice { - pub delta: ChatCompletionStreamResponseDelta, - /// The reason the model stopped generating tokens. This will be `stop` if the model hit a - /// natural stop point or a provided stop sequence, - /// `length` if the maximum number of tokens specified in the request was reached, - /// `content_filter` if content was omitted due to a flag from our content filters, - /// `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model - /// called a function. - pub finish_reason: FinishReason, - /// The index of the choice in the list of choices. - pub index: i64, - /// Log probability information for the choice. - #[serde(skip_serializing_if = "Option::is_none")] - pub logprobs: Option, -} - -/// A chat completion delta generated by streamed model responses. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatCompletionStreamResponseDelta { - #[serde(skip_serializing_if = "Option::is_none")] - pub content: Option, - /// Deprecated and replaced by `tool_calls`. The name and arguments of a function that should - /// be called, as generated by the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub function_call: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub refusal: Option, - /// The role of the author of this message. - #[serde(skip_serializing_if = "Option::is_none")] - pub role: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_calls: Option>, -} - -/// Deprecated and replaced by `tool_calls`. The name and arguments of a function that should -/// be called, as generated by the model. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct DeltaFunctionCall { - /// The arguments to call the function with, as generated by the model in JSON format. Note - /// that the model does not always generate valid JSON, and may hallucinate parameters not - /// defined by your function schema. Validate the arguments in your code before calling your - /// function. - #[serde(skip_serializing_if = "Option::is_none")] - pub arguments: Option, - /// The name of the function to call. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, -} - -/// The role of the author of this message. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum DeltaRole { - Assistant, - Developer, - System, - Tool, - User, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ChatCompletionMessageToolCallChunk { - #[serde(skip_serializing_if = "Option::is_none")] - pub function: Option, - /// The ID of the tool call. - #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option, - pub index: i64, - /// The type of the tool. Currently, only `function` is supported. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub chat_completion_message_tool_call_chunk_type: Option, -} - -/// The type of the tool. Currently, only `function` is supported. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum IndigoType { - Function, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct FluffyFunction { - /// The arguments to call the function with, as generated by the model in JSON format. Note - /// that the model does not always generate valid JSON, and may hallucinate parameters not - /// defined by your function schema. Validate the arguments in your code before calling your - /// function. - #[serde(skip_serializing_if = "Option::is_none")] - pub arguments: Option, - /// The name of the function to call. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, -} - -/// Log probability information for the choice. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct FluffyLogprobs { - /// A list of message content tokens with log probability information. - pub content: Vec, - /// A list of message refusal tokens with log probability information. - pub refusal: Vec, -} - -/// The object type, which is always `chat.completion.chunk`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub enum ChatStreamResponseObject { - #[serde(rename = "chat.completion.chunk")] - ChatCompletionChunk, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CreateResponseClass { - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option>, - /// Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. - /// Replaces the `user` field. [Learn more](/docs/guides/prompt-caching). - #[serde(skip_serializing_if = "Option::is_none")] - pub prompt_cache_key: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub prompt_cache_retention: Option, - /// A stable identifier used to help detect users of your application that may be violating - /// OpenAI's usage policies. - /// The IDs should be a string that uniquely identifies each user, with a maximum length of - /// 64 characters. We recommend hashing their username or email address, in order to avoid - /// sending us any identifying information. [Learn - /// more](/docs/guides/safety-best-practices#safety-identifiers). - #[serde(skip_serializing_if = "Option::is_none")] - pub safety_identifier: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub service_tier: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub temperature: Option, - /// An integer between 0 and 20 specifying the maximum number of most likely - /// tokens to return at each token position, each with an associated log - /// probability. In some cases, the number of returned tokens may be fewer than - /// requested. - #[serde(skip_serializing_if = "Option::is_none")] - pub top_logprobs: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub top_p: Option, - /// This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use - /// `prompt_cache_key` instead to maintain caching optimizations. - /// A stable identifier for your end-users. - /// Used to boost cache hit rates by better bucketing similar requests and to help OpenAI - /// detect and prevent abuse. [Learn - /// more](/docs/guides/safety-best-practices#safety-identifiers). - #[serde(skip_serializing_if = "Option::is_none")] - pub user: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub background: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub max_tool_calls: Option, - /// Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI - /// offers a wide range of models with different capabilities, performance - /// characteristics, and price points. Refer to the [model guide](/docs/models) - /// to browse and compare available models. - #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub previous_response_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub prompt: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_choice: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub tools: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub truncation: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub context_management: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub conversation: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub include: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub input: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub instructions: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub max_output_tokens: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub moderation: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub parallel_tool_calls: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub store: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub stream: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub stream_options: Option, -} - -/// Context management configuration for this request. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ContextManagementParam { - #[serde(skip_serializing_if = "Option::is_none")] - pub compact_threshold: Option, - /// The context management entry type. Currently only 'compaction' is supported. - #[serde(rename = "type")] - pub context_management_param_type: String, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum ConversationParam { - ConversationObject(ConversationObject), - String(String), -} - -/// The conversation that this response belongs to. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ConversationObject { - /// The unique ID of the conversation. - pub id: String, -} - -/// Specify additional output data to include in the model response. Currently supported -/// values are: -/// - `web_search_call.action.sources`: Include the sources of the web search tool call. -/// - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code -/// interpreter tool call items. -/// - `computer_call_output.output.image_url`: Include image urls from the computer call -/// output. -/// - `file_search_call.results`: Include the search results of the file search tool call. -/// - `message.input_image.image_url`: Include image urls from the input message. -/// - `message.output_text.logprobs`: Include logprobs with assistant messages. -/// - `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in -/// reasoning item outputs. This enables reasoning items to be used in multi-turn -/// conversations when using the Responses API statelessly (like when the `store` parameter -/// is set to `false`, or when an organization is enrolled in the zero data retention -/// program). -/// -/// Specify additional output data to include in the model response. Currently supported -/// values are: -/// - `web_search_call.results`: Include the search results of the web search tool call. -/// - `web_search_call.action.sources`: Include the sources of the web search tool call. -/// - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code -/// interpreter tool call items. -/// - `computer_call_output.output.image_url`: Include image urls from the computer call -/// output. -/// - `file_search_call.results`: Include the search results of the file search tool call. -/// - `message.input_image.image_url`: Include image urls from the input message. -/// - `message.output_text.logprobs`: Include logprobs with assistant messages. -/// - `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in -/// reasoning item outputs. This enables reasoning items to be used in multi-turn -/// conversations when using the Responses API statelessly (like when the `store` parameter -/// is set to `false`, or when an organization is enrolled in the zero data retention -/// program). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub enum IncludeEnum { - #[serde(rename = "code_interpreter_call.outputs")] - CodeInterpreterCallOutputs, - #[serde(rename = "computer_call_output.output.image_url")] - ComputerCallOutputOutputImageUrl, - #[serde(rename = "file_search_call.results")] - FileSearchCallResults, - #[serde(rename = "message.input_image.image_url")] - MessageInputImageImageUrl, - #[serde(rename = "message.output_text.logprobs")] - MessageOutputTextLogprobs, - #[serde(rename = "reasoning.encrypted_content")] - ReasoningEncryptedContent, - #[serde(rename = "web_search_call.action.sources")] - WebSearchCallActionSources, - #[serde(rename = "web_search_call.results")] - WebSearchCallResults, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum InputParam { - InputItemArray(Vec), - String(String), -} - -/// A list of one or many input items to the model, containing -/// different content types. -/// -/// -/// A message input to the model with a role indicating instruction following -/// hierarchy. Instructions given with the `developer` or `system` role take -/// precedence over instructions given with the `user` role. Messages with the -/// `assistant` role are presumed to have been generated by the model in previous -/// interactions. -/// -/// -/// An item representing part of the context for the response to be -/// generated by the model. Can contain text, images, and audio inputs, -/// as well as previous assistant responses and tool call outputs. -/// -/// -/// Content item used to generate a response. -/// -/// -/// A message input to the model with a role indicating instruction following -/// hierarchy. Instructions given with the `developer` or `system` role take -/// precedence over instructions given with the `user` role. -/// -/// -/// An output message from the model. -/// -/// -/// The results of a file search tool call. See the -/// [file search guide](/docs/guides/tools-file-search) for more information. -/// -/// -/// A tool call to a computer use tool. See the -/// [computer use guide](/docs/guides/tools-computer-use) for more information. -/// -/// -/// The output of a computer tool call. -/// -/// The results of a web search tool call. See the -/// [web search guide](/docs/guides/tools-web-search) for more information. -/// -/// -/// A tool call to run a function. See the -/// [function calling guide](/docs/guides/function-calling) for more information. -/// -/// -/// The output of a function tool call. -/// -/// A description of the chain of thought used by a reasoning model while generating -/// a response. Be sure to include these items in your `input` to the Responses API -/// for subsequent turns of a conversation if you are manually -/// [managing context](/docs/guides/conversation-state). -/// -/// -/// A compaction item generated by the [`v1/responses/compact` -/// API](/docs/api-reference/responses/compact). -/// -/// An image generation request made by the model. -/// -/// -/// A tool call to run code. -/// -/// -/// A tool call to run a command on the local shell. -/// -/// -/// The output of a local shell tool call. -/// -/// -/// A tool representing a request to execute one or more shell commands. -/// -/// The streamed output items emitted by a shell tool call. -/// -/// A tool call representing a request to create, delete, or update files using diff -/// patches. -/// -/// The streamed output emitted by an apply patch tool call. -/// -/// A list of tools available on an MCP server. -/// -/// -/// A request for human approval of a tool invocation. -/// -/// -/// A response to an MCP approval request. -/// -/// -/// An invocation of a tool on an MCP server. -/// -/// -/// The output of a custom tool call from your code, being sent back to the model. -/// -/// -/// A call to a custom tool created by the model. -/// -/// -/// Compacts the current context. Must be the final input item. -/// -/// An internal identifier for an item to reference. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export, export_to = "openai/")] -pub struct InputItem { - /// Text, image, or audio input to the model, used to generate a response. - /// Can also contain previous assistant responses. - /// - /// - /// The content of the output message. - /// - /// - /// Reasoning text content. - #[serde(skip_serializing_if = "Option::is_none")] - pub content: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub phase: Option, - /// The role of the message input. One of `user`, `assistant`, `system`, or - /// `developer`. - /// - /// - /// The role of the message input. One of `user`, `system`, or `developer`. - /// - /// - /// The role of the output message. Always `assistant`. - /// - /// - /// The role that provided the additional tools. Only `developer` is supported. - #[serde(skip_serializing_if = "Option::is_none")] - pub role: Option, - /// The type of the message input. Always `message`. - /// - /// - /// The type of the message input. Always set to `message`. - /// - /// - /// The type of the output message. Always `message`. - /// - /// - /// The type of the file search tool call. Always `file_search_call`. - /// - /// - /// The type of the computer call. Always `computer_call`. - /// - /// The type of the computer tool call output. Always `computer_call_output`. - /// - /// The type of the web search tool call. Always `web_search_call`. - /// - /// - /// The type of the function tool call. Always `function_call`. - /// - /// - /// The type of the function tool call output. Always `function_call_output`. - /// - /// The item type. Always `tool_search_call`. - /// - /// The item type. Always `tool_search_output`. - /// - /// The item type. Always `additional_tools`. - /// - /// The type of the object. Always `reasoning`. - /// - /// - /// The type of the item. Always `compaction`. - /// - /// The type of the image generation call. Always `image_generation_call`. - /// - /// - /// The type of the code interpreter tool call. Always `code_interpreter_call`. - /// - /// - /// The type of the local shell call. Always `local_shell_call`. - /// - /// - /// The type of the local shell tool call output. Always `local_shell_call_output`. - /// - /// - /// The type of the item. Always `shell_call`. - /// - /// The type of the item. Always `shell_call_output`. - /// - /// The type of the item. Always `apply_patch_call`. - /// - /// The type of the item. Always `apply_patch_call_output`. - /// - /// The type of the item. Always `mcp_list_tools`. - /// - /// - /// The type of the item. Always `mcp_approval_request`. - /// - /// - /// The type of the item. Always `mcp_approval_response`. - /// - /// - /// The type of the item. Always `mcp_call`. - /// - /// - /// The type of the custom tool call output. Always `custom_tool_call_output`. - /// - /// - /// The type of the custom tool call. Always `custom_tool_call`. - /// - /// - /// The type of the item. Always `compaction_trigger`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub input_item_type: Option, - /// The status of item. One of `in_progress`, `completed`, or - /// `incomplete`. Populated when items are returned via API. - /// - /// - /// The status of the message input. One of `in_progress`, `completed`, or - /// `incomplete`. Populated when input items are returned via API. - /// - /// - /// The status of the file search tool call. One of `in_progress`, - /// `searching`, `incomplete` or `failed`, - /// - /// - /// The status of the item. One of `in_progress`, `completed`, or - /// `incomplete`. Populated when items are returned via API. - /// - /// - /// The status of the web search tool call. - /// - /// - /// The status of the image generation call. - /// - /// - /// The status of the code interpreter tool call. Valid values are `in_progress`, - /// `completed`, `incomplete`, `interpreting`, and `failed`. - /// - /// - /// The status of the local shell call. - /// - /// - /// The status of the apply patch tool call. One of `in_progress` or `completed`. - /// - /// The status of the apply patch tool call output. One of `completed` or `failed`. - /// - /// The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, - /// or `failed`. - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// The unique ID of the output message. - /// - /// - /// The unique ID of the file search tool call. - /// - /// - /// The unique ID of the computer call. - /// - /// The unique ID of the web search tool call. - /// - /// - /// The unique ID of the function tool call. - /// - /// - /// The unique identifier of the reasoning content. - /// - /// - /// The unique ID of the image generation call. - /// - /// - /// The unique ID of the code interpreter tool call. - /// - /// - /// The unique ID of the local shell call. - /// - /// - /// The unique ID of the local shell tool call generated by the model. - /// - /// - /// The unique ID of the list. - /// - /// - /// The unique ID of the approval request. - /// - /// - /// The unique ID of the tool call. - /// - /// - /// The unique ID of the custom tool call output in the OpenAI platform. - /// - /// - /// The unique ID of the custom tool call in the OpenAI platform. - /// - /// - /// The ID of the item to reference. - #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option, - /// The queries used to search for files. - #[serde(skip_serializing_if = "Option::is_none")] - pub queries: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub results: Option>, - /// An object describing the specific action taken in this web search call. - /// Includes details on how the model used the web (search, open_page, find_in_page). - /// - /// - /// The shell commands and limits that describe how to run the tool call. - #[serde(skip_serializing_if = "Option::is_none")] - pub action: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub actions: Option>, - /// An identifier used when responding to the tool call with output. - /// - /// - /// The ID of the computer tool call that produced the output. - /// - /// The unique ID of the function tool call generated by the model. - /// - /// - /// The unique ID of the function tool call generated by the model. - /// - /// The unique ID of the local shell tool call generated by the model. - /// - /// - /// The unique ID of the shell tool call generated by the model. - /// - /// The unique ID of the apply patch tool call generated by the model. - /// - /// The call ID, used to map this custom tool call output to a custom tool call. - /// - /// - /// An identifier used to map this custom tool call to a tool call output. - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub call_id: Option, - /// The pending safety checks for the computer call. - #[serde(skip_serializing_if = "Option::is_none")] - pub pending_safety_checks: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub acknowledged_safety_checks: Option>, - /// Text, image, or file output of the function tool call. - /// - /// A JSON string of the output of the local shell tool call. - /// - /// - /// Captured chunks of stdout and stderr output, along with their associated outcomes. - /// - /// The output from the custom tool call generated by your code. - /// Can be a string or an list of output content. - #[serde(skip_serializing_if = "Option::is_none")] - pub output: Option, - /// A JSON string of the arguments to pass to the function. - /// - /// - /// The arguments supplied to the tool search call. - /// - /// A JSON string of arguments for the tool. - /// - /// - /// A JSON string of the arguments passed to the tool. - #[serde(skip_serializing_if = "Option::is_none")] - pub arguments: Option, - /// The name of the function to run. - /// - /// - /// The name of the tool to run. - /// - /// - /// The name of the tool that was run. - /// - /// - /// The name of the custom tool being called. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// The namespace of the function to run. - /// - /// - /// The namespace of the custom tool being called. - #[serde(skip_serializing_if = "Option::is_none")] - pub namespace: Option, - /// Whether tool search was executed by the server or by the client. - #[serde(skip_serializing_if = "Option::is_none")] - pub execution: Option, - /// The loaded tool definitions returned by the tool search output. - /// - /// A list of additional tools made available at this item. - /// - /// The tools available on the server. - #[serde(skip_serializing_if = "Option::is_none")] - pub tools: Option>, - /// The encrypted content of the compaction summary. - #[serde(skip_serializing_if = "Option::is_none")] - pub encrypted_content: Option, - /// Reasoning summary content. - #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub fingerprint: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub caller: Option, - /// The ID of the container used to run the code. - #[serde(skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub outputs: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub environment: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub max_output_length: Option, - /// The specific create, delete, or update instruction for the apply_patch tool call. - #[serde(skip_serializing_if = "Option::is_none")] - pub operation: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// The label of the MCP server. - /// - /// - /// The label of the MCP server making the request. - /// - /// - /// The label of the MCP server running the tool. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_label: Option, - /// The ID of the approval request being answered. - #[serde(skip_serializing_if = "Option::is_none")] - pub approval_request_id: Option, - /// Whether the request was approved. - #[serde(skip_serializing_if = "Option::is_none")] - pub approve: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub request_id: Option, - /// The input for the custom tool call generated by the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub input: Option, -} - -/// A pending safety check for the computer call. -/// -/// The safety checks reported by the API that have been acknowledged by the developer. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ComputerCallSafetyCheckParam { - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option, - /// The ID of the pending safety check. - pub id: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, -} - -/// Flattened batched actions for `computer_use`. Each action includes an -/// `type` discriminator and action-specific fields. -/// -/// -/// A click action. -/// -/// A double click action. -/// -/// A drag action. -/// -/// A collection of keypresses the model would like to perform. -/// -/// A mouse move action. -/// -/// A screenshot action. -/// -/// A scroll action. -/// -/// An action to type in text. -/// -/// A wait action. -/// -/// An object describing the specific action taken in this web search call. -/// Includes details on how the model used the web (search, open_page, find_in_page). -/// -/// -/// Action type "search" - Performs a web search query. -/// -/// -/// Action type "open_page" - Opens a specific URL from search results. -/// -/// -/// Action type "find_in_page": Searches for a pattern within a loaded page. -/// -/// -/// Execute a shell command on the server. -/// -/// The shell commands and limits that describe how to run the tool call. -/// -/// Commands and limits describing how to run the shell tool call. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct InputItemAction { - /// Indicates which mouse button was pressed during the click. One of `left`, `right`, - /// `wheel`, `back`, or `forward`. - #[serde(skip_serializing_if = "Option::is_none")] - pub button: Option, - /// The combination of keys the model is requesting to be pressed. This is an array of - /// strings, each representing a key. - #[serde(skip_serializing_if = "Option::is_none")] - pub keys: Option>, - /// Specifies the event type. For a click action, this property is always `click`. - /// - /// Specifies the event type. For a double click action, this property is always set to - /// `double_click`. - /// - /// Specifies the event type. For a drag action, this property is always set to `drag`. - /// - /// Specifies the event type. For a keypress action, this property is always set to - /// `keypress`. - /// - /// Specifies the event type. For a move action, this property is always set to `move`. - /// - /// Specifies the event type. For a screenshot action, this property is always set to - /// `screenshot`. - /// - /// Specifies the event type. For a scroll action, this property is always set to `scroll`. - /// - /// Specifies the event type. For a type action, this property is always set to `type`. - /// - /// Specifies the event type. For a wait action, this property is always set to `wait`. - /// - /// The action type. - /// - /// - /// The type of the local shell action. Always `exec`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub computer_action_type: Option, - /// The x-coordinate where the click occurred. - /// - /// The x-coordinate where the double click occurred. - /// - /// The x-coordinate to move to. - /// - /// The x-coordinate where the scroll occurred. - #[serde(skip_serializing_if = "Option::is_none")] - pub x: Option, - /// The y-coordinate where the click occurred. - /// - /// The y-coordinate where the double click occurred. - /// - /// The y-coordinate to move to. - /// - /// The y-coordinate where the scroll occurred. - #[serde(skip_serializing_if = "Option::is_none")] - pub y: Option, - /// An array of coordinates representing the path of the drag action. Coordinates will appear - /// as an array of objects, eg - /// ```json - /// [ - /// { "x": 100, "y": 200 }, - /// { "x": 200, "y": 300 } - /// ] - /// ``` - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option>, - /// The horizontal scroll distance. - #[serde(skip_serializing_if = "Option::is_none")] - pub scroll_x: Option, - /// The vertical scroll distance. - #[serde(skip_serializing_if = "Option::is_none")] - pub scroll_y: Option, - /// The text to type. - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - /// The search queries. - #[serde(skip_serializing_if = "Option::is_none")] - pub queries: Option>, - /// The search query. - #[serde(skip_serializing_if = "Option::is_none")] - pub query: Option, - /// The sources used in the search. - #[serde(skip_serializing_if = "Option::is_none")] - pub sources: Option>, - /// The URL opened by the model. - /// - /// - /// The URL of the page searched for the pattern. - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, - /// The pattern or text to search for within the page. - #[serde(skip_serializing_if = "Option::is_none")] - pub pattern: Option, - /// The command to run. - #[serde(skip_serializing_if = "Option::is_none")] - pub command: Option>, - /// Environment variables to set for the command. - #[serde(skip_serializing_if = "Option::is_none")] - pub env: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub timeout_ms: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub user: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub working_directory: Option, - /// Ordered shell commands for the execution environment to run. - #[serde(skip_serializing_if = "Option::is_none")] - pub commands: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub max_output_length: Option, -} - -/// Indicates which mouse button was pressed during the click. One of `left`, `right`, -/// `wheel`, `back`, or `forward`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ClickButtonType { - Back, - Forward, - Left, - Right, - Wheel, -} - -/// Specifies the event type. For a click action, this property is always `click`. -/// -/// Specifies the event type. For a double click action, this property is always set to -/// `double_click`. -/// -/// Specifies the event type. For a drag action, this property is always set to `drag`. -/// -/// Specifies the event type. For a keypress action, this property is always set to -/// `keypress`. -/// -/// Specifies the event type. For a move action, this property is always set to `move`. -/// -/// Specifies the event type. For a screenshot action, this property is always set to -/// `screenshot`. -/// -/// Specifies the event type. For a scroll action, this property is always set to `scroll`. -/// -/// Specifies the event type. For a type action, this property is always set to `type`. -/// -/// Specifies the event type. For a wait action, this property is always set to `wait`. -/// -/// The action type. -/// -/// -/// The type of the local shell action. Always `exec`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ActionType { - Click, - #[serde(rename = "double_click")] - DoubleClick, - Drag, - Exec, - #[serde(rename = "find_in_page")] - FindInPage, - Keypress, - Move, - #[serde(rename = "open_page")] - OpenPage, - Screenshot, - Scroll, - Search, - Type, - Wait, -} - -/// An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct Coordinate { - /// The x-coordinate. - pub x: i64, - /// The y-coordinate. - pub y: i64, -} - -/// A source used in the search. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct WebSearchSource { - /// The type of source. Always `url`. - #[serde(rename = "type")] - pub web_search_source_type: IndecentType, - /// The URL of the source. - pub url: String, -} - -/// The type of source. Always `url`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum IndecentType { - Url, -} - -/// Flattened batched actions for `computer_use`. Each action includes an -/// `type` discriminator and action-specific fields. -/// -/// -/// A click action. -/// -/// A double click action. -/// -/// A drag action. -/// -/// A collection of keypresses the model would like to perform. -/// -/// A mouse move action. -/// -/// A screenshot action. -/// -/// A scroll action. -/// -/// An action to type in text. -/// -/// A wait action. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ComputerAction { - /// Indicates which mouse button was pressed during the click. One of `left`, `right`, - /// `wheel`, `back`, or `forward`. - #[serde(skip_serializing_if = "Option::is_none")] - pub button: Option, - /// The combination of keys the model is requesting to be pressed. This is an array of - /// strings, each representing a key. - #[serde(skip_serializing_if = "Option::is_none")] - pub keys: Option>, - /// Specifies the event type. For a click action, this property is always `click`. - /// - /// Specifies the event type. For a double click action, this property is always set to - /// `double_click`. - /// - /// Specifies the event type. For a drag action, this property is always set to `drag`. - /// - /// Specifies the event type. For a keypress action, this property is always set to - /// `keypress`. - /// - /// Specifies the event type. For a move action, this property is always set to `move`. - /// - /// Specifies the event type. For a screenshot action, this property is always set to - /// `screenshot`. - /// - /// Specifies the event type. For a scroll action, this property is always set to `scroll`. - /// - /// Specifies the event type. For a type action, this property is always set to `type`. - /// - /// Specifies the event type. For a wait action, this property is always set to `wait`. - #[serde(rename = "type")] - pub computer_action_type: ComputerActionType, - /// The x-coordinate where the click occurred. - /// - /// The x-coordinate where the double click occurred. - /// - /// The x-coordinate to move to. - /// - /// The x-coordinate where the scroll occurred. - #[serde(skip_serializing_if = "Option::is_none")] - pub x: Option, - /// The y-coordinate where the click occurred. - /// - /// The y-coordinate where the double click occurred. - /// - /// The y-coordinate to move to. - /// - /// The y-coordinate where the scroll occurred. - #[serde(skip_serializing_if = "Option::is_none")] - pub y: Option, - /// An array of coordinates representing the path of the drag action. Coordinates will appear - /// as an array of objects, eg - /// ```json - /// [ - /// { "x": 100, "y": 200 }, - /// { "x": 200, "y": 300 } - /// ] - /// ``` - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option>, - /// The horizontal scroll distance. - #[serde(skip_serializing_if = "Option::is_none")] - pub scroll_x: Option, - /// The vertical scroll distance. - #[serde(skip_serializing_if = "Option::is_none")] - pub scroll_y: Option, - /// The text to type. - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, -} - -/// Specifies the event type. For a click action, this property is always `click`. -/// -/// Specifies the event type. For a double click action, this property is always set to -/// `double_click`. -/// -/// Specifies the event type. For a drag action, this property is always set to `drag`. -/// -/// Specifies the event type. For a keypress action, this property is always set to -/// `keypress`. -/// -/// Specifies the event type. For a move action, this property is always set to `move`. -/// -/// Specifies the event type. For a screenshot action, this property is always set to -/// `screenshot`. -/// -/// Specifies the event type. For a scroll action, this property is always set to `scroll`. -/// -/// Specifies the event type. For a type action, this property is always set to `type`. -/// -/// Specifies the event type. For a wait action, this property is always set to `wait`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ComputerActionType { - Click, - #[serde(rename = "double_click")] - DoubleClick, - Drag, - Keypress, - Move, - Screenshot, - Scroll, - Type, - Wait, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum Arguments { - #[ts(type = "Record")] - AnythingMap(serde_json::Map), - String(String), -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum InputItemContent { - InputContentArray(Vec), - String(String), -} - -/// A list of one or many input items to the model, containing different content -/// types. -/// -/// -/// Text, image, or file output of the custom tool call. -/// -/// -/// Text, image, or file output of the function call. -/// -/// -/// A text input to the model. -/// -/// An image input to the model. Learn about [image inputs](/docs/guides/vision). -/// -/// A file input to the model. -/// -/// A text output from the model. -/// -/// A refusal from the model. -/// -/// Reasoning text from the model. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ContentOutputContentList { - /// The text input to the model. - /// - /// The text output from the model. - /// - /// The reasoning text from the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - /// The type of the input item. Always `input_text`. - /// - /// The type of the input item. Always `input_image`. - /// - /// The type of the input item. Always `input_file`. - /// - /// The type of the output text. Always `output_text`. - /// - /// The type of the refusal. Always `refusal`. - /// - /// The type of the reasoning text. Always `reasoning_text`. - #[serde(rename = "type")] - pub input_content_type: HilariousType, - /// The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or - /// `original`. Defaults to `auto`. - /// - /// The detail level of the file to be sent to the model. Use `low` for the default rendering - /// behavior, or `high` to render the file at higher quality. Defaults to `low`. - #[serde(skip_serializing_if = "Option::is_none")] - pub detail: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub file_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub image_url: Option, - /// The content of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_data: Option, - /// The URL of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_url: Option, - /// The name of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub filename: Option, - /// The annotations of the text output. - #[serde(skip_serializing_if = "Option::is_none")] - pub annotations: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub logprobs: Option>, - /// The refusal explanation from the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub refusal: Option, -} - -/// An annotation that applies to a span of output text. -/// -/// A citation to a file. -/// -/// A citation for a web resource used to generate a model response. -/// -/// A citation for a container file used to generate a model response. -/// -/// A path to a file. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct Annotation { - /// The ID of the file. - /// - /// The ID of the file. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_id: Option, - /// The filename of the file cited. - /// - /// The filename of the container file cited. - #[serde(skip_serializing_if = "Option::is_none")] - pub filename: Option, - /// The index of the file in the list of files. - /// - /// The index of the file in the list of files. - #[serde(skip_serializing_if = "Option::is_none")] - pub index: Option, - /// The type of the file citation. Always `file_citation`. - /// - /// The type of the URL citation. Always `url_citation`. - /// - /// The type of the container file citation. Always `container_file_citation`. - /// - /// The type of the file path. Always `file_path`. - #[serde(rename = "type")] - pub annotation_type: AnnotationTypeEnum, - /// The index of the last character of the URL citation in the message. - /// - /// The index of the last character of the container file citation in the message. - #[serde(skip_serializing_if = "Option::is_none")] - pub end_index: Option, - /// The index of the first character of the URL citation in the message. - /// - /// The index of the first character of the container file citation in the message. - #[serde(skip_serializing_if = "Option::is_none")] - pub start_index: Option, - /// The title of the web resource. - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// The URL of the web resource. - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, - /// The ID of the container file. - #[serde(skip_serializing_if = "Option::is_none")] - pub container_id: Option, -} - -/// The type of the file citation. Always `file_citation`. -/// -/// The type of the URL citation. Always `url_citation`. -/// -/// The type of the container file citation. Always `container_file_citation`. -/// -/// The type of the file path. Always `file_path`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum AnnotationTypeEnum { - #[serde(rename = "container_file_citation")] - ContainerFileCitation, - #[serde(rename = "file_citation")] - FileCitation, - #[serde(rename = "file_path")] - FilePath, - #[serde(rename = "url_citation")] - UrlCitation, -} - -/// The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or -/// `original`. Defaults to `auto`. -/// -/// The detail level of the file to be sent to the model. Use `low` for the default rendering -/// behavior, or `high` to render the file at higher quality. Defaults to `low`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum DetailEnum { - Auto, - High, - Low, - Original, -} - -/// The type of the input item. Always `input_text`. -/// -/// The type of the input item. Always `input_image`. -/// -/// The type of the input item. Always `input_file`. -/// -/// The type of the output text. Always `output_text`. -/// -/// The type of the refusal. Always `refusal`. -/// -/// The type of the reasoning text. Always `reasoning_text`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum HilariousType { - #[serde(rename = "input_file")] - InputFile, - #[serde(rename = "input_image")] - InputImage, - #[serde(rename = "input_audio")] - InputAudio, - #[serde(rename = "input_text")] - InputText, - #[serde(rename = "output_text")] - OutputText, - #[serde(rename = "reasoning_text")] - ReasoningText, - Refusal, -} - -/// The log probability of a token. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct LogProbability { - pub bytes: Vec, - pub logprob: f64, - pub token: String, - pub top_logprobs: Vec, -} - -/// The top log probability of a token. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct TopLogProbability { - pub bytes: Vec, - pub logprob: f64, - pub token: String, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct InputItemLocalEnvironmentParam { - /// An optional list of skills. - #[serde(skip_serializing_if = "Option::is_none")] - pub skills: Option>, - /// Use a local computer environment. - /// - /// References a container created with the /v1/containers endpoint - #[serde(rename = "type")] - pub param_type: LocalEnvironmentType, - /// The ID of the referenced container. - #[serde(skip_serializing_if = "Option::is_none")] - pub container_id: Option, -} - -/// Use a local computer environment. -/// -/// References a container created with the /v1/containers endpoint -/// -/// The environment type. Always `local`. -/// -/// The environment type. Always `container_reference`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum LocalEnvironmentType { - #[serde(rename = "container_reference")] - ContainerReference, - Local, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct LocalSkillParam { - /// The description of the skill. - pub description: String, - /// The name of the skill. - pub name: String, - /// The path to the directory containing the skill. - pub path: String, -} - -/// Whether tool search is executed by the server or by the client. -/// -/// Whether tool search was executed by the server or by the client. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ToolSearchExecutionType { - Client, - Server, -} - -/// The type of the message input. Always `message`. -/// -/// -/// The type of the message input. Always set to `message`. -/// -/// -/// The type of the output message. Always `message`. -/// -/// -/// The type of the file search tool call. Always `file_search_call`. -/// -/// -/// The type of the computer call. Always `computer_call`. -/// -/// The type of the computer tool call output. Always `computer_call_output`. -/// -/// The type of the web search tool call. Always `web_search_call`. -/// -/// -/// The type of the function tool call. Always `function_call`. -/// -/// -/// The type of the function tool call output. Always `function_call_output`. -/// -/// The item type. Always `tool_search_call`. -/// -/// The item type. Always `tool_search_output`. -/// -/// The item type. Always `additional_tools`. -/// -/// The type of the object. Always `reasoning`. -/// -/// -/// The type of the item. Always `compaction`. -/// -/// The type of the image generation call. Always `image_generation_call`. -/// -/// -/// The type of the code interpreter tool call. Always `code_interpreter_call`. -/// -/// -/// The type of the local shell call. Always `local_shell_call`. -/// -/// -/// The type of the local shell tool call output. Always `local_shell_call_output`. -/// -/// -/// The type of the item. Always `shell_call`. -/// -/// The type of the item. Always `shell_call_output`. -/// -/// The type of the item. Always `apply_patch_call`. -/// -/// The type of the item. Always `apply_patch_call_output`. -/// -/// The type of the item. Always `mcp_list_tools`. -/// -/// -/// The type of the item. Always `mcp_approval_request`. -/// -/// -/// The type of the item. Always `mcp_approval_response`. -/// -/// -/// The type of the item. Always `mcp_call`. -/// -/// -/// The type of the custom tool call output. Always `custom_tool_call_output`. -/// -/// -/// The type of the custom tool call. Always `custom_tool_call`. -/// -/// -/// The type of the item. Always `compaction_trigger`. -/// -/// The type of item to reference. Always `item_reference`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum InputItemType { - #[serde(rename = "program")] - Program, - #[serde(rename = "program_output")] - ProgramOutput, - #[serde(rename = "additional_tools")] - AdditionalTools, - #[serde(rename = "apply_patch_call")] - ApplyPatchCall, - #[serde(rename = "apply_patch_call_output")] - ApplyPatchCallOutput, - #[serde(rename = "code_interpreter_call")] - CodeInterpreterCall, - Compaction, - #[serde(rename = "compaction_trigger")] - CompactionTrigger, - #[serde(rename = "computer_call")] - ComputerCall, - #[serde(rename = "computer_call_output")] - ComputerCallOutput, - #[serde(rename = "custom_tool_call")] - CustomToolCall, - #[serde(rename = "custom_tool_call_output")] - CustomToolCallOutput, - #[serde(rename = "file_search_call")] - FileSearchCall, - #[serde(rename = "function_call")] - FunctionCall, - #[serde(rename = "function_call_output")] - FunctionCallOutput, - #[serde(rename = "image_generation_call")] - ImageGenerationCall, - #[serde(rename = "item_reference")] - ItemReference, - #[serde(rename = "local_shell_call")] - LocalShellCall, - #[serde(rename = "local_shell_call_output")] - LocalShellCallOutput, - #[serde(rename = "mcp_approval_request")] - McpApprovalRequest, - #[serde(rename = "mcp_approval_response")] - McpApprovalResponse, - #[serde(rename = "mcp_call")] - McpCall, - #[serde(rename = "mcp_list_tools")] - McpListTools, - Message, - Reasoning, - #[serde(rename = "shell_call")] - ShellCall, - #[serde(rename = "shell_call_output")] - ShellCallOutput, - #[serde(rename = "tool_search_call")] - ToolSearchCall, - #[serde(rename = "tool_search_output")] - ToolSearchOutput, - #[serde(rename = "web_search_call")] - WebSearchCall, -} - -/// The specific create, delete, or update instruction for the apply_patch tool call. -/// -/// One of the create_file, delete_file, or update_file operations supplied to the -/// apply_patch tool. -/// -/// Instruction for creating a new file via the apply_patch tool. -/// -/// Instruction for deleting an existing file via the apply_patch tool. -/// -/// Instruction for updating an existing file via the apply_patch tool. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct PurpleApplyPatchOperation { - /// Unified diff content to apply when creating the file. - /// - /// Unified diff content to apply to the existing file. - #[serde(skip_serializing_if = "Option::is_none")] - pub diff: Option, - /// Path of the file to create relative to the workspace root. - /// - /// Path of the file to delete relative to the workspace root. - /// - /// Path of the file to update relative to the workspace root. - pub path: String, - /// The operation type. Always `create_file`. - /// - /// The operation type. Always `delete_file`. - /// - /// The operation type. Always `update_file`. - #[serde(rename = "type")] - pub apply_patch_operation_type: ApplyPatchOperationType, -} - -/// The operation type. Always `create_file`. -/// -/// The operation type. Always `delete_file`. -/// -/// The operation type. Always `update_file`. -/// -/// Create a new file with the provided diff. -/// -/// Delete the specified file. -/// -/// Update an existing file with the provided diff. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ApplyPatchOperationType { - #[serde(rename = "create_file")] - CreateFile, - #[serde(rename = "delete_file")] - DeleteFile, - #[serde(rename = "update_file")] - UpdateFile, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum Output { - ComputerScreenshotImage(ComputerScreenshotImage), - PurpleInputContentArray(Vec), - String(String), -} - -/// An array of content outputs (text, image, file) for the function tool call. -/// -/// A piece of message content, such as text, an image, or a file. -/// -/// A text input to the model. -/// -/// An image input to the model. Learn about [image inputs](/docs/guides/vision) -/// -/// A file input to the model. -/// -/// Captured stdout and stderr for a portion of a shell tool call output. -/// -/// A list of one or many input items to the model, containing different content -/// types. -/// -/// -/// Text, image, or file output of the custom tool call. -/// -/// -/// Text, image, or file output of the function call. -/// -/// -/// An image input to the model. Learn about [image inputs](/docs/guides/vision). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct PurpleInputContent { - /// The text input to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - /// The type of the input item. Always `input_text`. - /// - /// The type of the input item. Always `input_image`. - /// - /// The type of the input item. Always `input_file`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub input_content_type: Option, - /// The detail level of the file to be sent to the model. Use `low` for the default rendering - /// behavior, or `high` to render the file at higher quality. Defaults to `low`. - /// - /// The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or - /// `original`. Defaults to `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub detail: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub file_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub image_url: Option, - /// The content of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_data: Option, - /// The URL of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_url: Option, - /// The name of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub filename: Option, - /// The exit or timeout outcome associated with this shell call. - #[serde(skip_serializing_if = "Option::is_none")] - pub outcome: Option, - /// Captured stderr output for the shell call. - #[serde(skip_serializing_if = "Option::is_none")] - pub stderr: Option, - /// Captured stdout output for the shell call. - #[serde(skip_serializing_if = "Option::is_none")] - pub stdout: Option, -} - -/// The type of the input item. Always `input_text`. -/// -/// The type of the input item. Always `input_image`. -/// -/// The type of the input item. Always `input_file`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum InputTextType { - #[serde(rename = "input_file")] - InputFile, - #[serde(rename = "input_image")] - InputImage, - #[serde(rename = "input_audio")] - InputAudio, - #[serde(rename = "input_text")] - InputText, -} - -/// The exit or timeout outcome associated with this shell call. -/// -/// Indicates that the shell call exceeded its configured time limit. -/// -/// Indicates that the shell commands finished and returned an exit code. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct PurpleShellCallOutcome { - /// The outcome type. Always `timeout`. - /// - /// The outcome type. Always `exit`. - #[serde(rename = "type")] - pub shell_call_outcome_type: ShellCallOutcomeType, - /// The exit code returned by the shell process. - #[serde(skip_serializing_if = "Option::is_none")] - pub exit_code: Option, -} - -/// The outcome type. Always `timeout`. -/// -/// The outcome type. Always `exit`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ShellCallOutcomeType { - Exit, - Timeout, -} - -/// A computer screenshot image used with the computer use tool. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ComputerScreenshotImage { - /// The identifier of an uploaded file that contains the screenshot. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_id: Option, - /// The URL of the screenshot image. - #[serde(skip_serializing_if = "Option::is_none")] - pub image_url: Option, - /// Specifies the event type. For a computer screenshot, this property is - /// always set to `computer_screenshot`. - #[serde(rename = "type")] - pub computer_screenshot_image_type: AmbitiousType, -} - -/// Specifies the event type. For a computer screenshot, this property is -/// always set to `computer_screenshot`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum AmbitiousType { - #[serde(rename = "computer_screenshot")] - ComputerScreenshot, -} - -/// The outputs generated by the code interpreter, such as logs or images. -/// Can be null if no outputs are available. -/// -/// -/// The logs output from the code interpreter. -/// -/// The image output from the code interpreter. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CodeInterpreterOutput { - /// The logs output from the code interpreter. - #[serde(skip_serializing_if = "Option::is_none")] - pub logs: Option, - /// The type of the output. Always `logs`. - /// - /// The type of the output. Always `image`. - #[serde(rename = "type")] - pub code_interpreter_output_type: CunningType, - /// The URL of the image output from the code interpreter. - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, -} - -/// The type of the output. Always `logs`. -/// -/// The type of the output. Always `image`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum CunningType { - Image, - Logs, -} - -/// Labels an `assistant` message as intermediate commentary (`commentary`) or the final -/// answer (`final_answer`). -/// For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and -/// resend -/// phase on all assistant messages — dropping it can degrade performance. Not used for user -/// messages. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum MessagePhase { - Commentary, - #[serde(rename = "final_answer")] - FinalAnswer, -} - -/// The results of the file search tool call. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct Result { - #[serde(skip_serializing_if = "Option::is_none")] - pub attributes: Option>, - /// The unique ID of the file. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_id: Option, - /// The name of the file. - #[serde(skip_serializing_if = "Option::is_none")] - pub filename: Option, - /// The relevance score of the file - a value between 0 and 1. - #[serde(skip_serializing_if = "Option::is_none")] - pub score: Option, - /// The text that was retrieved from the file. - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum VectorStoreFileAttribute { - Bool(bool), - Double(f64), - String(String), -} - -/// The role of the message input. One of `user`, `assistant`, `system`, or -/// `developer`. -/// -/// -/// The role of the message input. One of `user`, `system`, or `developer`. -/// -/// -/// The role of the output message. Always `assistant`. -/// -/// -/// The role that provided the additional tools. Only `developer` is supported. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum InputItemRole { - Assistant, - Developer, - System, - User, -} - -/// The status of item. One of `in_progress`, `completed`, or -/// `incomplete`. Populated when items are returned via API. -/// -/// -/// The status of the message input. One of `in_progress`, `completed`, or -/// `incomplete`. Populated when input items are returned via API. -/// -/// -/// The status of the file search tool call. One of `in_progress`, -/// `searching`, `incomplete` or `failed`, -/// -/// -/// The status of the item. One of `in_progress`, `completed`, or -/// `incomplete`. Populated when items are returned via API. -/// -/// -/// The status of the message input. One of `in_progress`, `completed`, or `incomplete`. -/// Populated when input items are returned via API. -/// -/// The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated -/// when items are returned via API. -/// -/// The status of the tool search call. -/// -/// The status of the tool search output. -/// -/// The status of the web search tool call. -/// -/// -/// The status of the image generation call. -/// -/// -/// The status of the code interpreter tool call. Valid values are `in_progress`, -/// `completed`, `incomplete`, `interpreting`, and `failed`. -/// -/// -/// The status of the local shell call. -/// -/// -/// The status of the item. One of `in_progress`, `completed`, or `incomplete`. -/// -/// -/// The status of the shell call. One of `in_progress`, `completed`, or `incomplete`. -/// -/// Status values reported for shell tool calls. -/// -/// The status of the shell call output. -/// -/// The status of the apply patch tool call. One of `in_progress` or `completed`. -/// -/// Status values reported for apply_patch tool calls. -/// -/// The status of the apply patch tool call output. One of `completed` or `failed`. -/// -/// Outcome values reported for apply_patch tool call outputs. -/// -/// The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, -/// or `failed`. -/// -/// -/// The status of the tool search output item that was recorded. -/// -/// The status of the tool search call item that was recorded. -/// -/// The status of the shell call output. One of `in_progress`, `completed`, or `incomplete`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum Status { - Calling, - Completed, - Failed, - Generating, - #[serde(rename = "in_progress")] - InProgress, - Incomplete, - Interpreting, - Searching, -} - -/// A summary text from the model. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct SummaryText { - /// A summary of the reasoning output from the model so far. - pub text: String, - /// The type of the object. Always `summary_text`. - #[serde(rename = "type")] - pub summary_text_type: SummaryType, -} - -/// The type of the object. Always `summary_text`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum SummaryType { - #[serde(rename = "summary_text")] - SummaryText, -} - -/// An array of tools the model may call while generating a response. You -/// can specify which tool to use by setting the `tool_choice` parameter. -/// -/// We support the following categories of tools: -/// - **Built-in tools**: Tools that are provided by OpenAI that extend the -/// model's capabilities, like [web search](/docs/guides/tools-web-search) -/// or [file search](/docs/guides/tools-file-search). Learn more about -/// [built-in tools](/docs/guides/tools). -/// - **MCP Tools**: Integrations with third-party systems via custom MCP servers -/// or predefined connectors such as Google Drive and SharePoint. Learn more about -/// [MCP Tools](/docs/guides/tools-connectors-mcp). -/// - **Function calls (custom tools)**: Functions that are defined by you, -/// enabling the model to call your own code with strongly typed arguments -/// and outputs. Learn more about -/// [function calling](/docs/guides/function-calling). You can also use -/// custom tools to call your own code. -/// -/// -/// A tool that can be used to generate a response. -/// -/// -/// Defines a function in your own code the model can choose to call. Learn more about -/// [function calling](https://platform.openai.com/docs/guides/function-calling). -/// -/// A tool that searches for relevant content from uploaded files. Learn more about the [file -/// search tool](https://platform.openai.com/docs/guides/tools-file-search). -/// -/// A tool that controls a virtual computer. Learn more about the [computer -/// tool](https://platform.openai.com/docs/guides/tools-computer-use). -/// -/// Search the Internet for sources related to the prompt. Learn more about the -/// [web search tool](/docs/guides/tools-web-search). -/// -/// -/// Give the model access to additional tools via remote Model Context Protocol -/// (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). -/// -/// -/// A tool that runs Python code to help generate a response to a prompt. -/// -/// -/// A tool that generates images using the GPT image models. -/// -/// -/// A tool that allows the model to execute shell commands in a local environment. -/// -/// A tool that allows the model to execute shell commands. -/// -/// A custom tool that processes input using a specified format. Learn more about [custom -/// tools](/docs/guides/function-calling#custom-tools) -/// -/// Groups function/custom tools under a shared namespace. -/// -/// Hosted or BYOT tool search configuration for deferred tools. -/// -/// This tool searches the web for relevant results to use in a response. Learn more about -/// the [web search tool](https://platform.openai.com/docs/guides/tools-web-search). -/// -/// Allows the assistant to create, delete, or update files using unified diffs. -/// -/// A tool available on an MCP server. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct InputItemTool { - /// Whether this function is deferred and loaded via tool search. - /// - /// Whether this MCP tool is deferred and discovered via tool search. - /// - /// - /// Whether this tool should be deferred and discovered via tool search. - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_loading: Option, - /// Optional description of the custom tool, used to provide more context. - /// - /// A description of the namespace shown to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The name of the function to call. - /// - /// The name of the custom tool, used to identify it in tool calls. - /// - /// The namespace name used in tool calls (for example, `crm`). - /// - /// The name of the tool. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub parameters: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub strict: Option, - /// The type of the function tool. Always `function`. - /// - /// The type of the file search tool. Always `file_search`. - /// - /// The type of the computer tool. Always `computer`. - /// - /// The type of the computer use tool. Always `computer_use_preview`. - /// - /// The type of the web search tool. One of `web_search` or `web_search_2025_08_26`. - /// - /// The type of the MCP tool. Always `mcp`. - /// - /// The type of the code interpreter tool. Always `code_interpreter`. - /// - /// - /// The type of the image generation tool. Always `image_generation`. - /// - /// - /// The type of the local shell tool. Always `local_shell`. - /// - /// The type of the shell tool. Always `shell`. - /// - /// The type of the custom tool. Always `custom`. - /// - /// The type of the tool. Always `namespace`. - /// - /// The type of the tool. Always `tool_search`. - /// - /// The type of the web search tool. One of `web_search_preview` or - /// `web_search_preview_2025_03_11`. - /// - /// The type of the tool. Always `apply_patch`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_type: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub filters: Option, - /// The maximum number of results to return. This number should be between 1 and 50 inclusive. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_num_results: Option, - /// Ranking options for search. - #[serde(skip_serializing_if = "Option::is_none")] - pub ranking_options: Option, - /// The IDs of the vector stores to search. - #[serde(skip_serializing_if = "Option::is_none")] - pub vector_store_ids: Option>, - /// The height of the computer display. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_height: Option, - /// The width of the computer display. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_width: Option, - /// The type of computer environment to control. - #[serde(skip_serializing_if = "Option::is_none")] - pub environment: Option, - /// High level guidance for the amount of context window space to use for the search. One of - /// `low`, `medium`, or `high`. `medium` is the default. - #[serde(skip_serializing_if = "Option::is_none")] - pub search_context_size: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub user_location: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_tools: Option, - /// An OAuth access token that can be used with a remote MCP server, either - /// with a custom MCP server URL or a service connector. Your application - /// must handle the OAuth authorization flow and provide the token here. - #[serde(skip_serializing_if = "Option::is_none")] - pub authorization: Option, - /// Identifier for service connectors, like those available in ChatGPT. One of - /// `server_url` or `connector_id` must be provided. Learn more about service - /// connectors [here](/docs/guides/tools-remote-mcp#connectors). - /// - /// Currently supported `connector_id` values are: - /// - /// - Dropbox: `connector_dropbox` - /// - Gmail: `connector_gmail` - /// - Google Calendar: `connector_googlecalendar` - /// - Google Drive: `connector_googledrive` - /// - Microsoft Teams: `connector_microsoftteams` - /// - Outlook Calendar: `connector_outlookcalendar` - /// - Outlook Email: `connector_outlookemail` - /// - SharePoint: `connector_sharepoint` - #[serde(skip_serializing_if = "Option::is_none")] - pub connector_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub headers: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub require_approval: Option, - /// Optional description of the MCP server, used to provide more context. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_description: Option, - /// A label for this MCP server, used to identify it in tool calls. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_label: Option, - /// The URL for the MCP server. One of `server_url` or `connector_id` must be - /// provided. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_url: Option, - /// The code interpreter container. Can be a container ID or an object that - /// specifies uploaded file IDs to make available to your code, along with an - /// optional `memory_limit` setting. - #[serde(skip_serializing_if = "Option::is_none")] - pub container: Option, - /// Whether to generate a new image or edit an existing image. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub action: Option, - /// Background type for the generated image. One of `transparent`, - /// `opaque`, or `auto`. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub background: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub input_fidelity: Option, - /// Optional mask for inpainting. Contains `image_url` - /// (string, optional) and `file_id` (string, optional). - #[serde(skip_serializing_if = "Option::is_none")] - pub input_image_mask: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, - /// Moderation level for the generated image. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub moderation: Option, - /// Compression level for the output image. Default: 100. - #[serde(skip_serializing_if = "Option::is_none")] - pub output_compression: Option, - /// The output format of the generated image. One of `png`, `webp`, or - /// `jpeg`. Default: `png`. - #[serde(skip_serializing_if = "Option::is_none")] - pub output_format: Option, - /// Number of partial images to generate in streaming mode, from 0 (default value) to 3. - #[serde(skip_serializing_if = "Option::is_none")] - pub partial_images: Option, - /// The quality of the generated image. One of `low`, `medium`, `high`, - /// or `auto`. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub quality: Option, - /// The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, - /// arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. - /// Width and height must both be divisible by 16 and the requested aspect ratio must be - /// between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum - /// supported resolution is `3840x2160`. The requested size must also satisfy the model's - /// current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and - /// `1024x1536` are supported by the GPT image models; `auto` is supported for models that - /// allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. - /// For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. - #[serde(skip_serializing_if = "Option::is_none")] - pub size: Option, - /// The input format for the custom tool. Default is unconstrained text. - #[serde(skip_serializing_if = "Option::is_none")] - pub format: Option, - /// The function/custom tools available inside this namespace. - #[serde(skip_serializing_if = "Option::is_none")] - pub tools: Option>, - /// Whether tool search is executed by the server or by the client. - #[serde(skip_serializing_if = "Option::is_none")] - pub execution: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub search_content_types: Option>, - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub annotations: Option>, - /// The JSON schema describing the tool's input. - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub input_schema: Option>, -} - -/// Whether to generate a new image or edit an existing image. Default: `auto`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ImageGenActionEnum { - Auto, - Edit, - Generate, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum AllowedToolsUnion { - McpToolFilter(McpToolFilter), - StringArray(Vec), -} - -/// A filter object to specify which tools are allowed. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct McpToolFilter { - /// Indicates whether or not a tool modifies data or is read-only. If an - /// MCP server is [annotated with - /// `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), - /// it will match this filter. - #[serde(skip_serializing_if = "Option::is_none")] - pub read_only: Option, - /// List of allowed tool names. - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_names: Option>, -} - -/// Background type for the generated image. One of `transparent`, -/// `opaque`, or `auto`. Default: `auto`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum Background { - Auto, - Opaque, - Transparent, -} - -/// Identifier for service connectors, like those available in ChatGPT. One of -/// `server_url` or `connector_id` must be provided. Learn more about service -/// connectors [here](/docs/guides/tools-remote-mcp#connectors). -/// -/// Currently supported `connector_id` values are: -/// -/// - Dropbox: `connector_dropbox` -/// - Gmail: `connector_gmail` -/// - Google Calendar: `connector_googlecalendar` -/// - Google Drive: `connector_googledrive` -/// - Microsoft Teams: `connector_microsoftteams` -/// - Outlook Calendar: `connector_outlookcalendar` -/// - Outlook Email: `connector_outlookemail` -/// - SharePoint: `connector_sharepoint` -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ConnectorId { - #[serde(rename = "connector_dropbox")] - ConnectorDropbox, - #[serde(rename = "connector_gmail")] - ConnectorGmail, - #[serde(rename = "connector_googlecalendar")] - ConnectorGooglecalendar, - #[serde(rename = "connector_googledrive")] - ConnectorGoogledrive, - #[serde(rename = "connector_microsoftteams")] - ConnectorMicrosoftteams, - #[serde(rename = "connector_outlookcalendar")] - ConnectorOutlookcalendar, - #[serde(rename = "connector_outlookemail")] - ConnectorOutlookemail, - #[serde(rename = "connector_sharepoint")] - ConnectorSharepoint, -} - -/// The code interpreter container. Can be a container ID or an object that -/// specifies uploaded file IDs to make available to your code, along with an -/// optional `memory_limit` setting. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum Container { - CodeInterpreterToolAuto(CodeInterpreterToolAuto), - String(String), -} - -/// Configuration for a code interpreter container. Optionally specify the IDs of the files -/// to run the code on. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CodeInterpreterToolAuto { - /// An optional list of uploaded files to make available to your code. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_ids: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub memory_limit: Option, - /// Network access policy for the container. - #[serde(skip_serializing_if = "Option::is_none")] - pub network_policy: Option, - /// Always `auto`. - #[serde(rename = "type")] - pub code_interpreter_tool_auto_type: CodeInterpreterToolAutoType, -} - -/// Always `auto`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum CodeInterpreterToolAutoType { - Auto, -} - -/// The memory limit for the code interpreter container. -/// -/// The memory limit for the container. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub enum ContainerMemoryLimit { - #[serde(rename = "16g")] - The16G, - #[serde(rename = "1g")] - The1G, - #[serde(rename = "4g")] - The4G, - #[serde(rename = "64g")] - The64G, -} - -/// Network access policy for the container. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ContainerNetworkPolicyParam { - /// Disable outbound network access. Always `disabled`. - /// - /// Allow outbound network access only to specified domains. Always `allowlist`. - #[serde(rename = "type")] - pub container_network_policy_param_type: NetworkPolicyType, - /// A list of allowed domains when type is `allowlist`. - #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_domains: Option>, - /// Optional domain-scoped secrets for allowlisted domains. - #[serde(skip_serializing_if = "Option::is_none")] - pub domain_secrets: Option>, -} - -/// Disable outbound network access. Always `disabled`. -/// -/// Allow outbound network access only to specified domains. Always `allowlist`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum NetworkPolicyType { - Allowlist, - Disabled, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ContainerNetworkPolicyDomainSecretParam { - /// The domain associated with the secret. - pub domain: String, - /// The name of the secret to inject for the domain. - pub name: String, - /// The secret value to inject for the domain. - pub value: String, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum Environment { - ContainerAutoParamClass(ContainerAutoParamClass), - Enum(ComputerEnvironment), -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ContainerAutoParamClass { - /// An optional list of uploaded files to make available to your code. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_ids: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub memory_limit: Option, - /// Network access policy for the container. - #[serde(skip_serializing_if = "Option::is_none")] - pub network_policy: Option, - /// An optional list of skills referenced by id or inline data. - /// - /// An optional list of skills. - #[serde(skip_serializing_if = "Option::is_none")] - pub skills: Option>, - /// Automatically creates a container for this request - /// - /// Use a local computer environment. - /// - /// References a container created with the /v1/containers endpoint - #[serde(rename = "type")] - pub param_type: ContainerAutoParamType, - /// The ID of the referenced container. - #[serde(skip_serializing_if = "Option::is_none")] - pub container_id: Option, -} - -/// Automatically creates a container for this request -/// -/// Use a local computer environment. -/// -/// References a container created with the /v1/containers endpoint -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ContainerAutoParamType { - #[serde(rename = "container_auto")] - ContainerAuto, - #[serde(rename = "container_reference")] - ContainerReference, - Local, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct Param { - /// The ID of the referenced skill. - #[serde(skip_serializing_if = "Option::is_none")] - pub skill_id: Option, - /// References a skill created with the /v1/skills endpoint. - /// - /// Defines an inline skill for this request. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub param_type: Option, - /// Optional skill version. Use a positive integer or 'latest'. Omit for default. - #[serde(skip_serializing_if = "Option::is_none")] - pub version: Option, - /// The description of the skill. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The name of the skill. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Inline skill payload - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, - /// The path to the directory containing the skill. - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, -} - -/// References a skill created with the /v1/skills endpoint. -/// -/// Defines an inline skill for this request. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum SkillType { - Inline, - #[serde(rename = "skill_reference")] - SkillReference, -} - -/// Inline skill payload -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct InlineSkillSourceParam { - /// Base64-encoded skill zip bundle. - pub data: String, - /// The media type of the inline skill payload. Must be `application/zip`. - pub media_type: MediaType, - /// The type of the inline skill source. Must be `base64`. - #[serde(rename = "type")] - pub inline_skill_source_param_type: MagentaType, -} - -/// The type of the inline skill source. Must be `base64`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum MagentaType { - Base64, -} - -/// The media type of the inline skill payload. Must be `application/zip`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub enum MediaType { - #[serde(rename = "application/zip")] - ApplicationZip, -} - -/// The type of computer environment to control. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ComputerEnvironment { - Browser, - Linux, - Mac, - Ubuntu, - Windows, -} - -/// A filter used to compare a specified attribute key to a given value using a defined -/// comparison operation. -/// -/// -/// Combine multiple filters using `and` or `or`. -/// -/// Filters for the search. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CompFilter { - /// The key to compare against the value. - #[serde(skip_serializing_if = "Option::is_none")] - pub key: Option, - /// Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`. - /// - `eq`: equals - /// - `ne`: not equal - /// - `gt`: greater than - /// - `gte`: greater than or equal - /// - `lt`: less than - /// - `lte`: less than or equal - /// - `in`: in - /// - `nin`: not in - /// - /// - /// Type of operation: `and` or `or`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub comp_filter_type: Option, - /// The value to compare against the attribute key; supports string, number, or boolean types. - #[serde(skip_serializing_if = "Option::is_none")] - pub value: Option, - /// Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub filters: Option>>, - #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_domains: Option>, -} - -/// Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`. -/// - `eq`: equals -/// - `ne`: not equal -/// - `gt`: greater than -/// - `gte`: greater than or equal -/// - `lt`: less than -/// - `lte`: less than or equal -/// - `in`: in -/// - `nin`: not in -/// -/// -/// Type of operation: `and` or `or`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ComparisonFilterType { - And, - Eq, - Gt, - Gte, - In, - Lt, - Lte, - Ne, - Nin, - Or, -} - -/// The value to compare against the attribute key; supports string, number, or boolean types. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum ComparisonFilterValue { - Bool(bool), - Double(f64), - String(String), - UnionArray(Vec), -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum ValueElement { - Double(f64), - String(String), -} - -/// The input format for the custom tool. Default is unconstrained text. -/// -/// Unconstrained free-form text. -/// -/// A grammar defined by the user. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ToolFormat { - /// Unconstrained text format. Always `text`. - /// - /// Grammar format. Always `grammar`. - #[serde(rename = "type")] - pub format_type: FormatType, - /// The grammar definition. - #[serde(skip_serializing_if = "Option::is_none")] - pub definition: Option, - /// The syntax of the grammar definition. One of `lark` or `regex`. - #[serde(skip_serializing_if = "Option::is_none")] - pub syntax: Option, -} - -/// Control how much effort the model will exert to match the style and features, especially -/// facial features, of input images. This parameter is only supported for `gpt-image-1` and -/// `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and -/// `low`. Defaults to `low`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum InputFidelity { - High, - Low, -} - -/// Optional mask for inpainting. Contains `image_url` -/// (string, optional) and `file_id` (string, optional). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct InputImageMask { - /// File ID for the mask image. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_id: Option, - /// Base64-encoded mask image. - #[serde(skip_serializing_if = "Option::is_none")] - pub image_url: Option, -} - -/// Moderation level for the generated image. Default: `auto`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ModerationEnum { - Auto, - Low, -} - -/// The output format of the generated image. One of `png`, `webp`, or -/// `jpeg`. Default: `png`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum OutputFormat { - Jpeg, - Png, - Webp, -} - -/// The quality of the generated image. One of `low`, `medium`, `high`, -/// or `auto`. Default: `auto`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum Quality { - Auto, - High, - Low, - Medium, -} - -/// Ranking options for search. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct RankingOptions { - /// Weights that control how reciprocal rank fusion balances semantic embedding matches - /// versus sparse keyword matches when hybrid search is enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub hybrid_search: Option, - /// The ranker to use for the file search. - #[serde(skip_serializing_if = "Option::is_none")] - pub ranker: Option, - /// The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 - /// will attempt to return only the most relevant results, but may return fewer results. - #[serde(skip_serializing_if = "Option::is_none")] - pub score_threshold: Option, -} - -/// Weights that control how reciprocal rank fusion balances semantic embedding matches -/// versus sparse keyword matches when hybrid search is enabled. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct HybridSearchOptions { - /// The weight of the embedding in the reciprocal ranking fusion. - pub embedding_weight: f64, - /// The weight of the text in the reciprocal ranking fusion. - pub text_weight: f64, -} - -/// The ranker to use for the file search. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "kebab-case")] -#[ts(export_to = "openai/")] -pub enum RankerVersionType { - Auto, - #[serde(rename = "default-2024-11-15")] - Default20241115, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum RequireApproval { - Enum(McpToolApprovalSetting), - McpToolApprovalFilter(McpToolApprovalFilter), -} - -/// Specify which of the MCP server's tools require approval. Can be -/// `always`, `never`, or a filter object associated with tools -/// that require approval. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct McpToolApprovalFilter { - #[serde(skip_serializing_if = "Option::is_none")] - pub always: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub never: Option, -} - -/// Specify a single approval policy for all tools. One of `always` or -/// `never`. When set to `always`, all tools will require approval. When -/// set to `never`, all tools will not require approval. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum McpToolApprovalSetting { - Always, - Never, -} - -/// The type of the function tool. Always `function`. -/// -/// The type of the file search tool. Always `file_search`. -/// -/// The type of the computer tool. Always `computer`. -/// -/// The type of the computer use tool. Always `computer_use_preview`. -/// -/// The type of the web search tool. One of `web_search` or `web_search_2025_08_26`. -/// -/// The type of the MCP tool. Always `mcp`. -/// -/// The type of the code interpreter tool. Always `code_interpreter`. -/// -/// -/// The type of the image generation tool. Always `image_generation`. -/// -/// -/// The type of the local shell tool. Always `local_shell`. -/// -/// The type of the shell tool. Always `shell`. -/// -/// The type of the custom tool. Always `custom`. -/// -/// The type of the tool. Always `namespace`. -/// -/// The type of the tool. Always `tool_search`. -/// -/// The type of the web search tool. One of `web_search_preview` or -/// `web_search_preview_2025_03_11`. -/// -/// The type of the tool. Always `apply_patch`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ToolType { - #[serde(rename = "programmatic_tool_calling")] - ProgrammaticToolCalling, - #[serde(rename = "apply_patch")] - ApplyPatch, - #[serde(rename = "code_interpreter")] - CodeInterpreter, - Computer, - #[serde(rename = "computer_use_preview")] - ComputerUsePreview, - Custom, - #[serde(rename = "file_search")] - FileSearch, - Function, - #[serde(rename = "image_generation")] - ImageGeneration, - #[serde(rename = "local_shell")] - LocalShell, - Mcp, - Namespace, - Shell, - #[serde(rename = "tool_search")] - ToolSearch, - #[serde(rename = "web_search")] - WebSearch, - #[serde(rename = "web_search_2025_08_26")] - WebSearch2025_08_26, - #[serde(rename = "web_search_preview")] - WebSearchPreview, - #[serde(rename = "web_search_preview_2025_03_11")] - WebSearchPreview2025_03_11, -} - -/// A function or custom tool that belongs to a namespace. -/// -/// A custom tool that processes input using a specified format. Learn more about [custom -/// tools](/docs/guides/function-calling#custom-tools) -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct FunctionToolParam { - /// Whether this function should be deferred and discovered via tool search. - /// - /// Whether this tool should be deferred and discovered via tool search. - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_loading: Option, - /// Optional description of the custom tool, used to provide more context. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The name of the custom tool, used to identify it in tool calls. - pub name: String, - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub parameters: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub strict: Option, - /// The type of the custom tool. Always `custom`. - #[serde(rename = "type")] - pub function_tool_param_type: FluffyType, - /// The input format for the custom tool. Default is unconstrained text. - #[serde(skip_serializing_if = "Option::is_none")] - pub format: Option, -} - -/// The approximate location of the user. -/// -/// -/// The user's location. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ApproximateLocation { - #[serde(skip_serializing_if = "Option::is_none")] - pub city: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub country: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub region: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub timezone: Option, - /// The type of location approximation. Always `approximate`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub approximate_location_type: Option, -} - -/// Reference to a prompt template and its variables. -/// [Learn more](/docs/guides/text?api-mode=responses#reusable-prompts). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct Prompt { - /// The unique identifier of the prompt template to use. - pub id: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub variables: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub version: Option, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum PromptVariable { - Input(Input), - String(String), -} - -/// A text input to the model. -/// -/// An image input to the model. Learn about [image inputs](/docs/guides/vision). -/// -/// A file input to the model. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct Input { - /// The text input to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - /// The type of the input item. Always `input_text`. - /// - /// The type of the input item. Always `input_image`. - /// - /// The type of the input item. Always `input_file`. - #[serde(rename = "type")] - pub input_type: InputTextType, - /// The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or - /// `original`. Defaults to `auto`. - /// - /// The detail level of the file to be sent to the model. Use `low` for the default rendering - /// behavior, or `high` to render the file at higher quality. Defaults to `low`. - #[serde(skip_serializing_if = "Option::is_none")] - pub detail: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub file_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub image_url: Option, - /// The content of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_data: Option, - /// The URL of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_url: Option, - /// The name of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub filename: Option, -} - -/// **gpt-5 and o-series models only** -/// -/// Configuration options for -/// [reasoning models](https://platform.openai.com/docs/guides/reasoning). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct Reasoning { - #[serde(skip_serializing_if = "Option::is_none")] - pub effort: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub generate_summary: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option, -} - -/// **Deprecated:** use `summary` instead. -/// -/// A summary of the reasoning performed by the model. This can be -/// useful for debugging and understanding the model's reasoning process. -/// One of `auto`, `concise`, or `detailed`. -/// -/// -/// A summary of the reasoning performed by the model. This can be -/// useful for debugging and understanding the model's reasoning process. -/// One of `auto`, `concise`, or `detailed`. -/// -/// `concise` is supported for `computer-use-preview` models and all reasoning models after -/// `gpt-5`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum Summary { - Auto, - Concise, - Detailed, -} - -/// Options for streaming responses. Only set this when you set `stream: true`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ResponseStreamOptions { - /// When true, stream obfuscation will be enabled. Stream obfuscation adds - /// random characters to an `obfuscation` field on streaming delta events to - /// normalize payload sizes as a mitigation to certain side-channel attacks. - /// These obfuscation fields are included by default, but add a small amount - /// of overhead to the data stream. You can set `include_obfuscation` to - /// false to optimize for bandwidth if you trust the network links between - /// your application and the OpenAI API. - #[serde(skip_serializing_if = "Option::is_none")] - pub include_obfuscation: Option, -} - -/// Configuration options for a text response from the model. Can be plain -/// text or structured JSON data. Learn more: -/// - [Text inputs and outputs](/docs/guides/text) -/// - [Structured Outputs](/docs/guides/structured-outputs) -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ResponseTextParam { - #[serde(skip_serializing_if = "Option::is_none")] - pub format: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub verbosity: Option, -} - -/// An object specifying the format that the model must output. -/// -/// Configuring `{ "type": "json_schema" }` enables Structured Outputs, -/// which ensures the model will match your supplied JSON schema. Learn more in the -/// [Structured Outputs guide](/docs/guides/structured-outputs). -/// -/// The default format is `{ "type": "text" }` with no additional options. -/// -/// **Not recommended for gpt-4o and newer models:** -/// -/// Setting to `{ "type": "json_object" }` enables the older JSON mode, which -/// ensures the message the model generates is valid JSON. Using `json_schema` -/// is preferred for models that support it. -/// -/// -/// Default response format. Used to generate text responses. -/// -/// -/// JSON Schema response format. Used to generate structured JSON responses. -/// Learn more about [Structured Outputs](/docs/guides/structured-outputs). -/// -/// -/// JSON object response format. An older method of generating JSON responses. -/// Using `json_schema` is recommended for models that support it. Note that the -/// model will not generate JSON without a system or user message instructing it -/// to do so. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct TextResponseFormatConfiguration { - /// The type of response format being defined. Always `text`. - /// - /// The type of response format being defined. Always `json_schema`. - /// - /// The type of response format being defined. Always `json_object`. - #[serde(rename = "type")] - pub text_response_format_configuration_type: ResponseFormatType, - /// A description of what the response format is for, used by the model to - /// determine how to respond in the format. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The name of the response format. Must be a-z, A-Z, 0-9, or contain - /// underscores and dashes, with a maximum length of 64. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub schema: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub strict: Option, -} - -/// How the model should select which tool (or tools) to use when generating -/// a response. See the `tools` parameter to see how to specify which tools -/// the model can call. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum CreateResponseToolChoiceParam { - Enum(ToolChoiceMode), - HostedToolClass(HostedToolClass), -} - -/// Constrains the tools available to the model to a pre-defined set. -/// -/// -/// Indicates that the model should use a built-in tool to generate a response. -/// [Learn more about built-in tools](/docs/guides/tools). -/// -/// -/// Use this option to force the model to call a specific function. -/// -/// -/// Use this option to force the model to call a specific tool on a remote MCP server. -/// -/// -/// Use this option to force the model to call a specific custom tool. -/// -/// -/// Forces the model to call the apply_patch tool when executing a tool call. -/// -/// Forces the model to call the shell tool when a tool call is required. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct HostedToolClass { - /// Constrains the tools available to the model to a pre-defined set. - /// - /// `auto` allows the model to pick from among the allowed tools and generate a - /// message. - /// - /// `required` requires the model to call one or more of the allowed tools. - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, - /// A list of tool definitions that the model should be allowed to call. - /// - /// For the Responses API, the list of tool definitions might look like: - /// ```json - /// [ - /// { "type": "function", "name": "get_weather" }, - /// { "type": "mcp", "server_label": "deepwiki" }, - /// { "type": "image_generation" } - /// ] - /// ``` - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub tools: Option>>, - /// Allowed tool configuration type. Always `allowed_tools`. - /// - /// The type of hosted tool the model should to use. Learn more about - /// [built-in tools](/docs/guides/tools). - /// - /// Allowed values are: - /// - `file_search` - /// - `web_search_preview` - /// - `computer` - /// - `computer_use_preview` - /// - `computer_use` - /// - `code_interpreter` - /// - `image_generation` - /// - /// - /// For function calling, the type is always `function`. - /// - /// For MCP tools, the type is always `mcp`. - /// - /// For custom tool calling, the type is always `custom`. - /// - /// The tool to call. Always `apply_patch`. - /// - /// The tool to call. Always `shell`. - #[serde(rename = "type")] - pub allowed_tools_type: HostedToolType, - /// The name of the function to call. - /// - /// The name of the custom tool to call. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// The label of the MCP server to use. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_label: Option, -} - -/// Allowed tool configuration type. Always `allowed_tools`. -/// -/// The type of hosted tool the model should to use. Learn more about -/// [built-in tools](/docs/guides/tools). -/// -/// Allowed values are: -/// - `file_search` -/// - `web_search_preview` -/// - `computer` -/// - `computer_use_preview` -/// - `computer_use` -/// - `code_interpreter` -/// - `image_generation` -/// -/// -/// For function calling, the type is always `function`. -/// -/// For MCP tools, the type is always `mcp`. -/// -/// For custom tool calling, the type is always `custom`. -/// -/// The tool to call. Always `apply_patch`. -/// -/// The tool to call. Always `shell`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum HostedToolType { - #[serde(rename = "allowed_tools")] - AllowedTools, - #[serde(rename = "apply_patch")] - ApplyPatch, - #[serde(rename = "code_interpreter")] - CodeInterpreter, - Computer, - #[serde(rename = "computer_use")] - ComputerUse, - #[serde(rename = "computer_use_preview")] - ComputerUsePreview, - Custom, - #[serde(rename = "file_search")] - FileSearch, - Function, - #[serde(rename = "image_generation")] - ImageGeneration, - Mcp, - Shell, - #[serde(rename = "web_search_preview")] - WebSearchPreview, - #[serde(rename = "web_search_preview_2025_03_11")] - WebSearchPreview2025_03_11, -} - -/// An array of tools the model may call while generating a response. You -/// can specify which tool to use by setting the `tool_choice` parameter. -/// -/// We support the following categories of tools: -/// - **Built-in tools**: Tools that are provided by OpenAI that extend the -/// model's capabilities, like [web search](/docs/guides/tools-web-search) -/// or [file search](/docs/guides/tools-file-search). Learn more about -/// [built-in tools](/docs/guides/tools). -/// - **MCP Tools**: Integrations with third-party systems via custom MCP servers -/// or predefined connectors such as Google Drive and SharePoint. Learn more about -/// [MCP Tools](/docs/guides/tools-connectors-mcp). -/// - **Function calls (custom tools)**: Functions that are defined by you, -/// enabling the model to call your own code with strongly typed arguments -/// and outputs. Learn more about -/// [function calling](/docs/guides/function-calling). You can also use -/// custom tools to call your own code. -/// -/// -/// A tool that can be used to generate a response. -/// -/// -/// Defines a function in your own code the model can choose to call. Learn more about -/// [function calling](https://platform.openai.com/docs/guides/function-calling). -/// -/// A tool that searches for relevant content from uploaded files. Learn more about the [file -/// search tool](https://platform.openai.com/docs/guides/tools-file-search). -/// -/// A tool that controls a virtual computer. Learn more about the [computer -/// tool](https://platform.openai.com/docs/guides/tools-computer-use). -/// -/// Search the Internet for sources related to the prompt. Learn more about the -/// [web search tool](/docs/guides/tools-web-search). -/// -/// -/// Give the model access to additional tools via remote Model Context Protocol -/// (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). -/// -/// -/// A tool that runs Python code to help generate a response to a prompt. -/// -/// -/// A tool that generates images using the GPT image models. -/// -/// -/// A tool that allows the model to execute shell commands in a local environment. -/// -/// A tool that allows the model to execute shell commands. -/// -/// A custom tool that processes input using a specified format. Learn more about [custom -/// tools](/docs/guides/function-calling#custom-tools) -/// -/// Groups function/custom tools under a shared namespace. -/// -/// Hosted or BYOT tool search configuration for deferred tools. -/// -/// This tool searches the web for relevant results to use in a response. Learn more about -/// the [web search tool](https://platform.openai.com/docs/guides/tools-web-search). -/// -/// Allows the assistant to create, delete, or update files using unified diffs. -/// Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct FunctionTool { - /// Whether this function is deferred and loaded via tool search. - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_loading: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The name of the function to call. - pub name: String, - #[ts(type = "unknown")] - pub parameters: serde_json::Map, - pub strict: bool, -} - -/// A custom tool that processes input using a specified format. Learn more about [custom tools](/docs/guides/function-calling#custom-tools) -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CustomToolParam { - /// Whether this tool should be deferred and discovered via tool search. - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_loading: Option, - /// Optional description of the custom tool, used to provide more context. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The input format for the custom tool. Default is unconstrained text. - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub format: Option, - /// The name of the custom tool, used to identify it in tool calls. - pub name: String, -} - -/// A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct FileSearchTool { - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub filters: Option, - /// The maximum number of results to return. This number should be between 1 and 50 inclusive. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_num_results: Option, - /// Ranking options for search. - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub ranking_options: Option, - /// The IDs of the vector stores to search. - pub vector_store_ids: Vec, -} - -/// A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ComputerTool {} - -/// A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ComputerUsePreviewTool { - /// The height of the computer display. - pub display_height: i64, - /// The width of the computer display. - pub display_width: i64, - /// The type of computer environment to control. - #[ts(type = "unknown")] - pub environment: serde_json::Value, -} - -/// Search the Internet for sources related to the prompt. Learn more about the -/// [web search tool](/docs/guides/tools-web-search). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct WebSearchTool { - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub filters: Option, - /// High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default. - #[serde(skip_serializing_if = "Option::is_none")] - pub search_context_size: Option, - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub user_location: Option, -} - -/// Give the model access to additional tools via remote Model Context Protocol -/// (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct MCPTool { - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub allowed_tools: Option, - /// An OAuth access token that can be used with a remote MCP server, either - /// with a custom MCP server URL or a service connector. Your application - /// must handle the OAuth authorization flow and provide the token here. - #[serde(skip_serializing_if = "Option::is_none")] - pub authorization: Option, - /// Identifier for service connectors, like those available in ChatGPT. One of - /// `server_url` or `connector_id` must be provided. Learn more about service - /// connectors [here](/docs/guides/tools-remote-mcp#connectors). - /// - /// Currently supported `connector_id` values are: - /// - /// - Dropbox: `connector_dropbox` - /// - Gmail: `connector_gmail` - /// - Google Calendar: `connector_googlecalendar` - /// - Google Drive: `connector_googledrive` - /// - Microsoft Teams: `connector_microsoftteams` - /// - Outlook Calendar: `connector_outlookcalendar` - /// - Outlook Email: `connector_outlookemail` - /// - SharePoint: `connector_sharepoint` - #[serde(skip_serializing_if = "Option::is_none")] - pub connector_id: Option, - /// Whether this MCP tool is deferred and discovered via tool search. - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_loading: Option, - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub headers: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub require_approval: Option, - /// Optional description of the MCP server, used to provide more context. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_description: Option, - /// A label for this MCP server, used to identify it in tool calls. - pub server_label: String, - /// The URL for the MCP server. One of `server_url` or `connector_id` must be - /// provided. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_url: Option, -} - -/// A tool that runs Python code to help generate a response to a prompt. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct CodeInterpreterTool { - /// The code interpreter container. Can be a container ID or an object that - /// specifies uploaded file IDs to make available to your code, along with an - /// optional `memory_limit` setting. - #[ts(type = "unknown")] - pub container: serde_json::Value, -} - -/// A tool that generates images using the GPT image models. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ImageGenTool { - /// Whether to generate a new image or edit an existing image. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub action: Option, - /// Background type for the generated image. One of `transparent`, - /// `opaque`, or `auto`. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub background: Option, - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub input_fidelity: Option, - /// Optional mask for inpainting. Contains `image_url` - /// (string, optional) and `file_id` (string, optional). - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub input_image_mask: Option, - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub model: Option, - /// Moderation level for the generated image. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub moderation: Option, - /// Compression level for the output image. Default: 100. - #[serde(skip_serializing_if = "Option::is_none")] - pub output_compression: Option, - /// The output format of the generated image. One of `png`, `webp`, or - /// `jpeg`. Default: `png`. - #[serde(skip_serializing_if = "Option::is_none")] - pub output_format: Option, - /// Number of partial images to generate in streaming mode, from 0 (default value) to 3. - #[serde(skip_serializing_if = "Option::is_none")] - pub partial_images: Option, - /// The quality of the generated image. One of `low`, `medium`, `high`, - /// or `auto`. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub quality: Option, - /// The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub size: Option, -} - -/// A tool that allows the model to execute shell commands in a local environment. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct LocalShellToolParam {} - -/// A tool that allows the model to execute shell commands. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct FunctionShellToolParam { - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub environment: Option, -} - -/// Groups function/custom tools under a shared namespace. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct NamespaceToolParam { - /// A description of the namespace shown to the model. - pub description: String, - /// The namespace name used in tool calls (for example, `crm`). - pub name: String, - /// The function/custom tools available inside this namespace. - #[ts(type = "unknown")] - pub tools: Vec, -} - -/// Hosted or BYOT tool search configuration for deferred tools. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ToolSearchToolParam { - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Whether tool search is executed by the server or by the client. - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub execution: Option, - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub parameters: Option, -} - -/// This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search). -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct WebSearchPreviewTool { - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub search_content_types: Option>, - /// High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default. - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub search_context_size: Option, - #[serde(skip_serializing_if = "Option::is_none")] - #[ts(type = "unknown")] - pub user_location: Option, -} - -/// Allows the assistant to create, delete, or update files using unified diffs. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ApplyPatchToolParam {} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ProgrammaticToolCallingToolParam {} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(tag = "type")] -#[ts(export_to = "openai/")] -pub enum Tool { - #[serde(rename = "programmatic_tool_calling")] - ProgrammaticToolCalling(ProgrammaticToolCallingToolParam), - - #[serde(rename = "file_search")] - FileSearch(FileSearchTool), - - #[serde(rename = "computer")] - Computer(ComputerTool), - - #[serde(rename = "computer_use_preview")] - ComputerUsePreview(ComputerUsePreviewTool), - - #[serde(rename = "web_search")] - WebSearch(WebSearchTool), - - #[serde(rename = "mcp")] - MCP(MCPTool), - - #[serde(rename = "code_interpreter")] - CodeInterpreter(CodeInterpreterTool), - - #[serde(rename = "image_generation")] - ImageGen(ImageGenTool), - - #[serde(rename = "local_shell")] - LocalShellParam(LocalShellToolParam), - - #[serde(rename = "shell")] - FunctionShellParam(FunctionShellToolParam), - - #[serde(rename = "namespace")] - NamespaceParam(NamespaceToolParam), - - #[serde(rename = "tool_search")] - SearchParam(ToolSearchToolParam), - - #[serde(rename = "web_search_preview")] - WebSearchPreview(WebSearchPreviewTool), - - #[serde(rename = "apply_patch")] - ApplyPatchParam(ApplyPatchToolParam), - - #[serde(untagged)] - Function(FunctionTool), - - #[serde(untagged)] - CustomParam(CustomToolParam), -} - -/// The truncation strategy to use for the model response. -/// - `auto`: If the input to this Response exceeds -/// the model's context window size, the model will truncate the -/// response to fit the context window by dropping items from the beginning of the -/// conversation. -/// - `disabled` (default): If the input size will exceed the context window -/// size for a model, the request will fail with a 400 error. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum Truncation { - Auto, - Disabled, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct TheResponseObject { - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option>, - /// Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. - /// Replaces the `user` field. [Learn more](/docs/guides/prompt-caching). - #[serde(skip_serializing_if = "Option::is_none")] - pub prompt_cache_key: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub prompt_cache_retention: Option, - /// A stable identifier used to help detect users of your application that may be violating - /// OpenAI's usage policies. - /// The IDs should be a string that uniquely identifies each user, with a maximum length of - /// 64 characters. We recommend hashing their username or email address, in order to avoid - /// sending us any identifying information. [Learn - /// more](/docs/guides/safety-best-practices#safety-identifiers). - #[serde(skip_serializing_if = "Option::is_none")] - pub safety_identifier: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub service_tier: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub temperature: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub top_logprobs: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub top_p: Option, - /// This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use - /// `prompt_cache_key` instead to maintain caching optimizations. - /// A stable identifier for your end-users. - /// Used to boost cache hit rates by better bucketing similar requests and to help OpenAI - /// detect and prevent abuse. [Learn - /// more](/docs/guides/safety-best-practices#safety-identifiers). - #[serde(skip_serializing_if = "Option::is_none")] - pub user: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub background: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub max_tool_calls: Option, - /// Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI - /// offers a wide range of models with different capabilities, performance - /// characteristics, and price points. Refer to the [model guide](/docs/models) - /// to browse and compare available models. - pub model: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub previous_response_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub prompt: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - pub tool_choice: TheResponseObjectToolChoiceParam, - pub tools: Vec, - #[serde(skip_serializing_if = "Option::is_none")] - pub truncation: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub completed_at: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub conversation: Option, - /// Unix timestamp (in seconds) of when this Response was created. - pub created_at: f64, - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Unique identifier for this Response. - pub id: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub incomplete_details: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub instructions: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub max_output_tokens: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub moderation: Option, - /// The object type of this resource - always set to `response`. - pub object: TheResponseObjectObject, - /// An array of content items generated by the model. - /// - /// - The length and order of items in the `output` array is dependent - /// on the model's response. - /// - Rather than accessing the first item in the `output` array and - /// assuming it's an `assistant` message with the content generated by - /// the model, you might consider using the `output_text` property where - /// supported in SDKs. - pub output: Vec, - #[serde(skip_serializing_if = "Option::is_none")] - pub output_text: Option, - /// Whether to allow the model to run tool calls in parallel. - pub parallel_tool_calls: bool, - /// The status of the response generation. One of `completed`, `failed`, - /// `in_progress`, `cancelled`, `queued`, or `incomplete`. - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub usage: Option, -} - -/// The conversation that this response belonged to. Input items and output items from this -/// response were automatically added to this conversation. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct Conversation { - /// The unique ID of the conversation that this response was associated with. - pub id: String, -} - -/// An error object returned when the model fails to generate a Response. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ResponseError { - pub code: ResponseErrorCode, - /// A human-readable description of the error. - pub message: String, -} - -/// The error code for the response. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ResponseErrorCode { - #[serde(rename = "empty_image_file")] - EmptyImageFile, - #[serde(rename = "failed_to_download_image")] - FailedToDownloadImage, - #[serde(rename = "image_content_policy_violation")] - ImageContentPolicyViolation, - #[serde(rename = "image_file_not_found")] - ImageFileNotFound, - #[serde(rename = "image_file_too_large")] - ImageFileTooLarge, - #[serde(rename = "image_parse_error")] - ImageParseError, - #[serde(rename = "image_too_large")] - ImageTooLarge, - #[serde(rename = "image_too_small")] - ImageTooSmall, - #[serde(rename = "invalid_base64_image")] - InvalidBase64Image, - #[serde(rename = "invalid_image")] - InvalidImage, - #[serde(rename = "invalid_image_format")] - InvalidImageFormat, - #[serde(rename = "invalid_image_mode")] - InvalidImageMode, - #[serde(rename = "invalid_image_url")] - InvalidImageUrl, - #[serde(rename = "invalid_prompt")] - InvalidPrompt, - #[serde(rename = "rate_limit_exceeded")] - RateLimitExceeded, - #[serde(rename = "server_error")] - ServerError, - #[serde(rename = "unsupported_image_media_type")] - UnsupportedImageMediaType, - #[serde(rename = "vector_store_timeout")] - VectorStoreTimeout, -} - -/// Details about why the response is incomplete. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct IncompleteDetails { - /// The reason why the response is incomplete. - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, -} - -/// The reason why the response is incomplete. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum Reason { - #[serde(rename = "content_filter")] - ContentFilter, - #[serde(rename = "max_output_tokens")] - MaxOutputTokens, -} - -/// Moderation results for the response input and output, if moderated completions were -/// requested. -/// -/// -/// Moderation results or errors for the response input and output. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct Moderation { - /// Moderation for the response input. - pub input: OutputClass, - /// Moderation for the response output. - pub output: OutputClass, -} - -/// Moderation for the response input. -/// -/// Moderation for the response output. -/// -/// A moderation result produced for the response input or output. -/// -/// An error produced while attempting moderation for the response input or output. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct OutputClass { - /// A dictionary of moderation categories to booleans, True if the input is flagged under - /// this category. - #[serde(skip_serializing_if = "Option::is_none")] - pub categories: Option>, - /// Which modalities of input are reflected by the score for each category. - #[serde(skip_serializing_if = "Option::is_none")] - pub category_applied_input_types: Option>>, - /// A dictionary of moderation categories to scores. - #[serde(skip_serializing_if = "Option::is_none")] - pub category_scores: Option>, - /// A boolean indicating whether the content was flagged by any category. - #[serde(skip_serializing_if = "Option::is_none")] - pub flagged: Option, - /// The moderation model that produced this result. - #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, - /// The object type, which was always `moderation_result` for successful moderation results. - /// - /// The object type, which was always `error` for moderation failures. - #[serde(rename = "type")] - pub moderation_type: FriskyType, - /// The error code. - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option, - /// The error message. - #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, -} - -/// The object type, which was always `moderation_result` for successful moderation results. -/// -/// The object type, which was always `error` for moderation failures. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum FriskyType { - Error, - #[serde(rename = "moderation_result")] - ModerationResult, -} - -/// The object type of this resource - always set to `response`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum TheResponseObjectObject { - Response, -} - -/// An output message from the model. -/// -/// -/// The results of a file search tool call. See the -/// [file search guide](/docs/guides/tools-file-search) for more information. -/// -/// -/// A tool call to run a function. See the -/// [function calling guide](/docs/guides/function-calling) for more information. -/// -/// -/// The output of a function tool call. -/// -/// -/// The results of a web search tool call. See the -/// [web search guide](/docs/guides/tools-web-search) for more information. -/// -/// -/// A tool call to a computer use tool. See the -/// [computer use guide](/docs/guides/tools-computer-use) for more information. -/// -/// -/// The output of a computer tool call. -/// -/// -/// A description of the chain of thought used by a reasoning model while generating -/// a response. Be sure to include these items in your `input` to the Responses API -/// for subsequent turns of a conversation if you are manually -/// [managing context](/docs/guides/conversation-state). -/// -/// -/// A compaction item generated by the [`v1/responses/compact` -/// API](/docs/api-reference/responses/compact). -/// -/// An image generation request made by the model. -/// -/// -/// A tool call to run code. -/// -/// -/// A tool call to run a command on the local shell. -/// -/// -/// The output of a local shell tool call. -/// -/// -/// A tool call that executes one or more shell commands in a managed environment. -/// -/// The output of a shell tool call that was emitted. -/// -/// A tool call that applies file diffs by creating, deleting, or updating files. -/// -/// The output emitted by an apply patch tool call. -/// -/// An invocation of a tool on an MCP server. -/// -/// -/// A list of tools available on an MCP server. -/// -/// -/// A request for human approval of a tool invocation. -/// -/// -/// A response to an MCP approval request. -/// -/// -/// A call to a custom tool created by the model. -/// -/// -/// The output of a custom tool call from your code, being sent back to the model. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct OutputItem { - /// The content of the output message. - /// - /// - /// Reasoning text content. - #[serde(skip_serializing_if = "Option::is_none")] - pub content: Option>, - /// The unique ID of the output message. - /// - /// - /// The unique ID of the file search tool call. - /// - /// - /// The unique ID of the function tool call. - /// - /// - /// The unique ID of the function tool call output. Populated when this item - /// is returned via API. - /// - /// - /// The unique ID of the function call tool output. - /// - /// - /// The unique ID of the web search tool call. - /// - /// - /// The unique ID of the computer call. - /// - /// The ID of the computer tool call output. - /// - /// - /// The unique ID of the computer call tool output. - /// - /// - /// The unique identifier of the reasoning content. - /// - /// - /// The unique ID of the tool search call item. - /// - /// The unique ID of the tool search output item. - /// - /// The unique ID of the additional tools item. - /// - /// The unique ID of the compaction item. - /// - /// The unique ID of the image generation call. - /// - /// - /// The unique ID of the code interpreter tool call. - /// - /// - /// The unique ID of the local shell call. - /// - /// - /// The unique ID of the local shell tool call generated by the model. - /// - /// - /// The unique ID of the shell tool call. Populated when this item is returned via API. - /// - /// The unique ID of the shell call output. Populated when this item is returned via API. - /// - /// The unique ID of the apply patch tool call. Populated when this item is returned via - /// API. - /// - /// The unique ID of the apply patch tool call output. Populated when this item is returned - /// via API. - /// - /// The unique ID of the tool call. - /// - /// - /// The unique ID of the list. - /// - /// - /// The unique ID of the approval request. - /// - /// - /// The unique ID of the approval response - /// - /// - /// The unique ID of the custom tool call in the OpenAI platform. - /// - /// - /// The unique ID of the custom tool call output in the OpenAI platform. - /// - /// - /// The unique ID of the custom tool call output item. - #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub phase: Option, - /// The role of the output message. Always `assistant`. - /// - /// - /// The role that provided the additional tools. - #[serde(skip_serializing_if = "Option::is_none")] - pub role: Option, - /// The status of the message input. One of `in_progress`, `completed`, or - /// `incomplete`. Populated when input items are returned via API. - /// - /// - /// The status of the file search tool call. One of `in_progress`, - /// `searching`, `incomplete` or `failed`, - /// - /// - /// The status of the item. One of `in_progress`, `completed`, or - /// `incomplete`. Populated when items are returned via API. - /// - /// - /// The status of the web search tool call. - /// - /// - /// The status of the tool search call item that was recorded. - /// - /// The status of the tool search output item that was recorded. - /// - /// The status of the image generation call. - /// - /// - /// The status of the code interpreter tool call. Valid values are `in_progress`, - /// `completed`, `incomplete`, `interpreting`, and `failed`. - /// - /// - /// The status of the local shell call. - /// - /// - /// The status of the shell call. One of `in_progress`, `completed`, or `incomplete`. - /// - /// The status of the shell call output. One of `in_progress`, `completed`, or `incomplete`. - /// - /// The status of the apply patch tool call. One of `in_progress` or `completed`. - /// - /// The status of the apply patch tool call output. One of `completed` or `failed`. - /// - /// The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, - /// or `failed`. - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// The type of the output message. Always `message`. - /// - /// - /// The type of the file search tool call. Always `file_search_call`. - /// - /// - /// The type of the function tool call. Always `function_call`. - /// - /// - /// The type of the function tool call output. Always `function_call_output`. - /// - /// - /// The type of the web search tool call. Always `web_search_call`. - /// - /// - /// The type of the computer call. Always `computer_call`. - /// - /// The type of the computer tool call output. Always `computer_call_output`. - /// - /// - /// The type of the object. Always `reasoning`. - /// - /// - /// The type of the item. Always `tool_search_call`. - /// - /// The type of the item. Always `tool_search_output`. - /// - /// The type of the item. Always `additional_tools`. - /// - /// The type of the item. Always `compaction`. - /// - /// The type of the image generation call. Always `image_generation_call`. - /// - /// - /// The type of the code interpreter tool call. Always `code_interpreter_call`. - /// - /// - /// The type of the local shell call. Always `local_shell_call`. - /// - /// - /// The type of the local shell tool call output. Always `local_shell_call_output`. - /// - /// - /// The type of the item. Always `shell_call`. - /// - /// The type of the shell call output. Always `shell_call_output`. - /// - /// The type of the item. Always `apply_patch_call`. - /// - /// The type of the item. Always `apply_patch_call_output`. - /// - /// The type of the item. Always `mcp_call`. - /// - /// - /// The type of the item. Always `mcp_list_tools`. - /// - /// - /// The type of the item. Always `mcp_approval_request`. - /// - /// - /// The type of the item. Always `mcp_approval_response`. - /// - /// - /// The type of the custom tool call. Always `custom_tool_call`. - /// - /// - /// The type of the custom tool call output. Always `custom_tool_call_output`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub output_item_type: Option, - /// The queries used to search for files. - #[serde(skip_serializing_if = "Option::is_none")] - pub queries: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub results: Option>, - /// A JSON string of the arguments to pass to the function. - /// - /// - /// Arguments used for the tool search call. - /// - /// A JSON string of the arguments passed to the tool. - /// - /// - /// A JSON string of arguments for the tool. - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub arguments: Option, - /// The unique ID of the function tool call generated by the model. - /// - /// - /// An identifier used when responding to the tool call with output. - /// - /// - /// The ID of the computer tool call that produced the output. - /// - /// - /// The unique ID of the local shell tool call generated by the model. - /// - /// - /// The unique ID of the shell tool call generated by the model. - /// - /// The unique ID of the apply patch tool call generated by the model. - /// - /// An identifier used to map this custom tool call to a tool call output. - /// - /// - /// The call ID, used to map this custom tool call output to a custom tool call. - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub call_id: Option, - /// The name of the function to run. - /// - /// - /// The name of the tool that was run. - /// - /// - /// The name of the tool to run. - /// - /// - /// The name of the custom tool being called. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// The namespace of the function to run. - /// - /// - /// The namespace of the custom tool being called. - #[serde(skip_serializing_if = "Option::is_none")] - pub namespace: Option, - /// The output from the function call generated by your code. - /// Can be a string or an list of output content. - /// - /// - /// A JSON string of the output of the local shell tool call. - /// - /// - /// An array of shell call output contents - /// - /// The output from the custom tool call generated by your code. - /// Can be a string or an list of output content. - #[serde(skip_serializing_if = "Option::is_none")] - pub output: Option, - /// The identifier of the actor that created the item. - /// - /// - /// The identifier of the actor that created the item. - /// - /// The ID of the entity that created this tool call. - /// - /// The ID of the entity that created this tool call output. - #[serde(skip_serializing_if = "Option::is_none")] - pub created_by: Option, - /// An object describing the specific action taken in this web search call. - /// Includes details on how the model used the web (search, open_page, find_in_page). - /// - /// - /// The shell commands and limits that describe how to run the tool call. - #[serde(skip_serializing_if = "Option::is_none")] - pub action: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub actions: Option>, - /// The pending safety checks for the computer call. - #[serde(skip_serializing_if = "Option::is_none")] - pub pending_safety_checks: Option>, - /// The safety checks reported by the API that have been acknowledged by the - /// developer. - #[serde(skip_serializing_if = "Option::is_none")] - pub acknowledged_safety_checks: Option>, - /// The encrypted content that was produced by compaction. - #[serde(skip_serializing_if = "Option::is_none")] - pub encrypted_content: Option, - /// Reasoning summary content. - #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option>, - /// Whether tool search was executed by the server or by the client. - #[serde(skip_serializing_if = "Option::is_none")] - pub execution: Option, - /// The loaded tool definitions returned by tool search. - /// - /// The additional tool definitions made available at this item. - /// - /// The tools available on the server. - #[serde(skip_serializing_if = "Option::is_none")] - pub tools: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub fingerprint: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub caller: Option, - /// The ID of the container used to run the code. - #[serde(skip_serializing_if = "Option::is_none")] - pub container_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub outputs: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub environment: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub max_output_length: Option, - /// One of the create_file, delete_file, or update_file operations applied via apply_patch. - #[serde(skip_serializing_if = "Option::is_none")] - pub operation: Option, - /// The ID of the approval request being answered. - #[serde(skip_serializing_if = "Option::is_none")] - pub approval_request_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// The label of the MCP server running the tool. - /// - /// - /// The label of the MCP server. - /// - /// - /// The label of the MCP server making the request. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_label: Option, - /// Whether the request was approved. - #[serde(skip_serializing_if = "Option::is_none")] - pub approve: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub request_id: Option, - /// The input for the custom tool call generated by the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub input: Option, -} - -/// An object describing the specific action taken in this web search call. -/// Includes details on how the model used the web (search, open_page, find_in_page). -/// -/// -/// Action type "search" - Performs a web search query. -/// -/// -/// Action type "open_page" - Opens a specific URL from search results. -/// -/// -/// Action type "find_in_page": Searches for a pattern within a loaded page. -/// -/// -/// Flattened batched actions for `computer_use`. Each action includes an -/// `type` discriminator and action-specific fields. -/// -/// -/// A click action. -/// -/// A double click action. -/// -/// A drag action. -/// -/// A collection of keypresses the model would like to perform. -/// -/// A mouse move action. -/// -/// A screenshot action. -/// -/// A scroll action. -/// -/// An action to type in text. -/// -/// A wait action. -/// -/// Execute a shell command on the server. -/// -/// The shell commands and limits that describe how to run the tool call. -/// -/// Execute a shell command. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct OutputItemAction { - /// The search queries. - #[serde(skip_serializing_if = "Option::is_none")] - pub queries: Option>, - /// The search query. - #[serde(skip_serializing_if = "Option::is_none")] - pub query: Option, - /// The sources used in the search. - #[serde(skip_serializing_if = "Option::is_none")] - pub sources: Option>, - /// The action type. - /// - /// - /// Specifies the event type. For a click action, this property is always `click`. - /// - /// Specifies the event type. For a double click action, this property is always set to - /// `double_click`. - /// - /// Specifies the event type. For a drag action, this property is always set to `drag`. - /// - /// Specifies the event type. For a keypress action, this property is always set to - /// `keypress`. - /// - /// Specifies the event type. For a move action, this property is always set to `move`. - /// - /// Specifies the event type. For a screenshot action, this property is always set to - /// `screenshot`. - /// - /// Specifies the event type. For a scroll action, this property is always set to `scroll`. - /// - /// Specifies the event type. For a type action, this property is always set to `type`. - /// - /// Specifies the event type. For a wait action, this property is always set to `wait`. - /// - /// The type of the local shell action. Always `exec`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub computer_action_type: Option, - /// The URL opened by the model. - /// - /// - /// The URL of the page searched for the pattern. - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, - /// The pattern or text to search for within the page. - #[serde(skip_serializing_if = "Option::is_none")] - pub pattern: Option, - /// Indicates which mouse button was pressed during the click. One of `left`, `right`, - /// `wheel`, `back`, or `forward`. - #[serde(skip_serializing_if = "Option::is_none")] - pub button: Option, - /// The combination of keys the model is requesting to be pressed. This is an array of - /// strings, each representing a key. - #[serde(skip_serializing_if = "Option::is_none")] - pub keys: Option>, - /// The x-coordinate where the click occurred. - /// - /// The x-coordinate where the double click occurred. - /// - /// The x-coordinate to move to. - /// - /// The x-coordinate where the scroll occurred. - #[serde(skip_serializing_if = "Option::is_none")] - pub x: Option, - /// The y-coordinate where the click occurred. - /// - /// The y-coordinate where the double click occurred. - /// - /// The y-coordinate to move to. - /// - /// The y-coordinate where the scroll occurred. - #[serde(skip_serializing_if = "Option::is_none")] - pub y: Option, - /// An array of coordinates representing the path of the drag action. Coordinates will appear - /// as an array of objects, eg - /// ```json - /// [ - /// { "x": 100, "y": 200 }, - /// { "x": 200, "y": 300 } - /// ] - /// ``` - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option>, - /// The horizontal scroll distance. - #[serde(skip_serializing_if = "Option::is_none")] - pub scroll_x: Option, - /// The vertical scroll distance. - #[serde(skip_serializing_if = "Option::is_none")] - pub scroll_y: Option, - /// The text to type. - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - /// The command to run. - #[serde(skip_serializing_if = "Option::is_none")] - pub command: Option>, - /// Environment variables to set for the command. - #[serde(skip_serializing_if = "Option::is_none")] - pub env: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub timeout_ms: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub user: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub working_directory: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub commands: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub max_output_length: Option, -} - -/// A text output from the model. -/// -/// A refusal from the model. -/// -/// Reasoning text from the model. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct OutputMessageContent { - /// The annotations of the text output. - #[serde(skip_serializing_if = "Option::is_none")] - pub annotations: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub logprobs: Option>, - /// The text output from the model. - /// - /// The reasoning text from the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - /// The type of the output text. Always `output_text`. - /// - /// The type of the refusal. Always `refusal`. - /// - /// The type of the reasoning text. Always `reasoning_text`. - #[serde(rename = "type")] - pub output_message_content_type: ContentType, - /// The refusal explanation from the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub refusal: Option, -} - -/// The type of the output text. Always `output_text`. -/// -/// The type of the refusal. Always `refusal`. -/// -/// The type of the reasoning text. Always `reasoning_text`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum ContentType { - #[serde(rename = "output_text")] - OutputText, - #[serde(rename = "reasoning_text")] - ReasoningText, - Refusal, -} - -/// Represents the use of a local environment to perform shell actions. -/// -/// Represents a container created with /v1/containers. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct LocalEnvironment { - /// The environment type. Always `local`. - /// - /// The environment type. Always `container_reference`. - #[serde(rename = "type")] - pub local_environment_type: LocalEnvironmentType, - #[serde(skip_serializing_if = "Option::is_none")] - pub container_id: Option, -} - -/// One of the create_file, delete_file, or update_file operations applied via apply_patch. -/// -/// Instruction describing how to create a file via the apply_patch tool. -/// -/// Instruction describing how to delete a file via the apply_patch tool. -/// -/// Instruction describing how to update a file via the apply_patch tool. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct FluffyApplyPatchOperation { - /// Diff to apply. - #[serde(skip_serializing_if = "Option::is_none")] - pub diff: Option, - /// Path of the file to create. - /// - /// Path of the file to delete. - /// - /// Path of the file to update. - pub path: String, - /// Create a new file with the provided diff. - /// - /// Delete the specified file. - /// - /// Update an existing file with the provided diff. - #[serde(rename = "type")] - pub apply_patch_operation_type: ApplyPatchOperationType, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum OutputUnion { - ComputerScreenshotImage(ComputerScreenshotImage), - FluffyInputContentArray(Vec), - String(String), -} - -/// A list of one or many input items to the model, containing different content -/// types. -/// -/// -/// Text, image, or file output of the custom tool call. -/// -/// -/// Text, image, or file output of the function call. -/// -/// -/// A text input to the model. -/// -/// An image input to the model. Learn about [image inputs](/docs/guides/vision). -/// -/// A file input to the model. -/// -/// The content of a shell tool call output that was emitted. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct FluffyInputContent { - /// The text input to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - /// The type of the input item. Always `input_text`. - /// - /// The type of the input item. Always `input_image`. - /// - /// The type of the input item. Always `input_file`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub input_content_type: Option, - /// The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or - /// `original`. Defaults to `auto`. - /// - /// The detail level of the file to be sent to the model. Use `low` for the default rendering - /// behavior, or `high` to render the file at higher quality. Defaults to `low`. - #[serde(skip_serializing_if = "Option::is_none")] - pub detail: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub file_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub image_url: Option, - /// The content of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_data: Option, - /// The URL of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub file_url: Option, - /// The name of the file to be sent to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub filename: Option, - /// The identifier of the actor that created the item. - #[serde(skip_serializing_if = "Option::is_none")] - pub created_by: Option, - /// Represents either an exit outcome (with an exit code) or a timeout outcome for a shell - /// call output chunk. - #[serde(skip_serializing_if = "Option::is_none")] - pub outcome: Option, - /// The standard error output that was captured. - #[serde(skip_serializing_if = "Option::is_none")] - pub stderr: Option, - /// The standard output that was captured. - #[serde(skip_serializing_if = "Option::is_none")] - pub stdout: Option, -} - -/// Represents either an exit outcome (with an exit code) or a timeout outcome for a shell -/// call output chunk. -/// -/// Indicates that the shell call exceeded its configured time limit. -/// -/// Indicates that the shell commands finished and returned an exit code. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct FluffyShellCallOutcome { - /// The outcome type. Always `timeout`. - /// - /// The outcome type. Always `exit`. - #[serde(rename = "type")] - pub shell_call_outcome_type: ShellCallOutcomeType, - /// Exit code from the shell process. - #[serde(skip_serializing_if = "Option::is_none")] - pub exit_code: Option, -} - -/// The type of the output message. Always `message`. -/// -/// -/// The type of the file search tool call. Always `file_search_call`. -/// -/// -/// The type of the function tool call. Always `function_call`. -/// -/// -/// The type of the function tool call output. Always `function_call_output`. -/// -/// -/// The type of the web search tool call. Always `web_search_call`. -/// -/// -/// The type of the computer call. Always `computer_call`. -/// -/// The type of the computer tool call output. Always `computer_call_output`. -/// -/// -/// The type of the object. Always `reasoning`. -/// -/// -/// The type of the item. Always `tool_search_call`. -/// -/// The type of the item. Always `tool_search_output`. -/// -/// The type of the item. Always `additional_tools`. -/// -/// The type of the item. Always `compaction`. -/// -/// The type of the image generation call. Always `image_generation_call`. -/// -/// -/// The type of the code interpreter tool call. Always `code_interpreter_call`. -/// -/// -/// The type of the local shell call. Always `local_shell_call`. -/// -/// -/// The type of the local shell tool call output. Always `local_shell_call_output`. -/// -/// -/// The type of the item. Always `shell_call`. -/// -/// The type of the shell call output. Always `shell_call_output`. -/// -/// The type of the item. Always `apply_patch_call`. -/// -/// The type of the item. Always `apply_patch_call_output`. -/// -/// The type of the item. Always `mcp_call`. -/// -/// -/// The type of the item. Always `mcp_list_tools`. -/// -/// -/// The type of the item. Always `mcp_approval_request`. -/// -/// -/// The type of the item. Always `mcp_approval_response`. -/// -/// -/// The type of the custom tool call. Always `custom_tool_call`. -/// -/// -/// The type of the custom tool call output. Always `custom_tool_call_output`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum OutputItemType { - #[serde(rename = "program")] - Program, - #[serde(rename = "program_output")] - ProgramOutput, - #[serde(rename = "additional_tools")] - AdditionalTools, - #[serde(rename = "apply_patch_call")] - ApplyPatchCall, - #[serde(rename = "apply_patch_call_output")] - ApplyPatchCallOutput, - #[serde(rename = "code_interpreter_call")] - CodeInterpreterCall, - Compaction, - #[serde(rename = "computer_call")] - ComputerCall, - #[serde(rename = "computer_call_output")] - ComputerCallOutput, - #[serde(rename = "custom_tool_call")] - CustomToolCall, - #[serde(rename = "custom_tool_call_output")] - CustomToolCallOutput, - #[serde(rename = "file_search_call")] - FileSearchCall, - #[serde(rename = "function_call")] - FunctionCall, - #[serde(rename = "function_call_output")] - FunctionCallOutput, - #[serde(rename = "image_generation_call")] - ImageGenerationCall, - #[serde(rename = "local_shell_call")] - LocalShellCall, - #[serde(rename = "local_shell_call_output")] - LocalShellCallOutput, - #[serde(rename = "mcp_approval_request")] - McpApprovalRequest, - #[serde(rename = "mcp_approval_response")] - McpApprovalResponse, - #[serde(rename = "mcp_call")] - McpCall, - #[serde(rename = "mcp_list_tools")] - McpListTools, - Message, - Reasoning, - #[serde(rename = "shell_call")] - ShellCall, - #[serde(rename = "shell_call_output")] - ShellCallOutput, - #[serde(rename = "tool_search_call")] - ToolSearchCall, - #[serde(rename = "tool_search_output")] - ToolSearchOutput, - #[serde(rename = "web_search_call")] - WebSearchCall, -} - -/// The role of the output message. Always `assistant`. -/// -/// -/// The role that provided the additional tools. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum RoleEnum { - Assistant, - Critic, - Developer, - Discriminator, - System, - Tool, - Unknown, - User, -} - -/// An array of tools the model may call while generating a response. You -/// can specify which tool to use by setting the `tool_choice` parameter. -/// -/// We support the following categories of tools: -/// - **Built-in tools**: Tools that are provided by OpenAI that extend the -/// model's capabilities, like [web search](/docs/guides/tools-web-search) -/// or [file search](/docs/guides/tools-file-search). Learn more about -/// [built-in tools](/docs/guides/tools). -/// - **MCP Tools**: Integrations with third-party systems via custom MCP servers -/// or predefined connectors such as Google Drive and SharePoint. Learn more about -/// [MCP Tools](/docs/guides/tools-connectors-mcp). -/// - **Function calls (custom tools)**: Functions that are defined by you, -/// enabling the model to call your own code with strongly typed arguments -/// and outputs. Learn more about -/// [function calling](/docs/guides/function-calling). You can also use -/// custom tools to call your own code. -/// -/// -/// A tool that can be used to generate a response. -/// -/// -/// Defines a function in your own code the model can choose to call. Learn more about -/// [function calling](https://platform.openai.com/docs/guides/function-calling). -/// -/// A tool that searches for relevant content from uploaded files. Learn more about the [file -/// search tool](https://platform.openai.com/docs/guides/tools-file-search). -/// -/// A tool that controls a virtual computer. Learn more about the [computer -/// tool](https://platform.openai.com/docs/guides/tools-computer-use). -/// -/// Search the Internet for sources related to the prompt. Learn more about the -/// [web search tool](/docs/guides/tools-web-search). -/// -/// -/// Give the model access to additional tools via remote Model Context Protocol -/// (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). -/// -/// -/// A tool that runs Python code to help generate a response to a prompt. -/// -/// -/// A tool that generates images using the GPT image models. -/// -/// -/// A tool that allows the model to execute shell commands in a local environment. -/// -/// A tool that allows the model to execute shell commands. -/// -/// A custom tool that processes input using a specified format. Learn more about [custom -/// tools](/docs/guides/function-calling#custom-tools) -/// -/// Groups function/custom tools under a shared namespace. -/// -/// Hosted or BYOT tool search configuration for deferred tools. -/// -/// This tool searches the web for relevant results to use in a response. Learn more about -/// the [web search tool](https://platform.openai.com/docs/guides/tools-web-search). -/// -/// Allows the assistant to create, delete, or update files using unified diffs. -/// -/// A tool available on an MCP server. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct OutputItemTool { - /// Whether this function is deferred and loaded via tool search. - /// - /// Whether this MCP tool is deferred and discovered via tool search. - /// - /// - /// Whether this tool should be deferred and discovered via tool search. - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_loading: Option, - /// Optional description of the custom tool, used to provide more context. - /// - /// A description of the namespace shown to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// The name of the function to call. - /// - /// The name of the custom tool, used to identify it in tool calls. - /// - /// The namespace name used in tool calls (for example, `crm`). - /// - /// The name of the tool. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub parameters: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub strict: Option, - /// The type of the function tool. Always `function`. - /// - /// The type of the file search tool. Always `file_search`. - /// - /// The type of the computer tool. Always `computer`. - /// - /// The type of the computer use tool. Always `computer_use_preview`. - /// - /// The type of the web search tool. One of `web_search` or `web_search_2025_08_26`. - /// - /// The type of the MCP tool. Always `mcp`. - /// - /// The type of the code interpreter tool. Always `code_interpreter`. - /// - /// - /// The type of the image generation tool. Always `image_generation`. - /// - /// - /// The type of the local shell tool. Always `local_shell`. - /// - /// The type of the shell tool. Always `shell`. - /// - /// The type of the custom tool. Always `custom`. - /// - /// The type of the tool. Always `namespace`. - /// - /// The type of the tool. Always `tool_search`. - /// - /// The type of the web search tool. One of `web_search_preview` or - /// `web_search_preview_2025_03_11`. - /// - /// The type of the tool. Always `apply_patch`. - #[serde(rename = "type")] - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_type: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub filters: Option, - /// The maximum number of results to return. This number should be between 1 and 50 inclusive. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_num_results: Option, - /// Ranking options for search. - #[serde(skip_serializing_if = "Option::is_none")] - pub ranking_options: Option, - /// The IDs of the vector stores to search. - #[serde(skip_serializing_if = "Option::is_none")] - pub vector_store_ids: Option>, - /// The height of the computer display. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_height: Option, - /// The width of the computer display. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_width: Option, - /// The type of computer environment to control. - #[serde(skip_serializing_if = "Option::is_none")] - pub environment: Option, - /// High level guidance for the amount of context window space to use for the search. One of - /// `low`, `medium`, or `high`. `medium` is the default. - #[serde(skip_serializing_if = "Option::is_none")] - pub search_context_size: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub user_location: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_tools: Option, - /// An OAuth access token that can be used with a remote MCP server, either - /// with a custom MCP server URL or a service connector. Your application - /// must handle the OAuth authorization flow and provide the token here. - #[serde(skip_serializing_if = "Option::is_none")] - pub authorization: Option, - /// Identifier for service connectors, like those available in ChatGPT. One of - /// `server_url` or `connector_id` must be provided. Learn more about service - /// connectors [here](/docs/guides/tools-remote-mcp#connectors). - /// - /// Currently supported `connector_id` values are: - /// - /// - Dropbox: `connector_dropbox` - /// - Gmail: `connector_gmail` - /// - Google Calendar: `connector_googlecalendar` - /// - Google Drive: `connector_googledrive` - /// - Microsoft Teams: `connector_microsoftteams` - /// - Outlook Calendar: `connector_outlookcalendar` - /// - Outlook Email: `connector_outlookemail` - /// - SharePoint: `connector_sharepoint` - #[serde(skip_serializing_if = "Option::is_none")] - pub connector_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub headers: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub require_approval: Option, - /// Optional description of the MCP server, used to provide more context. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_description: Option, - /// A label for this MCP server, used to identify it in tool calls. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_label: Option, - /// The URL for the MCP server. One of `server_url` or `connector_id` must be - /// provided. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_url: Option, - /// The code interpreter container. Can be a container ID or an object that - /// specifies uploaded file IDs to make available to your code, along with an - /// optional `memory_limit` setting. - #[serde(skip_serializing_if = "Option::is_none")] - pub container: Option, - /// Whether to generate a new image or edit an existing image. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub action: Option, - /// Background type for the generated image. One of `transparent`, - /// `opaque`, or `auto`. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub background: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub input_fidelity: Option, - /// Optional mask for inpainting. Contains `image_url` - /// (string, optional) and `file_id` (string, optional). - #[serde(skip_serializing_if = "Option::is_none")] - pub input_image_mask: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, - /// Moderation level for the generated image. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub moderation: Option, - /// Compression level for the output image. Default: 100. - #[serde(skip_serializing_if = "Option::is_none")] - pub output_compression: Option, - /// The output format of the generated image. One of `png`, `webp`, or - /// `jpeg`. Default: `png`. - #[serde(skip_serializing_if = "Option::is_none")] - pub output_format: Option, - /// Number of partial images to generate in streaming mode, from 0 (default value) to 3. - #[serde(skip_serializing_if = "Option::is_none")] - pub partial_images: Option, - /// The quality of the generated image. One of `low`, `medium`, `high`, - /// or `auto`. Default: `auto`. - #[serde(skip_serializing_if = "Option::is_none")] - pub quality: Option, - /// The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`, - /// arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. - /// Width and height must both be divisible by 16 and the requested aspect ratio must be - /// between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum - /// supported resolution is `3840x2160`. The requested size must also satisfy the model's - /// current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and - /// `1024x1536` are supported by the GPT image models; `auto` is supported for models that - /// allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. - /// For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. - #[serde(skip_serializing_if = "Option::is_none")] - pub size: Option, - /// The input format for the custom tool. Default is unconstrained text. - #[serde(skip_serializing_if = "Option::is_none")] - pub format: Option, - /// The function/custom tools available inside this namespace. - #[serde(skip_serializing_if = "Option::is_none")] - pub tools: Option>, - /// Whether tool search is executed by the server or by the client. - #[serde(skip_serializing_if = "Option::is_none")] - pub execution: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub search_content_types: Option>, - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub annotations: Option>, - /// The JSON schema describing the tool's input. - #[ts(type = "unknown")] - #[serde(skip_serializing_if = "Option::is_none")] - pub input_schema: Option>, -} - -/// The status of the response generation. One of `completed`, `failed`, -/// `in_progress`, `cancelled`, `queued`, or `incomplete`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(rename_all = "snake_case")] -#[ts(export_to = "openai/")] -pub enum StatusEnum { - Cancelled, - Completed, - Failed, - #[serde(rename = "in_progress")] - InProgress, - Incomplete, - Queued, -} - -/// How the model should select which tool (or tools) to use when generating -/// a response. See the `tools` parameter to see how to specify which tools -/// the model can call. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[serde(untagged)] -#[ts(export_to = "openai/")] -pub enum TheResponseObjectToolChoiceParam { - Enum(ToolChoiceMode), - HostedToolClass(HostedToolClass), -} - -/// Represents token usage details including input tokens, output tokens, -/// a breakdown of output tokens, and the total tokens used. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct ResponseUsage { - /// The number of input tokens. - pub input_tokens: i64, - /// A detailed breakdown of the input tokens. - pub input_tokens_details: InputTokensDetails, - /// The number of output tokens. - pub output_tokens: i64, - /// A detailed breakdown of the output tokens. - pub output_tokens_details: OutputTokensDetails, - /// The total number of tokens used. - pub total_tokens: i64, -} - -/// A detailed breakdown of the input tokens. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct InputTokensDetails { - /// The number of tokens that were retrieved from the cache. - /// [More on prompt caching](/docs/guides/prompt-caching). - pub cached_tokens: i64, -} - -/// A detailed breakdown of the output tokens. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, TS)] -#[ts(export_to = "openai/")] -pub struct OutputTokensDetails { - /// The number of reasoning tokens. - pub reasoning_tokens: i64, -} - -// Compatibility aliases for names used by Lingua's hand-written adapters. -pub type Instructions = InputParam; -pub type InputContent = ContentOutputContentList; -pub type InputItemContentListType = HilariousType; -pub type FunctionCallItemStatus = Status; +// Quicktype generation failed diff --git a/specs/openai/openapi.yml b/specs/openai/openapi.yml index e83ae208..13f70cee 100644 --- a/specs/openai/openapi.yml +++ b/specs/openai/openapi.yml @@ -14030,6 +14030,7 @@ paths: "name": "Main Admin Key", "redacted_value": "sk-admin...def", "created_at": 1711471533, + "expires_at": 1714063533, "last_used_at": 1711471534, "owner": { "type": "service_account", @@ -14063,6 +14064,14 @@ paths: name: type: string example: New Admin Key + expires_in_seconds: + type: integer + minimum: 1 + maximum: 31536000 + example: 2592000 + description: >- + The number of seconds until the API key expires. Omit this + field for a key that does not expire. responses: '200': description: The newly created admin API key. @@ -14081,7 +14090,8 @@ paths: -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ -H "Content-Type: application/json" \ -d '{ - "name": "New Admin Key" + "name": "New Admin Key", + "expires_in_seconds": 2592000 }' node.js: >- import OpenAI from 'openai'; @@ -14157,6 +14167,7 @@ paths: "name": "New Admin Key", "redacted_value": "sk-admin...xyz", "created_at": 1711471533, + "expires_at": 1714063533, "last_used_at": 1711471534, "owner": { "type": "user", @@ -14472,12 +14483,25 @@ paths: in: query description: >- Return only events performed on these targets. For example, a - project ID updated. + project ID updated. For ChatGPT connector role events, use the + workspace connector resource ID shown in `details.id`, such as + `__`. required: false schema: type: array items: type: string + - name: tenant_only + in: query + description: >- + Return only tenant-scoped events associated with this organization. + Required for tenant-scoped events such as `role.bound_to_resource` + and `role.unbound_from_resource`. When `true`, all supplied event + types must be tenant-scoped. + required: false + schema: + type: boolean + default: false - name: limit in: query description: > @@ -21913,6 +21937,133 @@ paths: } } /organization/projects/{project_id}/spend_alerts/{alert_id}: + get: + security: + - AdminApiKeyAuth: [] + summary: Retrieves a project spend alert. + operationId: retrieve-project-spend-alert + tags: + - Spend alerts + parameters: + - name: project_id + in: path + description: The ID of the project. + required: true + schema: + type: string + - name: alert_id + in: path + description: The ID of the spend alert to retrieve. + required: true + schema: + type: string + responses: + '200': + description: Project spend alert retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/ProjectSpendAlert' + x-oaiMeta: + name: Retrieve project spend alert + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/projects/proj_abc/spend_alerts/alert_abc123 + \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const projectSpendAlert = await + client.admin.organization.projects.spendAlerts.retrieve( + 'alert_id', + { project_id: 'project_id' }, + ); + + + console.log(projectSpendAlert.id); + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + + project_spend_alert = + client.admin.organization.projects.spend_alerts.retrieve( + alert_id="alert_id", + project_id="project_id", + ) + + print(project_spend_alert.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tprojectSpendAlert, err := client.Admin.Organization.Projects.SpendAlerts.Get(\n\t\tcontext.TODO(),\n\t\t\"project_id\",\n\t\t\"alert_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", projectSpendAlert.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.projects.spendalerts.ProjectSpendAlert; + + import + com.openai.models.admin.organization.projects.spendalerts.SpendAlertRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + SpendAlertRetrieveParams params = SpendAlertRetrieveParams.builder() + .projectId("project_id") + .alertId("alert_id") + .build(); + ProjectSpendAlert projectSpendAlert = client.admin().organization().projects().spendAlerts().retrieve(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + project_spend_alert = + openai.admin.organization.projects.spend_alerts.retrieve("alert_id", + project_id: "project_id") + + + puts(project_spend_alert) + response: | + { + "id": "alert_abc123", + "object": "project.spend_alert", + "threshold_amount": 150000, + "currency": "USD", + "interval": "month", + "notification_channel": { + "type": "email", + "recipients": ["finance@example.com"], + "subject_prefix": "OpenAI spend alert" + } + } post: security: - AdminApiKeyAuth: [] @@ -23673,6 +23824,117 @@ paths: } } /organization/spend_alerts/{alert_id}: + get: + security: + - AdminApiKeyAuth: [] + summary: Retrieves an organization spend alert. + operationId: retrieve-organization-spend-alert + tags: + - Spend alerts + parameters: + - name: alert_id + in: path + description: The ID of the spend alert to retrieve. + required: true + schema: + type: string + responses: + '200': + description: Organization spend alert retrieved successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/OrganizationSpendAlert' + x-oaiMeta: + name: Retrieve organization spend alert + group: administration + examples: + request: + curl: > + curl + https://api.openai.com/v1/organization/spend_alerts/alert_abc123 \ + -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \ + -H "Content-Type: application/json" + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted + }); + + + const organizationSpendAlert = await + client.admin.organization.spendAlerts.retrieve('alert_id'); + + + console.log(organizationSpendAlert.id); + python: >- + import os + + from openai import OpenAI + + + client = OpenAI( + admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted + ) + + organization_spend_alert = + client.admin.organization.spend_alerts.retrieve( + "alert_id", + ) + + print(organization_spend_alert.id) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\torganizationSpendAlert, err := client.Admin.Organization.SpendAlerts.Get(context.TODO(), \"alert_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", organizationSpendAlert.ID)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.admin.organization.spendalerts.OrganizationSpendAlert; + + import + com.openai.models.admin.organization.spendalerts.SpendAlertRetrieveParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + OrganizationSpendAlert organizationSpendAlert = client.admin().organization().spendAlerts().retrieve("alert_id"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(admin_api_key: "My Admin API Key") + + + organization_spend_alert = + openai.admin.organization.spend_alerts.retrieve("alert_id") + + + puts(organization_spend_alert) + response: | + { + "id": "alert_abc123", + "object": "organization.spend_alert", + "threshold_amount": 150000, + "currency": "USD", + "interval": "month", + "notification_channel": { + "type": "email", + "recipients": ["finance@example.com"], + "subject_prefix": "OpenAI spend alert" + } + } post: security: - AdminApiKeyAuth: [] @@ -30013,7 +30275,8 @@ paths: {"type": "input_text", "text": "what is in this file?"}, { "type": "input_file", - "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf" + "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf", + "detail": "auto" } ] } @@ -30034,6 +30297,7 @@ paths: { type: "input_file", file_url: "https://www.berkshirehathaway.com/letters/2024ltr.pdf", + detail: "auto", }, ], }, @@ -39864,9 +40128,6 @@ paths: application/json: schema: $ref: '#/components/schemas/TokenCountsBody' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/TokenCountsBody' responses: '200': description: Success @@ -39973,9 +40234,6 @@ paths: application/json: schema: $ref: '#/components/schemas/CompactResponseMethodPublicBody' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/CompactResponseMethodPublicBody' responses: '200': description: Success @@ -40056,7 +40314,7 @@ paths: api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted ) compacted_response = client.responses.compact( - model="gpt-5.4", + model="gpt-5.6-sol", ) print(compacted_response.id) node.js: >- @@ -40069,11 +40327,11 @@ paths: const compactedResponse = await client.responses.compact({ model: - 'gpt-5.4' }); + 'gpt-5.6-sol' }); console.log(compactedResponse.id); - go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcompactedResponse, err := client.Responses.Compact(context.TODO(), responses.ResponseCompactParams{\n\t\tModel: responses.ResponseCompactParamsModelGPT5_4,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", compactedResponse.ID)\n}\n" + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n\t\"github.com/openai/openai-go/responses\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tcompactedResponse, err := client.Responses.Compact(context.TODO(), responses.ResponseCompactParams{\n\t\tModel: responses.ResponseCompactParamsModelGPT5_6Sol,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", compactedResponse.ID)\n}\n" java: |- package com.openai.example; @@ -40089,17 +40347,21 @@ paths: OpenAIClient client = OpenAIOkHttpClient.fromEnv(); ResponseCompactParams params = ResponseCompactParams.builder() - .model(ResponseCompactParams.Model.GPT_5_4) + .model(ResponseCompactParams.Model.GPT_5_6_SOL) .build(); CompactedResponse compactedResponse = client.responses().compact(params); } } - ruby: |- + ruby: >- require "openai" + openai = OpenAI::Client.new(api_key: "My API Key") - compacted_response = openai.responses.compact(model: :"gpt-5.4") + + compacted_response = openai.responses.compact(model: + :"gpt-5.6-sol") + puts(compacted_response) response: | @@ -40457,9 +40719,6 @@ paths: application/json: schema: $ref: '#/components/schemas/SetDefaultSkillVersionBody' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/SetDefaultSkillVersionBody' responses: '200': description: Success @@ -41903,2411 +42162,13019 @@ paths: "has_more": false, "object": "list" } -webhooks: - batch_cancelled: + /responses?beta=true: post: - description: | - Sent when a batch has been cancelled. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookBatchCancelled' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + operationId: beta_createResponse + tags: + - Responses + summary: > + Creates a model response. Provide [text](/docs/guides/text) or - status codes will be retried. - batch_completed: - post: - description: | - Sent when a batch has completed processing. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookBatchCompleted' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + [image](/docs/guides/images) inputs to generate + [text](/docs/guides/text) - status codes will be retried. - batch_expired: - post: - description: | - Sent when a batch has expired before completion. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookBatchExpired' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + or [JSON](/docs/guides/structured-outputs) outputs. Have the model call - status codes will be retried. - batch_failed: - post: - description: | - Sent when a batch has failed. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookBatchFailed' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + your own [custom code](/docs/guides/function-calling) or use built-in - status codes will be retried. - eval_run_canceled: - post: - description: | - Sent when an eval run has been canceled. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookEvalRunCanceled' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + [tools](/docs/guides/tools) like [web + search](/docs/guides/tools-web-search) - status codes will be retried. - eval_run_failed: - post: - description: | - Sent when an eval run has failed. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookEvalRunFailed' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + or [file search](/docs/guides/tools-file-search) to use your own data - status codes will be retried. - eval_run_succeeded: - post: - description: | - Sent when an eval run has succeeded. + as input for the model's response. requestBody: - description: The event payload sent by the API. + required: true content: application/json: schema: - $ref: '#/components/schemas/WebhookEvalRunSucceeded' + $ref: '#/components/schemas/BetaCreateResponse' responses: '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BetaResponse' + text/event-stream: + schema: + $ref: '#/components/schemas/BetaResponseStreamEvent' + x-oaiMeta: + name: Create a model response + group: responses + path: create + examples: + - title: Text input + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "input": "Tell me a three sentence bedtime story about a unicorn." + }' + javascript: | + import OpenAI from "openai"; - status codes will be retried. - fine_tuning_job_cancelled: - post: - description: | - Sent when a fine-tuning job has been cancelled. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookFineTuningJobCancelled' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + const openai = new OpenAI(); - status codes will be retried. - fine_tuning_job_failed: - post: - description: | - Sent when a fine-tuning job has failed. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookFineTuningJobFailed' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + const response = await openai.responses.create({ + model: "gpt-5.4", + input: "Tell me a three sentence bedtime story about a unicorn." + }); - status codes will be retried. - fine_tuning_job_succeeded: - post: - description: | - Sent when a fine-tuning job has succeeded. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookFineTuningJobSucceeded' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + console.log(response); + python: |- + import os + from openai import OpenAI - status codes will be retried. - realtime_call_incoming: - post: - description: | - Sent when Realtime API Receives a incoming SIP call. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookRealtimeCallIncoming' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.beta.responses.create(): + print(response) + csharp: > + using System; - status codes will be retried. - response_cancelled: - post: - description: | - Sent when a background response has been cancelled. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookResponseCancelled' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + using OpenAI.Responses; - status codes will be retried. - response_completed: - post: - description: | - Sent when a background response has completed successfully. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookResponseCompleted' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 - status codes will be retried. - response_failed: - post: - description: | - Sent when a background response has failed. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookResponseFailed' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); - status codes will be retried. - response_incomplete: - post: - description: | - Sent when a background response is incomplete. - requestBody: - description: The event payload sent by the API. - content: - application/json: - schema: - $ref: '#/components/schemas/WebhookResponseIncomplete' - responses: - '200': - description: > - Return a 200 status code to acknowledge receipt of the event. - Non-200 - - status codes will be retried. -components: - schemas: - AddUploadPartRequest: - type: object - additionalProperties: false - properties: - data: - description: | - The chunk of bytes for this Part. - type: string - format: binary - required: - - data - AdminApiKey: - type: object - description: Represents an individual Admin API key in an org. - properties: - object: - type: string - enum: - - organization.admin_api_key - description: The object type, which is always `organization.admin_api_key` - x-stainless-const: true - id: - type: string - example: key_abc - description: The identifier, which can be referenced in API endpoints - name: - anyOf: - - type: string - - type: 'null' - example: Administration Key - description: The name of the API key - redacted_value: - type: string - example: sk-admin...def - description: The redacted value of the API key - created_at: - type: integer - format: unixtime - example: 1711471533 - description: The Unix timestamp (in seconds) of when the API key was created - last_used_at: - anyOf: - - type: integer - format: unixtime - example: 1711471534 - description: >- - The Unix timestamp (in seconds) of when the API key was last - used - - type: 'null' - owner: - type: object - properties: - type: - type: string - example: user - description: Always `user` - object: - type: string - example: organization.user - description: The object type, which is always organization.user - id: - type: string - example: sa_456 - description: The identifier, which can be referenced in API endpoints - name: - type: string - example: My Service Account - description: The name of the user - created_at: - type: integer - format: unixtime - example: 1711471533 - description: The Unix timestamp (in seconds) of when the user was created - role: - type: string - example: owner - description: Always `owner` - required: - - object - - redacted_value - - created_at - - id - - owner - x-oaiMeta: - name: The admin API key object - example: | - { - "object": "organization.admin_api_key", - "id": "key_abc", - "name": "Main Admin Key", - "redacted_value": "sk-admin...xyz", - "created_at": 1711471533, - "last_used_at": 1711471534, - "owner": { - "type": "user", - "object": "organization.user", - "id": "user_123", - "name": "John Doe", - "created_at": 1711471533, - "role": "owner" - } - } - AdminApiKeyCreateResponse: - allOf: - - $ref: '#/components/schemas/AdminApiKey' - - type: object - description: >- - The newly created admin API key. The `value` field is only returned - once, when the key is created. - properties: - value: - type: string - example: sk-admin-1234abcd - description: The value of the API key. Only shown on create. - required: - - value - ApiKeyList: - type: object - properties: - object: - type: string - enum: - - list - example: list - x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/AdminApiKey' - has_more: - type: boolean - example: false - first_id: - anyOf: - - type: string - - type: 'null' - example: key_abc - last_id: - anyOf: - - type: string - - type: 'null' - example: key_xyz - required: - - object - - data - - has_more - AssignedRoleDetails: - type: object - description: >- - Detailed information about a role assignment entry returned when listing - assignments. - properties: - id: - type: string - description: Identifier for the role. - name: - type: string - description: Name of the role. - permissions: - type: array - description: Permissions associated with the role. - items: - type: string - resource_type: - type: string - description: Resource type the role applies to. - predefined_role: - type: boolean - description: Whether the role is predefined by OpenAI. - description: - description: Description of the role. - anyOf: - - type: string - - type: 'null' - created_at: - description: When the role was created. - anyOf: - - type: integer - format: unixtime - - type: 'null' - updated_at: - description: When the role was last updated. - anyOf: - - type: integer - format: unixtime - - type: 'null' - created_by: - description: Identifier of the actor who created the role. - anyOf: - - type: string - - type: 'null' - created_by_user_obj: - description: User details for the actor that created the role, when available. - anyOf: - - type: object - additionalProperties: true - - type: 'null' - metadata: - description: Arbitrary metadata stored on the role. - anyOf: - - type: object - additionalProperties: true - - type: 'null' - assignment_sources: - description: >- - Principals from which the role assignment is inherited, when - available. - anyOf: - - type: array - items: - type: object - properties: - principal_id: - type: string - principal_type: - type: string - required: - - principal_id - - principal_type - - type: 'null' - required: - - id - - name - - permissions - - resource_type - - predefined_role - - description - - created_at - - updated_at - - created_by - - created_by_user_obj - - metadata - - assignment_sources - AssistantObject: - type: object - title: Assistant - description: Represents an `assistant` that can call the model and use tools. - properties: - id: - description: The identifier, which can be referenced in API endpoints. - type: string - object: - description: The object type, which is always `assistant`. - type: string - enum: - - assistant - x-stainless-const: true - created_at: - description: The Unix timestamp (in seconds) for when the assistant was created. - type: integer - format: unixtime - name: - anyOf: - - description: | - The name of the assistant. The maximum length is 256 characters. - type: string - maxLength: 256 - - type: 'null' - description: - anyOf: - - description: > - The description of the assistant. The maximum length is 512 - characters. - type: string - maxLength: 512 - - type: 'null' - model: - description: > - ID of the model to use. You can use the [List - models](/docs/api-reference/models/list) API to see all of your - available models, or see our [Model overview](/docs/models) for - descriptions of them. - type: string - instructions: - anyOf: - - description: > - The system instructions that the assistant uses. The maximum - length is 256,000 characters. - type: string - maxLength: 256000 - - type: 'null' - tools: - description: > - A list of tool enabled on the assistant. There can be a maximum of - 128 tools per assistant. Tools can be of types `code_interpreter`, - `file_search`, or `function`. - default: [] - type: array - maxItems: 128 - items: - oneOf: - - $ref: '#/components/schemas/AssistantToolsCode' - - $ref: '#/components/schemas/AssistantToolsFileSearch' - - $ref: '#/components/schemas/AssistantToolsFunction' - tool_resources: - anyOf: - - type: object - description: > - A set of resources that are used by the assistant's tools. The - resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the - `file_search` tool requires a list of vector store IDs. - properties: - code_interpreter: - type: object - properties: - file_ids: - type: array - description: > - A list of [file](/docs/api-reference/files) IDs made - available to the `code_interpreter`` tool. There can be - a maximum of 20 files associated with the tool. - default: [] - maxItems: 20 - items: - type: string - file_search: - type: object - properties: - vector_store_ids: - type: array - description: > - The ID of the [vector - store](/docs/api-reference/vector-stores/object) - attached to this assistant. There can be a maximum of 1 - vector store attached to the assistant. - maxItems: 1 - items: - type: string - - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - temperature: - anyOf: - - description: > - What sampling temperature to use, between 0 and 2. Higher values - like 0.8 will make the output more random, while lower values - like 0.2 will make it more focused and deterministic. - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 - - type: 'null' - top_p: - anyOf: - - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 - description: > - An alternative to sampling with temperature, called nucleus - sampling, where the model considers the results of the tokens - with top_p probability mass. So 0.1 means only the tokens - comprising the top 10% probability mass are considered. - - - We generally recommend altering this or temperature but not - both. - - type: 'null' - response_format: - anyOf: - - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' - - type: 'null' - required: - - id - - object - - created_at - - name - - description - - model - - instructions - - tools - - metadata - x-oaiMeta: - name: The assistant object - example: | - { - "id": "asst_abc123", - "object": "assistant", - "created_at": 1698984975, - "name": "Math Tutor", - "description": null, - "model": "gpt-4o", - "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", - "tools": [ - { - "type": "code_interpreter" - } - ], - "metadata": {}, - "top_p": 1.0, - "temperature": 1.0, - "response_format": "auto" - } - deprecated: true - AssistantStreamEvent: - description: > - Represents an event emitted when streaming a Run. + OpenAIResponse response = client.CreateResponse("Tell me a three + sentence bedtime story about a unicorn."); - Each event in a server-sent events stream has an `event` and `data` - property: - - - ``` - - event: thread.created - - data: {"id": "thread_123", "object": "thread", ...} - - ``` + Console.WriteLine(response.GetOutputText()); + node.js: |- + import OpenAI from 'openai'; - We emit events whenever a new object is created, transitions to a new - state, or is being + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); - streamed in parts (deltas). For example, we emit `thread.run.created` - when a new run + const betaResponse = await client.beta.responses.create(); - is created, `thread.run.completed` when a run completes, and so on. When - an Assistant chooses + console.log(betaResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbetaResponse, err := client.Beta.Responses.New(context.TODO(), openai.BetaResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", betaResponse.ID)\n}\n" + java: |- + package com.openai.example; - to create a message during a run, we emit a `thread.message.created - event`, a + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.BetaResponse; + import com.openai.models.beta.responses.ResponseCreateParams; - `thread.message.in_progress` event, many `thread.message.delta` events, - and finally a + public final class Main { + private Main() {} - `thread.message.completed` event. + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + BetaResponse betaResponse = client.beta().responses().create(); + } + } + ruby: |- + require "openai" - We may add additional events over time, so we recommend handling unknown - events gracefully + openai = OpenAI::Client.new(api_key: "My API Key") - in your code. See the [Assistants API - quickstart](/docs/assistants/overview) to learn how to + beta_response = openai.beta.responses.create - integrate the Assistants API with streaming. - oneOf: - - $ref: '#/components/schemas/ThreadStreamEvent' - - $ref: '#/components/schemas/RunStreamEvent' - - $ref: '#/components/schemas/RunStepStreamEvent' - - $ref: '#/components/schemas/MessageStreamEvent' - - $ref: '#/components/schemas/ErrorEvent' - - $ref: '#/components/schemas/DoneEvent' - x-oaiMeta: - name: Assistant stream events - beta: true - AssistantSupportedModels: - type: string - enum: - - gpt-5 - - gpt-5-mini - - gpt-5-nano - - gpt-5-2025-08-07 - - gpt-5-mini-2025-08-07 - - gpt-5-nano-2025-08-07 - - gpt-4.1 - - gpt-4.1-mini - - gpt-4.1-nano - - gpt-4.1-2025-04-14 - - gpt-4.1-mini-2025-04-14 - - gpt-4.1-nano-2025-04-14 - - o3-mini - - o3-mini-2025-01-31 - - o1 - - o1-2024-12-17 - - gpt-4o - - gpt-4o-2024-11-20 - - gpt-4o-2024-08-06 - - gpt-4o-2024-05-13 - - gpt-4o-mini - - gpt-4o-mini-2024-07-18 - - gpt-4.5-preview - - gpt-4.5-preview-2025-02-27 - - gpt-4-turbo - - gpt-4-turbo-2024-04-09 - - gpt-4-0125-preview - - gpt-4-turbo-preview - - gpt-4-1106-preview - - gpt-4-vision-preview - - gpt-4 - - gpt-4-0314 - - gpt-4-0613 - - gpt-4-32k - - gpt-4-32k-0314 - - gpt-4-32k-0613 - - gpt-3.5-turbo - - gpt-3.5-turbo-16k - - gpt-3.5-turbo-0613 - - gpt-3.5-turbo-1106 - - gpt-3.5-turbo-0125 - - gpt-3.5-turbo-16k-0613 - AssistantToolsCode: - type: object - title: Code interpreter tool - properties: - type: - type: string - description: 'The type of tool being defined: `code_interpreter`' - enum: - - code_interpreter - x-stainless-const: true - required: - - type - AssistantToolsFileSearch: - type: object - title: FileSearch tool - properties: - type: - type: string - description: 'The type of tool being defined: `file_search`' - enum: - - file_search - x-stainless-const: true - file_search: - type: object - description: Overrides for the file search tool. - properties: - max_num_results: - type: integer - minimum: 1 - maximum: 50 - description: > - The maximum number of results the file search tool should - output. The default is 20 for `gpt-4*` models and 5 for - `gpt-3.5-turbo`. This number should be between 1 and 50 - inclusive. + puts(beta_response) + response: | + { + "id": "resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b", + "object": "response", + "created_at": 1741476542, + "status": "completed", + "completed_at": 1741476543, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-5.4", + "output": [ + { + "type": "message", + "id": "msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "In a peaceful grove beneath a silver moon, a unicorn named Lumina discovered a hidden pool that reflected the stars. As she dipped her horn into the water, the pool began to shimmer, revealing a pathway to a magical realm of endless night skies. Filled with wonder, Lumina whispered a wish for all who dream to find their own hidden magic, and as she glanced back, her hoofprints sparkled like stardust.", + "annotations": [] + } + ] + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 36, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 87, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 123 + }, + "user": null, + "metadata": {} + } + - title: Image input + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "input": [ + { + "role": "user", + "content": [ + {"type": "input_text", "text": "what is in this image?"}, + { + "type": "input_image", + "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" + } + ] + } + ] + }' + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); - Note that the file search tool may output fewer than - `max_num_results` results. See the [file search tool - documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) - for more information. - ranking_options: - $ref: '#/components/schemas/FileSearchRankingOptions' - required: - - type - AssistantToolsFileSearchTypeOnly: - type: object - title: FileSearch tool - properties: - type: - type: string - description: 'The type of tool being defined: `file_search`' - enum: - - file_search - x-stainless-const: true - required: - - type - AssistantToolsFunction: - type: object - title: Function tool - properties: - type: - type: string - description: 'The type of tool being defined: `function`' - enum: - - function - x-stainless-const: true - function: - $ref: '#/components/schemas/FunctionObject' - required: - - type - - function - AssistantsApiResponseFormatOption: - description: > - Specifies the format that the model must output. Compatible with - [GPT-4o](/docs/models#gpt-4o), [GPT-4 - Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models - since `gpt-3.5-turbo-1106`. + const response = await openai.responses.create({ + model: "gpt-5.4", + input: [ + { + role: "user", + content: [ + { type: "input_text", text: "what is in this image?" }, + { + type: "input_image", + image_url: + "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg", + }, + ], + }, + ], + }); + console.log(response); + python: |- + import os + from openai import OpenAI - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables - Structured Outputs which ensures the model will match your supplied JSON - schema. Learn more in the [Structured Outputs - guide](/docs/guides/structured-outputs). + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.beta.responses.create(): + print(response) + csharp: | + using System; + using System.Collections.Generic; + using OpenAI.Responses; - Setting to `{ "type": "json_object" }` enables JSON mode, which ensures - the message the model generates is valid JSON. + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + List inputItems = + [ + ResponseItem.CreateUserMessageItem( + [ + ResponseContentPart.CreateInputTextPart("What is in this image?"), + ResponseContentPart.CreateInputImagePart(new Uri("https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg")) + ] + ) + ]; - **Important:** when using JSON mode, you **must** also instruct the - model to produce JSON yourself via a system or user message. Without - this, the model may generate an unending stream of whitespace until the - generation reaches the token limit, resulting in a long-running and - seemingly "stuck" request. Also note that the message content may be - partially cut off if `finish_reason="length"`, which indicates the - generation exceeded `max_tokens` or the conversation exceeded the max - context length. - oneOf: - - type: string - description: | - `auto` is the default value - enum: - - auto - x-stainless-const: true - - $ref: '#/components/schemas/ResponseFormatText' - - $ref: '#/components/schemas/ResponseFormatJsonObject' - - $ref: '#/components/schemas/ResponseFormatJsonSchema' - AssistantsApiToolChoiceOption: - description: > - Controls which (if any) tool is called by the model. + OpenAIResponse response = client.CreateResponse(inputItems); - `none` means the model will not call any tools and instead generates a - message. + Console.WriteLine(response.GetOutputText()); + node.js: |- + import OpenAI from 'openai'; - `auto` is the default value and means the model can pick between - generating a message or calling one or more tools. + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); - `required` means the model must call one or more tools before responding - to the user. + const betaResponse = await client.beta.responses.create(); - Specifying a particular tool like `{"type": "file_search"}` or `{"type": - "function", "function": {"name": "my_function"}}` forces the model to - call that tool. - oneOf: - - type: string - description: > - `none` means the model will not call any tools and instead generates - a message. `auto` means the model can pick between generating a - message or calling one or more tools. `required` means the model - must call one or more tools before responding to the user. - enum: - - none - - auto - - required - - $ref: '#/components/schemas/AssistantsNamedToolChoice' - AssistantsNamedToolChoice: - type: object - description: >- - Specifies a tool the model should use. Use to force the model to call a - specific tool. - properties: - type: - type: string - enum: - - function - - code_interpreter - - file_search - description: >- - The type of the tool. If type is `function`, the function name must - be set - function: - type: object - properties: - name: - type: string - description: The name of the function to call. - required: - - name - required: - - type - AudioResponseFormat: - description: > - The format of the output, in one of these options: `json`, `text`, - `srt`, `verbose_json`, `vtt`, or `diarized_json`. For - `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported - format is `json`. For `gpt-4o-transcribe-diarize`, the supported formats - are `json`, `text`, and `diarized_json`, with `diarized_json` required - to receive speaker annotations. - type: string - enum: - - json - - text - - srt - - verbose_json - - vtt - - diarized_json - default: json - AudioTranscription: - type: object - properties: - model: - description: > - The model to use for transcription. Current options are `whisper-1`, - `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. - anyOf: - - type: string - - type: string - enum: - - whisper-1 - - gpt-4o-mini-transcribe - - gpt-4o-mini-transcribe-2025-12-15 - - gpt-4o-transcribe - - gpt-4o-transcribe-diarize - - gpt-realtime-whisper - language: - type: string - description: > - The language of the input audio. Supplying the input language in + console.log(betaResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbetaResponse, err := client.Beta.Responses.New(context.TODO(), openai.BetaResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", betaResponse.ID)\n}\n" + java: |- + package com.openai.example; - [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) - (e.g. `en`) format + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.BetaResponse; + import com.openai.models.beta.responses.ResponseCreateParams; - will improve accuracy and latency. - prompt: - type: string - description: > - An optional text to guide the model's style or continue a previous - audio + public final class Main { + private Main() {} - segment. + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - For `whisper-1`, the [prompt is a list of - keywords](/docs/guides/speech-to-text#prompting). + BetaResponse betaResponse = client.beta().responses().create(); + } + } + ruby: |- + require "openai" - For `gpt-4o-transcribe` models (excluding - `gpt-4o-transcribe-diarize`), the prompt is a free text string, for - example "expect words related to technology". + openai = OpenAI::Client.new(api_key: "My API Key") - Prompt is not supported with `gpt-realtime-whisper` in GA Realtime - sessions. - delay: - type: string - description: > - Controls how long the model waits before emitting transcription - text. + beta_response = openai.beta.responses.create - Higher values can improve transcription accuracy at the cost of - latency. + puts(beta_response) + response: | + { + "id": "resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41", + "object": "response", + "created_at": 1741476777, + "status": "completed", + "completed_at": 1741476778, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-5.4", + "output": [ + { + "type": "message", + "id": "msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.", + "annotations": [] + } + ] + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 328, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 52, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 380 + }, + "user": null, + "metadata": {} + } + - title: File input + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "input": [ + { + "role": "user", + "content": [ + {"type": "input_text", "text": "what is in this file?"}, + { + "type": "input_file", + "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf", + "detail": "auto" + } + ] + } + ] + }' + javascript: | + import OpenAI from "openai"; - Only supported with `gpt-realtime-whisper` in GA Realtime sessions. - enum: - - minimal - - low - - medium - - high - - xhigh - AudioTranscriptionResponse: - type: object - properties: - model: - description: > - The model used for transcription. Current options are `whisper-1`, - `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, - `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and - `gpt-realtime-whisper`. - anyOf: - - type: string - - type: string - enum: - - whisper-1 - - gpt-4o-mini-transcribe - - gpt-4o-mini-transcribe-2025-12-15 - - gpt-4o-transcribe - - gpt-4o-transcribe-diarize - - gpt-realtime-whisper - language: - type: string - description: | - The language of the input audio. - prompt: - type: string - description: | - The prompt configured for input audio transcription, when present. - AuditLog: - type: object - description: A log of a user action or configuration change within this organization. - properties: - id: - type: string - description: The ID of this log. - type: - $ref: '#/components/schemas/AuditLogEventType' - effective_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of the event. - project: - type: object - description: >- - The project that the action was scoped to. Absent for actions not - scoped to projects. Note that any admin actions taken via Admin API - keys are associated with the default project. - properties: - id: - type: string - description: The project ID. - name: - type: string - description: The project title. - actor: - anyOf: - - $ref: '#/components/schemas/AuditLogActor' - - type: 'null' - api_key.created: - type: object - description: The details for events with this `type`. - properties: - id: + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-5.4", + input: [ + { + role: "user", + content: [ + { type: "input_text", text: "what is in this file?" }, + { + type: "input_file", + file_url: "https://www.berkshirehathaway.com/letters/2024ltr.pdf", + detail: "auto", + }, + ], + }, + ], + }); + + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.beta.responses.create(): + print(response) + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const betaResponse = await client.beta.responses.create(); + + console.log(betaResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbetaResponse, err := client.Beta.Responses.New(context.TODO(), openai.BetaResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", betaResponse.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.BetaResponse; + import com.openai.models.beta.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BetaResponse betaResponse = client.beta().responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + beta_response = openai.beta.responses.create + + puts(beta_response) + response: | + { + "id": "resp_686eef60237881a2bd1180bb8b13de430e34c516d176ff86", + "object": "response", + "created_at": 1752100704, + "status": "completed", + "completed_at": 1752100705, + "background": false, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-5.4", + "output": [ + { + "id": "msg_686eef60d3e081a29283bdcbc4322fd90e34c516d176ff86", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "The file seems to contain excerpts from a letter to the shareholders of Berkshire Hathaway Inc., likely written by Warren Buffett. It covers several topics:\n\n1. **Communication Philosophy**: Buffett emphasizes the importance of transparency and candidness in reporting mistakes and successes to shareholders.\n\n2. **Mistakes and Learnings**: The letter acknowledges past mistakes in business assessments and management hires, highlighting the importance of correcting errors promptly.\n\n3. **CEO Succession**: Mention of Greg Abel stepping in as the new CEO and continuing the tradition of honest communication.\n\n4. **Pete Liegl Story**: A detailed account of acquiring Forest River and the relationship with its founder, highlighting trust and effective business decisions.\n\n5. **2024 Performance**: Overview of business performance, particularly in insurance and investment activities, with a focus on GEICO's improvement.\n\n6. **Tax Contributions**: Discussion of significant tax payments to the U.S. Treasury, credited to shareholders' reinvestments.\n\n7. **Investment Strategy**: A breakdown of Berkshire\u2019s investments in both controlled subsidiaries and marketable equities, along with a focus on long-term holding strategies.\n\n8. **American Capitalism**: Reflections on America\u2019s economic development and Berkshire\u2019s role within it.\n\n9. **Property-Casualty Insurance**: Insights into the P/C insurance business model and its challenges and benefits.\n\n10. **Japanese Investments**: Information about Berkshire\u2019s investments in Japanese companies and future plans.\n\n11. **Annual Meeting**: Details about the upcoming annual gathering in Omaha, including schedule changes and new book releases.\n\n12. **Personal Anecdotes**: Light-hearted stories about family and interactions, conveying Buffett's personable approach.\n\n13. **Financial Performance Data**: Tables comparing Berkshire\u2019s annual performance to the S&P 500, showing impressive long-term gains.\n\nOverall, the letter reinforces Berkshire Hathaway's commitment to transparency, investment in both its businesses and the wider economy, and emphasizes strong leadership and prudent financial management." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 8438, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 398, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 8836 + }, + "user": null, + "metadata": {} + } + - title: Web search + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "tools": [{ "type": "web_search_preview" }], + "input": "What was a positive news story from today?" + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-5.4", + tools: [{ type: "web_search_preview" }], + input: "What was a positive news story from today?", + }); + + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.beta.responses.create(): + print(response) + csharp: > + using System; + + + using OpenAI.Responses; + + + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + string userInputText = "What was a positive news story from + today?"; + + + ResponseCreationOptions options = new() + + { + Tools = + { + ResponseTool.CreateWebSearchTool() + }, + }; + + + OpenAIResponse response = client.CreateResponse(userInputText, + options); + + + Console.WriteLine(response.GetOutputText()); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const betaResponse = await client.beta.responses.create(); + + console.log(betaResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbetaResponse, err := client.Beta.Responses.New(context.TODO(), openai.BetaResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", betaResponse.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.BetaResponse; + import com.openai.models.beta.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BetaResponse betaResponse = client.beta().responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + beta_response = openai.beta.responses.create + + puts(beta_response) + response: | + { + "id": "resp_67ccf18ef5fc8190b16dbee19bc54e5f087bb177ab789d5c", + "object": "response", + "created_at": 1741484430, + "status": "completed", + "completed_at": 1741484431, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-5.4", + "output": [ + { + "type": "web_search_call", + "id": "ws_67ccf18f64008190a39b619f4c8455ef087bb177ab789d5c", + "status": "completed" + }, + { + "type": "message", + "id": "msg_67ccf190ca3881909d433c50b1f6357e087bb177ab789d5c", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "As of today, March 9, 2025, one notable positive news story...", + "annotations": [ + { + "type": "url_citation", + "start_index": 442, + "end_index": 557, + "url": "https://.../?utm_source=chatgpt.com", + "title": "..." + }, + { + "type": "url_citation", + "start_index": 962, + "end_index": 1077, + "url": "https://.../?utm_source=chatgpt.com", + "title": "..." + }, + { + "type": "url_citation", + "start_index": 1336, + "end_index": 1451, + "url": "https://.../?utm_source=chatgpt.com", + "title": "..." + } + ] + } + ] + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [ + { + "type": "web_search_preview", + "domains": [], + "search_context_size": "medium", + "user_location": { + "type": "approximate", + "city": null, + "country": "US", + "region": null, + "timezone": null + } + } + ], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 328, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 356, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 684 + }, + "user": null, + "metadata": {} + } + - title: File search + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "tools": [{ + "type": "file_search", + "vector_store_ids": ["vs_1234567890"], + "max_num_results": 20 + }], + "input": "What are the attributes of an ancient brown dragon?" + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-5.4", + tools: [{ + type: "file_search", + vector_store_ids: ["vs_1234567890"], + max_num_results: 20 + }], + input: "What are the attributes of an ancient brown dragon?", + }); + + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.beta.responses.create(): + print(response) + csharp: > + using System; + + + using OpenAI.Responses; + + + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + string userInputText = "What are the attributes of an ancient + brown dragon?"; + + + ResponseCreationOptions options = new() + + { + Tools = + { + ResponseTool.CreateFileSearchTool( + vectorStoreIds: ["vs_1234567890"], + maxResultCount: 20 + ) + }, + }; + + + OpenAIResponse response = client.CreateResponse(userInputText, + options); + + + Console.WriteLine(response.GetOutputText()); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const betaResponse = await client.beta.responses.create(); + + console.log(betaResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbetaResponse, err := client.Beta.Responses.New(context.TODO(), openai.BetaResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", betaResponse.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.BetaResponse; + import com.openai.models.beta.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BetaResponse betaResponse = client.beta().responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + beta_response = openai.beta.responses.create + + puts(beta_response) + response: | + { + "id": "resp_67ccf4c55fc48190b71bd0463ad3306d09504fb6872380d7", + "object": "response", + "created_at": 1741485253, + "status": "completed", + "completed_at": 1741485254, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-5.4", + "output": [ + { + "type": "file_search_call", + "id": "fs_67ccf4c63cd08190887ef6464ba5681609504fb6872380d7", + "status": "completed", + "queries": [ + "attributes of an ancient brown dragon" + ], + "results": null + }, + { + "type": "message", + "id": "msg_67ccf4c93e5c81909d595b369351a9d309504fb6872380d7", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "The attributes of an ancient brown dragon include...", + "annotations": [ + { + "type": "file_citation", + "index": 320, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 576, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 815, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 815, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 1030, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 1030, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 1156, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + }, + { + "type": "file_citation", + "index": 1225, + "file_id": "file-4wDz5b167pAf72nx1h9eiN", + "filename": "dragons.pdf" + } + ] + } + ] + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [ + { + "type": "file_search", + "filters": null, + "max_num_results": 20, + "ranking_options": { + "ranker": "auto", + "score_threshold": 0.0 + }, + "vector_store_ids": [ + "vs_1234567890" + ] + } + ], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 18307, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 348, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18655 + }, + "user": null, + "metadata": {} + } + - title: Streaming + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "instructions": "You are a helpful assistant.", + "input": "Hello!", + "stream": true + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.beta.responses.create(): + print(response) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-5.4", + instructions: "You are a helpful assistant.", + input: "Hello!", + stream: true, + }); + + for await (const event of response) { + console.log(event); + } + csharp: > + using System; + + using System.ClientModel; + + using System.Threading.Tasks; + + + using OpenAI.Responses; + + + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + string userInputText = "Hello!"; + + + ResponseCreationOptions options = new() + + { + Instructions = "You are a helpful assistant.", + }; + + + AsyncCollectionResult responseUpdates = + client.CreateResponseStreamingAsync(userInputText, options); + + + await foreach (StreamingResponseUpdate responseUpdate in + responseUpdates) + + { + if (responseUpdate is StreamingResponseOutputTextDeltaUpdate outputTextDeltaUpdate) + { + Console.Write(outputTextDeltaUpdate.Delta); + } + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const betaResponse = await client.beta.responses.create(); + + console.log(betaResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbetaResponse, err := client.Beta.Responses.New(context.TODO(), openai.BetaResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", betaResponse.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.BetaResponse; + import com.openai.models.beta.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BetaResponse betaResponse = client.beta().responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + beta_response = openai.beta.responses.create + + puts(beta_response) + response: > + event: response.created + + data: + {"type":"response.created","response":{"id":"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654","object":"response","created_at":1741290958,"status":"in_progress","error":null,"incomplete_details":null,"instructions":"You + are a helpful + assistant.","max_output_tokens":null,"model":"gpt-5.4","output":[],"parallel_tool_calls":true,"previous_response_id":null,"reasoning":{"effort":null,"summary":null},"store":true,"temperature":1.0,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[],"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}}} + + + event: response.in_progress + + data: + {"type":"response.in_progress","response":{"id":"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654","object":"response","created_at":1741290958,"status":"in_progress","error":null,"incomplete_details":null,"instructions":"You + are a helpful + assistant.","max_output_tokens":null,"model":"gpt-5.4","output":[],"parallel_tool_calls":true,"previous_response_id":null,"reasoning":{"effort":null,"summary":null},"store":true,"temperature":1.0,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[],"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}}} + + + event: response.output_item.added + + data: + {"type":"response.output_item.added","output_index":0,"item":{"id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","type":"message","status":"in_progress","role":"assistant","content":[]}} + + + event: response.content_part.added + + data: + {"type":"response.content_part.added","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"part":{"type":"output_text","text":"","annotations":[]}} + + + event: response.output_text.delta + + data: + {"type":"response.output_text.delta","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"delta":"Hi"} + + + ... + + + event: response.output_text.done + + data: + {"type":"response.output_text.done","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"text":"Hi + there! How can I assist you today?"} + + + event: response.content_part.done + + data: + {"type":"response.content_part.done","item_id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","output_index":0,"content_index":0,"part":{"type":"output_text","text":"Hi + there! How can I assist you today?","annotations":[]}} + + + event: response.output_item.done + + data: + {"type":"response.output_item.done","output_index":0,"item":{"id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","type":"message","status":"completed","role":"assistant","content":[{"type":"output_text","text":"Hi + there! How can I assist you today?","annotations":[]}]}} + + + event: response.completed + + data: + {"type":"response.completed","response":{"id":"resp_67c9fdcecf488190bdd9a0409de3a1ec07b8b0ad4e5eb654","object":"response","created_at":1741290958,"status":"completed","error":null,"incomplete_details":null,"instructions":"You + are a helpful + assistant.","max_output_tokens":null,"model":"gpt-5.4","output":[{"id":"msg_67c9fdcf37fc8190ba82116e33fb28c507b8b0ad4e5eb654","type":"message","status":"completed","role":"assistant","content":[{"type":"output_text","text":"Hi + there! How can I assist you + today?","annotations":[]}]}],"parallel_tool_calls":true,"previous_response_id":null,"reasoning":{"effort":null,"summary":null},"store":true,"temperature":1.0,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[],"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":37,"output_tokens":11,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":48},"user":null,"metadata":{}}} + - title: Functions + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.4", + "input": "What is the weather like in Boston today?", + "tools": [ + { + "type": "function", + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": { + "type": "string", + "enum": ["celsius", "fahrenheit"] + } + }, + "required": ["location", "unit"] + } + } + ], + "tool_choice": "auto" + }' + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.beta.responses.create(): + print(response) + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const tools = [ + { + type: "function", + name: "get_current_weather", + description: "Get the current weather in a given location", + parameters: { + type: "object", + properties: { + location: { + type: "string", + description: "The city and state, e.g. San Francisco, CA", + }, + unit: { type: "string", enum: ["celsius", "fahrenheit"] }, + }, + required: ["location", "unit"], + }, + }, + ]; + + const response = await openai.responses.create({ + model: "gpt-5.4", + tools: tools, + input: "What is the weather like in Boston today?", + tool_choice: "auto", + }); + + console.log(response); + csharp: > + using System; + + using OpenAI.Responses; + + + OpenAIResponseClient client = new( + model: "gpt-5.4", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + ResponseTool getCurrentWeatherFunctionTool = + ResponseTool.CreateFunctionTool( + functionName: "get_current_weather", + functionDescription: "Get the current weather in a given location", + functionParameters: BinaryData.FromString(""" + { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]} + }, + "required": ["location", "unit"] + } + """ + ) + ); + + + string userInputText = "What is the weather like in Boston + today?"; + + + ResponseCreationOptions options = new() + + { + Tools = + { + getCurrentWeatherFunctionTool + }, + ToolChoice = ResponseToolChoice.CreateAutoChoice(), + }; + + + OpenAIResponse response = client.CreateResponse(userInputText, + options); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const betaResponse = await client.beta.responses.create(); + + console.log(betaResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbetaResponse, err := client.Beta.Responses.New(context.TODO(), openai.BetaResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", betaResponse.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.BetaResponse; + import com.openai.models.beta.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BetaResponse betaResponse = client.beta().responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + beta_response = openai.beta.responses.create + + puts(beta_response) + response: | + { + "id": "resp_67ca09c5efe0819096d0511c92b8c890096610f474011cc0", + "object": "response", + "created_at": 1741294021, + "status": "completed", + "completed_at": 1741294022, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-5.4", + "output": [ + { + "type": "function_call", + "id": "fc_67ca09c6bedc8190a7abfec07b1a1332096610f474011cc0", + "call_id": "call_unLAR8MvFNptuiZK6K6HCy5k", + "name": "get_current_weather", + "arguments": "{\"location\":\"Boston, MA\",\"unit\":\"celsius\"}", + "status": "completed" + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [ + { + "type": "function", + "description": "Get the current weather in a given location", + "name": "get_current_weather", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": { + "type": "string", + "enum": [ + "celsius", + "fahrenheit" + ] + } + }, + "required": [ + "location", + "unit" + ] + }, + "strict": true + } + ], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 291, + "output_tokens": 23, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 314 + }, + "user": null, + "metadata": {} + } + - title: Reasoning + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "o3-mini", + "input": "How much wood would a woodchuck chuck?", + "reasoning": { + "effort": "high" + } + }' + javascript: | + import OpenAI from "openai"; + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "o3-mini", + input: "How much wood would a woodchuck chuck?", + reasoning: { + effort: "high" + } + }); + + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.beta.responses.create(): + print(response) + csharp: > + using System; + + using OpenAI.Responses; + + + OpenAIResponseClient client = new( + model: "o3-mini", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + + string userInputText = "How much wood would a woodchuck chuck?"; + + + ResponseCreationOptions options = new() + + { + ReasoningOptions = new() + { + ReasoningEffortLevel = ResponseReasoningEffortLevel.High, + }, + }; + + + OpenAIResponse response = client.CreateResponse(userInputText, + options); + + + Console.WriteLine(response.GetOutputText()); + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const betaResponse = await client.beta.responses.create(); + + console.log(betaResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbetaResponse, err := client.Beta.Responses.New(context.TODO(), openai.BetaResponseNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", betaResponse.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.BetaResponse; + import com.openai.models.beta.responses.ResponseCreateParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BetaResponse betaResponse = client.beta().responses().create(); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + beta_response = openai.beta.responses.create + + puts(beta_response) + response: | + { + "id": "resp_67ccd7eca01881908ff0b5146584e408072912b2993db808", + "object": "response", + "created_at": 1741477868, + "status": "completed", + "completed_at": 1741477869, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "o1-2024-12-17", + "output": [ + { + "type": "message", + "id": "msg_67ccd7f7b5848190a6f3e95d809f6b44072912b2993db808", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "The classic tongue twister...", + "annotations": [] + } + ] + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": "high", + "summary": null + }, + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 81, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 1035, + "output_tokens_details": { + "reasoning_tokens": 832 + }, + "total_tokens": 1116 + }, + "user": null, + "metadata": {} + } + parameters: + - name: openai-beta + in: header + required: false + description: Optional beta features to enable for this request. + style: simple + explode: false + schema: + type: array + x-stainless-param: betas + items: + type: string + enum: + - responses_multi_agent=v1 + /responses/{response_id}?beta=true: + get: + operationId: beta_getResponse + tags: + - Responses + summary: | + Retrieves a model response with the given ID. + parameters: + - in: path + name: response_id + required: true + schema: + type: string + example: resp_677efb5139a88190b512bc3fef8e535d + description: The ID of the response to retrieve. + - in: query + name: include + schema: + type: array + items: + $ref: '#/components/schemas/BetaIncludeEnum' + description: | + Additional fields to include in the response. See the `include` + parameter for Response creation above for more information. + - in: query + name: stream + schema: + type: boolean + description: > + If set to true, the model response data will be streamed to the + client + + as it is generated using [server-sent + events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + + See the [Streaming section + below](/docs/api-reference/responses-streaming) + + for more information. + - in: query + name: starting_after + schema: + type: integer + description: | + The sequence number of the event after which to start streaming. + - in: query + name: include_obfuscation + schema: + type: boolean + description: > + When true, stream obfuscation will be enabled. Stream obfuscation + adds + + random characters to an `obfuscation` field on streaming delta + events + + to normalize payload sizes as a mitigation to certain side-channel + + attacks. These obfuscation fields are included by default, but add a + + small amount of overhead to the data stream. You can set + + `include_obfuscation` to false to optimize for bandwidth if you + trust + + the network links between your application and the OpenAI API. + - name: openai-beta + in: header + required: false + description: Optional beta features to enable for this request. + style: simple + explode: false + schema: + type: array + x-stainless-param: betas + items: + type: string + enum: + - responses_multi_agent=v1 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BetaResponse' + x-oaiMeta: + name: Get a model response + group: responses + examples: + request: + curl: | + curl https://api.openai.com/v1/responses/resp_123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const response = await client.responses.retrieve("resp_123"); + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + for response in client.beta.responses.retrieve( + response_id="resp_677efb5139a88190b512bc3fef8e535d", + ): + print(response) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const betaResponse = await + client.beta.responses.retrieve('resp_677efb5139a88190b512bc3fef8e535d'); + + + console.log(betaResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbetaResponse, err := client.Beta.Responses.Get(\n\t\tcontext.TODO(),\n\t\t\"resp_677efb5139a88190b512bc3fef8e535d\",\n\t\topenai.BetaResponseGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", betaResponse.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.BetaResponse; + import com.openai.models.beta.responses.ResponseRetrieveParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BetaResponse betaResponse = client.beta().responses().retrieve("resp_677efb5139a88190b512bc3fef8e535d"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + beta_response = + openai.beta.responses.retrieve("resp_677efb5139a88190b512bc3fef8e535d") + + + puts(beta_response) + response: | + { + "id": "resp_67cb71b351908190a308f3859487620d06981a8637e6bc44", + "object": "response", + "created_at": 1741386163, + "status": "completed", + "completed_at": 1741386164, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", + "output": [ + { + "type": "message", + "id": "msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "Silent circuits hum, \nThoughts emerge in data streams— \nDigital dawn breaks.", + "annotations": [] + } + ] + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 32, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 18, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 50 + }, + "user": null, + "metadata": {} + } + delete: + operationId: beta_deleteResponse + tags: + - Responses + summary: | + Deletes a model response with the given ID. + parameters: + - in: path + name: response_id + required: true + schema: + type: string + example: resp_677efb5139a88190b512bc3fef8e535d + description: The ID of the response to delete. + - name: openai-beta + in: header + required: false + description: Optional beta features to enable for this request. + style: simple + explode: false + schema: + type: array + x-stainless-param: betas + items: + type: string + enum: + - responses_multi_agent=v1 + responses: + '200': + description: OK + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/BetaError' + x-oaiMeta: + name: Delete a model response + group: responses + examples: + request: + curl: | + curl -X DELETE https://api.openai.com/v1/responses/resp_123 \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const response = await client.responses.delete("resp_123"); + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + client.beta.responses.delete( + response_id="resp_677efb5139a88190b512bc3fef8e535d", + ) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + await + client.beta.responses.delete('resp_677efb5139a88190b512bc3fef8e535d'); + go: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.Beta.Responses.Delete(\n\t\tcontext.TODO(),\n\t\t\"resp_677efb5139a88190b512bc3fef8e535d\",\n\t\topenai.BetaResponseDeleteParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.ResponseDeleteParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + client.beta().responses().delete("resp_677efb5139a88190b512bc3fef8e535d"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + result = + openai.beta.responses.delete("resp_677efb5139a88190b512bc3fef8e535d") + + + puts(result) + response: | + { + "id": "resp_6786a1bec27481909a17d673315b29f6", + "object": "response", + "deleted": true + } + /responses/{response_id}/cancel?beta=true: + post: + operationId: beta_cancelResponse + tags: + - Responses + summary: | + Cancels a model response with the given ID. Only responses created with + the `background` parameter set to `true` can be cancelled. + [Learn more](/docs/guides/background). + parameters: + - in: path + name: response_id + required: true + schema: + type: string + example: resp_677efb5139a88190b512bc3fef8e535d + description: The ID of the response to cancel. + - name: openai-beta + in: header + required: false + description: Optional beta features to enable for this request. + style: simple + explode: false + schema: + type: array + x-stainless-param: betas + items: + type: string + enum: + - responses_multi_agent=v1 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BetaResponse' + '404': + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/BetaError' + x-oaiMeta: + name: Cancel a response + group: responses + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/responses/resp_123/cancel \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: | + import OpenAI from "openai"; + const client = new OpenAI(); + + const response = await client.responses.cancel("resp_123"); + console.log(response); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + beta_response = client.beta.responses.cancel( + response_id="resp_677efb5139a88190b512bc3fef8e535d", + ) + print(beta_response.id) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const betaResponse = await + client.beta.responses.cancel('resp_677efb5139a88190b512bc3fef8e535d'); + + + console.log(betaResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbetaResponse, err := client.Beta.Responses.Cancel(\n\t\tcontext.TODO(),\n\t\t\"resp_677efb5139a88190b512bc3fef8e535d\",\n\t\topenai.BetaResponseCancelParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", betaResponse.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.BetaResponse; + import com.openai.models.beta.responses.ResponseCancelParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + BetaResponse betaResponse = client.beta().responses().cancel("resp_677efb5139a88190b512bc3fef8e535d"); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + beta_response = + openai.beta.responses.cancel("resp_677efb5139a88190b512bc3fef8e535d") + + + puts(beta_response) + response: | + { + "id": "resp_67cb71b351908190a308f3859487620d06981a8637e6bc44", + "object": "response", + "created_at": 1741386163, + "status": "cancelled", + "background": true, + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", + "output": [ + { + "type": "message", + "id": "msg_67cb71b3c2b0819084d481baaaf148f206981a8637e6bc44", + "status": "in_progress", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "Silent circuits hum, \nThoughts emerge in data streams— \nDigital dawn breaks.", + "annotations": [] + } + ] + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1.0, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + } + /responses/compact?beta=true: + post: + summary: >- + Compact a conversation. Returns a compacted response object. + + + Learn when and how to compact long-running conversations in the + [conversation state + guide](/docs/guides/conversation-state#managing-the-context-window). For + ZDR-compatible compaction details, see [Compaction + (advanced)](/docs/guides/conversation-state#compaction-advanced). + operationId: beta_Compactconversation + parameters: + - name: openai-beta + in: header + required: false + description: Optional beta features to enable for this request. + style: simple + explode: false + schema: + type: array + x-stainless-param: betas + items: + type: string + enum: + - responses_multi_agent=v1 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCompactResponseMethodPublicBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCompactResource' + x-oaiMeta: + name: Compact a response + group: responses + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/responses/compact \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5.1-codex-max", + "input": [ + { + "role": "user", + "content": "Create a simple landing page for a dog petting café." + }, + { + "id": "msg_001", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "Below is a single file, ready-to-use landing page for a dog petting café:..." + } + ], + "role": "assistant" + } + ] + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + // Compact the previous response if you are running out of tokens + const compactedResponse = await openai.responses.compact({ + model: "gpt-5.1-codex-max", + input: [ + { + role: "user", + content: "Create a simple landing page for a dog petting café.", + }, + // All items returned from previous requests are included here, like reasoning, message, function call, etc. + { + id: "msg_030d085c0b53e67e0069332e3a72d4819c96c6f2c4adc15d33", + type: "message", + status: "completed", + content: [ + { + type: "output_text", + annotations: [], + logprobs: [], + text: "Below is a single file, ready-to-use landing page for a dog petting café:...", + }, + ], + role: "assistant", + }, + ], + }); + + // Pass the compactedResponse.output as input to the next request + console.log(compactedResponse); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + beta_compacted_response = client.beta.responses.compact( + model="gpt-5.6-sol", + ) + print(beta_compacted_response.id) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + const betaCompactedResponse = await + client.beta.responses.compact({ model: 'gpt-5.6-sol' }); + + + console.log(betaCompactedResponse.id); + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tbetaCompactedResponse, err := client.Beta.Responses.Compact(context.TODO(), openai.BetaResponseCompactParams{\n\t\tModel: openai.BetaResponseCompactParamsModelGPT5_6Sol,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", betaCompactedResponse.ID)\n}\n" + java: |- + package com.openai.example; + + import com.openai.client.OpenAIClient; + import com.openai.client.okhttp.OpenAIOkHttpClient; + import com.openai.models.beta.responses.BetaCompactedResponse; + import com.openai.models.beta.responses.ResponseCompactParams; + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + ResponseCompactParams params = ResponseCompactParams.builder() + .model(ResponseCompactParams.Model.GPT_5_6_SOL) + .build(); + BetaCompactedResponse betaCompactedResponse = client.beta().responses().compact(params); + } + } + ruby: >- + require "openai" + + + openai = OpenAI::Client.new(api_key: "My API Key") + + + beta_compacted_response = openai.beta.responses.compact(model: + :"gpt-5.6-sol") + + + puts(beta_compacted_response) + response: | + { + "id": "resp_001", + "object": "response.compaction", + "created_at": 1764967971, + "output": [ + { + "id": "msg_000", + "type": "message", + "status": "completed", + "content": [ + { + "type": "input_text", + "text": "Create a simple landing page for a dog petting cafe." + } + ], + "role": "user" + }, + { + "id": "cmp_001", + "type": "compaction", + "encrypted_content": "gAAAAABpM0Yj-...=" + } + ], + "usage": { + "input_tokens": 139, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 438, + "output_tokens_details": { + "reasoning_tokens": 64 + }, + "total_tokens": 577 + } + } + /responses/{response_id}/input_items?beta=true: + get: + operationId: beta_listInputItems + tags: + - Responses + summary: Returns a list of input items for a given response. + parameters: + - in: path + name: response_id + required: true + schema: + type: string + description: The ID of the response to retrieve input items for. + - name: limit + in: query + description: > + A limit on the number of objects to be returned. Limit can range + between + + 1 and 100, and the default is 20. + required: false + schema: + type: integer + default: 20 + - in: query + name: order + schema: + type: string + enum: + - asc + - desc + description: | + The order to return the input items in. Default is `desc`. + - `asc`: Return the input items in ascending order. + - `desc`: Return the input items in descending order. + - in: query + name: after + schema: + type: string + description: | + An item ID to list items after, used in pagination. + - in: query + name: include + schema: + type: array + items: + $ref: '#/components/schemas/BetaIncludeEnum' + description: | + Additional fields to include in the response. See the `include` + parameter for Response creation above for more information. + - name: openai-beta + in: header + required: false + description: Optional beta features to enable for this request. + style: simple + explode: false + schema: + type: array + x-stainless-param: betas + items: + type: string + enum: + - responses_multi_agent=v1 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BetaResponseItemList' + x-oaiMeta: + name: List input items + group: responses + examples: + request: + curl: | + curl https://api.openai.com/v1/responses/resp_abc123/input_items \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" + javascript: > + import OpenAI from "openai"; + + const client = new OpenAI(); + + + const response = await + client.responses.inputItems.list("resp_123"); + + console.log(response.data); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + page = client.beta.responses.input_items.list( + response_id="response_id", + ) + page = page.data[0] + print(page) + node.js: >- + import OpenAI from 'openai'; + + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + + // Automatically fetches more pages as needed. + + for await (const betaResponseItem of + client.beta.responses.inputItems.list('response_id')) { + console.log(betaResponseItem); + } + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Beta.Responses.InputItems.List(\n\t\tcontext.TODO(),\n\t\t\"response_id\",\n\t\topenai.BetaResponseInputItemListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.beta.responses.inputitems.InputItemListPage; + + import + com.openai.models.beta.responses.inputitems.InputItemListParams; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + InputItemListPage page = client.beta().responses().inputItems().list("response_id"); + } + } + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + page = openai.beta.responses.input_items.list("response_id") + + puts(page) + response: | + { + "object": "list", + "data": [ + { + "id": "msg_abc123", + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Tell me a three sentence bedtime story about a unicorn." + } + ] + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc123", + "has_more": false + } + /responses/input_tokens?beta=true: + post: + summary: >- + Returns input token counts of the request. + + + Returns an object with `object` set to `response.input_tokens` and an + `input_tokens` count. + operationId: beta_Getinputtokencounts + parameters: + - name: openai-beta + in: header + required: false + description: Optional beta features to enable for this request. + style: simple + explode: false + schema: + type: array + x-stainless-param: betas + items: + type: string + enum: + - responses_multi_agent=v1 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BetaTokenCountsBody' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/BetaTokenCountsResource' + x-oaiMeta: + name: Get input token counts + group: responses + examples: + request: + curl: | + curl -X POST https://api.openai.com/v1/responses/input_tokens \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-5", + "input": "Tell me a joke." + }' + javascript: | + import OpenAI from "openai"; + + const client = new OpenAI(); + + const response = await client.responses.inputTokens.count({ + model: "gpt-5", + input: "Tell me a joke.", + }); + + console.log(response.input_tokens); + python: |- + import os + from openai import OpenAI + + client = OpenAI( + api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted + ) + response = client.beta.responses.input_tokens.count() + print(response.input_tokens) + go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Beta.Responses.InputTokens.Count(context.TODO(), openai.BetaResponseInputTokenCountParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.InputTokens)\n}\n" + ruby: |- + require "openai" + + openai = OpenAI::Client.new(api_key: "My API Key") + + response = openai.beta.responses.input_tokens.count + + puts(response) + java: >- + package com.openai.example; + + + import com.openai.client.OpenAIClient; + + import com.openai.client.okhttp.OpenAIOkHttpClient; + + import + com.openai.models.beta.responses.inputtokens.InputTokenCountParams; + + import + com.openai.models.beta.responses.inputtokens.InputTokenCountResponse; + + + public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + InputTokenCountResponse response = client.beta().responses().inputTokens().count(); + } + } + node.js: |- + import OpenAI from 'openai'; + + const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted + }); + + const response = await client.beta.responses.inputTokens.count(); + + console.log(response.input_tokens); + response: | + { + "object": "response.input_tokens", + "input_tokens": 11 + } +webhooks: + batch_cancelled: + post: + description: | + Sent when a batch has been cancelled. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookBatchCancelled' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + batch_completed: + post: + description: | + Sent when a batch has completed processing. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookBatchCompleted' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + batch_expired: + post: + description: | + Sent when a batch has expired before completion. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookBatchExpired' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + batch_failed: + post: + description: | + Sent when a batch has failed. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookBatchFailed' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + eval_run_canceled: + post: + description: | + Sent when an eval run has been canceled. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookEvalRunCanceled' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + eval_run_failed: + post: + description: | + Sent when an eval run has failed. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookEvalRunFailed' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + eval_run_succeeded: + post: + description: | + Sent when an eval run has succeeded. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookEvalRunSucceeded' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + fine_tuning_job_cancelled: + post: + description: | + Sent when a fine-tuning job has been cancelled. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookFineTuningJobCancelled' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + fine_tuning_job_failed: + post: + description: | + Sent when a fine-tuning job has failed. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookFineTuningJobFailed' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + fine_tuning_job_succeeded: + post: + description: | + Sent when a fine-tuning job has succeeded. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookFineTuningJobSucceeded' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + realtime_call_incoming: + post: + description: | + Sent when Realtime API Receives a incoming SIP call. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookRealtimeCallIncoming' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + response_cancelled: + post: + description: | + Sent when a background response has been cancelled. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookResponseCancelled' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + response_completed: + post: + description: | + Sent when a background response has completed successfully. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookResponseCompleted' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + response_failed: + post: + description: | + Sent when a background response has failed. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookResponseFailed' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + response_incomplete: + post: + description: | + Sent when a background response is incomplete. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookResponseIncomplete' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. + safety_identifier_blocked: + post: + description: > + Sent when a request associated with a safety identifier has been + blocked. + requestBody: + description: The event payload sent by the API. + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookSafetyIdentifierBlocked' + responses: + '200': + description: > + Return a 200 status code to acknowledge receipt of the event. + Non-200 + + status codes will be retried. +components: + schemas: + AddUploadPartRequest: + type: object + additionalProperties: false + properties: + data: + description: | + The chunk of bytes for this Part. + type: string + format: binary + required: + - data + AdminApiKey: + type: object + description: Represents an individual Admin API key in an org. + properties: + object: + type: string + enum: + - organization.admin_api_key + description: The object type, which is always `organization.admin_api_key` + x-stainless-const: true + id: + type: string + example: key_abc + description: The identifier, which can be referenced in API endpoints + name: + anyOf: + - type: string + - type: 'null' + example: Administration Key + description: The name of the API key + redacted_value: + type: string + example: sk-admin...def + description: The redacted value of the API key + created_at: + type: integer + format: unixtime + example: 1711471533 + description: The Unix timestamp (in seconds) of when the API key was created + expires_at: + anyOf: + - type: integer + format: unixtime + example: 1714063533 + description: The Unix timestamp (in seconds) of when the API key expires + - type: 'null' + last_used_at: + anyOf: + - type: integer + format: unixtime + example: 1711471534 + description: >- + The Unix timestamp (in seconds) of when the API key was last + used + - type: 'null' + owner: + type: object + properties: + type: + type: string + example: user + description: Always `user` + object: + type: string + example: organization.user + description: The object type, which is always organization.user + id: + type: string + example: sa_456 + description: The identifier, which can be referenced in API endpoints + name: + type: string + example: My Service Account + description: The name of the user + created_at: + type: integer + format: unixtime + example: 1711471533 + description: The Unix timestamp (in seconds) of when the user was created + role: + type: string + example: owner + description: Always `owner` + required: + - object + - redacted_value + - created_at + - expires_at + - id + - owner + x-oaiMeta: + name: The admin API key object + example: | + { + "object": "organization.admin_api_key", + "id": "key_abc", + "name": "Main Admin Key", + "redacted_value": "sk-admin...xyz", + "created_at": 1711471533, + "last_used_at": 1711471534, + "owner": { + "type": "user", + "object": "organization.user", + "id": "user_123", + "name": "John Doe", + "created_at": 1711471533, + "role": "owner" + } + } + AdminApiKeyCreateResponse: + allOf: + - $ref: '#/components/schemas/AdminApiKey' + - type: object + description: >- + The newly created admin API key. The `value` field is only returned + once, when the key is created. + properties: + value: + type: string + example: sk-admin-1234abcd + description: The value of the API key. Only shown on create. + required: + - value + ApiKeyList: + type: object + properties: + object: + type: string + enum: + - list + example: list + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/AdminApiKey' + has_more: + type: boolean + example: false + first_id: + anyOf: + - type: string + - type: 'null' + example: key_abc + last_id: + anyOf: + - type: string + - type: 'null' + example: key_xyz + required: + - object + - data + - has_more + AssignedRoleDetails: + type: object + description: >- + Detailed information about a role assignment entry returned when listing + assignments. + properties: + id: + type: string + description: Identifier for the role. + name: + type: string + description: Name of the role. + permissions: + type: array + description: Permissions associated with the role. + items: + type: string + resource_type: + type: string + description: Resource type the role applies to. + predefined_role: + type: boolean + description: Whether the role is predefined by OpenAI. + description: + description: Description of the role. + anyOf: + - type: string + - type: 'null' + created_at: + description: When the role was created. + anyOf: + - type: integer + format: unixtime + - type: 'null' + updated_at: + description: When the role was last updated. + anyOf: + - type: integer + format: unixtime + - type: 'null' + created_by: + description: Identifier of the actor who created the role. + anyOf: + - type: string + - type: 'null' + created_by_user_obj: + description: User details for the actor that created the role, when available. + anyOf: + - type: object + additionalProperties: true + - type: 'null' + metadata: + description: Arbitrary metadata stored on the role. + anyOf: + - type: object + additionalProperties: true + - type: 'null' + assignment_sources: + description: >- + Principals from which the role assignment is inherited, when + available. + anyOf: + - type: array + items: + type: object + properties: + principal_id: + type: string + principal_type: + type: string + required: + - principal_id + - principal_type + - type: 'null' + required: + - id + - name + - permissions + - resource_type + - predefined_role + - description + - created_at + - updated_at + - created_by + - created_by_user_obj + - metadata + - assignment_sources + AssistantObject: + type: object + title: Assistant + description: Represents an `assistant` that can call the model and use tools. + properties: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `assistant`. + type: string + enum: + - assistant + x-stainless-const: true + created_at: + description: The Unix timestamp (in seconds) for when the assistant was created. + type: integer + format: unixtime + name: + anyOf: + - description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + - type: 'null' + description: + anyOf: + - description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + maxLength: 512 + - type: 'null' + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + type: string + instructions: + anyOf: + - description: > + The system instructions that the assistant uses. The maximum + length is 256,000 characters. + type: string + maxLength: 256000 + - type: 'null' + tools: + description: > + A list of tool enabled on the assistant. There can be a maximum of + 128 tools per assistant. Tools can be of types `code_interpreter`, + `file_search`, or `function`. + default: [] + type: array + maxItems: 128 + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' + tool_resources: + anyOf: + - type: object + description: > + A set of resources that are used by the assistant's tools. The + resources are specific to the type of tool. For example, the + `code_interpreter` tool requires a list of file IDs, while the + `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter`` tool. There can be + a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The ID of the [vector + store](/docs/api-reference/vector-stores/object) + attached to this assistant. There can be a maximum of 1 + vector store attached to the assistant. + maxItems: 1 + items: + type: string + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + anyOf: + - description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values + like 0.2 will make it more focused and deterministic. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + - type: 'null' + top_p: + anyOf: + - type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens + with top_p probability mass. So 0.1 means only the tokens + comprising the top 10% probability mass are considered. + + + We generally recommend altering this or temperature but not + both. + - type: 'null' + response_format: + anyOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + - type: 'null' + required: + - id + - object + - created_at + - name + - description + - model + - instructions + - tools + - metadata + x-oaiMeta: + name: The assistant object + example: | + { + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698984975, + "name": "Math Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.", + "tools": [ + { + "type": "code_interpreter" + } + ], + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } + deprecated: true + AssistantStreamEvent: + description: > + Represents an event emitted when streaming a Run. + + + Each event in a server-sent events stream has an `event` and `data` + property: + + + ``` + + event: thread.created + + data: {"id": "thread_123", "object": "thread", ...} + + ``` + + + We emit events whenever a new object is created, transitions to a new + state, or is being + + streamed in parts (deltas). For example, we emit `thread.run.created` + when a new run + + is created, `thread.run.completed` when a run completes, and so on. When + an Assistant chooses + + to create a message during a run, we emit a `thread.message.created + event`, a + + `thread.message.in_progress` event, many `thread.message.delta` events, + and finally a + + `thread.message.completed` event. + + + We may add additional events over time, so we recommend handling unknown + events gracefully + + in your code. See the [Assistants API + quickstart](/docs/assistants/overview) to learn how to + + integrate the Assistants API with streaming. + oneOf: + - $ref: '#/components/schemas/ThreadStreamEvent' + - $ref: '#/components/schemas/RunStreamEvent' + - $ref: '#/components/schemas/RunStepStreamEvent' + - $ref: '#/components/schemas/MessageStreamEvent' + - $ref: '#/components/schemas/ErrorEvent' + - $ref: '#/components/schemas/DoneEvent' + x-oaiMeta: + name: Assistant stream events + beta: true + AssistantSupportedModels: + type: string + enum: + - gpt-5 + - gpt-5-mini + - gpt-5-nano + - gpt-5-2025-08-07 + - gpt-5-mini-2025-08-07 + - gpt-5-nano-2025-08-07 + - gpt-4.1 + - gpt-4.1-mini + - gpt-4.1-nano + - gpt-4.1-2025-04-14 + - gpt-4.1-mini-2025-04-14 + - gpt-4.1-nano-2025-04-14 + - o3-mini + - o3-mini-2025-01-31 + - o1 + - o1-2024-12-17 + - gpt-4o + - gpt-4o-2024-11-20 + - gpt-4o-2024-08-06 + - gpt-4o-2024-05-13 + - gpt-4o-mini + - gpt-4o-mini-2024-07-18 + - gpt-4.5-preview + - gpt-4.5-preview-2025-02-27 + - gpt-4-turbo + - gpt-4-turbo-2024-04-09 + - gpt-4-0125-preview + - gpt-4-turbo-preview + - gpt-4-1106-preview + - gpt-4-vision-preview + - gpt-4 + - gpt-4-0314 + - gpt-4-0613 + - gpt-4-32k + - gpt-4-32k-0314 + - gpt-4-32k-0613 + - gpt-3.5-turbo + - gpt-3.5-turbo-16k + - gpt-3.5-turbo-0613 + - gpt-3.5-turbo-1106 + - gpt-3.5-turbo-0125 + - gpt-3.5-turbo-16k-0613 + AssistantToolsCode: + type: object + title: Code interpreter tool + properties: + type: + type: string + description: 'The type of tool being defined: `code_interpreter`' + enum: + - code_interpreter + x-stainless-const: true + required: + - type + AssistantToolsFileSearch: + type: object + title: FileSearch tool + properties: + type: + type: string + description: 'The type of tool being defined: `file_search`' + enum: + - file_search + x-stainless-const: true + file_search: + type: object + description: Overrides for the file search tool. + properties: + max_num_results: + type: integer + minimum: 1 + maximum: 50 + description: > + The maximum number of results the file search tool should + output. The default is 20 for `gpt-4*` models and 5 for + `gpt-3.5-turbo`. This number should be between 1 and 50 + inclusive. + + + Note that the file search tool may output fewer than + `max_num_results` results. See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + ranking_options: + $ref: '#/components/schemas/FileSearchRankingOptions' + required: + - type + AssistantToolsFileSearchTypeOnly: + type: object + title: FileSearch tool + properties: + type: + type: string + description: 'The type of tool being defined: `file_search`' + enum: + - file_search + x-stainless-const: true + required: + - type + AssistantToolsFunction: + type: object + title: Function tool + properties: + type: + type: string + description: 'The type of tool being defined: `function`' + enum: + - function + x-stainless-const: true + function: + $ref: '#/components/schemas/FunctionObject' + required: + - type + - function + AssistantsApiResponseFormatOption: + description: > + Specifies the format that the model must output. Compatible with + [GPT-4o](/docs/models#gpt-4o), [GPT-4 + Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models + since `gpt-3.5-turbo-1106`. + + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied JSON + schema. Learn more in the [Structured Outputs + guide](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables JSON mode, which ensures + the message the model generates is valid JSON. + + + **Important:** when using JSON mode, you **must** also instruct the + model to produce JSON yourself via a system or user message. Without + this, the model may generate an unending stream of whitespace until the + generation reaches the token limit, resulting in a long-running and + seemingly "stuck" request. Also note that the message content may be + partially cut off if `finish_reason="length"`, which indicates the + generation exceeded `max_tokens` or the conversation exceeded the max + context length. + oneOf: + - type: string + description: | + `auto` is the default value + enum: + - auto + x-stainless-const: true + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + - $ref: '#/components/schemas/ResponseFormatJsonSchema' + AssistantsApiToolChoiceOption: + description: > + Controls which (if any) tool is called by the model. + + `none` means the model will not call any tools and instead generates a + message. + + `auto` is the default value and means the model can pick between + generating a message or calling one or more tools. + + `required` means the model must call one or more tools before responding + to the user. + + Specifying a particular tool like `{"type": "file_search"}` or `{"type": + "function", "function": {"name": "my_function"}}` forces the model to + call that tool. + oneOf: + - type: string + description: > + `none` means the model will not call any tools and instead generates + a message. `auto` means the model can pick between generating a + message or calling one or more tools. `required` means the model + must call one or more tools before responding to the user. + enum: + - none + - auto + - required + - $ref: '#/components/schemas/AssistantsNamedToolChoice' + AssistantsNamedToolChoice: + type: object + description: >- + Specifies a tool the model should use. Use to force the model to call a + specific tool. + properties: + type: + type: string + enum: + - function + - code_interpreter + - file_search + description: >- + The type of the tool. If type is `function`, the function name must + be set + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + required: + - name + required: + - type + AudioResponseFormat: + description: > + The format of the output, in one of these options: `json`, `text`, + `srt`, `verbose_json`, `vtt`, or `diarized_json`. For + `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported + format is `json`. For `gpt-4o-transcribe-diarize`, the supported formats + are `json`, `text`, and `diarized_json`, with `diarized_json` required + to receive speaker annotations. + type: string + enum: + - json + - text + - srt + - verbose_json + - vtt + - diarized_json + default: json + AudioTranscription: + type: object + properties: + model: + description: > + The model to use for transcription. Current options are `whisper-1`, + `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. + anyOf: + - type: string + - type: string + enum: + - whisper-1 + - gpt-4o-mini-transcribe + - gpt-4o-mini-transcribe-2025-12-15 + - gpt-4o-transcribe + - gpt-4o-transcribe-diarize + - gpt-realtime-whisper + language: + type: string + description: > + The language of the input audio. Supplying the input language in + + [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) + (e.g. `en`) format + + will improve accuracy and latency. + prompt: + type: string + description: > + An optional text to guide the model's style or continue a previous + audio + + segment. + + For `whisper-1`, the [prompt is a list of + keywords](/docs/guides/speech-to-text#prompting). + + For `gpt-4o-transcribe` models (excluding + `gpt-4o-transcribe-diarize`), the prompt is a free text string, for + example "expect words related to technology". + + Prompt is not supported with `gpt-realtime-whisper` in GA Realtime + sessions. + delay: + type: string + description: > + Controls how long the model waits before emitting transcription + text. + + Higher values can improve transcription accuracy at the cost of + latency. + + Only supported with `gpt-realtime-whisper` in GA Realtime sessions. + enum: + - minimal + - low + - medium + - high + - xhigh + AudioTranscriptionResponse: + type: object + properties: + model: + description: > + The model used for transcription. Current options are `whisper-1`, + `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, + `gpt-4o-transcribe`, `gpt-4o-transcribe-diarize`, and + `gpt-realtime-whisper`. + anyOf: + - type: string + - type: string + enum: + - whisper-1 + - gpt-4o-mini-transcribe + - gpt-4o-mini-transcribe-2025-12-15 + - gpt-4o-transcribe + - gpt-4o-transcribe-diarize + - gpt-realtime-whisper + language: + type: string + description: | + The language of the input audio. + prompt: + type: string + description: | + The prompt configured for input audio transcription, when present. + AuditLog: + type: object + description: A log of a user action or configuration change within this organization. + properties: + id: + type: string + description: The ID of this log. + type: + $ref: '#/components/schemas/AuditLogEventType' + effective_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of the event. + project: + type: object + description: >- + The project that the action was scoped to. Absent for actions not + scoped to projects. Note that any admin actions taken via Admin API + keys are associated with the default project. + properties: + id: + type: string + description: The project ID. + name: + type: string + description: The project title. + actor: + anyOf: + - $ref: '#/components/schemas/AuditLogActor' + - type: 'null' + api_key.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The tracking ID of the API key. + data: + type: object + description: The payload used to create the API key. + properties: + scopes: + type: array + items: + type: string + description: >- + A list of scopes allowed for the API key, e.g. + `["api.model.request"]` + api_key.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The tracking ID of the API key. + changes_requested: + type: object + description: The payload used to update the API key. + properties: + scopes: + type: array + items: + type: string + description: >- + A list of scopes allowed for the API key, e.g. + `["api.model.request"]` + api_key.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The tracking ID of the API key. + checkpoint.permission.created: + type: object + description: >- + The project and fine-tuned model checkpoint that the checkpoint + permission was created for. + properties: + id: + type: string + description: The ID of the checkpoint permission. + data: + type: object + description: The payload used to create the checkpoint permission. + properties: + project_id: + type: string + description: >- + The ID of the project that the checkpoint permission was + created for. + fine_tuned_model_checkpoint: + type: string + description: The ID of the fine-tuned model checkpoint. + checkpoint.permission.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the checkpoint permission. + external_key.registered: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the external key configuration. + data: + type: object + description: The configuration for the external key. + external_key.removed: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the external key configuration. + group.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the group. + data: + type: object + description: Information about the created group. + properties: + group_name: + type: string + description: The group name. + group.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the group. + changes_requested: + type: object + description: The payload used to update the group. + properties: + group_name: + type: string + description: The updated group name. + group.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the group. + scim.enabled: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the SCIM was enabled for. + scim.disabled: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the SCIM was disabled for. + invite.sent: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the invite. + data: + type: object + description: The payload used to create the invite. + properties: + email: + type: string + description: The email invited to the organization. + role: + type: string + description: >- + The role the email was invited to be. Is either `owner` or + `member`. + invite.accepted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the invite. + invite.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the invite. + ip_allowlist.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the IP allowlist configuration. + name: + type: string + description: The name of the IP allowlist configuration. + allowed_ips: + type: array + description: The IP addresses or CIDR ranges included in the configuration. + items: + type: string + ip_allowlist.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the IP allowlist configuration. + allowed_ips: + type: array + description: >- + The updated set of IP addresses or CIDR ranges in the + configuration. + items: + type: string + ip_allowlist.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the IP allowlist configuration. + name: + type: string + description: The name of the IP allowlist configuration. + allowed_ips: + type: array + description: The IP addresses or CIDR ranges that were in the configuration. + items: + type: string + ip_allowlist.config.activated: + type: object + description: The details for events with this `type`. + properties: + configs: + type: array + description: The configurations that were activated. + items: + type: object + properties: + id: + type: string + description: The ID of the IP allowlist configuration. + name: + type: string + description: The name of the IP allowlist configuration. + ip_allowlist.config.deactivated: + type: object + description: The details for events with this `type`. + properties: + configs: + type: array + description: The configurations that were deactivated. + items: + type: object + properties: + id: + type: string + description: The ID of the IP allowlist configuration. + name: + type: string + description: The name of the IP allowlist configuration. + login.succeeded: + type: object + description: >- + This event has no additional fields beyond the standard audit log + attributes. + login.failed: + type: object + description: The details for events with this `type`. + properties: + error_code: + type: string + description: The error code of the failure. + error_message: + type: string + description: The error message of the failure. + logout.succeeded: + type: object + description: >- + This event has no additional fields beyond the standard audit log + attributes. + logout.failed: + type: object + description: The details for events with this `type`. + properties: + error_code: + type: string + description: The error code of the failure. + error_message: + type: string + description: The error message of the failure. + organization.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The organization ID. + changes_requested: + type: object + description: The payload used to update the organization settings. + properties: + title: + type: string + description: The organization title. + description: + type: string + description: The organization description. + name: + type: string + description: The organization name. + threads_ui_visibility: + type: string + description: >- + Visibility of the threads page which shows messages created + with the Assistants API and Playground. One of `ANY_ROLE`, + `OWNERS`, or `NONE`. + usage_dashboard_visibility: + type: string + description: >- + Visibility of the usage dashboard which shows activity and + costs for your organization. One of `ANY_ROLE` or `OWNERS`. + api_call_logging: + type: string + description: >- + How your organization logs data from supported API calls. + One of `disabled`, `enabled_per_call`, + `enabled_for_all_projects`, or + `enabled_for_selected_projects` + api_call_logging_project_ids: + type: string + description: >- + The list of project ids if api_call_logging is set to + `enabled_for_selected_projects` + project.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + data: + type: object + description: The payload used to create the project. + properties: + name: + type: string + description: The project name. + title: + type: string + description: The title of the project as seen on the dashboard. + project.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + changes_requested: + type: object + description: The payload used to update the project. + properties: + title: + type: string + description: The title of the project as seen on the dashboard. + project.archived: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + project.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + rate_limit.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The rate limit ID + changes_requested: + type: object + description: The payload used to update the rate limits. + properties: + max_requests_per_1_minute: + type: integer + description: The maximum requests per minute. + max_tokens_per_1_minute: + type: integer + description: The maximum tokens per minute. + max_images_per_1_minute: + type: integer + description: >- + The maximum images per minute. Only relevant for certain + models. + max_audio_megabytes_per_1_minute: + type: integer + description: >- + The maximum audio megabytes per minute. Only relevant for + certain models. + max_requests_per_1_day: + type: integer + description: >- + The maximum requests per day. Only relevant for certain + models. + batch_1_day_max_input_tokens: + type: integer + description: >- + The maximum batch input tokens per day. Only relevant for + certain models. + rate_limit.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The rate limit ID + role.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The role ID. + role_name: + type: string + description: The name of the role. + permissions: + type: array + items: + type: string + description: The permissions granted by the role. + resource_type: + type: string + description: The type of resource the role belongs to. + resource_id: + type: string + description: The resource the role is scoped to. + role.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The role ID. + changes_requested: + type: object + description: The payload used to update the role. + properties: + role_name: + type: string + description: The updated role name, when provided. + resource_id: + type: string + description: The resource the role is scoped to. + resource_type: + type: string + description: The type of resource the role belongs to. + permissions_added: + type: array + items: + type: string + description: The permissions added to the role. + permissions_removed: + type: array + items: + type: string + description: The permissions removed from the role. + description: + type: string + description: The updated role description, when provided. + metadata: + type: object + description: Additional metadata stored on the role. + role.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The role ID. + role.assignment.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The identifier of the role assignment. + principal_id: + type: string + description: The principal (user or group) that received the role. + principal_type: + type: string + description: The type of principal (user or group) that received the role. + resource_id: + type: string + description: The resource the role assignment is scoped to. + resource_type: + type: string + description: The type of resource the role assignment is scoped to. + role.assignment.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The identifier of the role assignment. + principal_id: + type: string + description: The principal (user or group) that had the role removed. + principal_type: + type: string + description: The type of principal (user or group) that had the role removed. + resource_id: + type: string + description: The resource the role assignment was scoped to. + resource_type: + type: string + description: The type of resource the role assignment was scoped to. + role.bound_to_resource: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: >- + The ID of the resource the role was bound to. ChatGPT workspace + connector resources use `__`. + role_id: + type: string + description: The ID of the role that was bound to the resource. + resource_id: + type: string + description: The ID of the resource the role was bound to. + resource_type: + type: string + description: The type of resource the role was bound to. + permissions: + type: array + items: + type: string + description: The permissions granted to the role for the resource. + workspace_id: + type: string + description: The workspace ID for a ChatGPT workspace connector resource. + connector_id: + type: string + description: The connector ID for a ChatGPT workspace connector resource. + connector_name: + type: string + description: >- + The connector display name for a ChatGPT workspace connector + resource, or the connector ID when the display name could not be + resolved. + enabled: + type: boolean + description: Whether the connector is enabled for the role. + source: + type: string + description: The connector role mutation path that produced the event. + enum: + - role_toggle + - role_connector_update + - role_delete + - workspace_permissions + - connector_publish + role.unbound_from_resource: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: >- + The ID of the resource the role was unbound from. ChatGPT + workspace connector resources use + `__`. + role_id: + type: string + description: The ID of the role that was unbound from the resource. + resource_id: + type: string + description: The ID of the resource the role was unbound from. + resource_type: + type: string + description: The type of resource the role was unbound from. + permissions: + type: array + items: + type: string + description: The permissions remaining for the role after the change. + workspace_id: + type: string + description: The workspace ID for a ChatGPT workspace connector resource. + connector_id: + type: string + description: The connector ID for a ChatGPT workspace connector resource. + connector_name: + type: string + description: >- + The connector display name for a ChatGPT workspace connector + resource, or the connector ID when the display name could not be + resolved. + enabled: + type: boolean + description: Whether the connector is enabled for the role. + source: + type: string + description: The connector role mutation path that produced the event. + enum: + - role_toggle + - role_connector_update + - role_delete + - workspace_permissions + - connector_publish + service_account.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The service account ID. + data: + type: object + description: The payload used to create the service account. + properties: + role: + type: string + description: >- + The role of the service account. Is either `owner` or + `member`. + service_account.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The service account ID. + changes_requested: + type: object + description: The payload used to updated the service account. + properties: + role: + type: string + description: >- + The role of the service account. Is either `owner` or + `member`. + service_account.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The service account ID. + workload_identity_provider.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The workload identity provider ID. + data: + type: object + description: The payload used to create the workload identity provider. + workload_identity_provider.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The workload identity provider ID. + changes_requested: + type: object + description: The payload used to update the workload identity provider. + workload_identity_provider.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The workload identity provider ID. + name: + type: string + description: The workload identity provider name. + workload_identity_provider_mapping.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The workload identity provider mapping ID. + identity_provider_id: + type: string + description: The workload identity provider ID. + data: + type: object + description: >- + The payload used to create the workload identity provider + mapping. + workload_identity_provider_mapping.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The workload identity provider mapping ID. + identity_provider_id: + type: string + description: The workload identity provider ID. + changes_requested: + type: object + description: >- + The payload used to update the workload identity provider + mapping. + workload_identity_provider_mapping.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The workload identity provider mapping ID. + identity_provider_id: + type: string + description: The workload identity provider ID. + project_id: + type: string + description: The project ID. + service_account_id: + type: string + description: The mapped service account ID. + user.added: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The user ID. + data: + type: object + description: The payload used to add the user to the project. + properties: + role: + type: string + description: The role of the user. Is either `owner` or `member`. + user.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + changes_requested: + type: object + description: The payload used to update the user. + properties: + role: + type: string + description: The role of the user. Is either `owner` or `member`. + user.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The user ID. + certificate.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The certificate ID. + name: + type: string + description: The name of the certificate. + certificate.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The certificate ID. + name: + type: string + description: The name of the certificate. + certificate.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The certificate ID. + name: + type: string + description: The name of the certificate. + certificate: + type: string + description: The certificate content in PEM format. + certificates.activated: + type: object + description: The details for events with this `type`. + properties: + certificates: + type: array + items: + type: object + properties: + id: + type: string + description: The certificate ID. + name: + type: string + description: The name of the certificate. + certificates.deactivated: + type: object + description: The details for events with this `type`. + properties: + certificates: + type: array + items: + type: object + properties: + id: + type: string + description: The certificate ID. + name: + type: string + description: The name of the certificate. + required: + - id + - type + - effective_at + x-oaiMeta: + name: The audit log object + example: | + { + "id": "req_xxx_20240101", + "type": "api_key.created", + "effective_at": 1720804090, + "actor": { + "type": "session", + "session": { + "user": { + "id": "user-xxx", + "email": "user@example.com" + }, + "ip_address": "127.0.0.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" + } + }, + "api_key.created": { + "id": "key_xxxx", + "data": { + "scopes": ["resource.operation"] + } + } + } + AuditLogActor: + type: object + description: The actor who performed the audit logged action. + properties: + type: + type: string + description: The type of actor. Is either `session` or `api_key`. + enum: + - session + - api_key + session: + $ref: '#/components/schemas/AuditLogActorSession' + api_key: + $ref: '#/components/schemas/AuditLogActorApiKey' + AuditLogActorApiKey: + type: object + description: The API Key used to perform the audit logged action. + properties: + id: + type: string + description: The tracking id of the API key. + type: + type: string + description: The type of API key. Can be either `user` or `service_account`. + enum: + - user + - service_account + user: + $ref: '#/components/schemas/AuditLogActorUser' + service_account: + $ref: '#/components/schemas/AuditLogActorServiceAccount' + AuditLogActorServiceAccount: + type: object + description: The service account that performed the audit logged action. + properties: + id: + type: string + description: The service account id. + AuditLogActorSession: + type: object + description: The session in which the audit logged action was performed. + properties: + user: + $ref: '#/components/schemas/AuditLogActorUser' + ip_address: + type: string + description: The IP address from which the action was performed. + AuditLogActorUser: + type: object + description: The user who performed the audit logged action. + properties: + id: + type: string + description: The user id. + email: + type: string + description: The user email. + AuditLogEventType: + type: string + description: The event type. + enum: + - api_key.created + - api_key.updated + - api_key.deleted + - certificate.created + - certificate.updated + - certificate.deleted + - certificates.activated + - certificates.deactivated + - checkpoint.permission.created + - checkpoint.permission.deleted + - external_key.registered + - external_key.removed + - group.created + - group.updated + - group.deleted + - invite.sent + - invite.accepted + - invite.deleted + - ip_allowlist.created + - ip_allowlist.updated + - ip_allowlist.deleted + - ip_allowlist.config.activated + - ip_allowlist.config.deactivated + - login.succeeded + - login.failed + - logout.succeeded + - logout.failed + - organization.updated + - project.created + - project.updated + - project.archived + - project.deleted + - rate_limit.updated + - rate_limit.deleted + - resource.deleted + - tunnel.created + - tunnel.updated + - tunnel.deleted + - workload_identity_provider.created + - workload_identity_provider.updated + - workload_identity_provider.deleted + - workload_identity_provider_mapping.created + - workload_identity_provider_mapping.updated + - workload_identity_provider_mapping.deleted + - role.created + - role.updated + - role.deleted + - role.assignment.created + - role.assignment.deleted + - role.bound_to_resource + - role.unbound_from_resource + - scim.enabled + - scim.disabled + - service_account.created + - service_account.updated + - service_account.deleted + - user.added + - user.updated + - user.deleted + AutoChunkingStrategyRequestParam: + type: object + title: Auto Chunking Strategy + description: >- + The default strategy. This strategy currently uses a + `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + x-stainless-const: true + required: + - type + Batch: + type: object + properties: + id: + type: string + object: + type: string + enum: + - batch + description: The object type, which is always `batch`. + x-stainless-const: true + endpoint: + type: string + description: The OpenAI API endpoint used by the batch. + model: + type: string + description: > + Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI + + offers a wide range of models with different capabilities, + performance + + characteristics, and price points. Refer to the [model + + guide](/docs/models) to browse and compare available models. + errors: + type: object + properties: + object: + type: string + description: The object type, which is always `list`. + data: + type: array + items: + type: object + properties: + code: + type: string + description: An error code identifying the error type. + message: + type: string + description: >- + A human-readable message providing more details about the + error. + param: + anyOf: + - type: string + description: >- + The name of the parameter that caused the error, if + applicable. + - type: 'null' + line: + anyOf: + - type: integer + description: >- + The line number of the input file where the error + occurred, if applicable. + - type: 'null' + input_file_id: + type: string + description: The ID of the input file for the batch. + completion_window: + type: string + description: The time frame within which the batch should be processed. + status: + type: string + description: The current status of the batch. + enum: + - validating + - failed + - in_progress + - finalizing + - completed + - expired + - cancelling + - cancelled + output_file_id: + type: string + description: >- + The ID of the file containing the outputs of successfully executed + requests. + error_file_id: + type: string + description: The ID of the file containing the outputs of requests with errors. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was created. + in_progress_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the batch started + processing. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch will expire. + finalizing_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the batch started + finalizing. + completed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was completed. + failed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch failed. + expired_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch expired. + cancelling_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the batch started + cancelling. + cancelled_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was cancelled. + request_counts: + type: object + properties: + total: + type: integer + description: Total number of requests in the batch. + completed: + type: integer + description: Number of requests that have been completed successfully. + failed: + type: integer + description: Number of requests that have failed. + required: + - total + - completed + - failed + description: The request counts for different statuses within the batch. + usage: + type: object + description: > + Represents token usage details including input tokens, output + tokens, a + + breakdown of output tokens, and the total tokens used. Only + populated on + + batches created after September 7, 2025. + properties: + input_tokens: + type: integer + description: The number of input tokens. + input_tokens_details: + type: object + description: A detailed breakdown of the input tokens. + properties: + cached_tokens: + type: integer + description: > + The number of tokens that were retrieved from the cache. + [More on + + prompt caching](/docs/guides/prompt-caching). + required: + - cached_tokens + output_tokens: + type: integer + description: The number of output tokens. + output_tokens_details: + type: object + description: A detailed breakdown of the output tokens. + properties: + reasoning_tokens: + type: integer + description: The number of reasoning tokens. + required: + - reasoning_tokens + total_tokens: + type: integer + description: The total number of tokens used. + required: + - input_tokens + - input_tokens_details + - output_tokens + - output_tokens_details + - total_tokens + metadata: + $ref: '#/components/schemas/Metadata' + required: + - id + - object + - endpoint + - input_file_id + - completion_window + - status + - created_at + x-oaiMeta: + name: The batch object + example: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/completions", + "model": "gpt-5-2025-08-07", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "usage": { + "input_tokens": 1500, + "input_tokens_details": { + "cached_tokens": 1024 + }, + "output_tokens": 500, + "output_tokens_details": { + "reasoning_tokens": 300 + }, + "total_tokens": 2000 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + BatchFileExpirationAfter: + type: object + title: File expiration policy + description: >- + The expiration policy for the output and/or error file that are + generated for a batch. + properties: + anchor: + description: >- + Anchor timestamp after which the expiration policy applies. + Supported anchors: `created_at`. Note that the anchor is the file + creation time, not the time the batch is created. + type: string + enum: + - created_at + x-stainless-const: true + seconds: + description: >- + The number of seconds after the anchor time that the file will + expire. Must be between 3600 (1 hour) and 2592000 (30 days). + type: integer + format: int64 + minimum: 3600 + maximum: 2592000 + required: + - anchor + - seconds + Certificate: + type: object + description: Represents an individual `certificate` uploaded to the organization. + properties: + object: + type: string + enum: + - certificate + - organization.certificate + - organization.project.certificate + description: > + The object type. + + + - If creating, updating, or getting a specific certificate, the + object type is `certificate`. + + - If listing, activating, or deactivating certificates for the + organization, the object type is `organization.certificate`. + + - If listing, activating, or deactivating certificates for a + project, the object type is `organization.project.certificate`. + x-stainless-const: true + id: + type: string + description: The identifier, which can be referenced in API endpoints + name: + anyOf: + - type: string + - type: 'null' + description: The name of the certificate. + created_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) of when the certificate was + uploaded. + certificate_details: + type: object + properties: + valid_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) of when the certificate becomes + valid. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the certificate expires. + content: + type: string + description: The content of the certificate in PEM format. + active: + type: boolean + description: >- + Whether the certificate is currently active at the specified scope. + Not returned when getting details for a specific certificate. + required: + - object + - id + - name + - created_at + - certificate_details + x-oaiMeta: + name: The certificate object + example: | + { + "object": "certificate", + "id": "cert_abc", + "name": "My Certificate", + "created_at": 1234567, + "certificate_details": { + "valid_at": 1234567, + "expires_at": 12345678, + "content": "-----BEGIN CERTIFICATE----- MIIGAjCCA...6znFlOW+ -----END CERTIFICATE-----" + } + } + ChatCompletionAllowedTools: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + properties: + mode: + type: string + enum: + - auto + - required + description: > + Constrains the tools available to the model to a pre-defined set. + + + `auto` allows the model to pick from among the allowed tools and + generate a + + message. + + + `required` requires the model to call one or more of the allowed + tools. + tools: + type: array + description: > + A list of tool definitions that the model should be allowed to call. + + + For the Chat Completions API, the list of tool definitions might + look like: + + ```json + + [ + { "type": "function", "function": { "name": "get_weather" } }, + { "type": "function", "function": { "name": "get_time" } } + ] + + ``` + items: + type: object + x-oaiExpandable: false + description: | + A tool definition that the model should be allowed to call. + additionalProperties: true + required: + - mode + - tools + ChatCompletionAllowedToolsChoice: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + properties: + type: + type: string + enum: + - allowed_tools + description: Allowed tool configuration type. Always `allowed_tools`. + x-stainless-const: true + allowed_tools: + $ref: '#/components/schemas/ChatCompletionAllowedTools' + required: + - type + - allowed_tools + ChatCompletionDeleted: + type: object + properties: + object: + type: string + description: The type of object being deleted. + enum: + - chat.completion.deleted + x-stainless-const: true + id: + type: string + description: The ID of the chat completion that was deleted. + deleted: + type: boolean + description: Whether the chat completion was deleted. + required: + - object + - id + - deleted + ChatCompletionFunctionCallOption: + type: object + description: > + Specifying a particular function via `{"name": "my_function"}` forces + the model to call that function. + properties: + name: + type: string + description: The name of the function to call. + required: + - name + ChatCompletionFunctions: + type: object + deprecated: true + properties: + description: + type: string + description: >- + A description of what the function does, used by the model to choose + when and how to call the function. + name: + type: string + description: >- + The name of the function to be called. Must be a-z, A-Z, 0-9, or + contain underscores and dashes, with a maximum length of 64. + parameters: + $ref: '#/components/schemas/FunctionParameters' + required: + - name + ChatCompletionList: + type: object + title: ChatCompletionList + description: | + An object representing a list of Chat Completions. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of chat completion objects. + items: + $ref: '#/components/schemas/CreateChatCompletionResponse' + first_id: + type: string + description: The identifier of the first chat completion in the data array. + last_id: + type: string + description: The identifier of the last chat completion in the data array. + has_more: + type: boolean + description: Indicates whether there are more Chat Completions available. + required: + - object + - data + - first_id + - last_id + - has_more + x-oaiMeta: + name: The chat completion list object + group: chat + example: | + { + "object": "list", + "data": [ + { + "object": "chat.completion", + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "model": "gpt-4o-2024-08-06", + "created": 1738960610, + "request_id": "req_ded8ab984ec4bf840f37566c1011c417", + "tool_choice": null, + "usage": { + "total_tokens": 31, + "completion_tokens": 18, + "prompt_tokens": 13 + }, + "seed": 4944116822809979520, + "top_p": 1.0, + "temperature": 1.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0, + "system_fingerprint": "fp_50cad350e4", + "input_user": null, + "service_tier": "default", + "tools": null, + "metadata": {}, + "choices": [ + { + "index": 0, + "message": { + "content": "Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark.", + "role": "assistant", + "tool_calls": null, + "function_call": null + }, + "finish_reason": "stop", + "logprobs": null + } + ], + "response_format": null + } + ], + "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "has_more": false + } + ChatCompletionMessageCustomToolCall: + type: object + title: Custom tool call + description: | + A call to a custom tool created by the model. + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - custom + description: The type of the tool. Always `custom`. + x-stainless-const: true + custom: + type: object + description: The custom tool that the model called. + properties: + name: + type: string + description: The name of the custom tool to call. + input: + type: string + description: The input for the custom tool call generated by the model. + required: + - name + - input + required: + - id + - type + - custom + ChatCompletionMessageList: + type: object + title: ChatCompletionMessageList + description: | + An object representing a list of chat completion messages. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of chat completion message objects. + items: + allOf: + - $ref: '#/components/schemas/ChatCompletionResponseMessage' + - type: object + required: + - id + properties: + id: + type: string + description: The identifier of the chat message. + content_parts: + anyOf: + - type: array + description: > + If a content parts array was provided, this is an + array of `text` and `image_url` parts. + + Otherwise, null. + items: + oneOf: + - $ref: >- + #/components/schemas/ChatCompletionRequestMessageContentPartText + - $ref: >- + #/components/schemas/ChatCompletionRequestMessageContentPartImage + - type: 'null' + first_id: + type: string + description: The identifier of the first chat message in the data array. + last_id: + type: string + description: The identifier of the last chat message in the data array. + has_more: + type: boolean + description: Indicates whether there are more chat messages available. + required: + - object + - data + - first_id + - last_id + - has_more + x-oaiMeta: + name: The chat completion message list object + group: chat + example: | + { + "object": "list", + "data": [ + { + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "role": "user", + "content": "write a haiku about ai", + "name": null, + "content_parts": null + } + ], + "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "has_more": false + } + ChatCompletionMessageToolCall: + type: object + title: Function tool call + description: | + A call to a function tool created by the model. + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + x-stainless-const: true + function: + type: object + description: The function that the model called. + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: >- + The arguments to call the function with, as generated by the + model in JSON format. Note that the model does not always + generate valid JSON, and may hallucinate parameters not defined + by your function schema. Validate the arguments in your code + before calling your function. + required: + - name + - arguments + required: + - id + - type + - function + ChatCompletionMessageToolCallChunk: + type: object + properties: + index: + type: integer + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + x-stainless-const: true + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: >- + The arguments to call the function with, as generated by the + model in JSON format. Note that the model does not always + generate valid JSON, and may hallucinate parameters not defined + by your function schema. Validate the arguments in your code + before calling your function. + required: + - index + ChatCompletionMessageToolCalls: + type: array + description: The tool calls generated by the model, such as function calls. + items: + oneOf: + - $ref: '#/components/schemas/ChatCompletionMessageToolCall' + - $ref: '#/components/schemas/ChatCompletionMessageCustomToolCall' + discriminator: + propertyName: type + ChatCompletionModalities: + anyOf: + - type: array + description: > + Output types that you would like the model to generate for this + request. + + Most models are capable of generating text, which is the default: + + + `["text"]` + + + The `gpt-4o-audio-preview` model can also be used to [generate + audio](/docs/guides/audio). To + + request that this model generate both text and audio responses, you + can + + use: + + + `["text", "audio"]` + items: + type: string + enum: + - text + - audio + - type: 'null' + ChatCompletionModeration: + type: object + description: Moderation results or errors for the request input and generated output. + properties: + input: + oneOf: + - $ref: '#/components/schemas/ChatCompletionModerationResults' + - $ref: '#/components/schemas/ChatCompletionModerationError' + discriminator: + propertyName: type + description: Moderation for the request input. + output: + oneOf: + - $ref: '#/components/schemas/ChatCompletionModerationResults' + - $ref: '#/components/schemas/ChatCompletionModerationError' + discriminator: + propertyName: type + description: Moderation for the generated output. + required: + - input + - output + ChatCompletionModerationError: + type: object + description: An error produced while attempting moderation. + properties: + type: + type: string + enum: + - error + description: The object type, which is always `error`. + x-stainless-const: true + code: + type: string + description: The error code. + message: + type: string + description: The error message. + required: + - type + - code + - message + ChatCompletionModerationResults: + type: object + description: Successful moderation results for the request input or generated output. + properties: + type: + type: string + enum: + - moderation_results + description: The object type, which is always `moderation_results`. + x-stainless-const: true + model: + type: string + description: The moderation model used to generate the results. + results: + type: array + description: A list of moderation results. + items: + $ref: '#/components/schemas/ModerationResultBody' + required: + - type + - model + - results + ChatCompletionNamedToolChoice: + type: object + title: Function tool choice + description: >- + Specifies a tool the model should use. Use to force the model to call a + specific function. + properties: + type: + type: string + enum: + - function + description: For function calling, the type is always `function`. + x-stainless-const: true + function: + type: object + properties: + name: + type: string + description: The name of the function to call. + required: + - name + required: + - type + - function + ChatCompletionNamedToolChoiceCustom: + type: object + title: Custom tool choice + description: >- + Specifies a tool the model should use. Use to force the model to call a + specific custom tool. + properties: + type: + type: string + enum: + - custom + description: For custom tool calling, the type is always `custom`. + x-stainless-const: true + custom: + type: object + properties: + name: + type: string + description: The name of the custom tool to call. + required: + - name + required: + - type + - custom + ChatCompletionRequestAssistantMessage: + type: object + title: Assistant message + description: | + Messages sent by the model in response to user messages. + properties: + content: + anyOf: + - oneOf: + - type: string + description: The contents of the assistant message. + title: Text content + - type: array + description: >- + An array of content parts with a defined type. Can be one or + more of type `text`, or exactly one of type `refusal`. + title: Array of content parts + items: + $ref: >- + #/components/schemas/ChatCompletionRequestAssistantMessageContentPart + minItems: 1 + description: > + The contents of the assistant message. Required unless + `tool_calls` or `function_call` is specified. + - type: 'null' + refusal: + anyOf: + - type: string + description: The refusal message by the assistant. + - type: 'null' + role: + type: string + enum: + - assistant + description: The role of the messages author, in this case `assistant`. + x-stainless-const: true + name: + type: string + description: >- + An optional name for the participant. Provides the model information + to differentiate between participants of the same role. + audio: + anyOf: + - type: object + description: | + Data about a previous audio response from the model. + [Learn more](/docs/guides/audio). + required: + - id + properties: + id: + type: string + description: > + Unique identifier for a previous audio response from the + model. + - type: 'null' + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCalls' + function_call: + anyOf: + - type: object + deprecated: true + description: >- + Deprecated and replaced by `tool_calls`. The name and arguments + of a function that should be called, as generated by the model. + properties: + arguments: + type: string + description: >- + The arguments to call the function with, as generated by the + model in JSON format. Note that the model does not always + generate valid JSON, and may hallucinate parameters not + defined by your function schema. Validate the arguments in + your code before calling your function. + name: + type: string + description: The name of the function to call. + required: + - arguments + - name + - type: 'null' + required: + - role + ChatCompletionRequestAssistantMessageContentPart: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartRefusal' + discriminator: + propertyName: type + ChatCompletionRequestDeveloperMessage: + type: object + title: Developer message + description: > + Developer-provided instructions that the model should follow, regardless + of + + messages sent by the user. With o1 models and newer, `developer` + messages + + replace the previous `system` messages. + properties: + content: + description: The contents of the developer message. + oneOf: + - type: string + description: The contents of the developer message. + title: Text content + - type: array + description: >- + An array of content parts with a defined type. For developer + messages, only type `text` is supported. + title: Array of content parts + items: + $ref: >- + #/components/schemas/ChatCompletionRequestMessageContentPartText + minItems: 1 + role: + type: string + enum: + - developer + description: The role of the messages author, in this case `developer`. + x-stainless-const: true + name: + type: string + description: >- + An optional name for the participant. Provides the model information + to differentiate between participants of the same role. + required: + - content + - role + ChatCompletionRequestFunctionMessage: + type: object + title: Function message + deprecated: true + properties: + role: + type: string + enum: + - function + description: The role of the messages author, in this case `function`. + x-stainless-const: true + content: + anyOf: + - type: string + description: The contents of the function message. + - type: 'null' + name: + type: string + description: The name of the function to call. + required: + - role + - content + - name + ChatCompletionRequestMessage: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestDeveloperMessage' + - $ref: '#/components/schemas/ChatCompletionRequestSystemMessage' + - $ref: '#/components/schemas/ChatCompletionRequestUserMessage' + - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' + - $ref: '#/components/schemas/ChatCompletionRequestToolMessage' + - $ref: '#/components/schemas/ChatCompletionRequestFunctionMessage' + discriminator: + propertyName: role + ChatCompletionRequestMessageContentPartAudio: + type: object + title: Audio content part + description: | + Learn about [audio inputs](/docs/guides/audio). + properties: + type: + type: string + enum: + - input_audio + description: The type of the content part. Always `input_audio`. + x-stainless-const: true + input_audio: + type: object + properties: + data: + type: string + description: Base64 encoded audio data. + format: + type: string + enum: + - wav + - mp3 + description: > + The format of the encoded audio data. Currently supports "wav" + and "mp3". + required: + - data + - format + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointParam' + required: + - type + - input_audio + ChatCompletionRequestMessageContentPartFile: + type: object + title: File content part + description: | + Learn about [file inputs](/docs/guides/text) for text generation. + properties: + type: + type: string + enum: + - file + description: The type of the content part. Always `file`. + x-stainless-const: true + file: + type: object + properties: + filename: + type: string + description: > + The name of the file, used when passing the file to the model as + a + + string. + file_data: + type: string + description: > + The base64 encoded file data, used when passing the file to the + model + + as a string. + file_id: + type: string + description: | + The ID of an uploaded file to use as input. + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointParam' + required: + - type + - file + ChatCompletionRequestMessageContentPartImage: + type: object + title: Image content part + description: | + Learn about [image inputs](/docs/guides/vision). + properties: + type: + type: string + enum: + - image_url + description: The type of the content part. + x-stainless-const: true + image_url: + type: object + properties: + url: + type: string + description: Either a URL of the image or the base64 encoded image data. + format: uri + detail: + type: string + description: >- + Specifies the detail level of the image. Learn more in the + [Vision + guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). + enum: + - auto + - low + - high + default: auto + required: + - url + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointParam' + required: + - type + - image_url + ChatCompletionRequestMessageContentPartRefusal: + type: object + title: Refusal content part + properties: + type: + type: string + enum: + - refusal + description: The type of the content part. + x-stainless-const: true + refusal: + type: string + description: The refusal message generated by the model. + required: + - type + - refusal + ChatCompletionRequestMessageContentPartText: + type: object + title: Text content part + description: | + Learn about [text inputs](/docs/guides/text-generation). + properties: + type: + type: string + enum: + - text + description: The type of the content part. + x-stainless-const: true + text: + type: string + description: The text content. + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointParam' + required: + - type + - text + ChatCompletionRequestSystemMessage: + type: object + title: System message + description: > + Developer-provided instructions that the model should follow, regardless + of + + messages sent by the user. With o1 models and newer, use `developer` + messages + + for this purpose instead. + properties: + content: + description: The contents of the system message. + oneOf: + - type: string + description: The contents of the system message. + title: Text content + - type: array + description: >- + An array of content parts with a defined type. For system + messages, only type `text` is supported. + title: Array of content parts + items: + $ref: >- + #/components/schemas/ChatCompletionRequestSystemMessageContentPart + minItems: 1 + role: + type: string + enum: + - system + description: The role of the messages author, in this case `system`. + x-stainless-const: true + name: + type: string + description: >- + An optional name for the participant. Provides the model information + to differentiate between participants of the same role. + required: + - content + - role + ChatCompletionRequestSystemMessageContentPart: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + ChatCompletionRequestToolMessage: + type: object + title: Tool message + properties: + role: + type: string + enum: + - tool + description: The role of the messages author, in this case `tool`. + x-stainless-const: true + content: + oneOf: + - type: string + description: The contents of the tool message. + title: Text content + - type: array + description: >- + An array of content parts with a defined type. For tool + messages, only type `text` is supported. + title: Array of content parts + items: + $ref: >- + #/components/schemas/ChatCompletionRequestToolMessageContentPart + minItems: 1 + description: The contents of the tool message. + tool_call_id: + type: string + description: Tool call that this message is responding to. + required: + - role + - content + - tool_call_id + ChatCompletionRequestToolMessageContentPart: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + ChatCompletionRequestUserMessage: + type: object + title: User message + description: | + Messages sent by an end user, containing prompts or additional context + information. + properties: + content: + description: | + The contents of the user message. + oneOf: + - type: string + description: The text contents of the message. + title: Text content + - type: array + description: >- + An array of content parts with a defined type. Supported options + differ based on the [model](/docs/models) being used to generate + the response. Can contain text, image, or audio inputs. + title: Array of content parts + items: + $ref: >- + #/components/schemas/ChatCompletionRequestUserMessageContentPart + minItems: 1 + role: + type: string + enum: + - user + description: The role of the messages author, in this case `user`. + x-stainless-const: true + name: + type: string + description: >- + An optional name for the participant. Provides the model information + to differentiate between participants of the same role. + required: + - content + - role + ChatCompletionRequestUserMessageContentPart: + oneOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartAudio' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartFile' + ChatCompletionResponseMessage: + type: object + description: A chat completion message generated by the model. + properties: + content: + anyOf: + - type: string + description: The contents of the message. + - type: 'null' + refusal: + anyOf: + - type: string + description: The refusal message generated by the model. + - type: 'null' + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCalls' + annotations: + type: array + description: | + Annotations for the message, when applicable, as when using the + [web search tool](/docs/guides/tools-web-search?api-mode=chat). + items: + type: object + description: | + A URL citation when using web search. + required: + - type + - url_citation + properties: + type: + type: string + description: The type of the URL citation. Always `url_citation`. + enum: + - url_citation + x-stainless-const: true + url_citation: + type: object + description: A URL citation when using web search. + required: + - end_index + - start_index + - url + - title + properties: + end_index: + type: integer + description: >- + The index of the last character of the URL citation in the + message. + start_index: + type: integer + description: >- + The index of the first character of the URL citation in + the message. + url: + type: string + format: uri + description: The URL of the web resource. + title: + type: string + description: The title of the web resource. + role: + type: string + enum: + - assistant + description: The role of the author of this message. + x-stainless-const: true + function_call: + type: object + deprecated: true + description: >- + Deprecated and replaced by `tool_calls`. The name and arguments of a + function that should be called, as generated by the model. + properties: + arguments: + type: string + description: >- + The arguments to call the function with, as generated by the + model in JSON format. Note that the model does not always + generate valid JSON, and may hallucinate parameters not defined + by your function schema. Validate the arguments in your code + before calling your function. + name: + type: string + description: The name of the function to call. + required: + - name + - arguments + audio: + anyOf: + - type: object + description: > + If the audio output modality is requested, this object contains + data + + about the audio response from the model. [Learn + more](/docs/guides/audio). + required: + - id + - expires_at + - data + - transcript + properties: + id: + type: string + description: Unique identifier for this audio response. + expires_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) for when this audio response + will + + no longer be accessible on the server for use in multi-turn + + conversations. + data: + type: string + description: > + Base64 encoded audio bytes generated by the model, in the + format + + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. + - type: 'null' + required: + - role + - content + - refusal + ChatCompletionRole: + type: string + description: The role of the author of a message + enum: + - developer + - system + - user + - assistant + - tool + - function + ChatCompletionStreamOptions: + anyOf: + - description: > + Options for streaming response. Only set this when you set `stream: + true`. + type: object + default: null + properties: + include_usage: + type: boolean + description: > + If set, an additional chunk will be streamed before the `data: + [DONE]` + + message. The `usage` field on this chunk shows the token usage + statistics + + for the entire request, and the `choices` field will always be + an empty + + array. + + + All other chunks will also include a `usage` field, but with a + null + + value. **NOTE:** If the stream is interrupted, you may not + receive the + + final usage chunk which contains the total token usage for the + request. + include_obfuscation: + type: boolean + description: > + When true, stream obfuscation will be enabled. Stream + obfuscation adds + + random characters to an `obfuscation` field on streaming delta + events to + + normalize payload sizes as a mitigation to certain side-channel + attacks. + + These obfuscation fields are included by default, but add a + small amount + + of overhead to the data stream. You can set + `include_obfuscation` to + + false to optimize for bandwidth if you trust the network links + between + + your application and the OpenAI API. + - type: 'null' + ChatCompletionStreamResponseDelta: + type: object + description: A chat completion delta generated by streamed model responses. + properties: + content: + anyOf: + - type: string + description: The contents of the chunk message. + - type: 'null' + function_call: + deprecated: true + type: object + description: >- + Deprecated and replaced by `tool_calls`. The name and arguments of a + function that should be called, as generated by the model. + properties: + arguments: + type: string + description: >- + The arguments to call the function with, as generated by the + model in JSON format. Note that the model does not always + generate valid JSON, and may hallucinate parameters not defined + by your function schema. Validate the arguments in your code + before calling your function. + name: + type: string + description: The name of the function to call. + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatCompletionMessageToolCallChunk' + role: + type: string + enum: + - developer + - system + - user + - assistant + - tool + description: The role of the author of this message. + refusal: + anyOf: + - type: string + description: The refusal message generated by the model. + - type: 'null' + ChatCompletionTokenLogprob: + type: object + properties: + token: + description: The token. + type: string + logprob: + description: >- + The log probability of this token, if it is within the top 20 most + likely tokens. Otherwise, the value `-9999.0` is used to signify + that the token is very unlikely. + type: number + bytes: + anyOf: + - description: >- + A list of integers representing the UTF-8 bytes representation + of the token. Useful in instances where characters are + represented by multiple tokens and their byte representations + must be combined to generate the correct text representation. + Can be `null` if there is no bytes representation for the token. + type: array + items: + type: integer + - type: 'null' + top_logprobs: + description: >- + List of the most likely tokens and their log probability, at this + token position. The number of entries may be fewer than the + requested `top_logprobs`. + type: array + items: + type: object + properties: + token: + description: The token. + type: string + logprob: + description: >- + The log probability of this token, if it is within the top 20 + most likely tokens. Otherwise, the value `-9999.0` is used to + signify that the token is very unlikely. + type: number + bytes: + anyOf: + - description: >- + A list of integers representing the UTF-8 bytes + representation of the token. Useful in instances where + characters are represented by multiple tokens and their + byte representations must be combined to generate the + correct text representation. Can be `null` if there is no + bytes representation for the token. + type: array + items: + type: integer + - type: 'null' + required: + - token + - logprob + - bytes + required: + - token + - logprob + - bytes + - top_logprobs + ChatCompletionTool: + type: object + title: Function tool + description: | + A function tool that can be used to generate a response. + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + x-stainless-const: true + function: + $ref: '#/components/schemas/FunctionObject' + required: + - type + - function + ChatCompletionToolChoiceOption: + description: > + Controls which (if any) tool is called by the model. + + `none` means the model will not call any tool and instead generates a + message. + + `auto` means the model can pick between generating a message or calling + one or more tools. + + `required` means the model must call one or more tools. + + Specifying a particular tool via `{"type": "function", "function": + {"name": "my_function"}}` forces the model to call that tool. + + + `none` is the default when no tools are present. `auto` is the default + if tools are present. + oneOf: + - type: string + title: Tool choice mode + description: > + `none` means the model will not call any tool and instead generates + a message. `auto` means the model can pick between generating a + message or calling one or more tools. `required` means the model + must call one or more tools. + enum: + - none + - auto + - required + - $ref: '#/components/schemas/ChatCompletionAllowedToolsChoice' + - $ref: '#/components/schemas/ChatCompletionNamedToolChoice' + - $ref: '#/components/schemas/ChatCompletionNamedToolChoiceCustom' + ChunkingStrategyRequestParam: + type: object + description: >- + The chunking strategy used to chunk the file(s). If not set, will use + the `auto` strategy. + oneOf: + - $ref: '#/components/schemas/AutoChunkingStrategyRequestParam' + - $ref: '#/components/schemas/StaticChunkingStrategyRequestParam' + discriminator: + propertyName: type + CodeInterpreterFileOutput: + type: object + title: Code interpreter file output + description: | + The output of a code interpreter tool call that is a file. + properties: + type: + type: string + enum: + - files + description: | + The type of the code interpreter file output. Always `files`. + x-stainless-const: true + files: + type: array + items: + type: object + properties: + mime_type: + type: string + description: | + The MIME type of the file. + file_id: + type: string + description: | + The ID of the file. + required: + - mime_type + - file_id + required: + - type + - files + CodeInterpreterTextOutput: + type: object + title: Code interpreter text output + description: | + The output of a code interpreter tool call that is text. + properties: + type: + type: string + enum: + - logs + description: | + The type of the code interpreter text output. Always `logs`. + x-stainless-const: true + logs: + type: string + description: | + The logs of the code interpreter tool call. + required: + - type + - logs + CodeInterpreterTool: + type: object + title: Code interpreter + description: | + A tool that runs Python code to help generate a response to a prompt. + properties: + type: + type: string + enum: + - code_interpreter + description: | + The type of the code interpreter tool. Always `code_interpreter`. + x-stainless-const: true + container: + description: > + The code interpreter container. Can be a container ID or an object + that + + specifies uploaded file IDs to make available to your code, along + with an + + optional `memory_limit` setting. + oneOf: + - type: string + description: The container ID. + - $ref: '#/components/schemas/AutoCodeInterpreterToolParam' + allowed_callers: + anyOf: + - type: array + minItems: 1 + items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + description: The tool invocation context(s). + - type: 'null' + required: + - type + - container + CodeInterpreterToolCall: + type: object + title: Code interpreter tool call + description: | + A tool call to run code. + properties: + type: + type: string + enum: + - code_interpreter_call + default: code_interpreter_call + x-stainless-const: true + description: > + The type of the code interpreter tool call. Always + `code_interpreter_call`. + id: + type: string + description: | + The unique ID of the code interpreter tool call. + status: + type: string + enum: + - in_progress + - completed + - incomplete + - interpreting + - failed + description: > + The status of the code interpreter tool call. Valid values are + `in_progress`, `completed`, `incomplete`, `interpreting`, and + `failed`. + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + anyOf: + - type: string + description: | + The code to run, or null if not available. + - type: 'null' + outputs: + anyOf: + - type: array + items: + oneOf: + - $ref: '#/components/schemas/CodeInterpreterOutputLogs' + - $ref: '#/components/schemas/CodeInterpreterOutputImage' + discriminator: + propertyName: type + discriminator: + propertyName: type + description: > + The outputs generated by the code interpreter, such as logs or + images. + + Can be null if no outputs are available. + - type: 'null' + required: + - type + - id + - status + - container_id + - code + - outputs + ComparisonFilter: + type: object + additionalProperties: false + title: Comparison Filter + description: > + A filter used to compare a specified attribute key to a given value + using a defined comparison operation. + properties: + type: + type: string + default: eq + enum: + - eq + - ne + - gt + - gte + - lt + - lte + - in + - nin + description: > + Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, + `lte`, `in`, `nin`. + + - `eq`: equals + + - `ne`: not equal + + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + oneOf: + - type: string + - type: number + - type: boolean + - type: array + items: + oneOf: + - type: string + - type: number + description: >- + The value to compare against the attribute key; supports string, + number, or boolean types. + required: + - type + - key + - value + x-oaiMeta: + name: ComparisonFilter + CompleteUploadRequest: + type: object + additionalProperties: false + properties: + part_ids: + type: array + description: | + The ordered list of Part IDs. + items: + type: string + md5: + description: > + The optional md5 checksum for the file contents to verify if the + bytes uploaded matches what you expect. + type: string + required: + - part_ids + CompletionUsage: + type: object + description: Usage statistics for the completion request. + properties: + completion_tokens: + type: integer + default: 0 + description: Number of tokens in the generated completion. + prompt_tokens: + type: integer + default: 0 + description: Number of tokens in the prompt. + total_tokens: + type: integer + default: 0 + description: Total number of tokens used in the request (prompt + completion). + completion_tokens_details: + type: object + description: Breakdown of tokens used in a completion. + properties: + accepted_prediction_tokens: + type: integer + default: 0 + description: | + When using Predicted Outputs, the number of tokens in the + prediction that appeared in the completion. + audio_tokens: + type: integer + default: 0 + description: Audio input tokens generated by the model. + reasoning_tokens: + type: integer + default: 0 + description: Tokens generated by the model for reasoning. + rejected_prediction_tokens: + type: integer + default: 0 + description: > + When using Predicted Outputs, the number of tokens in the + + prediction that did not appear in the completion. However, like + + reasoning tokens, these tokens are still counted in the total + + completion tokens for purposes of billing, output, and context + window + + limits. + prompt_tokens_details: + type: object + description: Breakdown of tokens used in the prompt. + properties: + audio_tokens: + type: integer + default: 0 + description: Audio input tokens present in the prompt. + cached_tokens: + type: integer + default: 0 + description: Cached tokens present in the prompt. + cache_write_tokens: + type: integer + default: 0 + description: The unadjusted number of prompt tokens written to cache. + required: + - prompt_tokens + - completion_tokens + - total_tokens + CompoundFilter: + $recursiveAnchor: true + type: object + additionalProperties: false + title: Compound Filter + description: Combine multiple filters using `and` or `or`. + properties: + type: + type: string + description: 'Type of operation: `and` or `or`.' + enum: + - and + - or + filters: + type: array + description: >- + Array of filters to combine. Items can be `ComparisonFilter` or + `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - filters + x-oaiMeta: + name: CompoundFilter + ComputerAction: + oneOf: + - $ref: '#/components/schemas/ClickParam' + - $ref: '#/components/schemas/DoubleClickAction' + - $ref: '#/components/schemas/DragParam' + - $ref: '#/components/schemas/KeyPressAction' + - $ref: '#/components/schemas/MoveParam' + - $ref: '#/components/schemas/ScreenshotParam' + - $ref: '#/components/schemas/ScrollParam' + - $ref: '#/components/schemas/TypeParam' + - $ref: '#/components/schemas/WaitParam' + discriminator: + propertyName: type + ComputerActionList: + title: Computer Action List + type: array + description: | + Flattened batched actions for `computer_use`. Each action includes an + `type` discriminator and action-specific fields. + items: + $ref: '#/components/schemas/ComputerAction' + ComputerScreenshotImage: + type: object + description: | + A computer screenshot image used with the computer use tool. + properties: + type: + type: string + enum: + - computer_screenshot + default: computer_screenshot + description: > + Specifies the event type. For a computer screenshot, this property + is + + always set to `computer_screenshot`. + x-stainless-const: true + image_url: + type: string + format: uri + description: The URL of the screenshot image. + file_id: + type: string + description: The identifier of an uploaded file that contains the screenshot. + required: + - type + ComputerToolCall: + type: object + title: Computer tool call + description: > + A tool call to a computer use tool. See the + + [computer use guide](/docs/guides/tools-computer-use) for more + information. + properties: + type: + type: string + description: The type of the computer call. Always `computer_call`. + enum: + - computer_call + default: computer_call + id: + type: string + description: The unique ID of the computer call. + call_id: + type: string + description: | + An identifier used when responding to the tool call with output. + action: + $ref: '#/components/schemas/ComputerAction' + actions: + $ref: '#/components/schemas/ComputerActionList' + pending_safety_checks: + type: array + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + description: | + The pending safety checks for the computer call. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - id + - call_id + - pending_safety_checks + - status + ComputerToolCallOutput: + type: object + title: Computer tool call output + description: | + The output of a computer tool call. + properties: + type: + type: string + description: > + The type of the computer tool call output. Always + `computer_call_output`. + enum: + - computer_call_output + default: computer_call_output + x-stainless-const: true + id: + type: string + description: | + The ID of the computer tool call output. + call_id: + type: string + description: | + The ID of the computer tool call that produced the output. + acknowledged_safety_checks: + type: array + description: > + The safety checks reported by the API that have been acknowledged by + the + + developer. + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + status: + type: string + description: > + The status of the message input. One of `in_progress`, `completed`, + or + + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - output + ComputerToolCallOutputResource: + allOf: + - $ref: '#/components/schemas/ComputerToolCallOutput' + - type: object + properties: + id: + type: string + description: | + The unique ID of the computer call tool output. + status: + description: > + The status of the message input. One of `in_progress`, + `completed`, or + + `incomplete`. Populated when input items are returned via API. + $ref: '#/components/schemas/ComputerCallOutputStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + ContainerFileListResource: + type: object + properties: + object: + type: string + enum: + - list + description: The type of object returned, must be 'list'. + data: + type: array + description: A list of container files. + items: + $ref: '#/components/schemas/ContainerFileResource' + first_id: + type: string + description: The ID of the first file in the list. + last_id: + type: string + description: The ID of the last file in the list. + has_more: + type: boolean + description: Whether there are more files available. + required: + - object + - data + - first_id + - last_id + - has_more + ContainerFileResource: + type: object + title: The container file object + properties: + id: + type: string + description: Unique identifier for the file. + object: + type: string + description: The type of this object (`container.file`). + container_id: + type: string + description: The container this file belongs to. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the file was created. + bytes: + type: integer + description: Size of the file in bytes. + path: + type: string + description: Path of the file in the container. + source: + type: string + description: Source of the file (e.g., `user`, `assistant`). + required: + - id + - object + - created_at + - bytes + - container_id + - path + - source + x-oaiMeta: + name: The container file object + example: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + ContainerListResource: + type: object + properties: + object: + type: string + enum: + - list + description: The type of object returned, must be 'list'. + data: + type: array + description: A list of containers. + items: + $ref: '#/components/schemas/ContainerResource' + first_id: + type: string + description: The ID of the first container in the list. + last_id: + type: string + description: The ID of the last container in the list. + has_more: + type: boolean + description: Whether there are more containers available. + required: + - object + - data + - first_id + - last_id + - has_more + ContainerResource: + type: object + title: The container object + properties: + id: + type: string + description: Unique identifier for the container. + object: + type: string + description: The type of this object. + name: + type: string + description: Name of the container. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the container was created. + status: + type: string + description: Status of the container (e.g., active, deleted). + last_active_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the container was last active. + expires_after: + type: object + description: > + The container will expire after this time period. + + The anchor is the reference point for the expiration. + + The minutes is the number of minutes after the anchor before the + container expires. + properties: + anchor: + type: string + description: The reference point for the expiration. + enum: + - last_active_at + minutes: + type: integer + description: >- + The number of minutes after the anchor before the container + expires. + memory_limit: + type: string + description: The memory limit configured for the container. + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + type: object + properties: + type: + type: string + description: The network policy mode. + enum: + - allowlist + - disabled + allowed_domains: + type: array + description: Allowed outbound domains when `type` is `allowlist`. + items: + type: string + required: + - type + required: + - id + - object + - name + - created_at + - status + - id + - name + - created_at + - status + x-oaiMeta: + name: The container object + example: | + { + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "1g", + "name": "My Container" + } + Content: + description: | + Multi-modal input and output contents. + oneOf: + - title: Input content types + $ref: '#/components/schemas/InputContent' + - title: Output content types + $ref: '#/components/schemas/OutputContent' + ConversationItem: + title: Conversation item + description: >- + A single item within a conversation. The set of possible types are the + same as the `output` type of a [Response + object](/docs/api-reference/responses/object#responses/object-output). + oneOf: + - $ref: '#/components/schemas/Message' + - $ref: '#/components/schemas/FunctionToolCallResource' + - $ref: '#/components/schemas/FunctionToolCallOutputResource' + - $ref: '#/components/schemas/FileSearchToolCall' + - $ref: '#/components/schemas/WebSearchToolCall' + - $ref: '#/components/schemas/ImageGenToolCall' + - $ref: '#/components/schemas/ComputerToolCall' + - $ref: '#/components/schemas/ComputerToolCallOutputResource' + - $ref: '#/components/schemas/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $ref: '#/components/schemas/AdditionalTools' + - $ref: '#/components/schemas/ReasoningItem' + - $ref: '#/components/schemas/Program' + - $ref: '#/components/schemas/ProgramOutput' + - $ref: '#/components/schemas/CompactionBody' + - $ref: '#/components/schemas/CodeInterpreterToolCall' + - $ref: '#/components/schemas/LocalShellToolCall' + - $ref: '#/components/schemas/LocalShellToolCallOutput' + - $ref: '#/components/schemas/FunctionShellCall' + - $ref: '#/components/schemas/FunctionShellCallOutput' + - $ref: '#/components/schemas/ApplyPatchToolCall' + - $ref: '#/components/schemas/ApplyPatchToolCallOutput' + - $ref: '#/components/schemas/MCPListTools' + - $ref: '#/components/schemas/MCPApprovalRequest' + - $ref: '#/components/schemas/MCPApprovalResponseResource' + - $ref: '#/components/schemas/MCPToolCall' + - $ref: '#/components/schemas/CustomToolCall' + - $ref: '#/components/schemas/CustomToolCallOutput' + discriminator: + propertyName: type + ConversationItemList: + type: object + title: The conversation item list + description: A list of Conversation items. + properties: + object: + type: string + description: The type of object returned, must be `list`. + enum: + - list + x-stainless-const: true + data: + type: array + description: A list of conversation items. + items: + $ref: '#/components/schemas/ConversationItem' + has_more: + type: boolean + description: Whether there are more items available. + first_id: + type: string + description: The ID of the first item in the list. + last_id: + type: string + description: The ID of the last item in the list. + required: + - object + - data + - has_more + - first_id + - last_id + x-oaiMeta: + name: The item list + group: conversations + ConversationParam: + description: > + The conversation that this response belongs to. Items from this + conversation are prepended to `input_items` for this response request. + + Input items and output items from this response are automatically added + to this conversation after this response completes. + default: null + oneOf: + - type: string + title: Conversation ID + description: | + The unique ID of the conversation. + - $ref: '#/components/schemas/ConversationParam-2' + CostsResult: + type: object + description: The aggregated costs details of the specific time bucket. + properties: + object: + type: string + enum: + - organization.costs.result + x-stainless-const: true + amount: + type: object + description: The monetary value in its associated currency. + properties: + value: + type: number + description: The numeric value of the cost. + currency: + type: string + description: Lowercase ISO-4217 currency e.g. "usd" + line_item: + anyOf: + - type: string + description: >- + When `group_by=line_item`, this field provides the line item of + the grouped costs result. + - type: 'null' + project_id: + anyOf: + - type: string + description: >- + When `group_by=project_id`, this field provides the project ID + of the grouped costs result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: >- + When `group_by=api_key_id`, this field provides the API Key ID + of the grouped costs result. + - type: 'null' + quantity: + anyOf: + - type: number + description: >- + When `group_by=line_item`, this field provides the quantity of + the grouped costs result. + - type: 'null' + required: + - object + x-oaiMeta: + name: Costs object + example: | + { + "object": "organization.costs.result", + "amount": { + "value": 0.06, + "currency": "usd" + }, + "line_item": "Image models", + "project_id": "proj_abc", + "quantity": 10000 + } + CreateAssistantRequest: + type: object + additionalProperties: false + properties: + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + example: gpt-4o + anyOf: + - type: string + - $ref: '#/components/schemas/AssistantSupportedModels' + x-oaiTypeLabel: string + name: + anyOf: + - description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + - type: 'null' + description: + anyOf: + - description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + maxLength: 512 + - type: 'null' + instructions: + anyOf: + - description: > + The system instructions that the assistant uses. The maximum + length is 256,000 characters. + type: string + maxLength: 256000 + - type: 'null' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + tools: + description: > + A list of tool enabled on the assistant. There can be a maximum of + 128 tools per assistant. Tools can be of types `code_interpreter`, + `file_search`, or `function`. + default: [] + type: array + maxItems: 128 + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' + tool_resources: + anyOf: + - type: object + description: > + A set of resources that are used by the assistant's tools. The + resources are specific to the type of tool. For example, the + `code_interpreter` tool requires a list of file IDs, while the + `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector + store](/docs/api-reference/vector-stores/object) + attached to this assistant. There can be a maximum of 1 + vector store attached to the assistant. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: > + A helper to create a [vector + store](/docs/api-reference/vector-stores/object) with + file_ids and attach it to this assistant. There can be a + maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs to + add to the vector store. For vector stores created + before Nov 2025, there can be a maximum of 10,000 + files in a vector store. For vector stores created + starting in Nov 2025, the limit is 100,000,000 + files. + maxItems: 100000000 + items: + type: string + chunking_strategy: + type: object + description: >- + The chunking strategy used to chunk the file(s). + If not set, will use the `auto` strategy. + oneOf: + - type: object + title: Auto Chunking Strategy + description: >- + The default strategy. This strategy currently + uses a `max_chunk_size_tokens` of `800` and + `chunk_overlap_tokens` of `400`. + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + x-stainless-const: true + required: + - type + - type: object + title: Static Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `static`. + enum: + - static + x-stainless-const: true + static: + type: object + additionalProperties: false + properties: + max_chunk_size_tokens: + type: integer + minimum: 100 + maximum: 4096 + description: >- + The maximum number of tokens in each + chunk. The default value is `800`. The + minimum value is `100` and the maximum + value is `4096`. + chunk_overlap_tokens: + type: integer + description: > + The number of tokens that overlap + between chunks. The default value is + `400`. + + + Note that the overlap must not exceed + half of `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + required: + - type + - static + metadata: + $ref: '#/components/schemas/Metadata' + oneOf: + - required: + - vector_store_ids + - required: + - vector_stores + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + anyOf: + - description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values + like 0.2 will make it more focused and deterministic. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + - type: 'null' + top_p: + anyOf: + - type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens + with top_p probability mass. So 0.1 means only the tokens + comprising the top 10% probability mass are considered. + + + We generally recommend altering this or temperature but not + both. + - type: 'null' + response_format: + anyOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + - type: 'null' + required: + - model + CreateChatCompletionRequest: + allOf: + - $ref: '#/components/schemas/CreateModelResponseProperties' + - type: object + properties: + messages: + description: > + A list of messages comprising the conversation so far. Depending + on the + + [model](/docs/models) you use, different message types + (modalities) are + + supported, like [text](/docs/guides/text-generation), + + [images](/docs/guides/vision), and [audio](/docs/guides/audio). + type: array + minItems: 1 + items: + $ref: '#/components/schemas/ChatCompletionRequestMessage' + model: + description: > + Model ID used to generate the response, like `gpt-4o` or `o3`. + OpenAI + + offers a wide range of models with different capabilities, + performance + + characteristics, and price points. Refer to the [model + guide](/docs/models) + + to browse and compare available models. + $ref: '#/components/schemas/ModelIdsShared' + modalities: + $ref: '#/components/schemas/ResponseModalities' + verbosity: + $ref: '#/components/schemas/Verbosity' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + max_completion_tokens: + description: > + An upper bound for the number of tokens that can be generated + for a completion, including visible output tokens and [reasoning + tokens](/docs/guides/reasoning). + type: integer + nullable: true + frequency_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: > + Number between -2.0 and 2.0. Positive values penalize new tokens + based on + + their existing frequency in the text so far, decreasing the + model's + + likelihood to repeat the same line verbatim. + presence_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: > + Number between -2.0 and 2.0. Positive values penalize new tokens + based on + + whether they appear in the text so far, increasing the model's + likelihood + + to talk about new topics. + web_search_options: + type: object + title: Web search + description: > + This tool searches the web for relevant results to use in a + response. + + Learn more about the [web search + tool](/docs/guides/tools-web-search?api-mode=chat). + properties: + user_location: + type: object + nullable: true + required: + - type + - approximate + description: | + Approximate location parameters for the search. + properties: + type: + type: string + description: > + The type of location approximation. Always + `approximate`. + enum: + - approximate + x-stainless-const: true + approximate: + $ref: '#/components/schemas/WebSearchLocation' + search_context_size: + $ref: '#/components/schemas/WebSearchContextSize' + top_logprobs: + description: > + An integer between 0 and 20 specifying the maximum number of + most likely + + tokens to return at each token position, each with an associated + log + + probability. In some cases, the number of returned tokens may be + fewer than + + requested. + + `logprobs` must be set to `true` if this parameter is used. + type: integer + minimum: 0 + maximum: 20 + nullable: true + response_format: + description: > + An object specifying the format that the model must output. + + + Setting to `{ "type": "json_schema", "json_schema": {...} }` + enables + + Structured Outputs which ensures the model will match your + supplied JSON + + schema. Learn more in the [Structured Outputs + + guide](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables the older JSON + mode, which + + ensures the message the model generates is valid JSON. Using + `json_schema` + + is preferred for models that support it. + oneOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/ResponseFormatJsonSchema' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + discriminator: + propertyName: type + audio: + type: object + nullable: true + description: > + Parameters for audio output. Required when audio output is + requested with + + `modalities: ["audio"]`. [Learn more](/docs/guides/audio). + required: + - voice + - format + properties: + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + description: > + The voice the model uses to respond. Supported built-in + voices are + + `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, + `onyx`, + + `sage`, `shimmer`, `marin`, and `cedar`. You may also + provide a + + custom voice object with an `id`, for example `{ "id": + "voice_1234" }`. + format: + type: string + enum: + - wav + - aac + - mp3 + - flac + - opus + - pcm16 + description: > + Specifies the output audio format. Must be one of `wav`, + `mp3`, `flac`, + + `opus`, or `pcm16`. + store: + type: boolean + default: false + nullable: true + description: > + Whether or not to store the output of this chat completion + request for + + use in our [model distillation](/docs/guides/distillation) or + + [evals](/docs/guides/evals) products. + + + Supports text and image inputs. Note: image inputs over 8MB will + be dropped. + moderation: + anyOf: + - $ref: '#/components/schemas/ModerationParam' + description: > + Configuration for running moderation on the request input + and generated output. + - type: 'null' + stream: + description: > + If set to true, the model response data will be streamed to the + client + + as it is generated using [server-sent + events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + + See the [Streaming section + below](/docs/api-reference/chat/streaming) + + for more information, along with the [streaming + responses](/docs/guides/streaming-responses) + + guide for more information on how to handle the streaming + events. + type: boolean + nullable: true + default: false + stop: + $ref: '#/components/schemas/StopConfiguration' + logit_bias: + type: object + x-oaiTypeLabel: map + default: null + nullable: true + additionalProperties: + type: integer + description: > + Modify the likelihood of specified tokens appearing in the + completion. + + + Accepts a JSON object that maps tokens (specified by their token + ID in the + + tokenizer) to an associated bias value from -100 to 100. + Mathematically, + + the bias is added to the logits generated by the model prior to + sampling. + + The exact effect will vary per model, but values between -1 and + 1 should + + decrease or increase likelihood of selection; values like -100 + or 100 + + should result in a ban or exclusive selection of the relevant + token. + logprobs: + description: > + Whether to return log probabilities of the output tokens or not. + If true, + + returns the log probabilities of each output token returned in + the + + `content` of `message`. + type: boolean + default: false + nullable: true + max_tokens: + description: > + The maximum number of [tokens](/tokenizer) that can be generated + in the + + chat completion. This value can be used to control + + [costs](https://openai.com/api/pricing/) for text generated via + API. + + + This value is now deprecated in favor of + `max_completion_tokens`, and is + + not compatible with [o-series models](/docs/guides/reasoning). + type: integer + nullable: true + deprecated: true + 'n': + type: integer + minimum: 1 + maximum: 128 + default: 1 + example: 1 + nullable: true + description: >- + How many chat completion choices to generate for each input + message. Note that you will be charged based on the number of + generated tokens across all of the choices. Keep `n` as `1` to + minimize costs. + prediction: + nullable: true + description: > + Configuration for a [Predicted + Output](/docs/guides/predicted-outputs), + + which can greatly improve response times when large parts of the + model + + response are known ahead of time. This is most common when you + are + + regenerating a file with only minor changes to most of the + content. + oneOf: + - $ref: '#/components/schemas/PredictionContent' + seed: + type: integer + minimum: -9223372036854776000 + maximum: 9223372036854776000 + nullable: true + deprecated: true + description: > + This feature is in Beta. + + If specified, our system will make a best effort to sample + deterministically, such that repeated requests with the same + `seed` and parameters should return the same result. + + Determinism is not guaranteed, and you should refer to the + `system_fingerprint` response parameter to monitor changes in + the backend. + x-oaiMeta: + beta: true + stream_options: + $ref: '#/components/schemas/ChatCompletionStreamOptions' + tools: + type: array + description: | + A list of tools the model may call. You can provide either + [custom tools](/docs/guides/function-calling#custom-tools) or + [function tools](/docs/guides/function-calling). + items: + oneOf: + - $ref: '#/components/schemas/ChatCompletionTool' + - $ref: '#/components/schemas/CustomToolChatCompletions' + tool_choice: + $ref: '#/components/schemas/ChatCompletionToolChoiceOption' + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + function_call: + deprecated: true + description: > + Deprecated in favor of `tool_choice`. + + + Controls which (if any) function is called by the model. + + + `none` means the model will not call a function and instead + generates a + + message. + + + `auto` means the model can pick between generating a message or + calling a + + function. + + + Specifying a particular function via `{"name": "my_function"}` + forces the + + model to call that function. + + + `none` is the default when no functions are present. `auto` is + the default + + if functions are present. + oneOf: + - type: string + description: > + `none` means the model will not call a function and instead + generates a message. `auto` means the model can pick between + generating a message or calling a function. + enum: + - none + - auto + - $ref: '#/components/schemas/ChatCompletionFunctionCallOption' + functions: + deprecated: true + description: | + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + type: array + minItems: 1 + maxItems: 128 + items: + $ref: '#/components/schemas/ChatCompletionFunctions' + required: + - model + - messages + CreateChatCompletionResponse: + type: object + description: >- + Represents a chat completion response returned by model, based on the + provided input. + properties: + id: + type: string + description: A unique identifier for the chat completion. + choices: + type: array + description: >- + A list of chat completion choices. Can be more than one if `n` is + greater than 1. + items: + type: object + required: + - finish_reason + - index + - message + - logprobs + properties: + finish_reason: + type: string + description: > + The reason the model stopped generating tokens. This will be + `stop` if the model hit a natural stop point or a provided + stop sequence, + + `length` if the maximum number of tokens specified in the + request was reached, + + `content_filter` if content was omitted due to a flag from our + content filters, + + `tool_calls` if the model called a tool, or `function_call` + (deprecated) if the model called a function. + + Read the [Model + Spec](https://model-spec.openai.com/2025-12-18.html) for more. + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + index: + type: integer + description: The index of the choice in the list of choices. + message: + $ref: '#/components/schemas/ChatCompletionResponseMessage' + logprobs: + anyOf: + - description: Log probability information for the choice. + type: object + properties: + content: + anyOf: + - description: >- + A list of message content tokens with log + probability information. + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + - type: 'null' + refusal: + anyOf: + - description: >- + A list of message refusal tokens with log + probability information. + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + - type: 'null' + required: + - content + - refusal + - type: 'null' + created: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) of when the chat completion was + created. + model: + type: string + description: The model used for the chat completion. + service_tier: + $ref: '#/components/schemas/ServiceTier' + system_fingerprint: + type: string + deprecated: true + description: > + This fingerprint represents the backend configuration that the model + runs with. + + + Can be used in conjunction with the `seed` request parameter to + understand when backend changes have been made that might impact + determinism. + object: + type: string + description: The object type, which is always `chat.completion`. + enum: + - chat.completion + x-stainless-const: true + usage: + $ref: '#/components/schemas/CompletionUsage' + moderation: + anyOf: + - $ref: '#/components/schemas/ChatCompletionModeration' + description: > + Moderation results for the request input and generated output, + if moderated + + completions were requested. + - type: 'null' + required: + - choices + - created + - id + - model + - object + x-oaiMeta: + name: The chat completion object + group: chat + example: | + { + "id": "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG", + "object": "chat.completion", + "created": 1741570283, + "model": "gpt-4o-2024-08-06", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "The image shows a wooden boardwalk path running through a lush green field or meadow. The sky is bright blue with some scattered clouds, giving the scene a serene and peaceful atmosphere. Trees and shrubs are visible in the background.", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 1117, + "completion_tokens": 46, + "total_tokens": 1163, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_fc9f1d7035" + } + CreateChatCompletionStreamResponse: + type: object + description: | + Represents a streamed chunk of a chat completion response returned + by the model, based on the provided input. + [Learn more](/docs/guides/streaming-responses). + properties: + id: + type: string + description: >- + A unique identifier for the chat completion. Each chunk has the same + ID. + choices: + type: array + description: > + A list of chat completion choices. Can contain more than one + elements if `n` is greater than 1. Can also be empty for the + + last chunk if you set `stream_options: {"include_usage": true}`. + items: + type: object + required: + - delta + - finish_reason + - index + properties: + delta: + $ref: '#/components/schemas/ChatCompletionStreamResponseDelta' + logprobs: + description: Log probability information for the choice. + type: object + nullable: true + properties: + content: + description: >- + A list of message content tokens with log probability + information. + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + nullable: true + refusal: + description: >- + A list of message refusal tokens with log probability + information. + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + nullable: true + required: + - content + - refusal + finish_reason: + type: string + description: > + The reason the model stopped generating tokens. This will be + `stop` if the model hit a natural stop point or a provided + stop sequence, + + `length` if the maximum number of tokens specified in the + request was reached, + + `content_filter` if content was omitted due to a flag from our + content filters, + + `tool_calls` if the model called a tool, or `function_call` + (deprecated) if the model called a function. + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + nullable: true + index: + type: integer + description: The index of the choice in the list of choices. + created: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) of when the chat completion was + created. Each chunk has the same timestamp. + model: + type: string + description: The model to generate the completion. + service_tier: + $ref: '#/components/schemas/ServiceTier' + system_fingerprint: + type: string + deprecated: true + description: > + This fingerprint represents the backend configuration that the model + runs with. + + Can be used in conjunction with the `seed` request parameter to + understand when backend changes have been made that might impact + determinism. + object: + type: string + description: The object type, which is always `chat.completion.chunk`. + enum: + - chat.completion.chunk + x-stainless-const: true + usage: + $ref: '#/components/schemas/CompletionUsage' + nullable: true + description: > + An optional field that will only be present when you set + + `stream_options: {"include_usage": true}` in your request. When + present, it + + contains a null value **except for the last chunk** which contains + the + + token usage statistics for the entire request. + + + **NOTE:** If the stream is interrupted or cancelled, you may not + + receive the final usage chunk which contains the total token usage + for + + the request. + moderation: + anyOf: + - $ref: '#/components/schemas/ChatCompletionModeration' + description: > + Moderation results for the request input and generated output. + Present + + on the moderation chunk when moderated completions are + requested. + - type: 'null' + required: + - choices + - created + - id + - model + - object + x-oaiMeta: + name: The chat completion chunk object + group: chat + example: > + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} + + + .... + + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", + "system_fingerprint": "fp_44709d6fcb", + "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + CreateCompletionRequest: + type: object + properties: + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + anyOf: + - type: string + - type: string + enum: + - gpt-3.5-turbo-instruct + - davinci-002 + - babbage-002 + x-oaiTypeLabel: string + prompt: + description: > + The prompt(s) to generate completions for, encoded as a string, + array of strings, array of tokens, or array of token arrays. + + + Note that <|endoftext|> is the document separator that the model + sees during training, so if a prompt is not specified the model will + generate as if from the beginning of a new document. + default: <|endoftext|> + nullable: true + oneOf: + - type: string + default: '' + example: This is a test. + - type: array + items: + type: string + default: '' + example: This is a test. + - type: array + minItems: 1 + items: + type: integer + example: '[1212, 318, 257, 1332, 13]' + - type: array + minItems: 1 + items: + type: array + minItems: 1 + items: + type: integer + example: '[[1212, 318, 257, 1332, 13]]' + best_of: + type: integer + default: 1 + minimum: 0 + maximum: 20 + nullable: true + description: > + Generates `best_of` completions server-side and returns the "best" + (the one with the highest log probability per token). Results cannot + be streamed. + + + When used with `n`, `best_of` controls the number of candidate + completions and `n` specifies how many to return – `best_of` must be + greater than `n`. + + + **Note:** Because this parameter generates many completions, it can + quickly consume your token quota. Use carefully and ensure that you + have reasonable settings for `max_tokens` and `stop`. + echo: + type: boolean + default: false + nullable: true + description: | + Echo back the prompt in addition to the completion + frequency_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: > + Number between -2.0 and 2.0. Positive values penalize new tokens + based on their existing frequency in the text so far, decreasing the + model's likelihood to repeat the same line verbatim. + + + [See more information about frequency and presence + penalties.](/docs/guides/text-generation) + logit_bias: + type: object + x-oaiTypeLabel: map + default: null + nullable: true + additionalProperties: + type: integer + description: > + Modify the likelihood of specified tokens appearing in the + completion. + + + Accepts a JSON object that maps tokens (specified by their token ID + in the GPT tokenizer) to an associated bias value from -100 to 100. + You can use this [tokenizer tool](/tokenizer?view=bpe) to convert + text to token IDs. Mathematically, the bias is added to the logits + generated by the model prior to sampling. The exact effect will vary + per model, but values between -1 and 1 should decrease or increase + likelihood of selection; values like -100 or 100 should result in a + ban or exclusive selection of the relevant token. + + + As an example, you can pass `{"50256": -100}` to prevent the + <|endoftext|> token from being generated. + logprobs: + type: integer + minimum: 0 + maximum: 5 + default: null + nullable: true + description: > + Include the log probabilities on the `logprobs` most likely output + tokens, as well the chosen tokens. For example, if `logprobs` is 5, + the API will return a list of the 5 most likely tokens. The API will + always return the `logprob` of the sampled token, so there may be up + to `logprobs+1` elements in the response. + + + The maximum value for `logprobs` is 5. + max_tokens: + type: integer + minimum: 0 + default: 16 + example: 16 + nullable: true + description: > + The maximum number of [tokens](/tokenizer) that can be generated in + the completion. + + + The token count of your prompt plus `max_tokens` cannot exceed the + model's context length. [Example Python + code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) + for counting tokens. + 'n': + type: integer + minimum: 1 + maximum: 128 + default: 1 + example: 1 + nullable: true + description: > + How many completions to generate for each prompt. + + + **Note:** Because this parameter generates many completions, it can + quickly consume your token quota. Use carefully and ensure that you + have reasonable settings for `max_tokens` and `stop`. + presence_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: > + Number between -2.0 and 2.0. Positive values penalize new tokens + based on whether they appear in the text so far, increasing the + model's likelihood to talk about new topics. + + + [See more information about frequency and presence + penalties.](/docs/guides/text-generation) + seed: + type: integer + format: int64 + nullable: true + description: > + If specified, our system will make a best effort to sample + deterministically, such that repeated requests with the same `seed` + and parameters should return the same result. + + + Determinism is not guaranteed, and you should refer to the + `system_fingerprint` response parameter to monitor changes in the + backend. + stop: + $ref: '#/components/schemas/StopConfiguration' + stream: + description: > + Whether to stream back partial progress. If set, tokens will be sent + as data-only [server-sent + events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) + as they become available, with the stream terminated by a `data: + [DONE]` message. [Example Python + code](https://cookbook.openai.com/examples/how_to_stream_completions). + type: boolean + nullable: true + default: false + stream_options: + $ref: '#/components/schemas/ChatCompletionStreamOptions' + suffix: + description: | + The suffix that comes after a completion of inserted text. + + This parameter is only supported for `gpt-3.5-turbo-instruct`. + default: null + nullable: true + type: string + example: test. + temperature: + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values like + 0.2 will make it more focused and deterministic. + + + We generally recommend altering this or `top_p` but not both. + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens with + top_p probability mass. So 0.1 means only the tokens comprising the + top 10% probability mass are considered. + + + We generally recommend altering this or `temperature` but not both. + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices#end-user-ids). + required: + - model + - prompt + CreateCompletionResponse: + type: object + description: > + Represents a completion response from the API. Note: both the streamed + and non-streamed response objects share the same shape (unlike the chat + endpoint). + properties: + id: + type: string + description: A unique identifier for the completion. + choices: + type: array + description: >- + The list of completion choices the model generated for the input + prompt. + items: + type: object + required: + - finish_reason + - index + - logprobs + - text + properties: + finish_reason: + type: string + description: > + The reason the model stopped generating tokens. This will be + `stop` if the model hit a natural stop point or a provided + stop sequence, + + `length` if the maximum number of tokens specified in the + request was reached, + + or `content_filter` if content was omitted due to a flag from + our content filters. + enum: + - stop + - length + - content_filter + index: + type: integer + logprobs: + anyOf: + - type: object + properties: + text_offset: + type: array + items: + type: integer + token_logprobs: + type: array + items: + type: number + tokens: + type: array + items: + type: string + top_logprobs: + type: array + items: + type: object + additionalProperties: + type: number + - type: 'null' + text: + type: string + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the completion was created. + model: + type: string + description: The model used for completion. + system_fingerprint: + type: string + description: > + This fingerprint represents the backend configuration that the model + runs with. + + + Can be used in conjunction with the `seed` request parameter to + understand when backend changes have been made that might impact + determinism. + object: + type: string + description: The object type, which is always "text_completion" + enum: + - text_completion + x-stainless-const: true + usage: + $ref: '#/components/schemas/CompletionUsage' + required: + - id + - object + - created + - model + - choices + x-oaiMeta: + name: The completion object + legacy: true + example: | + { + "id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7", + "object": "text_completion", + "created": 1589478378, + "model": "gpt-4-turbo", + "choices": [ + { + "text": "\n\nThis is indeed a test", + "index": 0, + "logprobs": null, + "finish_reason": "length" + } + ], + "usage": { + "prompt_tokens": 5, + "completion_tokens": 7, + "total_tokens": 12 + } + } + CreateContainerBody: + type: object + properties: + name: + type: string + description: Name of the container to create. + file_ids: + type: array + description: IDs of files to copy to the container. + items: + type: string + expires_after: + type: object + description: Container expiration time in seconds relative to the 'anchor' time. + properties: + anchor: type: string - description: The tracking ID of the API key. - data: - type: object - description: The payload used to create the API key. + enum: + - last_active_at + description: >- + Time anchor for the expiration time. Currently only + 'last_active_at' is supported. + minutes: + type: integer + required: + - anchor + - minutes + skills: + type: array + description: An optional list of skills referenced by id or inline data. + items: + oneOf: + - $ref: '#/components/schemas/SkillReferenceParam' + - $ref: '#/components/schemas/InlineSkillParam' + discriminator: + propertyName: type + memory_limit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + description: Optional memory limit for the container. Defaults to "1g". + network_policy: + description: Network access policy for the container. + oneOf: + - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' + discriminator: + propertyName: type + required: + - name + CreateContainerFileBody: + type: object + properties: + file_id: + type: string + description: Name of the file to create. + file: + description: | + The File object (not file name) to be uploaded. + type: string + format: binary + required: [] + CreateEmbeddingRequest: + type: object + additionalProperties: false + properties: + input: + description: > + Input text to embed, encoded as a string or array of tokens. To + embed multiple inputs in a single request, pass an array of strings + or array of token arrays. The input must not exceed the max input + tokens for the model (8192 tokens for all embedding models), cannot + be an empty string, and any array must be 2048 dimensions or less. + [Example Python + code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) + for counting tokens. In addition to the per-input token limit, all + embedding models enforce a maximum of 300,000 tokens summed across + all inputs in a single request. + example: The quick brown fox jumped over the lazy dog + oneOf: + - type: string + title: string + description: The string that will be turned into an embedding. + default: '' + example: This is a test. + - type: array + title: array + description: The array of strings that will be turned into an embedding. + minItems: 1 + maxItems: 2048 + items: + type: string + default: '' + example: '[''This is a test.'']' + - type: array + title: array + description: The array of integers that will be turned into an embedding. + minItems: 1 + maxItems: 2048 + items: + type: integer + example: '[1212, 318, 257, 1332, 13]' + - type: array + title: array + description: >- + The array of arrays containing integers that will be turned into + an embedding. + minItems: 1 + maxItems: 2048 + items: + type: array + minItems: 1 + items: + type: integer + example: '[[1212, 318, 257, 1332, 13]]' + model: + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. + example: text-embedding-3-small + anyOf: + - type: string + - type: string + enum: + - text-embedding-ada-002 + - text-embedding-3-small + - text-embedding-3-large + x-oaiTypeLabel: string + encoding_format: + description: >- + The format to return the embeddings in. Can be either `float` or + [`base64`](https://pypi.org/project/pybase64/). + example: float + default: float + type: string + enum: + - float + - base64 + dimensions: + description: > + The number of dimensions the resulting output embeddings should + have. Only supported in `text-embedding-3` and later models. + type: integer + minimum: 1 + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices#end-user-ids). + required: + - model + - input + CreateEmbeddingResponse: + type: object + properties: + data: + type: array + description: The list of embeddings generated by the model. + items: + $ref: '#/components/schemas/Embedding' + model: + type: string + description: The name of the model used to generate the embedding. + object: + type: string + description: The object type, which is always "list". + enum: + - list + x-stainless-const: true + usage: + type: object + description: The usage information for the request. + properties: + prompt_tokens: + type: integer + description: The number of tokens used by the prompt. + total_tokens: + type: integer + description: The total number of tokens used by the request. + required: + - prompt_tokens + - total_tokens + required: + - object + - model + - data + - usage + CreateEvalCompletionsRunDataSource: + type: object + title: CompletionsRunDataSource + description: > + A CompletionsRunDataSource object describing a model sampling + configuration. + properties: + type: + type: string + enum: + - completions + default: completions + description: The type of run data source. Always `completions`. + input_messages: + description: >- + Used when sampling from a model. Dictates the structure of the + messages passed into the model. Can either be a reference to a + prebuilt trajectory (ie, `item.input_trajectory`), or a template + with variable references to the `item` namespace. + oneOf: + - type: object + title: TemplateInputMessages + properties: + type: + type: string + enum: + - template + description: The type of input messages. Always `template`. + template: + type: array + description: >- + A list of chat messages forming the prompt or context. May + include variable references to the `item` namespace, ie + {{item.name}}. + items: + oneOf: + - $ref: '#/components/schemas/EasyInputMessage' + - $ref: '#/components/schemas/EvalItem' + required: + - type + - template + - type: object + title: ItemReferenceInputMessages + properties: + type: + type: string + enum: + - item_reference + description: The type of input messages. Always `item_reference`. + item_reference: + type: string + description: >- + A reference to a variable in the `item` namespace. Ie, + "item.input_trajectory" + required: + - type + - item_reference + sampling_params: + type: object + properties: + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + temperature: + type: number + description: A higher temperature increases randomness in the outputs. + default: 1 + max_completion_tokens: + type: integer + description: The maximum number of tokens in the generated output. + top_p: + type: number + description: >- + An alternative to temperature for nucleus sampling; 1.0 includes + all tokens. + default: 1 + seed: + type: integer + description: A seed value to initialize the randomness, during sampling. + default: 42 + response_format: + description: > + An object specifying the format that the model must output. + + + Setting to `{ "type": "json_schema", "json_schema": {...} }` + enables + + Structured Outputs which ensures the model will match your + supplied JSON + + schema. Learn more in the [Structured Outputs + + guide](/docs/guides/structured-outputs). + + + Setting to `{ "type": "json_object" }` enables the older JSON + mode, which + + ensures the message the model generates is valid JSON. Using + `json_schema` + + is preferred for models that support it. + oneOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/ResponseFormatJsonSchema' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + tools: + type: array + description: > + A list of tools the model may call. Currently, only functions + are supported as a tool. Use this to provide a list of functions + the model may generate JSON inputs for. A max of 128 functions + are supported. + items: + $ref: '#/components/schemas/ChatCompletionTool' + model: + type: string + description: >- + The name of the model to use for generating completions (e.g. + "o3-mini"). + source: + description: >- + Determines what populates the `item` namespace in this run's data + source. + oneOf: + - $ref: '#/components/schemas/EvalJsonlFileContentSource' + - $ref: '#/components/schemas/EvalJsonlFileIdSource' + - $ref: '#/components/schemas/EvalStoredCompletionsSource' + required: + - type + - source + x-oaiMeta: + name: The completions data source object used to configure an individual run + group: eval runs + example: | + { + "name": "gpt-4o-mini-2024-07-18", + "data_source": { + "type": "completions", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-4o-mini-2024-07-18", + "source": { + "type": "stored_completions", + "model": "gpt-4o-mini-2024-07-18" + } + } + } + CreateEvalCustomDataSourceConfig: + type: object + title: CustomDataSourceConfig + description: > + A CustomDataSourceConfig object that defines the schema for the data + source used for the evaluation runs. + + This schema is used to define the shape of the data that will be: + + - Used to define your testing criteria and + + - What data is required when creating a run + properties: + type: + type: string + enum: + - custom + default: custom + description: The type of data source. Always `custom`. + x-stainless-const: true + item_schema: + type: object + description: The json schema for each row in the data source. + additionalProperties: true + example: | + { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + } + include_sample_schema: + type: boolean + default: false + description: >- + Whether the eval should expect you to populate the sample namespace + (ie, by generating responses off of your data source) + required: + - item_schema + - type + x-oaiMeta: + name: The eval file data source config object + group: evals + example: | + { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + }, + "include_sample_schema": true + } + CreateEvalItem: + title: CreateEvalItem + description: >- + A chat message that makes up the prompt or context. May include variable + references to the `item` namespace, ie {{item.name}}. + type: object + oneOf: + - type: object + title: SimpleInputMessage + properties: + role: + type: string + description: The role of the message (e.g. "system", "assistant", "user"). + content: + type: string + description: The content of the message. + required: + - role + - content + - $ref: '#/components/schemas/EvalItem' + x-oaiMeta: + name: The chat message object used to configure an individual run + CreateEvalJsonlRunDataSource: + type: object + title: JsonlRunDataSource + description: > + A JsonlRunDataSource object with that specifies a JSONL file that + matches the eval + properties: + type: + type: string + enum: + - jsonl + default: jsonl + description: The type of data source. Always `jsonl`. + x-stainless-const: true + source: + description: Determines what populates the `item` namespace in the data source. + oneOf: + - $ref: '#/components/schemas/EvalJsonlFileContentSource' + - $ref: '#/components/schemas/EvalJsonlFileIdSource' + required: + - type + - source + x-oaiMeta: + name: The file data source object for the eval run configuration + group: evals + example: | + { + "type": "jsonl", + "source": { + "type": "file_id", + "id": "file-9GYS6xbkWgWhmE7VoLUWFg" + } + } + CreateEvalLabelModelGrader: + type: object + title: LabelModelGrader + description: > + A LabelModelGrader object which uses a model to assign labels to each + item + + in the evaluation. + properties: + type: + description: The object type, which is always `label_model`. + type: string + enum: + - label_model + x-stainless-const: true + name: + type: string + description: The name of the grader. + model: + type: string + description: >- + The model to use for the evaluation. Must support structured + outputs. + input: + type: array + description: >- + A list of chat messages forming the prompt or context. May include + variable references to the `item` namespace, ie {{item.name}}. + items: + $ref: '#/components/schemas/CreateEvalItem' + labels: + type: array + items: + type: string + description: The labels to classify to each item in the evaluation. + passing_labels: + type: array + items: + type: string + description: >- + The labels that indicate a passing result. Must be a subset of + labels. + required: + - type + - model + - input + - passing_labels + - labels + - name + x-oaiMeta: + name: The eval label model grader object + group: evals + example: | + { + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "role": "system", + "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" + }, + { + "role": "user", + "content": "Statement: {{item.response}}" + } + ], + "passing_labels": ["positive"], + "labels": ["positive", "neutral", "negative"], + "name": "Sentiment label grader" + } + CreateEvalLogsDataSourceConfig: + type: object + title: LogsDataSourceConfig + description: > + A data source config which specifies the metadata property of your logs + query. + + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, + etc. + properties: + type: + type: string + enum: + - logs + default: logs + description: The type of data source. Always `logs`. + x-stainless-const: true + metadata: + type: object + description: Metadata filters for the logs data source. + additionalProperties: true + example: | + { + "use_case": "customer_support_agent" + } + required: + - type + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "use_case": "customer_support_agent" + } + } + CreateEvalRequest: + type: object + title: CreateEvalRequest + properties: + name: + type: string + description: The name of the evaluation. + metadata: + $ref: '#/components/schemas/Metadata' + data_source_config: + type: object + description: >- + The configuration for the data source used for the evaluation runs. + Dictates the schema of the data used in the evaluation. + oneOf: + - $ref: '#/components/schemas/CreateEvalCustomDataSourceConfig' + - $ref: '#/components/schemas/CreateEvalLogsDataSourceConfig' + - $ref: '#/components/schemas/CreateEvalStoredCompletionsDataSourceConfig' + testing_criteria: + type: array + description: >- + A list of graders for all eval runs in this group. Graders can + reference variables in the data source using double curly braces + notation, like `{{item.variable_name}}`. To reference the model's + output, use the `sample` namespace (ie, `{{sample.output_text}}`). + items: + oneOf: + - $ref: '#/components/schemas/CreateEvalLabelModelGrader' + - $ref: '#/components/schemas/EvalGraderStringCheck' + - $ref: '#/components/schemas/EvalGraderTextSimilarity' + - $ref: '#/components/schemas/EvalGraderPython' + - $ref: '#/components/schemas/EvalGraderScoreModel' + required: + - data_source_config + - testing_criteria + CreateEvalResponsesRunDataSource: + type: object + title: ResponsesRunDataSource + description: > + A ResponsesRunDataSource object describing a model sampling + configuration. + properties: + type: + type: string + enum: + - responses + default: responses + description: The type of run data source. Always `responses`. + input_messages: + description: >- + Used when sampling from a model. Dictates the structure of the + messages passed into the model. Can either be a reference to a + prebuilt trajectory (ie, `item.input_trajectory`), or a template + with variable references to the `item` namespace. + oneOf: + - type: object + title: InputMessagesTemplate properties: - scopes: + type: + type: string + enum: + - template + description: The type of input messages. Always `template`. + template: type: array + description: >- + A list of chat messages forming the prompt or context. May + include variable references to the `item` namespace, ie + {{item.name}}. items: - type: string + oneOf: + - type: object + title: ChatMessage + properties: + role: + type: string + description: >- + The role of the message (e.g. "system", + "assistant", "user"). + content: + type: string + description: The content of the message. + required: + - role + - content + - $ref: '#/components/schemas/EvalItem' + required: + - type + - template + - type: object + title: InputMessagesItemReference + properties: + type: + type: string + enum: + - item_reference + description: The type of input messages. Always `item_reference`. + item_reference: + type: string description: >- - A list of scopes allowed for the API key, e.g. - `["api.model.request"]` - api_key.updated: + A reference to a variable in the `item` namespace. Ie, + "item.name" + required: + - type + - item_reference + sampling_params: type: object - description: The details for events with this `type`. properties: - id: - type: string - description: The tracking ID of the API key. - changes_requested: + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + temperature: + type: number + description: A higher temperature increases randomness in the outputs. + default: 1 + max_completion_tokens: + type: integer + description: The maximum number of tokens in the generated output. + top_p: + type: number + description: >- + An alternative to temperature for nucleus sampling; 1.0 includes + all tokens. + default: 1 + seed: + type: integer + description: A seed value to initialize the randomness, during sampling. + default: 42 + tools: + type: array + description: > + An array of tools the model may call while generating a + response. You + + can specify which tool to use by setting the `tool_choice` + parameter. + + + The two categories of tools you can provide the model are: + + + - **Built-in tools**: Tools that are provided by OpenAI that + extend the + model's capabilities, like [web search](/docs/guides/tools-web-search) + or [file search](/docs/guides/tools-file-search). Learn more about + [built-in tools](/docs/guides/tools). + - **Function calls (custom tools)**: Functions that are defined + by you, + enabling the model to call your own code. Learn more about + [function calling](/docs/guides/function-calling). + items: + $ref: '#/components/schemas/Tool' + text: type: object - description: The payload used to update the API key. + description: > + Configuration options for a text response from the model. Can be + plain + + text or structured JSON data. Learn more: + + - [Text inputs and outputs](/docs/guides/text) + + - [Structured Outputs](/docs/guides/structured-outputs) properties: - scopes: - type: array - items: + format: + $ref: '#/components/schemas/TextResponseFormatConfiguration' + model: + type: string + description: >- + The name of the model to use for generating completions (e.g. + "o3-mini"). + source: + description: >- + Determines what populates the `item` namespace in this run's data + source. + oneOf: + - $ref: '#/components/schemas/EvalJsonlFileContentSource' + - $ref: '#/components/schemas/EvalJsonlFileIdSource' + - $ref: '#/components/schemas/EvalResponsesSource' + required: + - type + - source + x-oaiMeta: + name: The completions data source object used to configure an individual run + group: eval runs + example: | + { + "name": "gpt-4o-mini-2024-07-18", + "data_source": { + "type": "responses", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-4o-mini-2024-07-18", + "source": { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18" + } + } + } + CreateEvalRunRequest: + type: object + title: CreateEvalRunRequest + properties: + name: + type: string + description: The name of the run. + metadata: + $ref: '#/components/schemas/Metadata' + data_source: + type: object + description: Details about the run's data source. + oneOf: + - $ref: '#/components/schemas/CreateEvalJsonlRunDataSource' + - $ref: '#/components/schemas/CreateEvalCompletionsRunDataSource' + - $ref: '#/components/schemas/CreateEvalResponsesRunDataSource' + required: + - data_source + CreateEvalStoredCompletionsDataSourceConfig: + type: object + title: StoredCompletionsDataSourceConfig + description: | + Deprecated in favor of LogsDataSourceConfig. + properties: + type: + type: string + enum: + - stored_completions + default: stored_completions + description: The type of data source. Always `stored_completions`. + x-stainless-const: true + metadata: + type: object + description: Metadata filters for the stored completions data source. + additionalProperties: true + example: | + { + "use_case": "customer_support_agent" + } + required: + - type + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "use_case": "customer_support_agent" + } + } + CreateFileRequest: + type: object + additionalProperties: false + properties: + file: + description: | + The File object (not file name) to be uploaded. + type: string + format: binary + purpose: + description: | + The intended purpose of the uploaded file. One of: + - `assistants`: Used in the Assistants API + - `batch`: Used in the Batch API + - `fine-tune`: Used for fine-tuning + - `vision`: Images used for vision fine-tuning + - `user_data`: Flexible file type for any purpose + - `evals`: Used for eval data sets + type: string + enum: + - assistants + - batch + - fine-tune + - vision + - user_data + - evals + expires_after: + $ref: '#/components/schemas/FileExpirationAfter' + required: + - file + - purpose + CreateFineTuningCheckpointPermissionRequest: + type: object + additionalProperties: false + properties: + project_ids: + type: array + description: The project identifiers to grant access to. + items: + type: string + required: + - project_ids + CreateFineTuningJobRequest: + type: object + properties: + model: + description: > + The name of the model to fine-tune. You can select one of the + + [supported + models](/docs/guides/fine-tuning#which-models-can-be-fine-tuned). + example: gpt-4o-mini + anyOf: + - type: string + - type: string + enum: + - babbage-002 + - davinci-002 + - gpt-3.5-turbo + - gpt-4o-mini + x-oaiTypeLabel: string + training_file: + description: > + The ID of an uploaded file that contains training data. + + + See [upload file](/docs/api-reference/files/create) for how to + upload a file. + + + Your dataset must be formatted as a JSONL file. Additionally, you + must upload your file with the purpose `fine-tune`. + + + The contents of the file should differ depending on if the model + uses the [chat](/docs/api-reference/fine-tuning/chat-input), + [completions](/docs/api-reference/fine-tuning/completions-input) + format, or if the fine-tuning method uses the + [preference](/docs/api-reference/fine-tuning/preference-input) + format. + + + See the [fine-tuning guide](/docs/guides/model-optimization) for + more details. + type: string + example: file-abc123 + hyperparameters: + type: object + description: > + The hyperparameters used for the fine-tuning job. + + This value is now deprecated in favor of `method`, and should be + passed in under the `method` parameter. + properties: + batch_size: + description: > + Number of examples in each batch. A larger batch size means that + model parameters + + are updated less frequently, but with lower variance. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 256 + default: auto + learning_rate_multiplier: + description: > + Scaling factor for the learning rate. A smaller learning rate + may be useful to avoid + + overfitting. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0 + exclusiveMinimum: true + default: auto + n_epochs: + description: > + The number of epochs to train the model for. An epoch refers to + one full cycle + + through the training dataset. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 50 + default: auto + deprecated: true + suffix: + description: > + A string of up to 64 characters that will be added to your + fine-tuned model name. + + + For example, a `suffix` of "custom-model-name" would produce a model + name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. + type: string + minLength: 1 + maxLength: 64 + default: null + nullable: true + validation_file: + description: > + The ID of an uploaded file that contains validation data. + + + If you provide this file, the data is used to generate validation + + metrics periodically during fine-tuning. These metrics can be viewed + in + + the fine-tuning results file. + + The same data should not be present in both train and validation + files. + + + Your dataset must be formatted as a JSONL file. You must upload your + file with the purpose `fine-tune`. + + + See the [fine-tuning guide](/docs/guides/model-optimization) for + more details. + type: string + nullable: true + example: file-abc123 + integrations: + type: array + description: A list of integrations to enable for your fine-tuning job. + nullable: true + items: + type: object + required: + - type + - wandb + properties: + type: + description: > + The type of integration to enable. Currently, only "wandb" + (Weights and Biases) is supported. + oneOf: + - type: string + enum: + - wandb + x-stainless-const: true + wandb: + type: object + description: > + The settings for your integration with Weights and Biases. + This payload specifies the project that + + metrics will be sent to. Optionally, you can set an explicit + display name for your run, add tags + + to your run, and set a default entity (team, username, etc) to + be associated with your run. + required: + - project + properties: + project: + description: > + The name of the project that the new run will be created + under. type: string - description: >- - A list of scopes allowed for the API key, e.g. - `["api.model.request"]` - api_key.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The tracking ID of the API key. - checkpoint.permission.created: - type: object + example: my-wandb-project + name: + description: > + A display name to set for the run. If not set, we will use + the Job ID as the name. + nullable: true + type: string + entity: + description: > + The entity to use for the run. This allows you to set the + team or username of the WandB user that you would + + like associated with the run. If not set, the default + entity for the registered WandB API key is used. + nullable: true + type: string + tags: + description: > + A list of tags to be attached to the newly created run. + These tags are passed through directly to WandB. Some + + default tags are generated by OpenAI: "openai/finetune", + "openai/{base-model}", "openai/{ftjob-abcdef}". + type: array + items: + type: string + example: custom-tag + seed: + description: > + The seed controls the reproducibility of the job. Passing in the + same seed and job parameters should produce the same results, but + may differ in rare cases. + + If a seed is not specified, one will be generated for you. + type: integer + nullable: true + minimum: 0 + maximum: 2147483647 + example: 42 + method: + $ref: '#/components/schemas/FineTuneMethod' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - model + - training_file + CreateGroupBody: + type: object + description: Request payload for creating a new group in the organization. + properties: + name: + type: string + description: Human readable name for the group. + minLength: 1 + maxLength: 255 + required: + - name + x-oaiMeta: + example: | + { + "name": "Support Team" + } + CreateGroupUserBody: + type: object + description: Request payload for adding a user to a group. + properties: + user_id: + type: string + description: Identifier of the user to add to the group. + required: + - user_id + x-oaiMeta: + example: | + { + "user_id": "user_abc123" + } + CreateImageEditRequest: + type: object + properties: + image: + anyOf: + - type: string + format: binary + - type: array + maxItems: 16 + items: + type: string + format: binary + description: > + The image(s) to edit. Must be a supported image file or an array of + images. + + + For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and + `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` + + file less than 50MB. You can provide up to 16 images. + + `chatgpt-image-latest` follows the same input constraints as GPT + image models. + + + For `dall-e-2`, you can only provide one image, and it should be a + square + + `png` file less than 4MB. + prompt: + description: >- + A text description of the desired image(s). The maximum length is + 1000 characters for `dall-e-2`, and 32000 characters for the GPT + image models. + type: string + example: A cute baby sea otter wearing a beret + mask: + description: >- + An additional image whose fully transparent areas (e.g. where alpha + is zero) indicate where `image` should be edited. If there are + multiple images provided, the mask will be applied on the first + image. Must be a valid PNG file, less than 4MB, and have the same + dimensions as `image`. + type: string + format: binary + background: + type: string + enum: + - transparent + - opaque + - auto + default: auto + example: transparent + nullable: true + description: > + Allows to set transparency for the background of the generated + image(s). + + This parameter is only supported for the GPT image models. Must be + one of + + `transparent`, `opaque` or `auto` (default value). When `auto` is + used, the + + model will automatically determine the best background for the + image. + + + If `transparent`, the output format needs to support transparency, + so it + + should be set to either `png` (default value) or `webp`. + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1.5 + - dall-e-2 + - gpt-image-1 + - gpt-image-1-mini + - chatgpt-image-latest + x-stainless-const: true + x-oaiTypeLabel: string + default: gpt-image-1.5 + example: gpt-image-1.5 + nullable: true + description: The model to use for image generation. Defaults to `gpt-image-1.5`. + 'n': + type: integer + minimum: 1 + maximum: 10 + default: 1 + example: 1 + nullable: true + description: The number of images to generate. Must be between 1 and 10. + size: + anyOf: + - type: string + - type: string + enum: + - 256x256 + - 512x512 + - 1024x1024 + - 1536x1024 + - 1024x1536 + - auto + default: 1024x1024 + example: 1024x1024 + nullable: true + description: >- + The size of the generated images. For `gpt-image-2` and + `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as + `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height + must both be divisible by 16 and the requested aspect ratio must be + between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, + and the maximum supported resolution is `3840x2160`. The requested + size must also satisfy the model's current pixel and edge limits. + The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + supported by the GPT image models; `auto` is supported for models + that allow automatic sizing. For `dall-e-2`, use one of `256x256`, + `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, + `1792x1024`, or `1024x1792`. + response_format: + type: string + enum: + - url + - b64_json + example: url + nullable: true + description: >- + The format in which the generated images are returned. Must be one + of `url` or `b64_json`. URLs are only valid for 60 minutes after the + image has been generated. This parameter is only supported for + `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models + always return base64-encoded images. + output_format: + type: string + enum: + - png + - jpeg + - webp + default: png + example: png + nullable: true + description: > + The format in which the generated images are returned. This + parameter is + + only supported for the GPT image models. Must be one of `png`, + `jpeg`, or `webp`. + + The default value is `png`. + output_compression: + type: integer + default: 100 + example: 100 + nullable: true + description: > + The compression level (0-100%) for the generated images. This + parameter + + is only supported for the GPT image models with the `webp` or `jpeg` + output + + formats, and defaults to 100. + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices#end-user-ids). + input_fidelity: + anyOf: + - $ref: '#/components/schemas/InputFidelity' + - type: 'null' + stream: + type: boolean + default: false + example: false + nullable: true + description: > + Edit the image in streaming mode. Defaults to `false`. See the + + [Image generation guide](/docs/guides/image-generation) for more + information. + partial_images: + $ref: '#/components/schemas/PartialImages' + quality: + type: string + enum: + - standard + - low + - medium + - high + - auto + default: auto + example: high + nullable: true + description: > + The quality of the image that will be generated for GPT image + models. Defaults to `auto`. + required: + - prompt + - image + CreateImageRequest: + type: object + properties: + prompt: + description: >- + A text description of the desired image(s). The maximum length is + 32000 characters for the GPT image models, 1000 characters for + `dall-e-2` and 4000 characters for `dall-e-3`. + type: string + example: A cute baby sea otter + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1.5 + - dall-e-2 + - dall-e-3 + - gpt-image-1 + - gpt-image-1-mini + x-oaiTypeLabel: string + default: dall-e-2 + example: gpt-image-1.5 + nullable: true + description: >- + The model to use for image generation. One of `dall-e-2`, + `dall-e-3`, or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, + `gpt-image-1.5`). Defaults to `dall-e-2` unless a parameter specific + to the GPT image models is used. + 'n': + type: integer + minimum: 1 + maximum: 10 + default: 1 + example: 1 + nullable: true + description: >- + The number of images to generate. Must be between 1 and 10. For + `dall-e-3`, only `n=1` is supported. + quality: + type: string + enum: + - standard + - hd + - low + - medium + - high + - auto + default: auto + example: medium + nullable: true + description: > + The quality of the image that will be generated. + + + - `auto` (default value) will automatically select the best quality + for the given model. + + - `high`, `medium` and `low` are supported for the GPT image models. + + - `hd` and `standard` are supported for `dall-e-3`. + + - `standard` is the only option for `dall-e-2`. + response_format: + type: string + enum: + - url + - b64_json + default: url + example: url + nullable: true + description: >- + The format in which generated images with `dall-e-2` and `dall-e-3` + are returned. Must be one of `url` or `b64_json`. URLs are only + valid for 60 minutes after the image has been generated. This + parameter isn't supported for the GPT image models, which always + return base64-encoded images. + output_format: + type: string + enum: + - png + - jpeg + - webp + default: png + example: png + nullable: true + description: >- + The format in which the generated images are returned. This + parameter is only supported for the GPT image models. Must be one of + `png`, `jpeg`, or `webp`. + output_compression: + type: integer + default: 100 + example: 100 + nullable: true + description: >- + The compression level (0-100%) for the generated images. This + parameter is only supported for the GPT image models with the `webp` + or `jpeg` output formats, and defaults to 100. + stream: + type: boolean + default: false + example: false + nullable: true + description: > + Generate the image in streaming mode. Defaults to `false`. See the + + [Image generation guide](/docs/guides/image-generation) for more + information. + + This parameter is only supported for the GPT image models. + partial_images: + $ref: '#/components/schemas/PartialImages' + size: + anyOf: + - type: string + - type: string + enum: + - auto + - 1024x1024 + - 1536x1024 + - 1024x1536 + - 256x256 + - 512x512 + - 1792x1024 + - 1024x1792 + default: auto + example: 1024x1024 + nullable: true + description: >- + The size of the generated images. For `gpt-image-2` and + `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as + `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height + must both be divisible by 16 and the requested aspect ratio must be + between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, + and the maximum supported resolution is `3840x2160`. The requested + size must also satisfy the model's current pixel and edge limits. + The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + supported by the GPT image models; `auto` is supported for models + that allow automatic sizing. For `dall-e-2`, use one of `256x256`, + `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, + `1792x1024`, or `1024x1792`. + moderation: + type: string + enum: + - low + - auto + default: auto + example: low + nullable: true + description: >- + Control the content-moderation level for images generated by the GPT + image models. Must be either `low` for less restrictive filtering or + `auto` (default value). + background: + type: string + enum: + - transparent + - opaque + - auto + default: auto + example: transparent + nullable: true + description: > + Allows to set transparency for the background of the generated + image(s). + + This parameter is only supported for the GPT image models. Must be + one of + + `transparent`, `opaque` or `auto` (default value). When `auto` is + used, the + + model will automatically determine the best background for the + image. + + + If `transparent`, the output format needs to support transparency, + so it + + should be set to either `png` (default value) or `webp`. + style: + type: string + enum: + - vivid + - natural + default: vivid + example: vivid + nullable: true + description: >- + The style of the generated images. This parameter is only supported + for `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes + the model to lean towards generating hyper-real and dramatic images. + Natural causes the model to produce more natural, less hyper-real + looking images. + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices#end-user-ids). + required: + - prompt + CreateImageVariationRequest: + type: object + properties: + image: + description: >- + The image to use as the basis for the variation(s). Must be a valid + PNG file, less than 4MB, and square. + type: string + format: binary + model: + anyOf: + - type: string + - type: string + enum: + - dall-e-2 + x-stainless-const: true + x-oaiTypeLabel: string + default: dall-e-2 + example: dall-e-2 + nullable: true description: >- - The project and fine-tuned model checkpoint that the checkpoint - permission was created for. - properties: - id: - type: string - description: The ID of the checkpoint permission. - data: - type: object - description: The payload used to create the checkpoint permission. - properties: - project_id: - type: string - description: >- - The ID of the project that the checkpoint permission was - created for. - fine_tuned_model_checkpoint: - type: string - description: The ID of the fine-tuned model checkpoint. - checkpoint.permission.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the checkpoint permission. - external_key.registered: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the external key configuration. - data: - type: object - description: The configuration for the external key. - external_key.removed: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the external key configuration. - group.created: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the group. - data: - type: object - description: Information about the created group. - properties: - group_name: - type: string - description: The group name. - group.updated: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the group. - changes_requested: - type: object - description: The payload used to update the group. - properties: - group_name: - type: string - description: The updated group name. - group.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the group. - scim.enabled: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the SCIM was enabled for. - scim.disabled: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the SCIM was disabled for. - invite.sent: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the invite. - data: - type: object - description: The payload used to create the invite. - properties: - email: - type: string - description: The email invited to the organization. - role: - type: string - description: >- - The role the email was invited to be. Is either `owner` or - `member`. - invite.accepted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the invite. - invite.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the invite. - ip_allowlist.created: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the IP allowlist configuration. - name: - type: string - description: The name of the IP allowlist configuration. - allowed_ips: - type: array - description: The IP addresses or CIDR ranges included in the configuration. - items: - type: string - ip_allowlist.updated: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The ID of the IP allowlist configuration. - allowed_ips: - type: array + The model to use for image generation. Only `dall-e-2` is supported + at this time. + 'n': + type: integer + minimum: 1 + maximum: 10 + default: 1 + example: 1 + nullable: true + description: The number of images to generate. Must be between 1 and 10. + response_format: + type: string + enum: + - url + - b64_json + default: url + example: url + nullable: true + description: >- + The format in which the generated images are returned. Must be one + of `url` or `b64_json`. URLs are only valid for 60 minutes after the + image has been generated. + size: + type: string + enum: + - 256x256 + - 512x512 + - 1024x1024 + default: 1024x1024 + example: 1024x1024 + nullable: true + description: >- + The size of the generated images. Must be one of `256x256`, + `512x512`, or `1024x1024`. + user: + type: string + example: user-1234 + description: > + A unique identifier representing your end-user, which can help + OpenAI to monitor and detect abuse. [Learn + more](/docs/guides/safety-best-practices#end-user-ids). + required: + - image + CreateMessageRequest: + type: object + additionalProperties: false + required: + - role + - content + properties: + role: + type: string + enum: + - user + - assistant + description: > + The role of the entity that is creating the message. Allowed values + include: + + - `user`: Indicates the message is sent by an actual user and should + be used in most cases to represent user-generated messages. + + - `assistant`: Indicates the message is generated by the assistant. + Use this value to insert messages from the assistant into the + conversation. + content: + oneOf: + - type: string + description: The text contents of the message. + title: Text content + - type: array description: >- - The updated set of IP addresses or CIDR ranges in the - configuration. + An array of content parts with a defined type, each can be of + type `text` or images can be passed with `image_url` or + `image_file`. Image types are only supported on + [Vision-compatible models](/docs/models). + title: Array of content parts items: - type: string - ip_allowlist.deleted: - type: object - description: The details for events with this `type`. + oneOf: + - $ref: '#/components/schemas/MessageContentImageFileObject' + - $ref: '#/components/schemas/MessageContentImageUrlObject' + - $ref: '#/components/schemas/MessageRequestContentTextObject' + minItems: 1 + attachments: + anyOf: + - type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + description: The tools to add this file to. + type: array + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: >- + #/components/schemas/AssistantToolsFileSearchTypeOnly + description: >- + A list of files attached to the message, and the tools they + should be added to. + required: + - file_id + - tools + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + CreateModelResponseProperties: + allOf: + - $ref: '#/components/schemas/ModelResponseProperties' + - type: object properties: - id: - type: string - description: The ID of the IP allowlist configuration. - name: - type: string - description: The name of the IP allowlist configuration. - allowed_ips: - type: array - description: The IP addresses or CIDR ranges that were in the configuration. + prompt_cache_options: + $ref: '#/components/schemas/PromptCacheOptionsParam' + top_logprobs: + description: > + An integer between 0 and 20 specifying the maximum number of + most likely + + tokens to return at each token position, each with an associated + log + + probability. In some cases, the number of returned tokens may be + fewer than + + requested. + type: integer + minimum: 0 + maximum: 20 + CreateModerationRequest: + type: object + properties: + input: + description: > + Input (or inputs) to classify. Can be a single string, an array of + strings, or + + an array of multi-modal input objects similar to other models. + oneOf: + - type: string + description: A string of text to classify for moderation. + default: '' + example: I want to kill them. + - type: array + description: An array of strings to classify for moderation. items: type: string - ip_allowlist.config.activated: - type: object - description: The details for events with this `type`. - properties: - configs: - type: array - description: The configurations that were activated. + default: '' + example: I want to kill them. + - type: array + description: An array of multi-modal inputs to the moderation model. items: + oneOf: + - type: object + description: An object describing an image to classify. + properties: + type: + description: Always `image_url`. + type: string + enum: + - image_url + x-stainless-const: true + image_url: + type: object + description: >- + Contains either an image URL or a data URL for a + base64 encoded image. + properties: + url: + type: string + description: >- + Either a URL of the image or the base64 encoded + image data. + format: uri + example: https://example.com/image.jpg + required: + - url + required: + - type + - image_url + - type: object + description: An object describing text to classify. + properties: + type: + description: Always `text`. + type: string + enum: + - text + x-stainless-const: true + text: + description: A string of text to classify. + type: string + example: I want to kill them + required: + - type + - text + model: + description: | + The content moderation model you would like to use. Learn more in + [the moderation guide](/docs/guides/moderation), and learn about + available models [here](/docs/models#moderation). + nullable: false + default: omni-moderation-latest + example: omni-moderation-2024-09-26 + anyOf: + - type: string + - type: string + enum: + - omni-moderation-latest + - omni-moderation-2024-09-26 + - text-moderation-latest + - text-moderation-stable + x-oaiTypeLabel: string + required: + - input + CreateModerationResponse: + type: object + description: Represents if a given text input is potentially harmful. + properties: + id: + type: string + description: The unique identifier for the moderation request. + model: + type: string + description: The model used to generate the moderation results. + results: + type: array + description: A list of moderation objects. + items: + type: object + properties: + flagged: + type: boolean + description: Whether any of the below categories are flagged. + categories: + type: object + description: A list of the categories, and whether they are flagged or not. + properties: + hate: + type: boolean + description: >- + Content that expresses, incites, or promotes hate based on + race, gender, ethnicity, religion, nationality, sexual + orientation, disability status, or caste. Hateful content + aimed at non-protected groups (e.g., chess players) is + harassment. + hate/threatening: + type: boolean + description: >- + Hateful content that also includes violence or serious + harm towards the targeted group based on race, gender, + ethnicity, religion, nationality, sexual orientation, + disability status, or caste. + harassment: + type: boolean + description: >- + Content that expresses, incites, or promotes harassing + language towards any target. + harassment/threatening: + type: boolean + description: >- + Harassment content that also includes violence or serious + harm towards any target. + illicit: + anyOf: + - type: boolean + description: >- + Content that includes instructions or advice that + facilitate the planning or execution of wrongdoing, or + that gives advice or instruction on how to commit + illicit acts. For example, "how to shoplift" would fit + this category. + - type: 'null' + illicit/violent: + anyOf: + - type: boolean + description: >- + Content that includes instructions or advice that + facilitate the planning or execution of wrongdoing + that also includes violence, or that gives advice or + instruction on the procurement of any weapon. + - type: 'null' + self-harm: + type: boolean + description: >- + Content that promotes, encourages, or depicts acts of + self-harm, such as suicide, cutting, and eating disorders. + self-harm/intent: + type: boolean + description: >- + Content where the speaker expresses that they are engaging + or intend to engage in acts of self-harm, such as suicide, + cutting, and eating disorders. + self-harm/instructions: + type: boolean + description: >- + Content that encourages performing acts of self-harm, such + as suicide, cutting, and eating disorders, or that gives + instructions or advice on how to commit such acts. + sexual: + type: boolean + description: >- + Content meant to arouse sexual excitement, such as the + description of sexual activity, or that promotes sexual + services (excluding sex education and wellness). + sexual/minors: + type: boolean + description: >- + Sexual content that includes an individual who is under 18 + years old. + violence: + type: boolean + description: Content that depicts death, violence, or physical injury. + violence/graphic: + type: boolean + description: >- + Content that depicts death, violence, or physical injury + in graphic detail. + required: + - hate + - hate/threatening + - harassment + - harassment/threatening + - illicit + - illicit/violent + - self-harm + - self-harm/intent + - self-harm/instructions + - sexual + - sexual/minors + - violence + - violence/graphic + category_scores: type: object + description: >- + A list of the categories along with their scores as predicted + by model. properties: - id: - type: string - description: The ID of the IP allowlist configuration. - name: - type: string - description: The name of the IP allowlist configuration. - ip_allowlist.config.deactivated: - type: object - description: The details for events with this `type`. - properties: - configs: - type: array - description: The configurations that were deactivated. - items: + hate: + type: number + description: The score for the category 'hate'. + hate/threatening: + type: number + description: The score for the category 'hate/threatening'. + harassment: + type: number + description: The score for the category 'harassment'. + harassment/threatening: + type: number + description: The score for the category 'harassment/threatening'. + illicit: + type: number + description: The score for the category 'illicit'. + illicit/violent: + type: number + description: The score for the category 'illicit/violent'. + self-harm: + type: number + description: The score for the category 'self-harm'. + self-harm/intent: + type: number + description: The score for the category 'self-harm/intent'. + self-harm/instructions: + type: number + description: The score for the category 'self-harm/instructions'. + sexual: + type: number + description: The score for the category 'sexual'. + sexual/minors: + type: number + description: The score for the category 'sexual/minors'. + violence: + type: number + description: The score for the category 'violence'. + violence/graphic: + type: number + description: The score for the category 'violence/graphic'. + required: + - hate + - hate/threatening + - harassment + - harassment/threatening + - illicit + - illicit/violent + - self-harm + - self-harm/intent + - self-harm/instructions + - sexual + - sexual/minors + - violence + - violence/graphic + category_applied_input_types: type: object + description: >- + A list of the categories along with the input type(s) that the + score applies to. properties: - id: - type: string - description: The ID of the IP allowlist configuration. - name: - type: string - description: The name of the IP allowlist configuration. - login.succeeded: - type: object - description: >- - This event has no additional fields beyond the standard audit log - attributes. - login.failed: - type: object - description: The details for events with this `type`. - properties: - error_code: - type: string - description: The error code of the failure. - error_message: - type: string - description: The error message of the failure. - logout.succeeded: - type: object - description: >- - This event has no additional fields beyond the standard audit log - attributes. - logout.failed: - type: object - description: The details for events with this `type`. - properties: - error_code: - type: string - description: The error code of the failure. - error_message: - type: string - description: The error message of the failure. - organization.updated: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The organization ID. - changes_requested: - type: object - description: The payload used to update the organization settings. - properties: - title: - type: string - description: The organization title. - description: - type: string - description: The organization description. - name: - type: string - description: The organization name. - threads_ui_visibility: - type: string - description: >- - Visibility of the threads page which shows messages created - with the Assistants API and Playground. One of `ANY_ROLE`, - `OWNERS`, or `NONE`. - usage_dashboard_visibility: - type: string - description: >- - Visibility of the usage dashboard which shows activity and - costs for your organization. One of `ANY_ROLE` or `OWNERS`. - api_call_logging: - type: string - description: >- - How your organization logs data from supported API calls. - One of `disabled`, `enabled_per_call`, - `enabled_for_all_projects`, or - `enabled_for_selected_projects` - api_call_logging_project_ids: - type: string - description: >- - The list of project ids if api_call_logging is set to - `enabled_for_selected_projects` - project.created: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The project ID. - data: - type: object - description: The payload used to create the project. - properties: - name: - type: string - description: The project name. - title: - type: string - description: The title of the project as seen on the dashboard. - project.updated: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The project ID. - changes_requested: - type: object - description: The payload used to update the project. - properties: - title: - type: string - description: The title of the project as seen on the dashboard. - project.archived: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The project ID. - project.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The project ID. - rate_limit.updated: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The rate limit ID - changes_requested: - type: object - description: The payload used to update the rate limits. - properties: - max_requests_per_1_minute: - type: integer - description: The maximum requests per minute. - max_tokens_per_1_minute: - type: integer - description: The maximum tokens per minute. - max_images_per_1_minute: - type: integer - description: >- - The maximum images per minute. Only relevant for certain - models. - max_audio_megabytes_per_1_minute: - type: integer - description: >- - The maximum audio megabytes per minute. Only relevant for - certain models. - max_requests_per_1_day: - type: integer - description: >- - The maximum requests per day. Only relevant for certain - models. - batch_1_day_max_input_tokens: - type: integer - description: >- - The maximum batch input tokens per day. Only relevant for - certain models. - rate_limit.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The rate limit ID - role.created: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The role ID. - role_name: - type: string - description: The name of the role. - permissions: - type: array - items: - type: string - description: The permissions granted by the role. - resource_type: - type: string - description: The type of resource the role belongs to. - resource_id: - type: string - description: The resource the role is scoped to. - role.updated: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The role ID. - changes_requested: - type: object - description: The payload used to update the role. - properties: - role_name: - type: string - description: The updated role name, when provided. - resource_id: - type: string - description: The resource the role is scoped to. - resource_type: - type: string - description: The type of resource the role belongs to. - permissions_added: - type: array - items: - type: string - description: The permissions added to the role. - permissions_removed: - type: array - items: - type: string - description: The permissions removed from the role. - description: - type: string - description: The updated role description, when provided. - metadata: - type: object - description: Additional metadata stored on the role. - role.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The role ID. - role.assignment.created: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The identifier of the role assignment. - principal_id: - type: string - description: The principal (user or group) that received the role. - principal_type: - type: string - description: The type of principal (user or group) that received the role. - resource_id: - type: string - description: The resource the role assignment is scoped to. - resource_type: - type: string - description: The type of resource the role assignment is scoped to. - role.assignment.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The identifier of the role assignment. - principal_id: - type: string - description: The principal (user or group) that had the role removed. - principal_type: - type: string - description: The type of principal (user or group) that had the role removed. - resource_id: - type: string - description: The resource the role assignment was scoped to. - resource_type: - type: string - description: The type of resource the role assignment was scoped to. - service_account.created: - type: object - description: The details for events with this `type`. + hate: + type: array + description: The applied input type(s) for the category 'hate'. + items: + type: string + enum: + - text + x-stainless-const: true + hate/threatening: + type: array + description: >- + The applied input type(s) for the category + 'hate/threatening'. + items: + type: string + enum: + - text + x-stainless-const: true + harassment: + type: array + description: The applied input type(s) for the category 'harassment'. + items: + type: string + enum: + - text + x-stainless-const: true + harassment/threatening: + type: array + description: >- + The applied input type(s) for the category + 'harassment/threatening'. + items: + type: string + enum: + - text + x-stainless-const: true + illicit: + type: array + description: The applied input type(s) for the category 'illicit'. + items: + type: string + enum: + - text + x-stainless-const: true + illicit/violent: + type: array + description: >- + The applied input type(s) for the category + 'illicit/violent'. + items: + type: string + enum: + - text + x-stainless-const: true + self-harm: + type: array + description: The applied input type(s) for the category 'self-harm'. + items: + type: string + enum: + - text + - image + self-harm/intent: + type: array + description: >- + The applied input type(s) for the category + 'self-harm/intent'. + items: + type: string + enum: + - text + - image + self-harm/instructions: + type: array + description: >- + The applied input type(s) for the category + 'self-harm/instructions'. + items: + type: string + enum: + - text + - image + sexual: + type: array + description: The applied input type(s) for the category 'sexual'. + items: + type: string + enum: + - text + - image + sexual/minors: + type: array + description: >- + The applied input type(s) for the category + 'sexual/minors'. + items: + type: string + enum: + - text + x-stainless-const: true + violence: + type: array + description: The applied input type(s) for the category 'violence'. + items: + type: string + enum: + - text + - image + violence/graphic: + type: array + description: >- + The applied input type(s) for the category + 'violence/graphic'. + items: + type: string + enum: + - text + - image + required: + - hate + - hate/threatening + - harassment + - harassment/threatening + - illicit + - illicit/violent + - self-harm + - self-harm/intent + - self-harm/instructions + - sexual + - sexual/minors + - violence + - violence/graphic + required: + - flagged + - categories + - category_scores + - category_applied_input_types + required: + - id + - model + - results + x-oaiMeta: + name: The moderation object + example: | + { + "id": "modr-0d9740456c391e43c445bf0f010940c7", + "model": "omni-moderation-latest", + "results": [ + { + "flagged": true, + "categories": { + "harassment": true, + "harassment/threatening": true, + "sexual": false, + "hate": false, + "hate/threatening": false, + "illicit": false, + "illicit/violent": false, + "self-harm/intent": false, + "self-harm/instructions": false, + "self-harm": false, + "sexual/minors": false, + "violence": true, + "violence/graphic": true + }, + "category_scores": { + "harassment": 0.8189693396524255, + "harassment/threatening": 0.804985420696006, + "sexual": 1.573112165348997e-6, + "hate": 0.007562942636942845, + "hate/threatening": 0.004208854591835476, + "illicit": 0.030535955153511665, + "illicit/violent": 0.008925306722380033, + "self-harm/intent": 0.00023023930975076432, + "self-harm/instructions": 0.0002293869201073356, + "self-harm": 0.012598046106750154, + "sexual/minors": 2.212566909570261e-8, + "violence": 0.9999992735124786, + "violence/graphic": 0.843064871157054 + }, + "category_applied_input_types": { + "harassment": [ + "text" + ], + "harassment/threatening": [ + "text" + ], + "sexual": [ + "text", + "image" + ], + "hate": [ + "text" + ], + "hate/threatening": [ + "text" + ], + "illicit": [ + "text" + ], + "illicit/violent": [ + "text" + ], + "self-harm/intent": [ + "text", + "image" + ], + "self-harm/instructions": [ + "text", + "image" + ], + "self-harm": [ + "text", + "image" + ], + "sexual/minors": [ + "text" + ], + "violence": [ + "text", + "image" + ], + "violence/graphic": [ + "text", + "image" + ] + } + } + ] + } + CreateResponse: + allOf: + - $ref: '#/components/schemas/CreateModelResponseProperties' + - $ref: '#/components/schemas/ResponseProperties' + - type: object properties: - id: - type: string - description: The service account ID. - data: - type: object - description: The payload used to create the service account. - properties: - role: - type: string + truncation: + deprecated: true + anyOf: + - type: string + description: > + The truncation strategy to use for the model response. + + - `auto`: If the input to this Response exceeds + the model's context window size, the model will truncate the + response to fit the context window by dropping items from the beginning of the conversation. + - `disabled` (default): If the input size will exceed the + context window + size for a model, the request will fail with a 400 error. + enum: + - auto + - disabled + default: disabled + - type: 'null' + reasoning: + anyOf: + - $ref: '#/components/schemas/Reasoning' + - type: 'null' + input: + $ref: '#/components/schemas/InputParam' + include: + anyOf: + - type: array description: >- - The role of the service account. Is either `owner` or - `member`. - service_account.updated: + Specify additional output data to include in the model + response. Currently supported values are: + + - `web_search_call.action.sources`: Include the sources of + the web search tool call. + + - `code_interpreter_call.outputs`: Includes the outputs of + python code execution in code interpreter tool call items. + + - `computer_call_output.output.image_url`: Include image + urls from the computer call output. + + - `file_search_call.results`: Include the search results of + the file search tool call. + + - `message.input_image.image_url`: Include image urls from + the input message. + + - `message.output_text.logprobs`: Include logprobs with + assistant messages. + + - `reasoning.encrypted_content`: Includes an encrypted + version of reasoning tokens in reasoning item outputs. This + enables reasoning items to be used in multi-turn + conversations when using the Responses API statelessly (like + when the `store` parameter is set to `false`, or when an + organization is enrolled in the zero data retention + program). + items: + $ref: '#/components/schemas/IncludeEnum' + - type: 'null' + parallel_tool_calls: + anyOf: + - type: boolean + description: | + Whether to allow the model to run tool calls in parallel. + default: true + - type: 'null' + store: + anyOf: + - type: boolean + description: > + Whether to store the generated model response for later + retrieval via + + API. + default: true + - type: 'null' + instructions: + anyOf: + - type: string + description: > + A system (or developer) message inserted into the model's + context. + + + When using along with `previous_response_id`, the + instructions from a previous + + response will not be carried over to the next response. This + makes it simple + + to swap out system (or developer) messages in new responses. + - type: 'null' + moderation: + anyOf: + - $ref: '#/components/schemas/ModerationParam' + description: > + Configuration for running moderation on the input and output + of this response. + - type: 'null' + stream: + anyOf: + - description: > + If set to true, the model response data will be streamed to + the client + + as it is generated using [server-sent + events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + + See the [Streaming section + below](/docs/api-reference/responses-streaming) + + for more information. + type: boolean + default: false + - type: 'null' + stream_options: + $ref: '#/components/schemas/ResponseStreamOptions' + conversation: + anyOf: + - $ref: '#/components/schemas/ConversationParam' + - type: 'null' + context_management: + anyOf: + - type: array + description: | + Context management configuration for this request. + minItems: 1 + items: + $ref: '#/components/schemas/ContextManagementParam' + - type: 'null' + max_output_tokens: + anyOf: + - description: > + An upper bound for the number of tokens that can be + generated for a response, including visible output tokens + and [reasoning tokens](/docs/guides/reasoning). + type: integer + minimum: 16 + - type: 'null' + CreateRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: >- + The ID of the [assistant](/docs/api-reference/assistants) to use to + execute this run. + type: string + model: + description: >- + The ID of the [Model](/docs/api-reference/models) to be used to + execute this run. If a value is provided here, it will override the + model associated with the assistant. If not, the model associated + with the assistant will be used. + example: gpt-4o + anyOf: + - type: string + - $ref: '#/components/schemas/AssistantSupportedModels' + x-oaiTypeLabel: string + nullable: true + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + instructions: + description: >- + Overrides the + [instructions](/docs/api-reference/assistants/createAssistant) of + the assistant. This is useful for modifying the behavior on a + per-run basis. + type: string + nullable: true + additional_instructions: + description: >- + Appends additional instructions at the end of the instructions for + the run. This is useful for modifying the behavior on a per-run + basis without overriding other instructions. + type: string + nullable: true + additional_messages: + description: Adds additional messages to the thread before creating the run. + type: array + items: + $ref: '#/components/schemas/CreateMessageRequest' + nullable: true + tools: + description: >- + Override the tools the assistant can use for this run. This is + useful for modifying the behavior on a per-run basis. + nullable: true + type: array + maxItems: 20 + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values like + 0.2 will make it more focused and deterministic. + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens with + top_p probability mass. So 0.1 means only the tokens comprising the + top 10% probability mass are considered. + + + We generally recommend altering this or temperature but not both. + stream: + type: boolean + nullable: true + description: > + If `true`, returns a stream of events that happen during the Run as + server-sent events, terminating when the Run enters a terminal state + with a `data: [DONE]` message. + max_prompt_tokens: + type: integer + nullable: true + description: > + The maximum number of prompt tokens that may be used over the course + of the run. The run will make a best effort to use only the number + of prompt tokens specified, across multiple turns of the run. If the + run exceeds the number of prompt tokens specified, the run will end + with status `incomplete`. See `incomplete_details` for more info. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: > + The maximum number of completion tokens that may be used over the + course of the run. The run will make a best effort to use only the + number of completion tokens specified, across multiple turns of the + run. If the run exceeds the number of completion tokens specified, + the run will end with status `incomplete`. See `incomplete_details` + for more info. + minimum: 256 + truncation_strategy: + allOf: + - $ref: '#/components/schemas/TruncationObject' + - nullable: true + tool_choice: + allOf: + - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' + - nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + required: + - assistant_id + CreateSpeechRequest: + type: object + additionalProperties: false + properties: + model: + description: > + One of the available [TTS models](/docs/models#tts): `tts-1`, + `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`. + anyOf: + - type: string + - type: string + enum: + - tts-1 + - tts-1-hd + - gpt-4o-mini-tts + - gpt-4o-mini-tts-2025-12-15 + x-oaiTypeLabel: string + input: + type: string + description: >- + The text to generate audio for. The maximum length is 4096 + characters. + maxLength: 4096 + instructions: + type: string + description: >- + Control the voice of your generated audio with additional + instructions. Does not work with `tts-1` or `tts-1-hd`. + maxLength: 4096 + voice: + description: >- + The voice to use when generating the audio. Supported built-in + voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, + `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. + You may also provide a custom voice object with an `id`, for example + `{ "id": "voice_1234" }`. Previews of the voices are available in + the [Text to speech + guide](/docs/guides/text-to-speech#voice-options). + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + response_format: + description: >- + The format to audio in. Supported formats are `mp3`, `opus`, `aac`, + `flac`, `wav`, and `pcm`. + default: mp3 + type: string + enum: + - mp3 + - opus + - aac + - flac + - wav + - pcm + speed: + description: >- + The speed of the generated audio. Select a value from `0.25` to + `4.0`. `1.0` is the default. + type: number + default: 1 + minimum: 0.25 + maximum: 4 + stream_format: + description: >- + The format to stream the audio in. Supported formats are `sse` and + `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`. + type: string + default: audio + enum: + - sse + - audio + required: + - model + - input + - voice + CreateSpeechResponseStreamEvent: + anyOf: + - $ref: '#/components/schemas/SpeechAudioDeltaEvent' + - $ref: '#/components/schemas/SpeechAudioDoneEvent' + discriminator: + propertyName: type + CreateSpendAlertBody: + type: object + description: Parameters for creating or updating a spend alert. + properties: + threshold_amount: + type: integer + minimum: 0 + description: The alert threshold amount, in cents. + currency: + type: string + enum: + - USD + description: The currency for the threshold amount. + interval: + type: string + enum: + - month + description: The time interval for evaluating spend against the threshold. + notification_channel: + $ref: '#/components/schemas/SpendAlertNotificationChannel' + required: + - threshold_amount + - currency + - interval + - notification_channel + CreateThreadAndRunRequest: + type: object + additionalProperties: false + properties: + assistant_id: + description: >- + The ID of the [assistant](/docs/api-reference/assistants) to use to + execute this run. + type: string + thread: + $ref: '#/components/schemas/CreateThreadRequest' + model: + description: >- + The ID of the [Model](/docs/api-reference/models) to be used to + execute this run. If a value is provided here, it will override the + model associated with the assistant. If not, the model associated + with the assistant will be used. + example: gpt-4o + anyOf: + - type: string + - type: string + enum: + - gpt-5 + - gpt-5-mini + - gpt-5-nano + - gpt-5-2025-08-07 + - gpt-5-mini-2025-08-07 + - gpt-5-nano-2025-08-07 + - gpt-4.1 + - gpt-4.1-mini + - gpt-4.1-nano + - gpt-4.1-2025-04-14 + - gpt-4.1-mini-2025-04-14 + - gpt-4.1-nano-2025-04-14 + - gpt-4o + - gpt-4o-2024-11-20 + - gpt-4o-2024-08-06 + - gpt-4o-2024-05-13 + - gpt-4o-mini + - gpt-4o-mini-2024-07-18 + - gpt-4.5-preview + - gpt-4.5-preview-2025-02-27 + - gpt-4-turbo + - gpt-4-turbo-2024-04-09 + - gpt-4-0125-preview + - gpt-4-turbo-preview + - gpt-4-1106-preview + - gpt-4-vision-preview + - gpt-4 + - gpt-4-0314 + - gpt-4-0613 + - gpt-4-32k + - gpt-4-32k-0314 + - gpt-4-32k-0613 + - gpt-3.5-turbo + - gpt-3.5-turbo-16k + - gpt-3.5-turbo-0613 + - gpt-3.5-turbo-1106 + - gpt-3.5-turbo-0125 + - gpt-3.5-turbo-16k-0613 + x-oaiTypeLabel: string + nullable: true + instructions: + description: >- + Override the default system message of the assistant. This is useful + for modifying the behavior on a per-run basis. + type: string + nullable: true + tools: + description: >- + Override the tools the assistant can use for this run. This is + useful for modifying the behavior on a per-run basis. + nullable: true + type: array + maxItems: 20 + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' + tool_resources: type: object - description: The details for events with this `type`. + description: > + A set of resources that are used by the assistant's tools. The + resources are specific to the type of tool. For example, the + `code_interpreter` tool requires a list of file IDs, while the + `file_search` tool requires a list of vector store IDs. properties: - id: - type: string - description: The service account ID. - changes_requested: + code_interpreter: type: object - description: The payload used to updated the service account. properties: - role: - type: string - description: >- - The role of the service account. Is either `owner` or - `member`. - service_account.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The service account ID. - workload_identity_provider.created: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The workload identity provider ID. - data: - type: object - description: The payload used to create the workload identity provider. - workload_identity_provider.updated: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The workload identity provider ID. - changes_requested: - type: object - description: The payload used to update the workload identity provider. - workload_identity_provider.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The workload identity provider ID. - name: - type: string - description: The workload identity provider name. - workload_identity_provider_mapping.created: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The workload identity provider mapping ID. - identity_provider_id: - type: string - description: The workload identity provider ID. - data: - type: object - description: >- - The payload used to create the workload identity provider - mapping. - workload_identity_provider_mapping.updated: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The workload identity provider mapping ID. - identity_provider_id: - type: string - description: The workload identity provider ID. - changes_requested: - type: object - description: >- - The payload used to update the workload identity provider - mapping. - workload_identity_provider_mapping.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The workload identity provider mapping ID. - identity_provider_id: - type: string - description: The workload identity provider ID. - project_id: - type: string - description: The project ID. - service_account_id: - type: string - description: The mapped service account ID. - user.added: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The user ID. - data: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: type: object - description: The payload used to add the user to the project. properties: - role: - type: string - description: The role of the user. Is either `owner` or `member`. - user.updated: + vector_store_ids: + type: array + description: > + The ID of the [vector + store](/docs/api-reference/vector-stores/object) attached to + this assistant. There can be a maximum of 1 vector store + attached to the assistant. + maxItems: 1 + items: + type: string + nullable: true + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values like + 0.2 will make it more focused and deterministic. + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens with + top_p probability mass. So 0.1 means only the tokens comprising the + top 10% probability mass are considered. + + + We generally recommend altering this or temperature but not both. + stream: + type: boolean + nullable: true + description: > + If `true`, returns a stream of events that happen during the Run as + server-sent events, terminating when the Run enters a terminal state + with a `data: [DONE]` message. + max_prompt_tokens: + type: integer + nullable: true + description: > + The maximum number of prompt tokens that may be used over the course + of the run. The run will make a best effort to use only the number + of prompt tokens specified, across multiple turns of the run. If the + run exceeds the number of prompt tokens specified, the run will end + with status `incomplete`. See `incomplete_details` for more info. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: > + The maximum number of completion tokens that may be used over the + course of the run. The run will make a best effort to use only the + number of completion tokens specified, across multiple turns of the + run. If the run exceeds the number of completion tokens specified, + the run will end with status `incomplete`. See `incomplete_details` + for more info. + minimum: 256 + truncation_strategy: + allOf: + - $ref: '#/components/schemas/TruncationObject' + - nullable: true + tool_choice: + allOf: + - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' + - nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + required: + - assistant_id + CreateThreadRequest: + type: object + description: | + Options to create a new thread. If no thread is provided when running a + request, an empty thread will be created. + additionalProperties: false + properties: + messages: + description: >- + A list of [messages](/docs/api-reference/messages) to start the + thread with. + type: array + items: + $ref: '#/components/schemas/CreateMessageRequest' + tool_resources: + anyOf: + - type: object + description: > + A set of resources that are made available to the assistant's + tools in this thread. The resources are specific to the type of + tool. For example, the `code_interpreter` tool requires a list + of file IDs, while the `file_search` tool requires a list of + vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector + store](/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 + vector store attached to the thread. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: > + A helper to create a [vector + store](/docs/api-reference/vector-stores/object) with + file_ids and attach it to this thread. There can be a + maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs to + add to the vector store. For vector stores created + before Nov 2025, there can be a maximum of 10,000 + files in a vector store. For vector stores created + starting in Nov 2025, the limit is 100,000,000 + files. + maxItems: 100000000 + items: + type: string + chunking_strategy: + type: object + description: >- + The chunking strategy used to chunk the file(s). + If not set, will use the `auto` strategy. + oneOf: + - type: object + title: Auto Chunking Strategy + description: >- + The default strategy. This strategy currently + uses a `max_chunk_size_tokens` of `800` and + `chunk_overlap_tokens` of `400`. + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + x-stainless-const: true + required: + - type + - type: object + title: Static Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `static`. + enum: + - static + x-stainless-const: true + static: + type: object + additionalProperties: false + properties: + max_chunk_size_tokens: + type: integer + minimum: 100 + maximum: 4096 + description: >- + The maximum number of tokens in each + chunk. The default value is `800`. The + minimum value is `100` and the maximum + value is `4096`. + chunk_overlap_tokens: + type: integer + description: > + The number of tokens that overlap + between chunks. The default value is + `400`. + + + Note that the overlap must not exceed + half of `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + required: + - type + - static + metadata: + $ref: '#/components/schemas/Metadata' + oneOf: + - required: + - vector_store_ids + - required: + - vector_stores + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + CreateTranscriptionRequest: + type: object + additionalProperties: false + properties: + file: + description: > + The audio file object (not file name) to transcribe, in one of these + formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. + type: string + x-oaiTypeLabel: file + format: binary + model: + description: > + ID of the model to use. The options are `gpt-4o-transcribe`, + `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, + `whisper-1` (which is powered by our open source Whisper V2 model), + and `gpt-4o-transcribe-diarize`. + example: gpt-4o-transcribe + anyOf: + - type: string + - type: string + enum: + - whisper-1 + - gpt-4o-transcribe + - gpt-4o-mini-transcribe + - gpt-4o-mini-transcribe-2025-12-15 + - gpt-4o-transcribe-diarize + x-stainless-const: true + x-oaiTypeLabel: string + language: + description: > + The language of the input audio. Supplying the input language in + [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) + (e.g. `en`) format will improve accuracy and latency. + type: string + prompt: + description: > + An optional text to guide the model's style or continue a previous + audio segment. The [prompt](/docs/guides/speech-to-text#prompting) + should match the audio language. This field is not supported when + using `gpt-4o-transcribe-diarize`. + type: string + response_format: + $ref: '#/components/schemas/AudioResponseFormat' + temperature: + description: > + The sampling temperature, between 0 and 1. Higher values like 0.8 + will make the output more random, while lower values like 0.2 will + make it more focused and deterministic. If set to 0, the model will + use [log probability](https://en.wikipedia.org/wiki/Log_probability) + to automatically increase the temperature until certain thresholds + are hit. + type: number + default: 0 + include: + description: > + Additional information to include in the transcription response. + + `logprobs` will return the log probabilities of the tokens in the + + response to understand the model's confidence in the transcription. + + `logprobs` only works with response_format set to `json` and only + with + + the models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and + `gpt-4o-mini-transcribe-2025-12-15`. This field is not supported + when using `gpt-4o-transcribe-diarize`. + type: array + items: + $ref: '#/components/schemas/TranscriptionInclude' + timestamp_granularities: + description: > + The timestamp granularities to populate for this transcription. + `response_format` must be set `verbose_json` to use timestamp + granularities. Either or both of these options are supported: + `word`, or `segment`. Note: There is no additional latency for + segment timestamps, but generating word timestamps incurs additional + latency. + + This option is not available for `gpt-4o-transcribe-diarize`. + type: array + items: + type: string + enum: + - word + - segment + default: + - segment + stream: + anyOf: + - description: > + If set to true, the model response data will be streamed to the + client + + as it is generated using [server-sent + events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + + See the [Streaming section of the Speech-to-Text + guide](/docs/guides/speech-to-text?lang=curl#streaming-transcriptions) + + for more information. + + + Note: Streaming is not supported for the `whisper-1` model and + will be ignored. + type: boolean + default: false + - type: 'null' + chunking_strategy: + anyOf: + - description: >- + Controls how the audio is cut into chunks. When set to `"auto"`, + the server first normalizes loudness and then uses voice + activity detection (VAD) to choose boundaries. `server_vad` + object can be provided to tweak VAD detection parameters + manually. If unset, the audio is transcribed as a single block. + Required when using `gpt-4o-transcribe-diarize` for inputs + longer than 30 seconds. + anyOf: + - type: string + enum: + - auto + default: auto + description: > + Automatically set chunking parameters based on the audio. + Must be set to `"auto"`. + x-stainless-const: true + - $ref: '#/components/schemas/VadConfig' + x-oaiTypeLabel: string + - type: 'null' + known_speaker_names: + description: > + Optional list of speaker names that correspond to the audio samples + provided in `known_speaker_references[]`. Each entry should be a + short identifier (for example `customer` or `agent`). Up to 4 + speakers are supported. + type: array + maxItems: 4 + items: + type: string + known_speaker_references: + description: > + Optional list of audio samples (as [data + URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) + that contain known speaker references matching + `known_speaker_names[]`. Each sample must be between 2 and 10 + seconds, and can use any of the same input audio formats supported + by `file`. + type: array + maxItems: 4 + items: + type: string + required: + - file + - model + CreateTranscriptionResponseDiarizedJson: + type: object + description: > + Represents a diarized transcription response returned by the model, + including the combined transcript and speaker-segment annotations. + properties: + task: + type: string + description: The type of task that was run. Always `transcribe`. + enum: + - transcribe + x-stainless-const: true + duration: + type: number + format: double + description: Duration of the input audio in seconds. + text: + type: string + description: The concatenated transcript text for the entire audio input. + segments: + type: array + description: >- + Segments of the transcript annotated with timestamps and speaker + labels. + items: + $ref: '#/components/schemas/TranscriptionDiarizedSegment' + usage: type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The project ID. - changes_requested: - type: object - description: The payload used to update the user. - properties: - role: - type: string - description: The role of the user. Is either `owner` or `member`. - user.deleted: + description: Token or duration usage statistics for the request. + oneOf: + - $ref: '#/components/schemas/TranscriptTextUsageTokens' + title: Token Usage + - $ref: '#/components/schemas/TranscriptTextUsageDuration' + title: Duration Usage + discriminator: + propertyName: type + required: + - task + - duration + - text + - segments + x-oaiMeta: + name: The transcription object (Diarized JSON) + group: audio + example: | + { + "task": "transcribe", + "duration": 42.7, + "text": "Agent: Thanks for calling OpenAI support.\nCustomer: Hi, I need help with diarization.", + "segments": [ + { + "type": "transcript.text.segment", + "id": "seg_001", + "start": 0.0, + "end": 5.2, + "text": "Thanks for calling OpenAI support.", + "speaker": "agent" + }, + { + "type": "transcript.text.segment", + "id": "seg_002", + "start": 5.2, + "end": 12.8, + "text": "Hi, I need help with diarization.", + "speaker": "A" + } + ], + "usage": { + "type": "duration", + "seconds": 43 + } + } + CreateTranscriptionResponseJson: + type: object + description: >- + Represents a transcription response returned by model, based on the + provided input. + properties: + text: + type: string + description: The transcribed text. + logprobs: + type: array + optional: true + description: > + The log probabilities of the tokens in the transcription. Only + returned with the models `gpt-4o-transcribe` and + `gpt-4o-mini-transcribe` if `logprobs` is added to the `include` + array. + items: + type: object + properties: + token: + type: string + description: The token in the transcription. + logprob: + type: number + description: The log probability of the token. + bytes: + type: array + items: + type: number + description: The bytes of the token. + usage: type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The user ID. - certificate.created: + description: Token usage statistics for the request. + oneOf: + - $ref: '#/components/schemas/TranscriptTextUsageTokens' + title: Token Usage + - $ref: '#/components/schemas/TranscriptTextUsageDuration' + title: Duration Usage + required: + - text + x-oaiMeta: + name: The transcription object (JSON) + group: audio + example: | + { + "text": "Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.", + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 4 + }, + "output_tokens": 101, + "total_tokens": 115 + } + } + CreateTranscriptionResponseStreamEvent: + anyOf: + - $ref: '#/components/schemas/TranscriptTextSegmentEvent' + - $ref: '#/components/schemas/TranscriptTextDeltaEvent' + - $ref: '#/components/schemas/TranscriptTextDoneEvent' + discriminator: + propertyName: type + CreateTranscriptionResponseVerboseJson: + type: object + description: >- + Represents a verbose json transcription response returned by model, + based on the provided input. + properties: + language: + type: string + description: The language of the input audio. + duration: + type: number + format: double + description: The duration of the input audio. + text: + type: string + description: The transcribed text. + words: + type: array + description: Extracted words and their corresponding timestamps. + items: + $ref: '#/components/schemas/TranscriptionWord' + segments: + type: array + description: Segments of the transcribed text and their corresponding details. + items: + $ref: '#/components/schemas/TranscriptionSegment' + usage: + $ref: '#/components/schemas/TranscriptTextUsageDuration' + required: + - language + - duration + - text + x-oaiMeta: + name: The transcription object (Verbose JSON) + group: audio + example: | + { + "task": "transcribe", + "language": "english", + "duration": 8.470000267028809, + "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.", + "segments": [ + { + "id": 0, + "seek": 0, + "start": 0.0, + "end": 3.319999933242798, + "text": " The beach was a popular spot on a hot summer day.", + "tokens": [ + 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530 + ], + "temperature": 0.0, + "avg_logprob": -0.2860786020755768, + "compression_ratio": 1.2363636493682861, + "no_speech_prob": 0.00985979475080967 + }, + ... + ], + "usage": { + "type": "duration", + "seconds": 9 + } + } + CreateTranslationRequest: + type: object + additionalProperties: false + properties: + file: + description: > + The audio file object (not file name) translate, in one of these + formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. + type: string + x-oaiTypeLabel: file + format: binary + model: + description: > + ID of the model to use. Only `whisper-1` (which is powered by our + open source Whisper V2 model) is currently available. + example: whisper-1 + anyOf: + - type: string + - type: string + enum: + - whisper-1 + x-stainless-const: true + x-oaiTypeLabel: string + prompt: + description: > + An optional text to guide the model's style or continue a previous + audio segment. The [prompt](/docs/guides/speech-to-text#prompting) + should be in English. + type: string + response_format: + description: > + The format of the output, in one of these options: `json`, `text`, + `srt`, `verbose_json`, or `vtt`. + type: string + enum: + - json + - text + - srt + - verbose_json + - vtt + default: json + temperature: + description: > + The sampling temperature, between 0 and 1. Higher values like 0.8 + will make the output more random, while lower values like 0.2 will + make it more focused and deterministic. If set to 0, the model will + use [log probability](https://en.wikipedia.org/wiki/Log_probability) + to automatically increase the temperature until certain thresholds + are hit. + type: number + default: 0 + required: + - file + - model + CreateTranslationResponseJson: + type: object + properties: + text: + type: string + required: + - text + CreateTranslationResponseVerboseJson: + type: object + properties: + language: + type: string + description: The language of the output translation (always `english`). + duration: + type: number + format: double + description: The duration of the input audio. + text: + type: string + description: The translated text. + segments: + type: array + description: Segments of the translated text and their corresponding details. + items: + $ref: '#/components/schemas/TranscriptionSegment' + required: + - language + - duration + - text + CreateUploadRequest: + type: object + additionalProperties: false + properties: + filename: + description: | + The name of the file to upload. + type: string + purpose: + description: | + The intended purpose of the uploaded file. + + See the [documentation on File + purposes](/docs/api-reference/files/create#files-create-purpose). + type: string + enum: + - assistants + - batch + - fine-tune + - vision + bytes: + description: | + The number of bytes in the file you are uploading. + type: integer + mime_type: + description: > + The MIME type of the file. + + + + This must fall within the supported MIME types for your file + purpose. See + + the supported MIME types for assistants and vision. + type: string + expires_after: + $ref: '#/components/schemas/FileExpirationAfter' + required: + - filename + - purpose + - bytes + - mime_type + CreateVectorStoreFileBatchRequest: + type: object + additionalProperties: false + properties: + file_ids: + description: >- + A list of [File](/docs/api-reference/files) IDs that the vector + store should use. Useful for tools like `file_search` that can + access files. If `attributes` or `chunking_strategy` are provided, + they will be applied to all files in the batch. The maximum batch + size is 2000 files. This endpoint is recommended for multi-file + ingestion and helps reduce per-vector-store write request pressure. + Mutually exclusive with `files`. + type: array + minItems: 1 + maxItems: 2000 + items: + type: string + files: + description: >- + A list of objects that each include a `file_id` plus optional + `attributes` or `chunking_strategy`. Use this when you need to + override metadata for specific files. The global `attributes` or + `chunking_strategy` will be ignored and must be specified for each + file. The maximum batch size is 2000 files. This endpoint is + recommended for multi-file ingestion and helps reduce + per-vector-store write request pressure. Mutually exclusive with + `file_ids`. + type: array + minItems: 1 + maxItems: 2000 + items: + $ref: '#/components/schemas/CreateVectorStoreFileRequest' + chunking_strategy: + $ref: '#/components/schemas/ChunkingStrategyRequestParam' + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + anyOf: + - required: + - file_ids + - required: + - files + CreateVectorStoreFileRequest: + type: object + additionalProperties: false + properties: + file_id: + description: >- + A [File](/docs/api-reference/files) ID that the vector store should + use. Useful for tools like `file_search` that can access files. For + multi-file ingestion, we recommend + [`file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch) + to minimize per-vector-store write requests. + type: string + chunking_strategy: + $ref: '#/components/schemas/ChunkingStrategyRequestParam' + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + required: + - file_id + CreateVectorStoreRequest: + type: object + additionalProperties: false + properties: + file_ids: + description: >- + A list of [File](/docs/api-reference/files) IDs that the vector + store should use. Useful for tools like `file_search` that can + access files. + type: array + maxItems: 500 + items: + type: string + name: + description: The name of the vector store. + type: string + description: + description: >- + A description for the vector store. Can be used to describe the + vector store's purpose. + type: string + expires_after: + $ref: '#/components/schemas/VectorStoreExpirationAfter' + chunking_strategy: type: object - description: The details for events with this `type`. + description: >- + The chunking strategy used to chunk the file(s). If not set, will + use the `auto` strategy. Only applicable if `file_ids` is non-empty. + oneOf: + - $ref: '#/components/schemas/AutoChunkingStrategyRequestParam' + - $ref: '#/components/schemas/StaticChunkingStrategyRequestParam' + metadata: + $ref: '#/components/schemas/Metadata' + CreateVoiceConsentRequest: + type: object + additionalProperties: false + properties: + name: + type: string + description: The label to use for this consent recording. + recording: + type: string + format: binary + x-oaiTypeLabel: file + description: > + The consent audio recording file. Maximum size is 10 MiB. + + + Supported MIME types: + + `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, + `audio/flac`, `audio/webm`, `audio/mp4`. + language: + type: string + description: >- + The BCP 47 language tag for the consent phrase (for example, + `en-US`). + required: + - name + - recording + - language + CreateVoiceRequest: + type: object + additionalProperties: false + properties: + name: + type: string + description: The name of the new voice. + audio_sample: + type: string + format: binary + x-oaiTypeLabel: file + description: > + The sample audio recording file. Maximum size is 10 MiB. + + + Supported MIME types: + + `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, + `audio/flac`, `audio/webm`, `audio/mp4`. + consent: + type: string + description: The consent recording ID (for example, `cons_1234`). + required: + - name + - audio_sample + - consent + CustomToolCall: + type: object + title: Custom tool call + description: | + A call to a custom tool created by the model. + properties: + type: + type: string + enum: + - custom_tool_call + x-stainless-const: true + description: | + The type of the custom tool call. Always `custom_tool_call`. + id: + type: string + description: | + The unique ID of the custom tool call in the OpenAI platform. + call_id: + type: string + description: > + An identifier used to map this custom tool call to a tool call + output. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCaller' + - type: 'null' + namespace: + type: string + description: | + The namespace of the custom tool being called. + name: + type: string + description: | + The name of the custom tool being called. + input: + type: string + description: | + The input for the custom tool call generated by the model. + required: + - type + - call_id + - name + - input + CustomToolCallOutput: + type: object + title: Custom tool call output + description: > + The output of a custom tool call from your code, being sent back to the + model. + properties: + type: + type: string + enum: + - custom_tool_call_output + x-stainless-const: true + description: > + The type of the custom tool call output. Always + `custom_tool_call_output`. + id: + type: string + description: | + The unique ID of the custom tool call output in the OpenAI platform. + call_id: + type: string + description: > + The call ID, used to map this custom tool call output to a custom + tool call. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCallerParam' + - type: 'null' + output: + description: | + The output from the custom tool call generated by your code. + Can be a string or an list of output content. + oneOf: + - type: string + description: | + A string of the output of the custom tool call. + title: string output + - type: array + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + title: output content list + description: | + Text, image, or file output of the custom tool call. + required: + - type + - call_id + - output + CustomToolCallOutputResource: + title: ResponseCustomToolCallOutputItem + allOf: + - $ref: '#/components/schemas/CustomToolCallOutput' + - type: object properties: id: type: string - description: The certificate ID. - name: + description: | + The unique ID of the custom tool call output item. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallOutputStatusEnum' + created_by: type: string - description: The name of the certificate. - certificate.updated: - type: object - description: The details for events with this `type`. + description: | + The identifier of the actor that created the item. + required: + - id + - status + CustomToolCallResource: + title: ResponseCustomToolCallItem + allOf: + - $ref: '#/components/schemas/CustomToolCall' + - type: object properties: id: type: string - description: The certificate ID. - name: + description: | + The unique ID of the custom tool call item. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallStatus' + created_by: type: string - description: The name of the certificate. - certificate.deleted: + description: | + The identifier of the actor that created the item. + required: + - id + - status + CustomToolChatCompletions: + type: object + title: Custom tool + description: | + A custom tool that processes input using a specified format. + properties: + type: + type: string + enum: + - custom + description: The type of the custom tool. Always `custom`. + x-stainless-const: true + custom: type: object - description: The details for events with this `type`. + title: Custom tool properties + description: | + Properties of the custom tool. properties: - id: - type: string - description: The certificate ID. name: type: string - description: The name of the certificate. - certificate: + description: The name of the custom tool, used to identify it in tool calls. + description: type: string - description: The certificate content in PEM format. - certificates.activated: - type: object - description: The details for events with this `type`. - properties: - certificates: - type: array - items: - type: object - properties: - id: - type: string - description: The certificate ID. - name: - type: string - description: The name of the certificate. - certificates.deactivated: - type: object - description: The details for events with this `type`. - properties: - certificates: - type: array - items: - type: object - properties: - id: - type: string - description: The certificate ID. - name: - type: string - description: The name of the certificate. + description: > + Optional description of the custom tool, used to provide more + context. + format: + description: > + The input format for the custom tool. Default is unconstrained + text. + oneOf: + - type: object + title: Text format + description: Unconstrained free-form text. + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + x-stainless-const: true + required: + - type + additionalProperties: false + - type: object + title: Grammar format + description: A grammar defined by the user. + properties: + type: + type: string + enum: + - grammar + description: Grammar format. Always `grammar`. + x-stainless-const: true + grammar: + type: object + title: Grammar format + description: Your chosen grammar. + properties: + definition: + type: string + description: The grammar definition. + syntax: + type: string + description: >- + The syntax of the grammar definition. One of `lark` + or `regex`. + enum: + - lark + - regex + required: + - definition + - syntax + required: + - type + - grammar + additionalProperties: false + required: + - name required: - - id - type - - effective_at - x-oaiMeta: - name: The audit log object - example: | - { - "id": "req_xxx_20240101", - "type": "api_key.created", - "effective_at": 1720804090, - "actor": { - "type": "session", - "session": { - "user": { - "id": "user-xxx", - "email": "user@example.com" - }, - "ip_address": "127.0.0.1", - "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" - } - }, - "api_key.created": { - "id": "key_xxxx", - "data": { - "scopes": ["resource.operation"] - } - } - } - AuditLogActor: + - custom + DeleteAssistantResponse: type: object - description: The actor who performed the audit logged action. properties: - type: + id: + type: string + deleted: + type: boolean + object: type: string - description: The type of actor. Is either `session` or `api_key`. enum: - - session - - api_key - session: - $ref: '#/components/schemas/AuditLogActorSession' - api_key: - $ref: '#/components/schemas/AuditLogActorApiKey' - AuditLogActorApiKey: + - assistant.deleted + x-stainless-const: true + required: + - id + - object + - deleted + DeleteCertificateResponse: type: object - description: The API Key used to perform the audit logged action. properties: + object: + type: string + description: The object type, must be `certificate.deleted`. + enum: + - certificate.deleted + x-stainless-const: true id: type: string - description: The tracking id of the API key. - type: + description: The ID of the certificate that was deleted. + required: + - object + - id + DeleteFileResponse: + type: object + properties: + id: + type: string + object: type: string - description: The type of API key. Can be either `user` or `service_account`. enum: - - user - - service_account - user: - $ref: '#/components/schemas/AuditLogActorUser' - service_account: - $ref: '#/components/schemas/AuditLogActorServiceAccount' - AuditLogActorServiceAccount: + - file + x-stainless-const: true + deleted: + type: boolean + required: + - id + - object + - deleted + DeleteFineTuningCheckpointPermissionResponse: type: object - description: The service account that performed the audit logged action. properties: id: type: string - description: The service account id. - AuditLogActorSession: + description: >- + The ID of the fine-tuned model checkpoint permission that was + deleted. + object: + type: string + description: The object type, which is always "checkpoint.permission". + enum: + - checkpoint.permission + x-stainless-const: true + deleted: + type: boolean + description: >- + Whether the fine-tuned model checkpoint permission was successfully + deleted. + required: + - id + - object + - deleted + DeleteMessageResponse: type: object - description: The session in which the audit logged action was performed. properties: - user: - $ref: '#/components/schemas/AuditLogActorUser' - ip_address: + id: type: string - description: The IP address from which the action was performed. - AuditLogActorUser: + deleted: + type: boolean + object: + type: string + enum: + - thread.message.deleted + x-stainless-const: true + required: + - id + - object + - deleted + DeleteModelResponse: type: object - description: The user who performed the audit logged action. properties: id: type: string - description: The user id. - email: + deleted: + type: boolean + object: type: string - description: The user email. - AuditLogEventType: - type: string - description: The event type. - enum: - - api_key.created - - api_key.updated - - api_key.deleted - - certificate.created - - certificate.updated - - certificate.deleted - - certificates.activated - - certificates.deactivated - - checkpoint.permission.created - - checkpoint.permission.deleted - - external_key.registered - - external_key.removed - - group.created - - group.updated - - group.deleted - - invite.sent - - invite.accepted - - invite.deleted - - ip_allowlist.created - - ip_allowlist.updated - - ip_allowlist.deleted - - ip_allowlist.config.activated - - ip_allowlist.config.deactivated - - login.succeeded - - login.failed - - logout.succeeded - - logout.failed - - organization.updated - - project.created - - project.updated - - project.archived - - project.deleted - - rate_limit.updated - - rate_limit.deleted - - resource.deleted - - tunnel.created - - tunnel.updated - - tunnel.deleted - - workload_identity_provider.created - - workload_identity_provider.updated - - workload_identity_provider.deleted - - workload_identity_provider_mapping.created - - workload_identity_provider_mapping.updated - - workload_identity_provider_mapping.deleted - - role.created - - role.updated - - role.deleted - - role.assignment.created - - role.assignment.deleted - - scim.enabled - - scim.disabled - - service_account.created - - service_account.updated - - service_account.deleted - - user.added - - user.updated - - user.deleted - AutoChunkingStrategyRequestParam: + required: + - id + - object + - deleted + DeleteThreadResponse: type: object - title: Auto Chunking Strategy - description: >- - The default strategy. This strategy currently uses a - `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. - additionalProperties: false properties: - type: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - thread.deleted + x-stainless-const: true + required: + - id + - object + - deleted + DeleteVectorStoreFileResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - vector_store.file.deleted + x-stainless-const: true + required: + - id + - object + - deleted + DeleteVectorStoreResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: + type: string + enum: + - vector_store.deleted + x-stainless-const: true + required: + - id + - object + - deleted + DeletedConversation: + title: The deleted conversation object + allOf: + - $ref: '#/components/schemas/DeletedConversationResource' + x-oaiMeta: + name: The deleted conversation object + group: conversations + DeletedRoleAssignmentResource: + type: object + description: Confirmation payload returned after unassigning a role. + properties: + object: + type: string + description: >- + Identifier for the deleted assignment, such as `group.role.deleted` + or `user.role.deleted`. + deleted: + type: boolean + description: Whether the assignment was removed. + required: + - object + - deleted + x-oaiMeta: + name: Role assignment deletion confirmation + example: | + { + "object": "group.role.deleted", + "deleted": true + } + DoneEvent: + type: object + properties: + event: + type: string + enum: + - done + x-stainless-const: true + data: type: string - description: Always `auto`. enum: - - auto + - '[DONE]' x-stainless-const: true required: - - type - Batch: + - event + - data + description: Occurs when a stream ends. + x-oaiMeta: + dataDescription: '`data` is `[DONE]`' + EasyInputMessage: type: object + title: Input message + description: > + A message input to the model with a role indicating instruction + following + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. Messages with + the + + `assistant` role are presumed to have been generated by the model in + previous + + interactions. properties: - id: + role: type: string - object: + description: > + The role of the message input. One of `user`, `assistant`, `system`, + or + + `developer`. + enum: + - user + - assistant + - system + - developer + content: + description: > + Text, image, or audio input to the model, used to generate a + response. + + Can also contain previous assistant responses. + oneOf: + - type: string + title: Text input + description: | + A text input to the model. + - $ref: '#/components/schemas/InputMessageContentList' + phase: + anyOf: + - $ref: '#/components/schemas/MessagePhase' + - type: 'null' + type: type: string + description: | + The type of the message input. Always `message`. enum: - - batch - description: The object type, which is always `batch`. + - message x-stainless-const: true - endpoint: - type: string - description: The OpenAI API endpoint used by the batch. - model: - type: string - description: > - Model ID used to process the batch, like `gpt-5-2025-08-07`. OpenAI + required: + - role + - content + EditImageBodyJsonParam: + type: object + description: > + JSON request body for image edits. - offers a wide range of models with different capabilities, - performance - characteristics, and price points. Refer to the [model + Use `images` (array of `ImageRefParam`) instead of multipart `image` + uploads. - guide](/docs/models) to browse and compare available models. - errors: - type: object - properties: - object: - type: string - description: The object type, which is always `list`. - data: - type: array - items: - type: object - properties: - code: - type: string - description: An error code identifying the error type. - message: - type: string - description: >- - A human-readable message providing more details about the - error. - param: - anyOf: - - type: string - description: >- - The name of the parameter that caused the error, if - applicable. - - type: 'null' - line: - anyOf: - - type: integer - description: >- - The line number of the input file where the error - occurred, if applicable. - - type: 'null' - input_file_id: - type: string - description: The ID of the input file for the batch. - completion_window: - type: string - description: The time frame within which the batch should be processed. - status: - type: string - description: The current status of the batch. - enum: - - validating - - failed - - in_progress - - finalizing - - completed - - expired - - cancelling - - cancelled - output_file_id: + You can reference images via external URLs, data URLs, or uploaded file + IDs. + + JSON edits support GPT image models only; DALL-E edits require multipart + (`dall-e-2` only). + properties: + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1.5 + - gpt-image-1 + - gpt-image-1-mini + - chatgpt-image-latest + - type: 'null' + x-oaiTypeLabel: string + default: gpt-image-1.5 + example: gpt-image-1.5 + description: The model to use for image editing. + images: + type: array + minItems: 1 + maxItems: 16 + description: | + Input image references to edit. + For GPT image models, you can provide up to 16 images. + items: + $ref: '#/components/schemas/ImageRefParam' + mask: + $ref: '#/components/schemas/ImageRefParam' + prompt: type: string - description: >- - The ID of the file containing the outputs of successfully executed - requests. - error_file_id: + minLength: 1 + maxLength: 32000 + example: Add a watercolor effect and keep the subject centered + description: A text description of the desired image edit. + 'n': + anyOf: + - type: integer + minimum: 1 + maximum: 10 + - type: 'null' + default: 1 + example: 1 + description: The number of edited images to generate. + quality: + anyOf: + - type: string + enum: + - low + - medium + - high + - auto + - type: 'null' + default: auto + example: high + description: | + Output quality for GPT image models. + input_fidelity: + anyOf: + - type: string + enum: + - high + - low + - type: 'null' + description: Controls fidelity to the original input image(s). + size: + anyOf: + - type: string + enum: + - auto + - 1024x1024 + - 1536x1024 + - 1024x1536 + - type: 'null' + default: auto + example: 1024x1024 + description: Requested output image size. + user: type: string - description: The ID of the file containing the outputs of requests with errors. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch was created. - in_progress_at: - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) for when the batch started - processing. - expires_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch will expire. - finalizing_at: - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) for when the batch started - finalizing. - completed_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch was completed. - failed_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch failed. - expired_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch expired. - cancelling_at: - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) for when the batch started - cancelling. - cancelled_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch was cancelled. - request_counts: - type: object - properties: - total: - type: integer - description: Total number of requests in the batch. - completed: - type: integer - description: Number of requests that have been completed successfully. - failed: - type: integer - description: Number of requests that have failed. - required: - - total - - completed - - failed - description: The request counts for different statuses within the batch. - usage: - type: object + example: user-1234 description: > - Represents token usage details including input tokens, output - tokens, a - - breakdown of output tokens, and the total tokens used. Only - populated on - - batches created after September 7, 2025. - properties: - input_tokens: - type: integer - description: The number of input tokens. - input_tokens_details: - type: object - description: A detailed breakdown of the input tokens. - properties: - cached_tokens: - type: integer - description: > - The number of tokens that were retrieved from the cache. - [More on + A unique identifier representing your end-user, which can help + OpenAI - prompt caching](/docs/guides/prompt-caching). - required: - - cached_tokens - output_tokens: - type: integer - description: The number of output tokens. - output_tokens_details: - type: object - description: A detailed breakdown of the output tokens. - properties: - reasoning_tokens: - type: integer - description: The number of reasoning tokens. - required: - - reasoning_tokens - total_tokens: - type: integer - description: The total number of tokens used. - required: - - input_tokens - - input_tokens_details - - output_tokens - - output_tokens_details - - total_tokens - metadata: - $ref: '#/components/schemas/Metadata' + monitor and detect abuse. + output_format: + anyOf: + - type: string + enum: + - png + - jpeg + - webp + - type: 'null' + default: png + example: png + description: Output image format. Supported for GPT image models. + output_compression: + anyOf: + - type: integer + minimum: 0 + maximum: 100 + - type: 'null' + example: 100 + description: Compression level for `jpeg` or `webp` output. + moderation: + anyOf: + - type: string + enum: + - low + - auto + - type: 'null' + default: auto + example: auto + description: Moderation level for GPT image models. + background: + anyOf: + - type: string + enum: + - transparent + - opaque + - auto + - type: 'null' + default: auto + example: transparent + description: Background behavior for generated image output. + stream: + anyOf: + - type: boolean + - type: 'null' + default: false + example: false + description: Stream partial image results as events. + partial_images: + $ref: '#/components/schemas/PartialImages' required: - - id + - images + - prompt + Embedding: + type: object + description: | + Represents an embedding vector returned by embedding endpoint. + properties: + index: + type: integer + description: The index of the embedding in the list of embeddings. + embedding: + type: array + description: > + The embedding vector, which is a list of floats. The length of + vector depends on the model as listed in the [embedding + guide](/docs/guides/embeddings). + items: + type: number + format: float + object: + type: string + description: The object type, which is always "embedding". + enum: + - embedding + x-stainless-const: true + required: + - index - object - - endpoint - - input_file_id - - completion_window - - status - - created_at + - embedding x-oaiMeta: - name: The batch object + name: The embedding object example: | { - "id": "batch_abc123", - "object": "batch", - "endpoint": "/v1/completions", - "model": "gpt-5-2025-08-07", - "errors": null, - "input_file_id": "file-abc123", - "completion_window": "24h", - "status": "completed", - "output_file_id": "file-cvaTdG", - "error_file_id": "file-HOWS94", - "created_at": 1711471533, - "in_progress_at": 1711471538, - "expires_at": 1711557933, - "finalizing_at": 1711493133, - "completed_at": 1711493163, - "failed_at": null, - "expired_at": null, - "cancelling_at": null, - "cancelled_at": null, - "request_counts": { - "total": 100, - "completed": 95, - "failed": 5 - }, - "usage": { - "input_tokens": 1500, - "input_tokens_details": { - "cached_tokens": 1024 - }, - "output_tokens": 500, - "output_tokens_details": { - "reasoning_tokens": 300 - }, - "total_tokens": 2000 - }, - "metadata": { - "customer_id": "user_123456789", - "batch_description": "Nightly eval job", - } + "object": "embedding", + "embedding": [ + 0.0023064255, + -0.009327292, + .... (1536 floats total for ada-002) + -0.0028842222, + ], + "index": 0 } - BatchFileExpirationAfter: + Error: type: object - title: File expiration policy - description: >- - The expiration policy for the output and/or error file that are - generated for a batch. properties: - anchor: - description: >- - Anchor timestamp after which the expiration policy applies. - Supported anchors: `created_at`. Note that the anchor is the file - creation time, not the time the batch is created. + code: + anyOf: + - type: string + - type: 'null' + message: + type: string + param: + anyOf: + - type: string + - type: 'null' + type: + type: string + required: + - type + - message + - param + - code + ErrorEvent: + type: object + properties: + event: type: string enum: - - created_at + - error x-stainless-const: true - seconds: - description: >- - The number of seconds after the anchor time that the file will - expire. Must be between 3600 (1 hour) and 2592000 (30 days). - type: integer - format: int64 - minimum: 3600 - maximum: 2592000 + data: + $ref: '#/components/schemas/Error' + required: + - event + - data + description: >- + Occurs when an [error](/docs/guides/error-codes#api-errors) occurs. This + can happen due to an internal server error or a timeout. + x-oaiMeta: + dataDescription: '`data` is an [error](/docs/guides/error-codes#api-errors)' + ErrorResponse: + type: object + properties: + error: + $ref: '#/components/schemas/Error' required: - - anchor - - seconds - Certificate: + - error + Eval: type: object - description: Represents an individual `certificate` uploaded to the organization. + title: Eval + description: | + An Eval object with a data source config and testing criteria. + An Eval represents a task to be done for your LLM integration. + Like: + - Improve the quality of my chatbot + - See how well my chatbot handles customer support + - Check if o4-mini is better at my usecase than gpt-4o properties: object: type: string enum: - - certificate - - organization.certificate - - organization.project.certificate - description: > - The object type. - - - - If creating, updating, or getting a specific certificate, the - object type is `certificate`. - - - If listing, activating, or deactivating certificates for the - organization, the object type is `organization.certificate`. - - - If listing, activating, or deactivating certificates for a - project, the object type is `organization.project.certificate`. + - eval + default: eval + description: The object type. x-stainless-const: true id: type: string - description: The identifier, which can be referenced in API endpoints + description: Unique identifier for the evaluation. name: - anyOf: - - type: string - - type: 'null' - description: The name of the certificate. + type: string + description: The name of the evaluation. + example: Chatbot effectiveness Evaluation + data_source_config: + type: object + description: Configuration of data sources used in runs of the evaluation. + oneOf: + - $ref: '#/components/schemas/EvalCustomDataSourceConfig' + - $ref: '#/components/schemas/EvalLogsDataSourceConfig' + - $ref: '#/components/schemas/EvalStoredCompletionsDataSourceConfig' + testing_criteria: + default: eval + description: A list of testing criteria. + type: array + items: + oneOf: + - $ref: '#/components/schemas/EvalGraderLabelModel' + - $ref: '#/components/schemas/EvalGraderStringCheck' + - $ref: '#/components/schemas/EvalGraderTextSimilarity' + - $ref: '#/components/schemas/EvalGraderPython' + - $ref: '#/components/schemas/EvalGraderScoreModel' created_at: type: integer format: unixtime - description: >- - The Unix timestamp (in seconds) of when the certificate was - uploaded. - certificate_details: - type: object - properties: - valid_at: - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) of when the certificate becomes - valid. - expires_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate expires. - content: - type: string - description: The content of the certificate in PEM format. - active: - type: boolean - description: >- - Whether the certificate is currently active at the specified scope. - Not returned when getting details for a specific certificate. + description: The Unix timestamp (in seconds) for when the eval was created. + metadata: + $ref: '#/components/schemas/Metadata' required: - - object - id + - data_source_config + - object + - testing_criteria - name - created_at - - certificate_details + - metadata x-oaiMeta: - name: The certificate object + name: The eval object + group: evals example: | { - "object": "certificate", - "id": "cert_abc", - "name": "My Certificate", - "created_at": 1234567, - "certificate_details": { - "valid_at": 1234567, - "expires_at": 12345678, - "content": "-----BEGIN CERTIFICATE----- MIIGAjCCA...6znFlOW+ -----END CERTIFICATE-----" + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + }, + "include_sample_schema": true + }, + "testing_criteria": [ + { + "name": "My string check grader", + "type": "string_check", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq", + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": { + "test": "synthetics", } } - ChatCompletionAllowedTools: + EvalApiError: type: object - title: Allowed tools + title: EvalApiError description: | - Constrains the tools available to the model to a pre-defined set. + An object representing an error response from the Eval API. properties: - mode: + code: type: string - enum: - - auto - - required - description: > - Constrains the tools available to the model to a pre-defined set. - - - `auto` allows the model to pick from among the allowed tools and - generate a + description: The error code. + message: + type: string + description: The error message. + required: + - code + - message + x-oaiMeta: + name: The API error object + group: evals + example: | + { + "code": "internal_error", + "message": "The eval run failed due to an internal error." + } + EvalCustomDataSourceConfig: + type: object + title: CustomDataSourceConfig + description: > + A CustomDataSourceConfig which specifies the schema of your `item` and + optionally `sample` namespaces. - message. + The response schema defines the shape of the data that will be: + - Used to define your testing criteria and - `required` requires the model to call one or more of the allowed - tools. - tools: - type: array - description: > - A list of tool definitions that the model should be allowed to call. + - What data is required when creating a run + properties: + type: + type: string + enum: + - custom + default: custom + description: The type of data source. Always `custom`. + x-stainless-const: true + schema: + type: object + description: | + The json schema for the run data source items. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + example: | + { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + } + }, + "required": ["item"] + } + required: + - type + - schema + x-oaiMeta: + name: The eval custom data source config object + group: evals + example: | + { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + } + }, + "required": ["item"] + } + } + EvalGraderLabelModel: + type: object + title: LabelModelGrader + allOf: + - $ref: '#/components/schemas/GraderLabelModel' + EvalGraderPython: + type: object + title: PythonGrader + allOf: + - $ref: '#/components/schemas/GraderPython' + - type: object + properties: + pass_threshold: + type: number + description: The threshold for the score. + x-oaiMeta: + name: Eval Python Grader + group: graders + example: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + "pass_threshold": 0.8 + } + EvalGraderScoreModel: + type: object + title: ScoreModelGrader + allOf: + - $ref: '#/components/schemas/GraderScoreModel' + - type: object + properties: + pass_threshold: + type: number + description: The threshold for the score. + EvalGraderStringCheck: + type: object + title: StringCheckGrader + allOf: + - $ref: '#/components/schemas/GraderStringCheck' + EvalGraderTextSimilarity: + type: object + title: TextSimilarityGrader + allOf: + - $ref: '#/components/schemas/GraderTextSimilarity' + - type: object + properties: + pass_threshold: + type: number + description: The threshold for the score. + required: + - pass_threshold + x-oaiMeta: + name: Text Similarity Grader + group: graders + example: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "pass_threshold": 0.8, + "evaluation_metric": "fuzzy_match" + } + EvalItem: + type: object + title: Eval message object + description: > + A message input to the model with a role indicating instruction + following + hierarchy. Instructions given with the `developer` or `system` role take - For the Chat Completions API, the list of tool definitions might - look like: + precedence over instructions given with the `user` role. Messages with + the - ```json + `assistant` role are presumed to have been generated by the model in + previous - [ - { "type": "function", "function": { "name": "get_weather" } }, - { "type": "function", "function": { "name": "get_time" } } - ] + interactions. + properties: + role: + type: string + description: > + The role of the message input. One of `user`, `assistant`, `system`, + or - ``` - items: - type: object - x-oaiExpandable: false - description: | - A tool definition that the model should be allowed to call. - additionalProperties: true + `developer`. + enum: + - user + - assistant + - system + - developer + content: + $ref: '#/components/schemas/EvalItemContent' + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true required: - - mode - - tools - ChatCompletionAllowedToolsChoice: + - role + - content + EvalItemContent: + title: Eval content + description: > + Inputs to the model - can contain template strings. Supports text, + output text, input images, and input audio, either as a single item or + an array of items. + oneOf: + - $ref: '#/components/schemas/EvalItemContentItem' + - $ref: '#/components/schemas/EvalItemContentArray' + EvalItemContentArray: + type: array + title: An array of Input text, Output text, Input image, and Input audio + description: > + A list of inputs, each of which may be either an input text, output + text, input + + image, or input audio object. + items: + $ref: '#/components/schemas/EvalItemContentItem' + EvalItemContentItem: + title: Eval content item + description: > + A single content item: input text, output text, input image, or input + audio. + oneOf: + - $ref: '#/components/schemas/EvalItemContentText' + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/EvalItemContentOutputText' + - $ref: '#/components/schemas/EvalItemInputImage' + - $ref: '#/components/schemas/InputAudio' + EvalItemContentOutputText: type: object - title: Allowed tools + title: Output text description: | - Constrains the tools available to the model to a pre-defined set. + A text output from the model. properties: type: type: string + description: | + The type of the output text. Always `output_text`. enum: - - allowed_tools - description: Allowed tool configuration type. Always `allowed_tools`. + - output_text x-stainless-const: true - allowed_tools: - $ref: '#/components/schemas/ChatCompletionAllowedTools' + text: + type: string + description: | + The text output from the model. required: - type - - allowed_tools - ChatCompletionDeleted: + - text + EvalItemContentText: + type: string + title: Text input + description: | + A text input to the model. + EvalItemInputImage: + title: Input image + description: An image input block used within EvalItem content arrays. type: object properties: - object: + type: type: string - description: The type of object being deleted. + description: | + The type of the image input. Always `input_image`. enum: - - chat.completion.deleted + - input_image x-stainless-const: true - id: + image_url: type: string - description: The ID of the chat completion that was deleted. - deleted: - type: boolean - description: Whether the chat completion was deleted. + format: uri + description: | + The URL of the image input. + detail: + type: string + description: > + The detail level of the image to be sent to the model. One of + `high`, `low`, or `auto`. Defaults to `auto`. required: - - object - - id - - deleted - ChatCompletionFunctionCallOption: + - type + - image_url + EvalJsonlFileContentSource: type: object - description: > - Specifying a particular function via `{"name": "my_function"}` forces - the model to call that function. + title: EvalJsonlFileContentSource properties: - name: + type: type: string - description: The name of the function to call. + enum: + - file_content + default: file_content + description: The type of jsonl source. Always `file_content`. + x-stainless-const: true + content: + type: array + items: + type: object + properties: + item: + type: object + additionalProperties: true + sample: + type: object + additionalProperties: true + required: + - item + description: The content of the jsonl file. required: - - name - ChatCompletionFunctions: + - type + - content + EvalJsonlFileIdSource: type: object - deprecated: true + title: EvalJsonlFileIdSource properties: - description: + type: type: string - description: >- - A description of what the function does, used by the model to choose - when and how to call the function. - name: + enum: + - file_id + default: file_id + description: The type of jsonl source. Always `file_id`. + x-stainless-const: true + id: type: string - description: >- - The name of the function to be called. Must be a-z, A-Z, 0-9, or - contain underscores and dashes, with a maximum length of 64. - parameters: - $ref: '#/components/schemas/FunctionParameters' + description: The identifier of the file. required: - - name - ChatCompletionList: + - type + - id + EvalList: type: object - title: ChatCompletionList + title: EvalList description: | - An object representing a list of Chat Completions. + An object representing a list of evals. properties: object: type: string @@ -44320,18 +55187,18 @@ components: data: type: array description: | - An array of chat completion objects. + An array of eval objects. items: - $ref: '#/components/schemas/CreateChatCompletionResponse' + $ref: '#/components/schemas/Eval' first_id: type: string - description: The identifier of the first chat completion in the data array. + description: The identifier of the first eval in the data array. last_id: type: string - description: The identifier of the last chat completion in the data array. + description: The identifier of the last eval in the data array. has_more: type: boolean - description: Indicates whether there are more Chat Completions available. + description: Indicates whether there are more evals available. required: - object - data @@ -44339,91 +55206,507 @@ components: - last_id - has_more x-oaiMeta: - name: The chat completion list object - group: chat + name: The eval list object + group: evals example: | { "object": "list", "data": [ { - "object": "chat.completion", - "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", - "model": "gpt-4o-2024-08-06", - "created": 1738960610, - "request_id": "req_ded8ab984ec4bf840f37566c1011c417", - "tool_choice": null, - "usage": { - "total_tokens": 31, - "completion_tokens": 18, - "prompt_tokens": 13 + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } }, - "seed": 4944116822809979520, - "top_p": 1.0, - "temperature": 1.0, - "presence_penalty": 0.0, - "frequency_penalty": 0.0, - "system_fingerprint": "fp_50cad350e4", - "input_user": null, - "service_tier": "default", - "tools": null, - "metadata": {}, - "choices": [ + "testing_criteria": [ { - "index": 0, - "message": { - "content": "Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark.", - "role": "assistant", - "tool_calls": null, - "function_call": null - }, - "finish_reason": "stop", - "logprobs": null + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" } ], - "response_format": null + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": {}, } ], - "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", - "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", - "has_more": false + "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "last_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "has_more": true } - ChatCompletionMessageCustomToolCall: + EvalLogsDataSourceConfig: type: object - title: Custom tool call - description: | - A call to a custom tool created by the model. + title: LogsDataSourceConfig + description: > + A LogsDataSourceConfig which specifies the metadata property of your + logs query. + + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, + etc. + + The schema returned by this data source config is used to defined what + variables are available in your evals. + + `item` and `sample` are both defined when using this data source config. properties: - id: + type: type: string - description: The ID of the tool call. + enum: + - logs + default: logs + description: The type of data source. Always `logs`. + x-stainless-const: true + metadata: + $ref: '#/components/schemas/Metadata' + schema: + type: object + description: | + The json schema for the run data source items. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + required: + - type + - schema + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalResponsesSource: + type: object + title: EvalResponsesSource + description: | + A EvalResponsesSource object describing a run data source configuration. + properties: type: type: string enum: - - custom - description: The type of the tool. Always `custom`. + - responses + description: The type of run data source. Always `responses`. + metadata: + anyOf: + - type: object + description: >- + Metadata filter for the responses. This is a query parameter + used to select responses. + - type: 'null' + model: + anyOf: + - type: string + description: >- + The name of the model to find responses for. This is a query + parameter used to select responses. + - type: 'null' + instructions_search: + anyOf: + - type: string + description: >- + Optional string to search the 'instructions' field. This is a + query parameter used to select responses. + - type: 'null' + created_after: + anyOf: + - type: integer + minimum: 0 + description: >- + Only include items created after this timestamp (inclusive). + This is a query parameter used to select responses. + - type: 'null' + created_before: + anyOf: + - type: integer + minimum: 0 + description: >- + Only include items created before this timestamp (inclusive). + This is a query parameter used to select responses. + - type: 'null' + reasoning_effort: + anyOf: + - $ref: '#/components/schemas/ReasoningEffort' + description: >- + Optional reasoning effort parameter. This is a query parameter + used to select responses. + - type: 'null' + temperature: + anyOf: + - type: number + description: >- + Sampling temperature. This is a query parameter used to select + responses. + - type: 'null' + top_p: + anyOf: + - type: number + description: >- + Nucleus sampling parameter. This is a query parameter used to + select responses. + - type: 'null' + users: + anyOf: + - type: array + items: + type: string + description: >- + List of user identifiers. This is a query parameter used to + select responses. + - type: 'null' + tools: + anyOf: + - type: array + items: + type: string + description: >- + List of tool names. This is a query parameter used to select + responses. + - type: 'null' + required: + - type + x-oaiMeta: + name: The run data source object used to configure an individual run + group: eval runs + example: | + { + "type": "responses", + "model": "gpt-4o-mini-2024-07-18", + "temperature": 0.7, + "top_p": 1.0, + "users": ["user1", "user2"], + "tools": ["tool1", "tool2"], + "instructions_search": "You are a coding assistant" + } + EvalRun: + type: object + title: EvalRun + description: | + A schema representing an evaluation run. + properties: + object: + type: string + enum: + - eval.run + default: eval.run + description: The type of the object. Always "eval.run". x-stainless-const: true - custom: + id: + type: string + description: Unique identifier for the evaluation run. + eval_id: + type: string + description: The identifier of the associated evaluation. + status: + type: string + description: The status of the evaluation run. + model: + type: string + description: The model that is evaluated, if applicable. + name: + type: string + description: The name of the evaluation run. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the evaluation run was created. + report_url: + type: string + format: uri + description: The URL to the rendered evaluation run report on the UI dashboard. + result_counts: type: object - description: The custom tool that the model called. + description: Counters summarizing the outcomes of the evaluation run. properties: - name: - type: string - description: The name of the custom tool to call. - input: - type: string - description: The input for the custom tool call generated by the model. + total: + type: integer + description: Total number of executed output items. + errored: + type: integer + description: Number of output items that resulted in an error. + failed: + type: integer + description: Number of output items that failed to pass the evaluation. + passed: + type: integer + description: Number of output items that passed the evaluation. required: - - name - - input + - total + - errored + - failed + - passed + per_model_usage: + type: array + description: Usage statistics for each model during the evaluation run. + items: + type: object + properties: + model_name: + type: string + description: The name of the model. + invocation_count: + type: integer + description: The number of invocations. + prompt_tokens: + type: integer + description: The number of prompt tokens used. + completion_tokens: + type: integer + description: The number of completion tokens generated. + total_tokens: + type: integer + description: The total number of tokens used. + cached_tokens: + type: integer + description: The number of tokens retrieved from cache. + required: + - model_name + - invocation_count + - prompt_tokens + - completion_tokens + - total_tokens + - cached_tokens + per_testing_criteria_results: + type: array + description: Results per testing criteria applied during the evaluation run. + items: + type: object + properties: + testing_criteria: + type: string + description: A description of the testing criteria. + passed: + type: integer + description: Number of tests passed for this criteria. + failed: + type: integer + description: Number of tests failed for this criteria. + required: + - testing_criteria + - passed + - failed + data_source: + type: object + description: Information about the run's data source. + oneOf: + - $ref: '#/components/schemas/CreateEvalJsonlRunDataSource' + - $ref: '#/components/schemas/CreateEvalCompletionsRunDataSource' + - $ref: '#/components/schemas/CreateEvalResponsesRunDataSource' + metadata: + $ref: '#/components/schemas/Metadata' + error: + $ref: '#/components/schemas/EvalApiError' required: + - object - id - - type - - custom - ChatCompletionMessageList: + - eval_id + - status + - model + - name + - created_at + - report_url + - result_counts + - per_model_usage + - per_testing_criteria_results + - data_source + - metadata + - error + x-oaiMeta: + name: The eval run object + group: evals + example: | + { + "object": "eval.run", + "id": "evalrun_67e57965b480819094274e3a32235e4c", + "eval_id": "eval_67e579652b548190aaa83ada4b125f47", + "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47?run_id=evalrun_67e57965b480819094274e3a32235e4c", + "status": "queued", + "model": "gpt-4o-mini", + "name": "gpt-4o-mini", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "text": "Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\n\n# Steps\n\n1. Analyze the content of the news headline to understand its primary focus.\n2. Extract the subject matter, identifying any key indicators or keywords.\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\n4. Ensure only one category is selected per headline.\n\n# Output Format\n\nRespond with the chosen category as a single word. For instance: \"Technology\", \"Markets\", \"World\", \"Business\", or \"Sports\".\n\n# Examples\n\n**Input**: \"Apple Unveils New iPhone Model, Featuring Advanced AI Features\" \n**Output**: \"Technology\"\n\n**Input**: \"Global Stocks Mixed as Investors Await Central Bank Decisions\" \n**Output**: \"Markets\"\n\n**Input**: \"War in Ukraine: Latest Updates on Negotiation Status\" \n**Output**: \"World\"\n\n**Input**: \"Microsoft in Talks to Acquire Gaming Company for $2 Billion\" \n**Output**: \"Business\"\n\n**Input**: \"Manchester United Secures Win in Premier League Football Match\" \n**Output**: \"Sports\" \n\n# Notes\n\n- If the headline appears to fit into more than one category, choose the most dominant theme.\n- Keywords or phrases such as \"stocks\", \"company acquisition\", \"match\", or technological brands can be good indicators for classification.\n" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-4o-mini", + "sampling_params": { + "seed": 42, + "temperature": 1.0, + "top_p": 1.0, + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + EvalRunList: type: object - title: ChatCompletionMessageList + title: EvalRunList description: | - An object representing a list of chat completion messages. + An object representing a list of runs for an evaluation. properties: object: type: string @@ -44436,41 +55719,18 @@ components: data: type: array description: | - An array of chat completion message objects. + An array of eval run objects. items: - allOf: - - $ref: '#/components/schemas/ChatCompletionResponseMessage' - - type: object - required: - - id - properties: - id: - type: string - description: The identifier of the chat message. - content_parts: - anyOf: - - type: array - description: > - If a content parts array was provided, this is an - array of `text` and `image_url` parts. - - Otherwise, null. - items: - oneOf: - - $ref: >- - #/components/schemas/ChatCompletionRequestMessageContentPartText - - $ref: >- - #/components/schemas/ChatCompletionRequestMessageContentPartImage - - type: 'null' + $ref: '#/components/schemas/EvalRun' first_id: type: string - description: The identifier of the first chat message in the data array. + description: The identifier of the first eval run in the data array. last_id: type: string - description: The identifier of the last chat message in the data array. + description: The identifier of the last eval run in the data array. has_more: type: boolean - description: Indicates whether there are more chat messages available. + description: Indicates whether there are more evals available. required: - object - data @@ -44478,1422 +55738,1482 @@ components: - last_id - has_more x-oaiMeta: - name: The chat completion message list object - group: chat + name: The eval run list object + group: evals example: | { "object": "list", "data": [ { - "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", - "role": "user", - "content": "write a haiku about ai", - "name": null, - "content_parts": null + "object": "eval.run", + "id": "evalrun_67b7fbdad46c819092f6fe7a14189620", + "eval_id": "eval_67b7fa9a81a88190ab4aa417e397ea21", + "report_url": "https://platform.openai.com/evaluations/eval_67b7fa9a81a88190ab4aa417e397ea21?run_id=evalrun_67b7fbdad46c819092f6fe7a14189620", + "status": "completed", + "model": "o3-mini", + "name": "Academic Assistant", + "created_at": 1740110812, + "result_counts": { + "total": 171, + "errored": 0, + "failed": 80, + "passed": 91 + }, + "per_model_usage": null, + "per_testing_criteria_results": [ + { + "testing_criteria": "String check grader", + "passed": 91, + "failed": 80 + } + ], + "run_data_source": { + "type": "completions", + "template_messages": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "You are a helpful assistant." + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Hello, can you help me with my homework?" + } + } + ], + "datasource_reference": null, + "model": "o3-mini", + "max_completion_tokens": null, + "seed": null, + "temperature": null, + "top_p": null + }, + "error": null, + "metadata": {"test": "synthetics"} } ], - "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", - "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "first_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "last_id": "evalrun_67abd54d60ec8190832b46859da808f7", "has_more": false } - ChatCompletionMessageToolCall: - type: object - title: Function tool call - description: | - A call to a function tool created by the model. - properties: - id: - type: string - description: The ID of the tool call. - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - x-stainless-const: true - function: - type: object - description: The function that the model called. - properties: - name: - type: string - description: The name of the function to call. - arguments: - type: string - description: >- - The arguments to call the function with, as generated by the - model in JSON format. Note that the model does not always - generate valid JSON, and may hallucinate parameters not defined - by your function schema. Validate the arguments in your code - before calling your function. - required: - - name - - arguments - required: - - id - - type - - function - ChatCompletionMessageToolCallChunk: - type: object - properties: - index: - type: integer - id: - type: string - description: The ID of the tool call. - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - x-stainless-const: true - function: - type: object - properties: - name: - type: string - description: The name of the function to call. - arguments: - type: string - description: >- - The arguments to call the function with, as generated by the - model in JSON format. Note that the model does not always - generate valid JSON, and may hallucinate parameters not defined - by your function schema. Validate the arguments in your code - before calling your function. - required: - - index - ChatCompletionMessageToolCalls: - type: array - description: The tool calls generated by the model, such as function calls. - items: - oneOf: - - $ref: '#/components/schemas/ChatCompletionMessageToolCall' - - $ref: '#/components/schemas/ChatCompletionMessageCustomToolCall' - discriminator: - propertyName: type - ChatCompletionModalities: - anyOf: - - type: array - description: > - Output types that you would like the model to generate for this - request. - - Most models are capable of generating text, which is the default: - - - `["text"]` - - - The `gpt-4o-audio-preview` model can also be used to [generate - audio](/docs/guides/audio). To - - request that this model generate both text and audio responses, you - can - - use: - - - `["text", "audio"]` - items: - type: string - enum: - - text - - audio - - type: 'null' - ChatCompletionModeration: - type: object - description: Moderation results or errors for the request input and generated output. - properties: - input: - oneOf: - - $ref: '#/components/schemas/ChatCompletionModerationResults' - - $ref: '#/components/schemas/ChatCompletionModerationError' - discriminator: - propertyName: type - description: Moderation for the request input. - output: - oneOf: - - $ref: '#/components/schemas/ChatCompletionModerationResults' - - $ref: '#/components/schemas/ChatCompletionModerationError' - discriminator: - propertyName: type - description: Moderation for the generated output. - required: - - input - - output - ChatCompletionModerationError: - type: object - description: An error produced while attempting moderation. - properties: - type: - type: string - enum: - - error - description: The object type, which is always `error`. - x-stainless-const: true - code: - type: string - description: The error code. - message: - type: string - description: The error message. - required: - - type - - code - - message - ChatCompletionModerationResults: - type: object - description: Successful moderation results for the request input or generated output. - properties: - type: - type: string - enum: - - moderation_results - description: The object type, which is always `moderation_results`. - x-stainless-const: true - model: - type: string - description: The moderation model used to generate the results. - results: - type: array - description: A list of moderation results. - items: - $ref: '#/components/schemas/ModerationResultBody' - required: - - type - - model - - results - ChatCompletionNamedToolChoice: - type: object - title: Function tool choice - description: >- - Specifies a tool the model should use. Use to force the model to call a - specific function. - properties: - type: - type: string - enum: - - function - description: For function calling, the type is always `function`. - x-stainless-const: true - function: - type: object - properties: - name: - type: string - description: The name of the function to call. - required: - - name - required: - - type - - function - ChatCompletionNamedToolChoiceCustom: - type: object - title: Custom tool choice - description: >- - Specifies a tool the model should use. Use to force the model to call a - specific custom tool. - properties: - type: - type: string - enum: - - custom - description: For custom tool calling, the type is always `custom`. - x-stainless-const: true - custom: - type: object - properties: - name: - type: string - description: The name of the custom tool to call. - required: - - name - required: - - type - - custom - ChatCompletionRequestAssistantMessage: - type: object - title: Assistant message - description: | - Messages sent by the model in response to user messages. - properties: - content: - anyOf: - - oneOf: - - type: string - description: The contents of the assistant message. - title: Text content - - type: array - description: >- - An array of content parts with a defined type. Can be one or - more of type `text`, or exactly one of type `refusal`. - title: Array of content parts - items: - $ref: >- - #/components/schemas/ChatCompletionRequestAssistantMessageContentPart - minItems: 1 - description: > - The contents of the assistant message. Required unless - `tool_calls` or `function_call` is specified. - - type: 'null' - refusal: - anyOf: - - type: string - description: The refusal message by the assistant. - - type: 'null' - role: - type: string - enum: - - assistant - description: The role of the messages author, in this case `assistant`. - x-stainless-const: true - name: - type: string - description: >- - An optional name for the participant. Provides the model information - to differentiate between participants of the same role. - audio: - anyOf: - - type: object - description: | - Data about a previous audio response from the model. - [Learn more](/docs/guides/audio). - required: - - id - properties: - id: - type: string - description: > - Unique identifier for a previous audio response from the - model. - - type: 'null' - tool_calls: - $ref: '#/components/schemas/ChatCompletionMessageToolCalls' - function_call: - anyOf: - - type: object - deprecated: true - description: >- - Deprecated and replaced by `tool_calls`. The name and arguments - of a function that should be called, as generated by the model. - properties: - arguments: - type: string - description: >- - The arguments to call the function with, as generated by the - model in JSON format. Note that the model does not always - generate valid JSON, and may hallucinate parameters not - defined by your function schema. Validate the arguments in - your code before calling your function. - name: - type: string - description: The name of the function to call. - required: - - arguments - - name - - type: 'null' - required: - - role - ChatCompletionRequestAssistantMessageContentPart: - oneOf: - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartRefusal' - discriminator: - propertyName: type - ChatCompletionRequestDeveloperMessage: - type: object - title: Developer message - description: > - Developer-provided instructions that the model should follow, regardless - of - - messages sent by the user. With o1 models and newer, `developer` - messages - - replace the previous `system` messages. - properties: - content: - description: The contents of the developer message. - oneOf: - - type: string - description: The contents of the developer message. - title: Text content - - type: array - description: >- - An array of content parts with a defined type. For developer - messages, only type `text` is supported. - title: Array of content parts - items: - $ref: >- - #/components/schemas/ChatCompletionRequestMessageContentPartText - minItems: 1 - role: - type: string - enum: - - developer - description: The role of the messages author, in this case `developer`. - x-stainless-const: true - name: - type: string - description: >- - An optional name for the participant. Provides the model information - to differentiate between participants of the same role. - required: - - content - - role - ChatCompletionRequestFunctionMessage: - type: object - title: Function message - deprecated: true - properties: - role: - type: string - enum: - - function - description: The role of the messages author, in this case `function`. - x-stainless-const: true - content: - anyOf: - - type: string - description: The contents of the function message. - - type: 'null' - name: - type: string - description: The name of the function to call. - required: - - role - - content - - name - ChatCompletionRequestMessage: - oneOf: - - $ref: '#/components/schemas/ChatCompletionRequestDeveloperMessage' - - $ref: '#/components/schemas/ChatCompletionRequestSystemMessage' - - $ref: '#/components/schemas/ChatCompletionRequestUserMessage' - - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' - - $ref: '#/components/schemas/ChatCompletionRequestToolMessage' - - $ref: '#/components/schemas/ChatCompletionRequestFunctionMessage' - discriminator: - propertyName: role - ChatCompletionRequestMessageContentPartAudio: + EvalRunOutputItem: type: object - title: Audio content part + title: EvalRunOutputItem description: | - Learn about [audio inputs](/docs/guides/audio). + A schema representing an evaluation run output item. properties: - type: + object: type: string enum: - - input_audio - description: The type of the content part. Always `input_audio`. + - eval.run.output_item + default: eval.run.output_item + description: The type of the object. Always "eval.run.output_item". x-stainless-const: true - input_audio: + id: + type: string + description: Unique identifier for the evaluation run output item. + run_id: + type: string + description: >- + The identifier of the evaluation run associated with this output + item. + eval_id: + type: string + description: The identifier of the evaluation group. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the evaluation run was created. + status: + type: string + description: The status of the evaluation run. + datasource_item_id: + type: integer + description: The identifier for the data source item. + datasource_item: + type: object + description: Details of the input data source item. + additionalProperties: true + results: + type: array + description: A list of grader results for this output item. + items: + $ref: '#/components/schemas/EvalRunOutputItemResult' + sample: type: object + description: A sample containing the input and output of the evaluation run. properties: - data: + input: + type: array + description: An array of input messages. + items: + type: object + description: An input message. + properties: + role: + type: string + description: >- + The role of the message sender (e.g., system, user, + developer). + content: + type: string + description: The content of the message. + required: + - role + - content + output: + type: array + description: An array of output messages. + items: + type: object + properties: + role: + type: string + description: >- + The role of the message (e.g. "system", "assistant", + "user"). + content: + type: string + description: The content of the message. + finish_reason: type: string - description: Base64 encoded audio data. - format: + description: The reason why the sample generation was finished. + model: type: string - enum: - - wav - - mp3 - description: > - The format of the encoded audio data. Currently supports "wav" - and "mp3". + description: The model used for generating the sample. + usage: + type: object + description: Token usage details for the sample. + properties: + total_tokens: + type: integer + description: The total number of tokens used. + completion_tokens: + type: integer + description: The number of completion tokens generated. + prompt_tokens: + type: integer + description: The number of prompt tokens used. + cached_tokens: + type: integer + description: The number of tokens retrieved from cache. + required: + - total_tokens + - completion_tokens + - prompt_tokens + - cached_tokens + error: + $ref: '#/components/schemas/EvalApiError' + temperature: + type: number + description: The sampling temperature used. + max_completion_tokens: + type: integer + description: The maximum number of tokens allowed for completion. + top_p: + type: number + description: The top_p value used for sampling. + seed: + type: integer + description: The seed used for generating the sample. required: - - data - - format + - input + - output + - finish_reason + - model + - usage + - error + - temperature + - max_completion_tokens + - top_p + - seed required: - - type - - input_audio - ChatCompletionRequestMessageContentPartFile: + - object + - id + - run_id + - eval_id + - created_at + - status + - datasource_item_id + - datasource_item + - results + - sample + x-oaiMeta: + name: The eval run output item object + group: evals + example: | + { + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." + }, + "results": [ + { + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." + }, + { + "role": "user", + "content": "You are assessing..." + } + ], + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } + ], + "finish_reason": "stop", + "model": "gpt-4o-2024-08-06", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + EvalRunOutputItemList: type: object - title: File content part + title: EvalRunOutputItemList description: | - Learn about [file inputs](/docs/guides/text) for text generation. + An object representing a list of output items for an evaluation run. properties: - type: + object: type: string enum: - - file - description: The type of the content part. Always `file`. + - list + default: list + description: | + The type of this object. It is always set to "list". x-stainless-const: true - file: - type: object - properties: - filename: - type: string - description: > - The name of the file, used when passing the file to the model as - a - - string. - file_data: - type: string - description: > - The base64 encoded file data, used when passing the file to the - model - - as a string. - file_id: - type: string - description: | - The ID of an uploaded file to use as input. + data: + type: array + description: | + An array of eval run output item objects. + items: + $ref: '#/components/schemas/EvalRunOutputItem' + first_id: + type: string + description: The identifier of the first eval run output item in the data array. + last_id: + type: string + description: The identifier of the last eval run output item in the data array. + has_more: + type: boolean + description: Indicates whether there are more eval run output items available. required: - - type - - file - ChatCompletionRequestMessageContentPartImage: + - object + - data + - first_id + - last_id + - has_more + x-oaiMeta: + name: The eval run output item list object + group: evals + example: | + { + "object": "list", + "data": [ + { + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." + }, + "results": [ + { + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." + }, + { + "role": "user", + "content": "You are assessing..." + } + ], + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } + ], + "finish_reason": "stop", + "model": "gpt-4o-2024-08-06", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + }, + ], + "first_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "last_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "has_more": false + } + EvalRunOutputItemResult: type: object - title: Image content part + title: EvalRunOutputItemResult description: | - Learn about [image inputs](/docs/guides/vision). + A single grader result for an evaluation run output item. properties: + name: + type: string + description: The name of the grader. type: type: string - enum: - - image_url - description: The type of the content part. - x-stainless-const: true - image_url: - type: object - properties: - url: - type: string - description: Either a URL of the image or the base64 encoded image data. - format: uri - detail: - type: string - description: >- - Specifies the detail level of the image. Learn more in the - [Vision - guide](/docs/guides/vision#low-or-high-fidelity-image-understanding). - enum: - - auto - - low - - high - default: auto - required: - - url + description: The grader type (for example, "string-check-grader"). + score: + type: number + description: The numeric score produced by the grader. + passed: + type: boolean + description: Whether the grader considered the output a pass. + sample: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + description: Optional sample or intermediate data produced by the grader. + additionalProperties: true required: - - type - - image_url - ChatCompletionRequestMessageContentPartRefusal: + - name + - score + - passed + EvalStoredCompletionsDataSourceConfig: type: object - title: Refusal content part + title: StoredCompletionsDataSourceConfig + description: | + Deprecated in favor of LogsDataSourceConfig. properties: type: type: string enum: - - refusal - description: The type of the content part. + - stored_completions + default: stored_completions + description: The type of data source. Always `stored_completions`. x-stainless-const: true - refusal: - type: string - description: The refusal message generated by the model. + metadata: + $ref: '#/components/schemas/Metadata' + schema: + type: object + description: | + The json schema for the run data source items. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true required: - type - - refusal - ChatCompletionRequestMessageContentPartText: + - schema + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalStoredCompletionsSource: type: object - title: Text content part - description: | - Learn about [text inputs](/docs/guides/text-generation). + title: StoredCompletionsRunDataSource + description: > + A StoredCompletionsRunDataSource configuration describing a set of + filters properties: type: type: string enum: - - text - description: The type of the content part. + - stored_completions + default: stored_completions + description: The type of source. Always `stored_completions`. x-stainless-const: true - text: - type: string - description: The text content. + metadata: + $ref: '#/components/schemas/Metadata' + model: + anyOf: + - type: string + description: An optional model to filter by (e.g., 'gpt-4o'). + - type: 'null' + created_after: + anyOf: + - type: integer + description: >- + An optional Unix timestamp to filter items created after this + time. + - type: 'null' + created_before: + anyOf: + - type: integer + description: >- + An optional Unix timestamp to filter items created before this + time. + - type: 'null' + limit: + anyOf: + - type: integer + description: An optional maximum number of items to return. + - type: 'null' required: - type - - text - ChatCompletionRequestSystemMessage: + x-oaiMeta: + name: >- + The stored completions data source object used to configure an + individual run + group: eval runs + example: | + { + "type": "stored_completions", + "model": "gpt-4o", + "created_after": 1668124800, + "created_before": 1668124900, + "limit": 100, + "metadata": {} + } + FileExpirationAfter: type: object - title: System message - description: > - Developer-provided instructions that the model should follow, regardless - of - - messages sent by the user. With o1 models and newer, use `developer` - messages - - for this purpose instead. + title: File expiration policy + description: >- + The expiration policy for a file. By default, files with `purpose=batch` + expire after 30 days and all other files are persisted until they are + manually deleted. properties: - content: - description: The contents of the system message. - oneOf: - - type: string - description: The contents of the system message. - title: Text content - - type: array - description: >- - An array of content parts with a defined type. For system - messages, only type `text` is supported. - title: Array of content parts - items: - $ref: >- - #/components/schemas/ChatCompletionRequestSystemMessageContentPart - minItems: 1 - role: + anchor: + description: >- + Anchor timestamp after which the expiration policy applies. + Supported anchors: `created_at`. type: string enum: - - system - description: The role of the messages author, in this case `system`. + - created_at x-stainless-const: true - name: - type: string + seconds: description: >- - An optional name for the participant. Provides the model information - to differentiate between participants of the same role. + The number of seconds after the anchor time that the file will + expire. Must be between 3600 (1 hour) and 2592000 (30 days). + type: integer + format: int64 + minimum: 3600 + maximum: 2592000 required: - - content - - role - ChatCompletionRequestSystemMessageContentPart: - oneOf: - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - ChatCompletionRequestToolMessage: + - anchor + - seconds + FilePath: type: object - title: Tool message + title: File path + description: | + A path to a file. properties: - role: + type: type: string + description: | + The type of the file path. Always `file_path`. enum: - - tool - description: The role of the messages author, in this case `tool`. + - file_path x-stainless-const: true - content: - oneOf: - - type: string - description: The contents of the tool message. - title: Text content - - type: array - description: >- - An array of content parts with a defined type. For tool - messages, only type `text` is supported. - title: Array of content parts - items: - $ref: >- - #/components/schemas/ChatCompletionRequestToolMessageContentPart - minItems: 1 - description: The contents of the tool message. - tool_call_id: + file_id: type: string - description: Tool call that this message is responding to. + description: | + The ID of the file. + index: + type: integer + description: | + The index of the file in the list of files. required: - - role - - content - - tool_call_id - ChatCompletionRequestToolMessageContentPart: - oneOf: - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - ChatCompletionRequestUserMessage: + - type + - file_id + - index + FileSearchRanker: + type: string + description: >- + The ranker to use for the file search. If not specified will use the + `auto` ranker. + enum: + - auto + - default_2024_08_21 + FileSearchRankingOptions: + title: File search tool call ranking options type: object - title: User message - description: | - Messages sent by an end user, containing prompts or additional context + description: > + The ranking options for the file search. If not specified, the file + search tool will use the `auto` ranker and a score_threshold of 0. + + + See the [file search tool + documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) + for more information. + properties: + ranker: + $ref: '#/components/schemas/FileSearchRanker' + score_threshold: + type: number + description: >- + The score threshold for the file search. All values must be a + floating point number between 0 and 1. + minimum: 0 + maximum: 1 + required: + - score_threshold + FileSearchToolCall: + type: object + title: File search tool call + description: > + The results of a file search tool call. See the + + [file search guide](/docs/guides/tools-file-search) for more information. properties: - content: + id: + type: string description: | - The contents of the user message. - oneOf: - - type: string - description: The text contents of the message. - title: Text content - - type: array - description: >- - An array of content parts with a defined type. Supported options - differ based on the [model](/docs/models) being used to generate - the response. Can contain text, image, or audio inputs. - title: Array of content parts - items: - $ref: >- - #/components/schemas/ChatCompletionRequestUserMessageContentPart - minItems: 1 - role: + The unique ID of the file search tool call. + type: type: string enum: - - user - description: The role of the messages author, in this case `user`. + - file_search_call + description: | + The type of the file search tool call. Always `file_search_call`. x-stainless-const: true - name: + status: type: string - description: >- - An optional name for the participant. Provides the model information - to differentiate between participants of the same role. - required: - - content - - role - ChatCompletionRequestUserMessageContentPart: - oneOf: - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage' - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartAudio' - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartFile' - ChatCompletionResponseMessage: - type: object - description: A chat completion message generated by the model. - properties: - content: - anyOf: - - type: string - description: The contents of the message. - - type: 'null' - refusal: - anyOf: - - type: string - description: The refusal message generated by the model. - - type: 'null' - tool_calls: - $ref: '#/components/schemas/ChatCompletionMessageToolCalls' - annotations: - type: array description: | - Annotations for the message, when applicable, as when using the - [web search tool](/docs/guides/tools-web-search?api-mode=chat). + The status of the file search tool call. One of `in_progress`, + `searching`, `incomplete` or `failed`, + enum: + - in_progress + - searching + - completed + - incomplete + - failed + queries: + type: array items: - type: object - description: | - A URL citation when using web search. - required: - - type - - url_citation - properties: - type: - type: string - description: The type of the URL citation. Always `url_citation`. - enum: - - url_citation - x-stainless-const: true - url_citation: + type: string + description: | + The queries used to search for files. + results: + anyOf: + - type: array + description: | + The results of the file search tool call. + items: type: object - description: A URL citation when using web search. - required: - - end_index - - start_index - - url - - title properties: - end_index: - type: integer - description: >- - The index of the last character of the URL citation in the - message. - start_index: - type: integer - description: >- - The index of the first character of the URL citation in - the message. - url: + file_id: type: string - format: uri - description: The URL of the web resource. - title: + description: | + The unique ID of the file. + text: type: string - description: The title of the web resource. - role: - type: string - enum: - - assistant - description: The role of the author of this message. - x-stainless-const: true - function_call: - type: object - deprecated: true - description: >- - Deprecated and replaced by `tool_calls`. The name and arguments of a - function that should be called, as generated by the model. + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. + - type: 'null' + required: + - id + - type + - status + - queries + FineTuneChatCompletionRequestAssistantMessage: + allOf: + - type: object + title: Assistant message + deprecated: false properties: - arguments: - type: string + weight: + type: integer + enum: + - 0 + - 1 description: >- - The arguments to call the function with, as generated by the - model in JSON format. Note that the model does not always - generate valid JSON, and may hallucinate parameters not defined - by your function schema. Validate the arguments in your code - before calling your function. - name: - type: string - description: The name of the function to call. - required: - - name - - arguments - audio: - anyOf: - - type: object - description: > - If the audio output modality is requested, this object contains - data - - about the audio response from the model. [Learn - more](/docs/guides/audio). - required: - - id - - expires_at - - data - - transcript - properties: - id: - type: string - description: Unique identifier for this audio response. - expires_at: - type: integer - format: unixtime - description: > - The Unix timestamp (in seconds) for when this audio response - will - - no longer be accessible on the server for use in multi-turn - - conversations. - data: - type: string - description: > - Base64 encoded audio bytes generated by the model, in the - format - - specified in the request. - transcript: - type: string - description: Transcript of the audio generated by the model. - - type: 'null' + Controls whether the assistant message is trained against (0 or + 1) + - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' required: - role - - content - - refusal - ChatCompletionRole: - type: string - description: The role of the author of a message - enum: - - developer - - system - - user - - assistant - - tool - - function - ChatCompletionStreamOptions: - anyOf: - - description: > - Options for streaming response. Only set this when you set `stream: - true`. - type: object - default: null - properties: - include_usage: - type: boolean - description: > - If set, an additional chunk will be streamed before the `data: - [DONE]` - - message. The `usage` field on this chunk shows the token usage - statistics - - for the entire request, and the `choices` field will always be - an empty - - array. - - - All other chunks will also include a `usage` field, but with a - null - - value. **NOTE:** If the stream is interrupted, you may not - receive the - - final usage chunk which contains the total token usage for the - request. - include_obfuscation: - type: boolean - description: > - When true, stream obfuscation will be enabled. Stream - obfuscation adds - - random characters to an `obfuscation` field on streaming delta - events to - - normalize payload sizes as a mitigation to certain side-channel - attacks. - - These obfuscation fields are included by default, but add a - small amount - - of overhead to the data stream. You can set - `include_obfuscation` to - - false to optimize for bandwidth if you trust the network links - between - - your application and the OpenAI API. - - type: 'null' - ChatCompletionStreamResponseDelta: + FineTuneDPOHyperparameters: type: object - description: A chat completion delta generated by streamed model responses. + description: The hyperparameters used for the DPO fine-tuning job. properties: - content: - anyOf: - - type: string - description: The contents of the chunk message. - - type: 'null' - function_call: - deprecated: true - type: object - description: >- - Deprecated and replaced by `tool_calls`. The name and arguments of a - function that should be called, as generated by the model. - properties: - arguments: - type: string - description: >- - The arguments to call the function with, as generated by the - model in JSON format. Note that the model does not always - generate valid JSON, and may hallucinate parameters not defined - by your function schema. Validate the arguments in your code - before calling your function. - name: - type: string - description: The name of the function to call. - tool_calls: - type: array - items: - $ref: '#/components/schemas/ChatCompletionMessageToolCallChunk' - role: - type: string - enum: - - developer - - system - - user - - assistant - - tool - description: The role of the author of this message. - refusal: - anyOf: + beta: + description: > + The beta value for the DPO method. A higher beta value will increase + the weight of the penalty between the policy and reference model. + oneOf: - type: string - description: The refusal message generated by the model. - - type: 'null' - ChatCompletionTokenLogprob: - type: object - properties: - token: - description: The token. - type: string - logprob: - description: >- - The log probability of this token, if it is within the top 20 most - likely tokens. Otherwise, the value `-9999.0` is used to signify - that the token is very unlikely. - type: number - bytes: - anyOf: - - description: >- - A list of integers representing the UTF-8 bytes representation - of the token. Useful in instances where characters are - represented by multiple tokens and their byte representations - must be combined to generate the correct text representation. - Can be `null` if there is no bytes representation for the token. - type: array - items: - type: integer - - type: 'null' - top_logprobs: - description: >- - List of the most likely tokens and their log probability, at this - token position. The number of entries may be fewer than the - requested `top_logprobs`. - type: array - items: - type: object - properties: - token: - description: The token. - type: string - logprob: - description: >- - The log probability of this token, if it is within the top 20 - most likely tokens. Otherwise, the value `-9999.0` is used to - signify that the token is very unlikely. - type: number - bytes: - anyOf: - - description: >- - A list of integers representing the UTF-8 bytes - representation of the token. Useful in instances where - characters are represented by multiple tokens and their - byte representations must be combined to generate the - correct text representation. Can be `null` if there is no - bytes representation for the token. - type: array - items: - type: integer - - type: 'null' - required: - - token - - logprob - - bytes - required: - - token - - logprob - - bytes - - top_logprobs - ChatCompletionTool: + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0 + maximum: 2 + exclusiveMinimum: true + default: auto + batch_size: + description: > + Number of examples in each batch. A larger batch size means that + model parameters are updated less frequently, but with lower + variance. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 256 + default: auto + learning_rate_multiplier: + description: > + Scaling factor for the learning rate. A smaller learning rate may be + useful to avoid overfitting. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0 + exclusiveMinimum: true + default: auto + n_epochs: + description: > + The number of epochs to train the model for. An epoch refers to one + full cycle through the training dataset. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 50 + default: auto + FineTuneDPOMethod: type: object - title: Function tool - description: | - A function tool that can be used to generate a response. + description: Configuration for the DPO fine-tuning method. + properties: + hyperparameters: + $ref: '#/components/schemas/FineTuneDPOHyperparameters' + FineTuneMethod: + type: object + description: The method used for fine-tuning. properties: type: type: string + description: >- + The type of method. Is either `supervised`, `dpo`, or + `reinforcement`. enum: - - function - description: The type of the tool. Currently, only `function` is supported. - x-stainless-const: true - function: - $ref: '#/components/schemas/FunctionObject' + - supervised + - dpo + - reinforcement + supervised: + $ref: '#/components/schemas/FineTuneSupervisedMethod' + dpo: + $ref: '#/components/schemas/FineTuneDPOMethod' + reinforcement: + $ref: '#/components/schemas/FineTuneReinforcementMethod' required: - type - - function - ChatCompletionToolChoiceOption: - description: > - Controls which (if any) tool is called by the model. - - `none` means the model will not call any tool and instead generates a - message. - - `auto` means the model can pick between generating a message or calling - one or more tools. - - `required` means the model must call one or more tools. - - Specifying a particular tool via `{"type": "function", "function": - {"name": "my_function"}}` forces the model to call that tool. - - - `none` is the default when no tools are present. `auto` is the default - if tools are present. - oneOf: - - type: string - title: Tool choice mode - description: > - `none` means the model will not call any tool and instead generates - a message. `auto` means the model can pick between generating a - message or calling one or more tools. `required` means the model - must call one or more tools. - enum: - - none - - auto - - required - - $ref: '#/components/schemas/ChatCompletionAllowedToolsChoice' - - $ref: '#/components/schemas/ChatCompletionNamedToolChoice' - - $ref: '#/components/schemas/ChatCompletionNamedToolChoiceCustom' - ChunkingStrategyRequestParam: - type: object - description: >- - The chunking strategy used to chunk the file(s). If not set, will use - the `auto` strategy. - oneOf: - - $ref: '#/components/schemas/AutoChunkingStrategyRequestParam' - - $ref: '#/components/schemas/StaticChunkingStrategyRequestParam' - discriminator: - propertyName: type - CodeInterpreterFileOutput: + FineTuneReinforcementHyperparameters: type: object - title: Code interpreter file output - description: | - The output of a code interpreter tool call that is a file. + description: The hyperparameters used for the reinforcement fine-tuning job. properties: - type: + batch_size: + description: > + Number of examples in each batch. A larger batch size means that + model parameters are updated less frequently, but with lower + variance. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 256 + default: auto + learning_rate_multiplier: + description: > + Scaling factor for the learning rate. A smaller learning rate may be + useful to avoid overfitting. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0 + exclusiveMinimum: true + default: auto + n_epochs: + description: > + The number of epochs to train the model for. An epoch refers to one + full cycle through the training dataset. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 50 + default: auto + reasoning_effort: + description: | + Level of reasoning effort. type: string enum: - - files + - default + - low + - medium + - high + default: default + compute_multiplier: + description: > + Multiplier on amount of compute used for exploring search space + during training. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0.00001 + maximum: 10 + exclusiveMinimum: true + default: auto + eval_interval: description: | - The type of the code interpreter file output. Always `files`. - x-stainless-const: true - files: - type: array - items: - type: object - properties: - mime_type: - type: string - description: | - The MIME type of the file. - file_id: - type: string - description: | - The ID of the file. - required: - - mime_type - - file_id + The number of training steps between evaluation runs. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + default: auto + eval_samples: + description: | + Number of evaluation samples to generate per training step. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + default: auto + FineTuneReinforcementMethod: + type: object + description: Configuration for the reinforcement fine-tuning method. + properties: + grader: + type: object + description: The grader used for the fine-tuning job. + oneOf: + - $ref: '#/components/schemas/GraderStringCheck' + - $ref: '#/components/schemas/GraderTextSimilarity' + - $ref: '#/components/schemas/GraderPython' + - $ref: '#/components/schemas/GraderScoreModel' + - $ref: '#/components/schemas/GraderMulti' + hyperparameters: + $ref: '#/components/schemas/FineTuneReinforcementHyperparameters' required: - - type - - files - CodeInterpreterTextOutput: + - grader + FineTuneSupervisedHyperparameters: type: object - title: Code interpreter text output - description: | - The output of a code interpreter tool call that is text. + description: The hyperparameters used for the fine-tuning job. properties: - type: + batch_size: + description: > + Number of examples in each batch. A larger batch size means that + model parameters are updated less frequently, but with lower + variance. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 256 + default: auto + learning_rate_multiplier: + description: > + Scaling factor for the learning rate. A smaller learning rate may be + useful to avoid overfitting. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0 + exclusiveMinimum: true + default: auto + n_epochs: + description: > + The number of epochs to train the model for. An epoch refers to one + full cycle through the training dataset. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 50 + default: auto + FineTuneSupervisedMethod: + type: object + description: Configuration for the supervised fine-tuning method. + properties: + hyperparameters: + $ref: '#/components/schemas/FineTuneSupervisedHyperparameters' + FineTuningCheckpointPermission: + type: object + title: FineTuningCheckpointPermission + description: > + The `checkpoint.permission` object represents a permission for a + fine-tuned model checkpoint. + properties: + id: + type: string + description: >- + The permission identifier, which can be referenced in the API + endpoints. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the permission was created. + project_id: type: string + description: The project identifier that the permission is for. + object: + type: string + description: The object type, which is always "checkpoint.permission". enum: - - logs - description: | - The type of the code interpreter text output. Always `logs`. + - checkpoint.permission x-stainless-const: true - logs: - type: string - description: | - The logs of the code interpreter tool call. required: - - type - - logs - CodeInterpreterTool: + - created_at + - id + - object + - project_id + x-oaiMeta: + name: The fine-tuned model checkpoint permission object + example: | + { + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1712211699, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + } + FineTuningIntegration: type: object - title: Code interpreter - description: | - A tool that runs Python code to help generate a response to a prompt. + title: Fine-Tuning Job Integration + required: + - type + - wandb properties: type: type: string + description: The type of the integration being enabled for the fine-tuning job enum: - - code_interpreter - description: | - The type of the code interpreter tool. Always `code_interpreter`. + - wandb x-stainless-const: true - container: + wandb: + type: object description: > - The code interpreter container. Can be a container ID or an object - that + The settings for your integration with Weights and Biases. This + payload specifies the project that - specifies uploaded file IDs to make available to your code, along - with an + metrics will be sent to. Optionally, you can set an explicit display + name for your run, add tags - optional `memory_limit` setting. - oneOf: - - type: string - description: The container ID. - - $ref: '#/components/schemas/AutoCodeInterpreterToolParam' - required: - - type - - container - CodeInterpreterToolCall: + to your run, and set a default entity (team, username, etc) to be + associated with your run. + required: + - project + properties: + project: + description: | + The name of the project that the new run will be created under. + type: string + example: my-wandb-project + name: + anyOf: + - description: > + A display name to set for the run. If not set, we will use + the Job ID as the name. + type: string + - type: 'null' + entity: + anyOf: + - description: > + The entity to use for the run. This allows you to set the + team or username of the WandB user that you would + + like associated with the run. If not set, the default entity + for the registered WandB API key is used. + type: string + - type: 'null' + tags: + description: > + A list of tags to be attached to the newly created run. These + tags are passed through directly to WandB. Some + + default tags are generated by OpenAI: "openai/finetune", + "openai/{base-model}", "openai/{ftjob-abcdef}". + type: array + items: + type: string + example: custom-tag + FineTuningJob: type: object - title: Code interpreter tool call - description: | - A tool call to run code. + title: FineTuningJob + description: > + The `fine_tuning.job` object represents a fine-tuning job that has been + created through the API. properties: - type: + id: + type: string + description: The object identifier, which can be referenced in the API endpoints. + created_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the fine-tuning job was + created. + error: + anyOf: + - type: object + description: >- + For fine-tuning jobs that have `failed`, this will contain more + information on the cause of the failure. + properties: + code: + type: string + description: A machine-readable error code. + message: + type: string + description: A human-readable error message. + param: + anyOf: + - type: string + description: >- + The parameter that was invalid, usually `training_file` + or `validation_file`. This field will be null if the + failure was not parameter-specific. + - type: 'null' + required: + - code + - message + - param + - type: 'null' + fine_tuned_model: + anyOf: + - type: string + description: >- + The name of the fine-tuned model that is being created. The + value will be null if the fine-tuning job is still running. + - type: 'null' + finished_at: + anyOf: + - type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the fine-tuning job was + finished. The value will be null if the fine-tuning job is still + running. + - type: 'null' + hyperparameters: + type: object + description: >- + The hyperparameters used for the fine-tuning job. This value will + only be returned when running `supervised` jobs. + properties: + batch_size: + anyOf: + - description: > + Number of examples in each batch. A larger batch size means + that model parameters + + are updated less frequently, but with lower variance. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 256 + default: auto + - type: 'null' + learning_rate_multiplier: + description: > + Scaling factor for the learning rate. A smaller learning rate + may be useful to avoid + + overfitting. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0 + exclusiveMinimum: true + default: auto + n_epochs: + description: > + The number of epochs to train the model for. An epoch refers to + one full cycle + + through the training dataset. + oneOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 50 + default: auto + model: + type: string + description: The base model that is being fine-tuned. + object: type: string + description: The object type, which is always "fine_tuning.job". enum: - - code_interpreter_call - default: code_interpreter_call + - fine_tuning.job x-stainless-const: true - description: > - The type of the code interpreter tool call. Always - `code_interpreter_call`. - id: + organization_id: type: string - description: | - The unique ID of the code interpreter tool call. + description: The organization that owns the fine-tuning job. + result_files: + type: array + description: >- + The compiled results file ID(s) for the fine-tuning job. You can + retrieve the results with the [Files + API](/docs/api-reference/files/retrieve-contents). + items: + type: string + example: file-abc123 status: type: string + description: >- + The current status of the fine-tuning job, which can be either + `validating_files`, `queued`, `running`, `succeeded`, `failed`, or + `cancelled`. enum: - - in_progress - - completed - - incomplete - - interpreting + - validating_files + - queued + - running + - succeeded - failed - description: > - The status of the code interpreter tool call. Valid values are - `in_progress`, `completed`, `incomplete`, `interpreting`, and - `failed`. - container_id: + - cancelled + trained_tokens: + anyOf: + - type: integer + description: >- + The total number of billable tokens processed by this + fine-tuning job. The value will be null if the fine-tuning job + is still running. + - type: 'null' + training_file: type: string - description: | - The ID of the container used to run the code. - code: + description: >- + The file ID used for training. You can retrieve the training data + with the [Files API](/docs/api-reference/files/retrieve-contents). + validation_file: anyOf: - type: string - description: | - The code to run, or null if not available. + description: >- + The file ID used for validation. You can retrieve the validation + results with the [Files + API](/docs/api-reference/files/retrieve-contents). - type: 'null' - outputs: + integrations: anyOf: - type: array + description: A list of integrations to enable for this fine-tuning job. + maxItems: 5 items: oneOf: - - $ref: '#/components/schemas/CodeInterpreterOutputLogs' - - $ref: '#/components/schemas/CodeInterpreterOutputImage' - discriminator: - propertyName: type - discriminator: - propertyName: type - description: > - The outputs generated by the code interpreter, such as logs or - images. - - Can be null if no outputs are available. + - $ref: '#/components/schemas/FineTuningIntegration' + - type: 'null' + seed: + type: integer + description: The seed used for the fine-tuning job. + estimated_finish: + anyOf: + - type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the fine-tuning job is + estimated to finish. The value will be null if the fine-tuning + job is not running. - type: 'null' + method: + $ref: '#/components/schemas/FineTuneMethod' + metadata: + $ref: '#/components/schemas/Metadata' required: - - type + - created_at + - error + - finished_at + - fine_tuned_model + - hyperparameters - id + - model + - object + - organization_id + - result_files - status - - container_id - - code - - outputs - ComparisonFilter: + - trained_tokens + - training_file + - validation_file + - seed + x-oaiMeta: + name: The fine-tuning job object + example: | + { + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" + ], + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + } + } + }, + "metadata": { + "key": "value" + } + } + FineTuningJobCheckpoint: type: object - additionalProperties: false - title: Comparison Filter + title: FineTuningJobCheckpoint description: > - A filter used to compare a specified attribute key to a given value - using a defined comparison operation. + The `fine_tuning.job.checkpoint` object represents a model checkpoint + for a fine-tuning job that is ready to use. properties: - type: - type: string - default: eq - enum: - - eq - - ne - - gt - - gte - - lt - - lte - - in - - nin - description: > - Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, - `lte`, `in`, `nin`. - - - `eq`: equals - - - `ne`: not equal - - - `gt`: greater than - - - `gte`: greater than or equal - - - `lt`: less than - - - `lte`: less than or equal - - - `in`: in - - - `nin`: not in - key: + id: type: string - description: The key to compare against the value. - value: - oneOf: - - type: string - - type: number - - type: boolean - - type: array - items: - oneOf: - - type: string - - type: number description: >- - The value to compare against the attribute key; supports string, - number, or boolean types. - required: - - type - - key - - value - x-oaiMeta: - name: ComparisonFilter - CompleteUploadRequest: - type: object - additionalProperties: false - properties: - part_ids: - type: array - description: | - The ordered list of Part IDs. - items: - type: string - md5: - description: > - The optional md5 checksum for the file contents to verify if the - bytes uploaded matches what you expect. - type: string - required: - - part_ids - CompletionUsage: - type: object - description: Usage statistics for the completion request. - properties: - completion_tokens: - type: integer - default: 0 - description: Number of tokens in the generated completion. - prompt_tokens: + The checkpoint identifier, which can be referenced in the API + endpoints. + created_at: type: integer - default: 0 - description: Number of tokens in the prompt. - total_tokens: + format: unixtime + description: The Unix timestamp (in seconds) for when the checkpoint was created. + fine_tuned_model_checkpoint: + type: string + description: The name of the fine-tuned checkpoint model that is created. + step_number: type: integer - default: 0 - description: Total number of tokens used in the request (prompt + completion). - completion_tokens_details: - type: object - description: Breakdown of tokens used in a completion. - properties: - accepted_prediction_tokens: - type: integer - default: 0 - description: | - When using Predicted Outputs, the number of tokens in the - prediction that appeared in the completion. - audio_tokens: - type: integer - default: 0 - description: Audio input tokens generated by the model. - reasoning_tokens: - type: integer - default: 0 - description: Tokens generated by the model for reasoning. - rejected_prediction_tokens: - type: integer - default: 0 - description: > - When using Predicted Outputs, the number of tokens in the - - prediction that did not appear in the completion. However, like - - reasoning tokens, these tokens are still counted in the total - - completion tokens for purposes of billing, output, and context - window - - limits. - prompt_tokens_details: + description: The step number that the checkpoint was created at. + metrics: type: object - description: Breakdown of tokens used in the prompt. + description: Metrics at the step number during the fine-tuning job. properties: - audio_tokens: - type: integer - default: 0 - description: Audio input tokens present in the prompt. - cached_tokens: - type: integer - default: 0 - description: Cached tokens present in the prompt. + step: + type: number + train_loss: + type: number + train_mean_token_accuracy: + type: number + valid_loss: + type: number + valid_mean_token_accuracy: + type: number + full_valid_loss: + type: number + full_valid_mean_token_accuracy: + type: number + fine_tuning_job_id: + type: string + description: >- + The name of the fine-tuning job that this checkpoint was created + from. + object: + type: string + description: The object type, which is always "fine_tuning.job.checkpoint". + enum: + - fine_tuning.job.checkpoint + x-stainless-const: true required: - - prompt_tokens - - completion_tokens - - total_tokens - CompoundFilter: - $recursiveAnchor: true + - created_at + - fine_tuning_job_id + - fine_tuned_model_checkpoint + - id + - metrics + - object + - step_number + x-oaiMeta: + name: The fine-tuning job checkpoint object + example: | + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P", + "created_at": 1712211699, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88", + "fine_tuning_job_id": "ftjob-fpbNQ3H1GrMehXRf8cO97xTN", + "metrics": { + "step": 88, + "train_loss": 0.478, + "train_mean_token_accuracy": 0.924, + "valid_loss": 10.112, + "valid_mean_token_accuracy": 0.145, + "full_valid_loss": 0.567, + "full_valid_mean_token_accuracy": 0.944 + }, + "step_number": 88 + } + FineTuningJobEvent: type: object - additionalProperties: false - title: Compound Filter - description: Combine multiple filters using `and` or `or`. + description: Fine-tuning job event object properties: - type: + object: type: string - description: 'Type of operation: `and` or `or`.' + description: The object type, which is always "fine_tuning.job.event". enum: - - and - - or - filters: - type: array + - fine_tuning.job.event + x-stainless-const: true + id: + type: string + description: The object identifier. + created_at: + type: integer + format: unixtime description: >- - Array of filters to combine. Items can be `ComparisonFilter` or - `CompoundFilter`. - items: - oneOf: - - $ref: '#/components/schemas/ComparisonFilter' - - $recursiveRef: '#' - discriminator: - propertyName: type + The Unix timestamp (in seconds) for when the fine-tuning job was + created. + level: + type: string + description: The log level of the event. + enum: + - info + - warn + - error + message: + type: string + description: The message of the event. + type: + type: string + description: The type of event. + enum: + - message + - metrics + data: + type: object + description: The data associated with the event. required: - - type - - filters + - id + - object + - created_at + - level + - message x-oaiMeta: - name: CompoundFilter - ComputerAction: + name: The fine-tuning job event object + example: | + { + "object": "fine_tuning.job.event", + "id": "ftevent-abc123" + "created_at": 1677610602, + "level": "info", + "message": "Created fine-tuning job", + "data": {}, + "type": "message" + } + FunctionAndCustomToolCallOutput: oneOf: - - $ref: '#/components/schemas/ClickParam' - - $ref: '#/components/schemas/DoubleClickAction' - - $ref: '#/components/schemas/DragParam' - - $ref: '#/components/schemas/KeyPressAction' - - $ref: '#/components/schemas/MoveParam' - - $ref: '#/components/schemas/ScreenshotParam' - - $ref: '#/components/schemas/ScrollParam' - - $ref: '#/components/schemas/TypeParam' - - $ref: '#/components/schemas/WaitParam' + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/InputImageContent' + - $ref: '#/components/schemas/InputFileContent' discriminator: propertyName: type - ComputerActionList: - title: Computer Action List - type: array - description: | - Flattened batched actions for `computer_use`. Each action includes an - `type` discriminator and action-specific fields. - items: - $ref: '#/components/schemas/ComputerAction' - ComputerScreenshotImage: + FunctionObject: type: object - description: | - A computer screenshot image used with the computer use tool. properties: - type: - type: string - enum: - - computer_screenshot - default: computer_screenshot - description: > - Specifies the event type. For a computer screenshot, this property - is - - always set to `computer_screenshot`. - x-stainless-const: true - image_url: + description: type: string - format: uri - description: The URL of the screenshot image. - file_id: + description: >- + A description of what the function does, used by the model to choose + when and how to call the function. + name: type: string - description: The identifier of an uploaded file that contains the screenshot. + description: >- + The name of the function to be called. Must be a-z, A-Z, 0-9, or + contain underscores and dashes, with a maximum length of 64. + parameters: + $ref: '#/components/schemas/FunctionParameters' + strict: + anyOf: + - type: boolean + default: false + description: >- + Whether to enable strict schema adherence when generating the + function call. If set to true, the model will follow the exact + schema defined in the `parameters` field. Only a subset of JSON + Schema is supported when `strict` is `true`. Learn more about + Structured Outputs in the [function calling + guide](/docs/guides/function-calling). + - type: 'null' required: - - type - ComputerToolCall: + - name + FunctionParameters: type: object - title: Computer tool call + description: >- + The parameters the functions accepts, described as a JSON Schema object. + See the [guide](/docs/guides/function-calling) for examples, and the + [JSON Schema + reference](https://json-schema.org/understanding-json-schema/) for + documentation about the format. + + + Omitting `parameters` defines a function with an empty parameter list. + additionalProperties: true + FunctionToolCall: + type: object + title: Function tool call description: > - A tool call to a computer use tool. See the + A tool call to run a function. See the - [computer use guide](/docs/guides/tools-computer-use) for more + [function calling guide](/docs/guides/function-calling) for more information. properties: + id: + type: string + description: | + The unique ID of the function tool call. type: type: string - description: The type of the computer call. Always `computer_call`. enum: - - computer_call - default: computer_call - id: - type: string - description: The unique ID of the computer call. + - function_call + description: | + The type of the function tool call. Always `function_call`. + x-stainless-const: true call_id: type: string description: | - An identifier used when responding to the tool call with output. - action: - $ref: '#/components/schemas/ComputerAction' - actions: - $ref: '#/components/schemas/ComputerActionList' - pending_safety_checks: - type: array - items: - $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + The unique ID of the function tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCaller' + - type: 'null' + namespace: + type: string description: | - The pending safety checks for the computer call. + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. status: type: string description: | @@ -45905,51 +57225,58 @@ components: - incomplete required: - type - - id - call_id - - pending_safety_checks - - status - ComputerToolCallOutput: + - name + - arguments + FunctionToolCallOutput: type: object - title: Computer tool call output + title: Function tool call output description: | - The output of a computer tool call. + The output of a function tool call. properties: - type: + id: type: string description: > - The type of the computer tool call output. Always - `computer_call_output`. + The unique ID of the function tool call output. Populated when this + item + + is returned via API. + type: + type: string enum: - - computer_call_output - default: computer_call_output + - function_call_output + description: > + The type of the function tool call output. Always + `function_call_output`. x-stainless-const: true - id: - type: string - description: | - The ID of the computer tool call output. call_id: type: string description: | - The ID of the computer tool call that produced the output. - acknowledged_safety_checks: - type: array - description: > - The safety checks reported by the API that have been acknowledged by - the - - developer. - items: - $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + The unique ID of the function tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCallerParam' + - type: 'null' output: - $ref: '#/components/schemas/ComputerScreenshotImage' + description: | + The output from the function call generated by your code. + Can be a string or an list of output content. + oneOf: + - type: string + description: | + A string of the output of the function call. + title: string output + - type: array + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + title: output content list + description: | + Text, image, or file output of the function call. status: type: string - description: > - The status of the message input. One of `in_progress`, `completed`, - or - - `incomplete`. Populated when input items are returned via API. + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. enum: - in_progress - completed @@ -45958,22 +57285,20 @@ components: - type - call_id - output - ComputerToolCallOutputResource: + FunctionToolCallOutputResource: allOf: - - $ref: '#/components/schemas/ComputerToolCallOutput' + - $ref: '#/components/schemas/FunctionToolCallOutput' - type: object properties: id: type: string description: | - The unique ID of the computer call tool output. + The unique ID of the function call tool output. status: - description: > - The status of the message input. One of `in_progress`, - `completed`, or - - `incomplete`. Populated when input items are returned via API. - $ref: '#/components/schemas/ComputerCallOutputStatus' + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallOutputStatusEnum' created_by: type: string description: | @@ -45981,4397 +57306,4045 @@ components: required: - id - status - ContainerFileListResource: + FunctionToolCallResource: + allOf: + - $ref: '#/components/schemas/FunctionToolCall' + - type: object + properties: + id: + type: string + description: | + The unique ID of the function tool call. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + GraderLabelModel: type: object + title: LabelModelGrader + description: > + A LabelModelGrader object which uses a model to assign labels to each + item + + in the evaluation. properties: - object: + type: + description: The object type, which is always `label_model`. type: string enum: - - list - description: The type of object returned, must be 'list'. - data: - type: array - description: A list of container files. - items: - $ref: '#/components/schemas/ContainerFileResource' - first_id: + - label_model + x-stainless-const: true + name: type: string - description: The ID of the first file in the list. - last_id: + description: The name of the grader. + model: type: string - description: The ID of the last file in the list. - has_more: - type: boolean - description: Whether there are more files available. + description: >- + The model to use for the evaluation. Must support structured + outputs. + input: + type: array + items: + $ref: '#/components/schemas/EvalItem' + labels: + type: array + items: + type: string + description: The labels to assign to each item in the evaluation. + passing_labels: + type: array + items: + type: string + description: >- + The labels that indicate a passing result. Must be a subset of + labels. required: - - object - - data - - first_id - - last_id - - has_more - ContainerFileResource: + - type + - model + - input + - passing_labels + - labels + - name + x-oaiMeta: + name: Label Model Grader + group: graders + example: | + { + "name": "First label grader", + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.response}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + GraderMulti: type: object - title: The container file object + title: MultiGrader + description: >- + A MultiGrader object combines the output of multiple graders to produce + a single score. properties: - id: + type: type: string - description: Unique identifier for the file. - object: + enum: + - multi + default: multi + description: The object type, which is always `multi`. + x-stainless-const: true + name: type: string - description: The type of this object (`container.file`). - container_id: + description: The name of the grader. + graders: + oneOf: + - $ref: '#/components/schemas/GraderStringCheck' + - $ref: '#/components/schemas/GraderTextSimilarity' + - $ref: '#/components/schemas/GraderPython' + - $ref: '#/components/schemas/GraderScoreModel' + - $ref: '#/components/schemas/GraderLabelModel' + calculate_output: type: string - description: The container this file belongs to. - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the file was created. - bytes: - type: integer - description: Size of the file in bytes. - path: + description: A formula to calculate the output based on grader results. + required: + - name + - type + - graders + - calculate_output + x-oaiMeta: + name: Multi Grader + group: graders + example: | + { + "type": "multi", + "name": "example multi grader", + "graders": [ + { + "type": "text_similarity", + "name": "example text similarity grader", + "input": "The graded text", + "reference": "The reference text", + "evaluation_metric": "fuzzy_match" + }, + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + ], + "calculate_output": "0.5 * text_similarity_score + 0.5 * string_check_score)" + } + GraderPython: + type: object + title: PythonGrader + description: | + A PythonGrader object that runs a python script on the input. + properties: + type: type: string - description: Path of the file in the container. + enum: + - python + description: The object type, which is always `python`. + x-stainless-const: true + name: + type: string + description: The name of the grader. source: type: string - description: Source of the file (e.g., `user`, `assistant`). + description: The source code of the python script. + image_tag: + type: string + description: The image tag to use for the python script. required: - - id - - object - - created_at - - bytes - - container_id - - path + - type + - name - source x-oaiMeta: - name: The container file object + name: Python Grader + group: graders example: | { - "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", - "object": "container.file", - "created_at": 1747848842, - "bytes": 880, - "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", - "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", - "source": "user" + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + } + GraderScoreModel: + type: object + title: ScoreModelGrader + description: > + A ScoreModelGrader object that uses a model to assign a score to the + input. + properties: + type: + type: string + enum: + - score_model + description: The object type, which is always `score_model`. + x-stainless-const: true + name: + type: string + description: The name of the grader. + model: + type: string + description: The model to use for the evaluation. + sampling_params: + type: object + description: The sampling parameters for the model. + properties: + seed: + anyOf: + - type: integer + description: | + A seed value to initialize the randomness, during sampling. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: > + An alternative to temperature for nucleus sampling; 1.0 + includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: > + The maximum number of tokens the grader model may generate + in its response. + - type: 'null' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + input: + type: array + items: + $ref: '#/components/schemas/EvalItem' + description: > + The input messages evaluated by the grader. Supports text, output + text, input image, and input audio content blocks, and may include + template strings. + range: + type: array + items: + type: number + min_items: 2 + max_items: 2 + description: The range of the score. Defaults to `[0, 1]`. + required: + - type + - name + - input + - model + x-oaiMeta: + name: Score Model Grader + group: graders + example: | + { + "type": "score_model", + "name": "Example score model grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "text": ( + "Score how close the reference answer is to the model answer. Score 1.0 if they are the same and 0.0 if they are different." + " Return just a floating point score\n\n" + " Reference answer: {{item.label}}\n\n" + " Model answer: {{sample.output_text}}" + ) + }, + { + "type": "input_image", + "image_url": "https://example.com/reference.png", + "file_id": null, + "detail": "auto" + } + ], + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 1, + "top_p": 1, + "seed": 42, + "max_completions_tokens": 32768, + "reasoning_effort": "medium" + }, + } + GraderStringCheck: + type: object + title: StringCheckGrader + description: > + A StringCheckGrader object that performs a string comparison between + input and reference using a specified operation. + properties: + type: + type: string + enum: + - string_check + description: The object type, which is always `string_check`. + x-stainless-const: true + name: + type: string + description: The name of the grader. + input: + type: string + description: The input text. This may include template strings. + reference: + type: string + description: The reference text. This may include template strings. + operation: + type: string + enum: + - eq + - ne + - like + - ilike + description: >- + The string check operation to perform. One of `eq`, `ne`, `like`, or + `ilike`. + required: + - type + - name + - input + - reference + - operation + x-oaiMeta: + name: String Check Grader + group: graders + example: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" } - ContainerListResource: + GraderTextSimilarity: type: object + title: TextSimilarityGrader + description: > + A TextSimilarityGrader object which grades text based on similarity + metrics. properties: - object: + type: type: string enum: - - list - description: The type of object returned, must be 'list'. - data: - type: array - description: A list of containers. - items: - $ref: '#/components/schemas/ContainerResource' - first_id: - type: string - description: The ID of the first container in the list. - last_id: - type: string - description: The ID of the last container in the list. - has_more: - type: boolean - description: Whether there are more containers available. - required: - - object - - data - - first_id - - last_id - - has_more - ContainerResource: - type: object - title: The container object - properties: - id: + - text_similarity + default: text_similarity + description: The type of grader. + x-stainless-const: true + name: type: string - description: Unique identifier for the container. - object: + description: The name of the grader. + input: type: string - description: The type of this object. - name: + description: The text being graded. + reference: type: string - description: Name of the container. - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the container was created. - status: + description: The text being graded against. + evaluation_metric: type: string - description: Status of the container (e.g., active, deleted). - last_active_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the container was last active. - expires_after: - type: object + enum: + - cosine + - fuzzy_match + - bleu + - gleu + - meteor + - rouge_1 + - rouge_2 + - rouge_3 + - rouge_4 + - rouge_5 + - rouge_l description: > - The container will expire after this time period. + The evaluation metric to use. One of `cosine`, `fuzzy_match`, + `bleu`, - The anchor is the reference point for the expiration. + `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, + `rouge_5`, - The minutes is the number of minutes after the anchor before the - container expires. - properties: - anchor: - type: string - description: The reference point for the expiration. - enum: - - last_active_at - minutes: - type: integer - description: >- - The number of minutes after the anchor before the container - expires. - memory_limit: - type: string - description: The memory limit configured for the container. - enum: - - 1g - - 4g - - 16g - - 64g - network_policy: - description: Network access policy for the container. - type: object - properties: - type: - type: string - description: The network policy mode. - enum: - - allowlist - - disabled - allowed_domains: - type: array - description: Allowed outbound domains when `type` is `allowlist`. - items: - type: string - required: - - type + or `rouge_l`. required: - - id - - object - - name - - created_at - - status - - id + - type - name - - created_at - - status + - input + - reference + - evaluation_metric x-oaiMeta: - name: The container object + name: Text Similarity Grader + group: graders example: | { - "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", - "object": "container", - "created_at": 1747844794, - "status": "running", - "expires_after": { - "anchor": "last_active_at", - "minutes": 20 - }, - "last_active_at": 1747844794, - "memory_limit": "1g", - "name": "My Container" + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "evaluation_metric": "fuzzy_match" } - Content: - description: | - Multi-modal input and output contents. - oneOf: - - title: Input content types - $ref: '#/components/schemas/InputContent' - - title: Output content types - $ref: '#/components/schemas/OutputContent' - ConversationItem: - title: Conversation item - description: >- - A single item within a conversation. The set of possible types are the - same as the `output` type of a [Response - object](/docs/api-reference/responses/object#responses/object-output). - oneOf: - - $ref: '#/components/schemas/Message' - - $ref: '#/components/schemas/FunctionToolCallResource' - - $ref: '#/components/schemas/FunctionToolCallOutputResource' - - $ref: '#/components/schemas/FileSearchToolCall' - - $ref: '#/components/schemas/WebSearchToolCall' - - $ref: '#/components/schemas/ImageGenToolCall' - - $ref: '#/components/schemas/ComputerToolCall' - - $ref: '#/components/schemas/ComputerToolCallOutputResource' - - $ref: '#/components/schemas/ToolSearchCall' - - $ref: '#/components/schemas/ToolSearchOutput' - - $ref: '#/components/schemas/AdditionalTools' - - $ref: '#/components/schemas/ReasoningItem' - - $ref: '#/components/schemas/CompactionBody' - - $ref: '#/components/schemas/CodeInterpreterToolCall' - - $ref: '#/components/schemas/LocalShellToolCall' - - $ref: '#/components/schemas/LocalShellToolCallOutput' - - $ref: '#/components/schemas/FunctionShellCall' - - $ref: '#/components/schemas/FunctionShellCallOutput' - - $ref: '#/components/schemas/ApplyPatchToolCall' - - $ref: '#/components/schemas/ApplyPatchToolCallOutput' - - $ref: '#/components/schemas/MCPListTools' - - $ref: '#/components/schemas/MCPApprovalRequest' - - $ref: '#/components/schemas/MCPApprovalResponseResource' - - $ref: '#/components/schemas/MCPToolCall' - - $ref: '#/components/schemas/CustomToolCall' - - $ref: '#/components/schemas/CustomToolCallOutput' - discriminator: - propertyName: type - ConversationItemList: + Group: type: object - title: The conversation item list - description: A list of Conversation items. + description: Summary information about a group returned in role assignment responses. properties: object: type: string - description: The type of object returned, must be `list`. enum: - - list + - group + description: Always `group`. x-stainless-const: true - data: - type: array - description: A list of conversation items. - items: - $ref: '#/components/schemas/ConversationItem' - has_more: - type: boolean - description: Whether there are more items available. - first_id: + id: type: string - description: The ID of the first item in the list. - last_id: + description: Identifier for the group. + name: type: string - description: The ID of the last item in the list. + description: Display name of the group. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the group was created. + scim_managed: + type: boolean + description: Whether the group is managed through SCIM. required: - object - - data - - has_more - - first_id - - last_id + - id + - name + - created_at + - scim_managed x-oaiMeta: - name: The item list - group: conversations - ConversationParam: - description: > - The conversation that this response belongs to. Items from this - conversation are prepended to `input_items` for this response request. - - Input items and output items from this response are automatically added - to this conversation after this response completes. - default: null - oneOf: - - type: string - title: Conversation ID - description: | - The unique ID of the conversation. - - $ref: '#/components/schemas/ConversationParam-2' - CostsResult: + name: The group object + example: | + { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "scim_managed": false + } + GroupDeletedResource: type: object - description: The aggregated costs details of the specific time bucket. + description: Confirmation payload returned after deleting a group. properties: object: type: string enum: - - organization.costs.result + - group.deleted + description: Always `group.deleted`. x-stainless-const: true - amount: - type: object - description: The monetary value in its associated currency. - properties: - value: - type: number - description: The numeric value of the cost. - currency: - type: string - description: Lowercase ISO-4217 currency e.g. "usd" - line_item: - anyOf: - - type: string - description: >- - When `group_by=line_item`, this field provides the line item of - the grouped costs result. - - type: 'null' - project_id: - anyOf: - - type: string - description: >- - When `group_by=project_id`, this field provides the project ID - of the grouped costs result. - - type: 'null' - api_key_id: - anyOf: - - type: string - description: >- - When `group_by=api_key_id`, this field provides the API Key ID - of the grouped costs result. - - type: 'null' - quantity: - anyOf: - - type: number - description: >- - When `group_by=line_item`, this field provides the quantity of - the grouped costs result. - - type: 'null' + id: + type: string + description: Identifier of the deleted group. + deleted: + type: boolean + description: Whether the group was deleted. required: - object + - id + - deleted x-oaiMeta: - name: Costs object example: | { - "object": "organization.costs.result", - "amount": { - "value": 0.06, - "currency": "usd" - }, - "line_item": "Image models", - "project_id": "proj_abc", - "quantity": 10000 + "object": "group.deleted", + "id": "group_01J1F8ABCDXYZ", + "deleted": true } - CreateAssistantRequest: + GroupListResource: type: object - additionalProperties: false - properties: - model: - description: > - ID of the model to use. You can use the [List - models](/docs/api-reference/models/list) API to see all of your - available models, or see our [Model overview](/docs/models) for - descriptions of them. - example: gpt-4o - anyOf: - - type: string - - $ref: '#/components/schemas/AssistantSupportedModels' - x-oaiTypeLabel: string - name: - anyOf: - - description: | - The name of the assistant. The maximum length is 256 characters. - type: string - maxLength: 256 - - type: 'null' - description: - anyOf: - - description: > - The description of the assistant. The maximum length is 512 - characters. - type: string - maxLength: 512 - - type: 'null' - instructions: - anyOf: - - description: > - The system instructions that the assistant uses. The maximum - length is 256,000 characters. - type: string - maxLength: 256000 - - type: 'null' - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - tools: - description: > - A list of tool enabled on the assistant. There can be a maximum of - 128 tools per assistant. Tools can be of types `code_interpreter`, - `file_search`, or `function`. - default: [] - type: array - maxItems: 128 - items: - oneOf: - - $ref: '#/components/schemas/AssistantToolsCode' - - $ref: '#/components/schemas/AssistantToolsFileSearch' - - $ref: '#/components/schemas/AssistantToolsFunction' - tool_resources: - anyOf: - - type: object - description: > - A set of resources that are used by the assistant's tools. The - resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the - `file_search` tool requires a list of vector store IDs. - properties: - code_interpreter: - type: object - properties: - file_ids: - type: array - description: > - A list of [file](/docs/api-reference/files) IDs made - available to the `code_interpreter` tool. There can be a - maximum of 20 files associated with the tool. - default: [] - maxItems: 20 - items: - type: string - file_search: - type: object - properties: - vector_store_ids: - type: array - description: > - The [vector - store](/docs/api-reference/vector-stores/object) - attached to this assistant. There can be a maximum of 1 - vector store attached to the assistant. - maxItems: 1 - items: - type: string - vector_stores: - type: array - description: > - A helper to create a [vector - store](/docs/api-reference/vector-stores/object) with - file_ids and attach it to this assistant. There can be a - maximum of 1 vector store attached to the assistant. - maxItems: 1 - items: - type: object - properties: - file_ids: - type: array - description: > - A list of [file](/docs/api-reference/files) IDs to - add to the vector store. For vector stores created - before Nov 2025, there can be a maximum of 10,000 - files in a vector store. For vector stores created - starting in Nov 2025, the limit is 100,000,000 - files. - maxItems: 100000000 - items: - type: string - chunking_strategy: - type: object - description: >- - The chunking strategy used to chunk the file(s). - If not set, will use the `auto` strategy. - oneOf: - - type: object - title: Auto Chunking Strategy - description: >- - The default strategy. This strategy currently - uses a `max_chunk_size_tokens` of `800` and - `chunk_overlap_tokens` of `400`. - additionalProperties: false - properties: - type: - type: string - description: Always `auto`. - enum: - - auto - x-stainless-const: true - required: - - type - - type: object - title: Static Chunking Strategy - additionalProperties: false - properties: - type: - type: string - description: Always `static`. - enum: - - static - x-stainless-const: true - static: - type: object - additionalProperties: false - properties: - max_chunk_size_tokens: - type: integer - minimum: 100 - maximum: 4096 - description: >- - The maximum number of tokens in each - chunk. The default value is `800`. The - minimum value is `100` and the maximum - value is `4096`. - chunk_overlap_tokens: - type: integer - description: > - The number of tokens that overlap - between chunks. The default value is - `400`. - - - Note that the overlap must not exceed - half of `max_chunk_size_tokens`. - required: - - max_chunk_size_tokens - - chunk_overlap_tokens - required: - - type - - static - metadata: - $ref: '#/components/schemas/Metadata' - oneOf: - - required: - - vector_store_ids - - required: - - vector_stores + description: Paginated list of organization groups. + properties: + object: + type: string + enum: + - list + description: Always `list`. + x-stainless-const: true + data: + type: array + description: Groups returned in the current page. + items: + $ref: '#/components/schemas/GroupResponse' + has_more: + type: boolean + description: Whether additional groups are available when paginating. + next: + description: >- + Cursor to fetch the next page of results, or `null` if there are no + more results. + anyOf: + - type: string - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - temperature: + required: + - object + - data + - has_more + - next + x-oaiMeta: + name: Group list + example: | + { + "object": "list", + "data": [ + { + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "is_scim_managed": false + }, + { + "id": "group_01J1F8PQRMNO", + "name": "Sales", + "created_at": 1711472599, + "is_scim_managed": true + } + ], + "has_more": false, + "next": null + } + GroupMemberUser: + type: object + description: >- + Details about a user returned from an organization group membership + lookup. + properties: + id: + type: string + description: Identifier for the user. + name: + type: string + description: Display name of the user. + email: + description: Email address of the user, or `null` for users without an email. anyOf: - - description: > - What sampling temperature to use, between 0 and 2. Higher values - like 0.8 will make the output more random, while lower values - like 0.2 will make it more focused and deterministic. - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 + - type: string - type: 'null' - top_p: + picture: + description: URL of the user's profile picture, if available. anyOf: - - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 - description: > - An alternative to sampling with temperature, called nucleus - sampling, where the model considers the results of the tokens - with top_p probability mass. So 0.1 means only the tokens - comprising the top 10% probability mass are considered. - - - We generally recommend altering this or temperature but not - both. + - type: string - type: 'null' - response_format: + is_service_account: + description: Whether the user is a service account. anyOf: - - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + - type: boolean - type: 'null' - required: - - model - CreateChatCompletionRequest: - allOf: - - $ref: '#/components/schemas/CreateModelResponseProperties' - - type: object - properties: - messages: - description: > - A list of messages comprising the conversation so far. Depending - on the - - [model](/docs/models) you use, different message types - (modalities) are - - supported, like [text](/docs/guides/text-generation), - - [images](/docs/guides/vision), and [audio](/docs/guides/audio). - type: array - minItems: 1 - items: - $ref: '#/components/schemas/ChatCompletionRequestMessage' - model: - description: > - Model ID used to generate the response, like `gpt-4o` or `o3`. - OpenAI - - offers a wide range of models with different capabilities, - performance - - characteristics, and price points. Refer to the [model - guide](/docs/models) - - to browse and compare available models. - $ref: '#/components/schemas/ModelIdsShared' - modalities: - $ref: '#/components/schemas/ResponseModalities' - verbosity: - $ref: '#/components/schemas/Verbosity' - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - max_completion_tokens: - description: > - An upper bound for the number of tokens that can be generated - for a completion, including visible output tokens and [reasoning - tokens](/docs/guides/reasoning). - type: integer - nullable: true - frequency_penalty: - type: number - default: 0 - minimum: -2 - maximum: 2 - nullable: true - description: > - Number between -2.0 and 2.0. Positive values penalize new tokens - based on - - their existing frequency in the text so far, decreasing the - model's - - likelihood to repeat the same line verbatim. - presence_penalty: - type: number - default: 0 - minimum: -2 - maximum: 2 - nullable: true - description: > - Number between -2.0 and 2.0. Positive values penalize new tokens - based on - - whether they appear in the text so far, increasing the model's - likelihood - - to talk about new topics. - web_search_options: - type: object - title: Web search - description: > - This tool searches the web for relevant results to use in a - response. - - Learn more about the [web search - tool](/docs/guides/tools-web-search?api-mode=chat). - properties: - user_location: - type: object - nullable: true - required: - - type - - approximate - description: | - Approximate location parameters for the search. - properties: - type: - type: string - description: > - The type of location approximation. Always - `approximate`. - enum: - - approximate - x-stainless-const: true - approximate: - $ref: '#/components/schemas/WebSearchLocation' - search_context_size: - $ref: '#/components/schemas/WebSearchContextSize' - top_logprobs: - description: > - An integer between 0 and 20 specifying the maximum number of - most likely - - tokens to return at each token position, each with an associated - log - - probability. In some cases, the number of returned tokens may be - fewer than - - requested. - - `logprobs` must be set to `true` if this parameter is used. - type: integer - minimum: 0 - maximum: 20 - nullable: true - response_format: - description: > - An object specifying the format that the model must output. - - - Setting to `{ "type": "json_schema", "json_schema": {...} }` - enables - - Structured Outputs which ensures the model will match your - supplied JSON - - schema. Learn more in the [Structured Outputs - - guide](/docs/guides/structured-outputs). - - - Setting to `{ "type": "json_object" }` enables the older JSON - mode, which - - ensures the message the model generates is valid JSON. Using - `json_schema` - - is preferred for models that support it. - oneOf: - - $ref: '#/components/schemas/ResponseFormatText' - - $ref: '#/components/schemas/ResponseFormatJsonSchema' - - $ref: '#/components/schemas/ResponseFormatJsonObject' - discriminator: - propertyName: type - audio: - type: object - nullable: true - description: > - Parameters for audio output. Required when audio output is - requested with - - `modalities: ["audio"]`. [Learn more](/docs/guides/audio). - required: - - voice - - format - properties: - voice: - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - description: > - The voice the model uses to respond. Supported built-in - voices are - - `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, - `onyx`, - - `sage`, `shimmer`, `marin`, and `cedar`. You may also - provide a - - custom voice object with an `id`, for example `{ "id": - "voice_1234" }`. - format: - type: string - enum: - - wav - - aac - - mp3 - - flac - - opus - - pcm16 - description: > - Specifies the output audio format. Must be one of `wav`, - `mp3`, `flac`, - - `opus`, or `pcm16`. - store: - type: boolean - default: false - nullable: true - description: > - Whether or not to store the output of this chat completion - request for - - use in our [model distillation](/docs/guides/distillation) or - - [evals](/docs/guides/evals) products. - - - Supports text and image inputs. Note: image inputs over 8MB will - be dropped. - moderation: - anyOf: - - $ref: '#/components/schemas/ModerationParam' - description: > - Configuration for running moderation on the request input - and generated output. - - type: 'null' - stream: - description: > - If set to true, the model response data will be streamed to the - client - - as it is generated using [server-sent - events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). - - See the [Streaming section - below](/docs/api-reference/chat/streaming) - - for more information, along with the [streaming - responses](/docs/guides/streaming-responses) - - guide for more information on how to handle the streaming - events. - type: boolean - nullable: true - default: false - stop: - $ref: '#/components/schemas/StopConfiguration' - logit_bias: - type: object - x-oaiTypeLabel: map - default: null - nullable: true - additionalProperties: - type: integer - description: > - Modify the likelihood of specified tokens appearing in the - completion. - - - Accepts a JSON object that maps tokens (specified by their token - ID in the - - tokenizer) to an associated bias value from -100 to 100. - Mathematically, - - the bias is added to the logits generated by the model prior to - sampling. - - The exact effect will vary per model, but values between -1 and - 1 should - - decrease or increase likelihood of selection; values like -100 - or 100 - - should result in a ban or exclusive selection of the relevant - token. - logprobs: - description: > - Whether to return log probabilities of the output tokens or not. - If true, - - returns the log probabilities of each output token returned in - the - - `content` of `message`. - type: boolean - default: false - nullable: true - max_tokens: - description: > - The maximum number of [tokens](/tokenizer) that can be generated - in the - - chat completion. This value can be used to control - - [costs](https://openai.com/api/pricing/) for text generated via - API. - - - This value is now deprecated in favor of - `max_completion_tokens`, and is - - not compatible with [o-series models](/docs/guides/reasoning). - type: integer - nullable: true - deprecated: true - 'n': - type: integer - minimum: 1 - maximum: 128 - default: 1 - example: 1 - nullable: true - description: >- - How many chat completion choices to generate for each input - message. Note that you will be charged based on the number of - generated tokens across all of the choices. Keep `n` as `1` to - minimize costs. - prediction: - nullable: true - description: > - Configuration for a [Predicted - Output](/docs/guides/predicted-outputs), - - which can greatly improve response times when large parts of the - model - - response are known ahead of time. This is most common when you - are - - regenerating a file with only minor changes to most of the - content. - oneOf: - - $ref: '#/components/schemas/PredictionContent' - seed: - type: integer - minimum: -9223372036854776000 - maximum: 9223372036854776000 - nullable: true - deprecated: true - description: > - This feature is in Beta. - - If specified, our system will make a best effort to sample - deterministically, such that repeated requests with the same - `seed` and parameters should return the same result. - - Determinism is not guaranteed, and you should refer to the - `system_fingerprint` response parameter to monitor changes in - the backend. - x-oaiMeta: - beta: true - stream_options: - $ref: '#/components/schemas/ChatCompletionStreamOptions' - tools: - type: array - description: | - A list of tools the model may call. You can provide either - [custom tools](/docs/guides/function-calling#custom-tools) or - [function tools](/docs/guides/function-calling). - items: - oneOf: - - $ref: '#/components/schemas/ChatCompletionTool' - - $ref: '#/components/schemas/CustomToolChatCompletions' - tool_choice: - $ref: '#/components/schemas/ChatCompletionToolChoiceOption' - parallel_tool_calls: - $ref: '#/components/schemas/ParallelToolCalls' - function_call: - deprecated: true - description: > - Deprecated in favor of `tool_choice`. - - - Controls which (if any) function is called by the model. - - - `none` means the model will not call a function and instead - generates a - - message. - - - `auto` means the model can pick between generating a message or - calling a - - function. - - - Specifying a particular function via `{"name": "my_function"}` - forces the - - model to call that function. - - - `none` is the default when no functions are present. `auto` is - the default - - if functions are present. - oneOf: - - type: string - description: > - `none` means the model will not call a function and instead - generates a message. `auto` means the model can pick between - generating a message or calling a function. - enum: - - none - - auto - - $ref: '#/components/schemas/ChatCompletionFunctionCallOption' - functions: - deprecated: true - description: | - Deprecated in favor of `tools`. - - A list of functions the model may generate JSON inputs for. - type: array - minItems: 1 - maxItems: 128 - items: - $ref: '#/components/schemas/ChatCompletionFunctions' - required: - - model - - messages - CreateChatCompletionResponse: + user_type: + type: string + enum: + - user + - tenant_user + description: The type of user. + required: + - id + - name + - email + - picture + - is_service_account + - user_type + x-oaiMeta: + name: The group member user object + example: | + { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com", + "picture": null, + "is_service_account": false, + "user_type": "user" + } + GroupResourceWithSuccess: type: object - description: >- - Represents a chat completion response returned by model, based on the - provided input. + description: Response returned after updating a group. properties: id: type: string - description: A unique identifier for the chat completion. - choices: - type: array + description: Identifier for the group. + name: + type: string + description: Updated display name for the group. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the group was created. + is_scim_managed: + type: boolean description: >- - A list of chat completion choices. Can be more than one if `n` is - greater than 1. - items: - type: object - required: - - finish_reason - - index - - message - - logprobs - properties: - finish_reason: - type: string - description: > - The reason the model stopped generating tokens. This will be - `stop` if the model hit a natural stop point or a provided - stop sequence, - - `length` if the maximum number of tokens specified in the - request was reached, - - `content_filter` if content was omitted due to a flag from our - content filters, - - `tool_calls` if the model called a tool, or `function_call` - (deprecated) if the model called a function. - - Read the [Model - Spec](https://model-spec.openai.com/2025-12-18.html) for more. - enum: - - stop - - length - - tool_calls - - content_filter - - function_call - index: - type: integer - description: The index of the choice in the list of choices. - message: - $ref: '#/components/schemas/ChatCompletionResponseMessage' - logprobs: - anyOf: - - description: Log probability information for the choice. - type: object - properties: - content: - anyOf: - - description: >- - A list of message content tokens with log - probability information. - type: array - items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' - - type: 'null' - refusal: - anyOf: - - description: >- - A list of message refusal tokens with log - probability information. - type: array - items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' - - type: 'null' - required: - - content - - refusal - - type: 'null' - created: + Whether the group is managed through SCIM and controlled by your + identity provider. + required: + - id + - name + - created_at + - is_scim_managed + x-oaiMeta: + example: | + { + "id": "group_01J1F8ABCDXYZ", + "name": "Escalations", + "created_at": 1711471533, + "is_scim_managed": false + } + GroupResponse: + type: object + description: Details about an organization group. + properties: + id: + type: string + description: Identifier for the group. + name: + type: string + description: Display name of the group. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the group was created. + is_scim_managed: + type: boolean + description: >- + Whether the group is managed through SCIM and controlled by your + identity provider. + group_type: + type: string + enum: + - group + - tenant_group + description: The type of the group. + required: + - id + - name + - created_at + - is_scim_managed + - group_type + x-oaiMeta: + name: Group + example: | + { + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "is_scim_managed": false, + "group_type": "group" + } + GroupRoleAssignment: + type: object + description: Role assignment linking a group to a role. + properties: + object: + type: string + enum: + - group.role + description: Always `group.role`. + x-stainless-const: true + group: + $ref: '#/components/schemas/Group' + role: + $ref: '#/components/schemas/Role' + required: + - object + - group + - role + x-oaiMeta: + name: The group role object + example: | + { + "object": "group.role", + "group": { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "scim_managed": false + }, + "role": { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + } + GroupUser: + type: object + description: Represents an individual user returned when inspecting group membership. + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints + name: + type: string + description: The name of the user. + email: + anyOf: + - type: string + - type: 'null' + description: The email address of the user. + required: + - id + - name + - email + GroupUserAssignment: + type: object + description: Confirmation payload returned after adding a user to a group. + properties: + object: + type: string + enum: + - group.user + description: Always `group.user`. + x-stainless-const: true + user_id: + type: string + description: Identifier of the user that was added. + group_id: + type: string + description: Identifier of the group the user was added to. + required: + - object + - user_id + - group_id + x-oaiMeta: + name: The group user object + example: | + { + "object": "group.user", + "user_id": "user_abc123", + "group_id": "group_01J1F8ABCDXYZ" + } + GroupUserDeletedResource: + type: object + description: Confirmation payload returned after removing a user from a group. + properties: + object: + type: string + enum: + - group.user.deleted + description: Always `group.user.deleted`. + x-stainless-const: true + deleted: + type: boolean + description: Whether the group membership was removed. + required: + - object + - deleted + x-oaiMeta: + name: Group user deletion confirmation + example: | + { + "object": "group.user.deleted", + "deleted": true + } + HostedToolPermission: + type: object + description: Permission state for a single hosted tool on a project. + properties: + enabled: + type: boolean + description: Whether the hosted tool is enabled for the project. + required: + - enabled + HostedToolPermissionUpdate: + type: object + properties: + enabled: + type: boolean + description: Whether to enable the hosted tool for the project. + required: + - enabled + Image: + type: object + description: >- + Represents the content or the URL of an image generated by the OpenAI + API. + properties: + b64_json: + type: string + description: >- + The base64-encoded JSON of the generated image. Returned by default + for the GPT image models, and only present if `response_format` is + set to `b64_json` for `dall-e-2` and `dall-e-3`. + url: + type: string + format: uri + description: >- + When using `dall-e-2` or `dall-e-3`, the URL of the generated image + if `response_format` is set to `url` (default value). Unsupported + for the GPT image models. + revised_prompt: + type: string + description: >- + For `dall-e-3` only, the revised prompt that was used to generate + the image. + ImageEditCompletedEvent: + type: object + description: > + Emitted when image editing has completed and the final image is + available. + properties: + type: + type: string + description: | + The type of the event. Always `image_edit.completed`. + enum: + - image_edit.completed + x-stainless-const: true + b64_json: + type: string + description: > + Base64-encoded final edited image data, suitable for rendering as an + image. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + type: string + description: | + The size of the edited image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: + type: string + description: | + The quality setting for the edited image. + enum: + - low + - medium + - high + - auto + background: + type: string + description: | + The background setting for the edited image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the edited image. + enum: + - png + - webp + - jpeg + usage: + $ref: '#/components/schemas/ImagesUsage' + required: + - type + - b64_json + - created_at + - size + - quality + - background + - output_format + - usage + x-oaiMeta: + name: image_edit.completed + group: images + example: | + { + "type": "image_edit.completed", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 + } + } + } + ImageEditPartialImageEvent: + type: object + description: > + Emitted when a partial image is available during image editing + streaming. + properties: + type: + type: string + description: | + The type of the event. Always `image_edit.partial_image`. + enum: + - image_edit.partial_image + x-stainless-const: true + b64_json: + type: string + description: > + Base64-encoded partial image data, suitable for rendering as an + image. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + type: string + description: | + The size of the requested edited image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: + type: string + description: | + The quality setting for the requested edited image. + enum: + - low + - medium + - high + - auto + background: + type: string + description: | + The background setting for the requested edited image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the requested edited image. + enum: + - png + - webp + - jpeg + partial_image_index: + type: integer + description: | + 0-based index for the partial image (streaming). + required: + - type + - b64_json + - created_at + - size + - quality + - background + - output_format + - partial_image_index + x-oaiMeta: + name: image_edit.partial_image + group: images + example: | + { + "type": "image_edit.partial_image", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "partial_image_index": 0 + } + ImageEditStreamEvent: + anyOf: + - $ref: '#/components/schemas/ImageEditPartialImageEvent' + - $ref: '#/components/schemas/ImageEditCompletedEvent' + discriminator: + propertyName: type + ImageGenCompletedEvent: + type: object + description: > + Emitted when image generation has completed and the final image is + available. + properties: + type: + type: string + description: | + The type of the event. Always `image_generation.completed`. + enum: + - image_generation.completed + x-stainless-const: true + b64_json: + type: string + description: | + Base64-encoded image data, suitable for rendering as an image. + created_at: type: integer format: unixtime - description: >- - The Unix timestamp (in seconds) of when the chat completion was - created. - model: + description: | + The Unix timestamp when the event was created. + size: type: string - description: The model used for the chat completion. - service_tier: - $ref: '#/components/schemas/ServiceTier' - system_fingerprint: + description: | + The size of the generated image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: type: string - deprecated: true - description: > - This fingerprint represents the backend configuration that the model - runs with. - - - Can be used in conjunction with the `seed` request parameter to - understand when backend changes have been made that might impact - determinism. - object: + description: | + The quality setting for the generated image. + enum: + - low + - medium + - high + - auto + background: type: string - description: The object type, which is always `chat.completion`. + description: | + The background setting for the generated image. enum: - - chat.completion - x-stainless-const: true + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the generated image. + enum: + - png + - webp + - jpeg usage: - $ref: '#/components/schemas/CompletionUsage' - moderation: - anyOf: - - $ref: '#/components/schemas/ChatCompletionModeration' - description: > - Moderation results for the request input and generated output, - if moderated - - completions were requested. - - type: 'null' + $ref: '#/components/schemas/ImagesUsage' required: - - choices - - created - - id - - model - - object + - type + - b64_json + - created_at + - size + - quality + - background + - output_format + - usage x-oaiMeta: - name: The chat completion object - group: chat + name: image_generation.completed + group: images example: | { - "id": "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG", - "object": "chat.completion", - "created": 1741570283, - "model": "gpt-4o-2024-08-06", - "choices": [ - { - "index": 0, - "message": { - "role": "assistant", - "content": "The image shows a wooden boardwalk path running through a lush green field or meadow. The sky is bright blue with some scattered clouds, giving the scene a serene and peaceful atmosphere. Trees and shrubs are visible in the background.", - "refusal": null, - "annotations": [] - }, - "logprobs": null, - "finish_reason": "stop" - } - ], + "type": "image_generation.completed", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", "usage": { - "prompt_tokens": 1117, - "completion_tokens": 46, - "total_tokens": 1163, - "prompt_tokens_details": { - "cached_tokens": 0, - "audio_tokens": 0 - }, - "completion_tokens_details": { - "reasoning_tokens": 0, - "audio_tokens": 0, - "accepted_prediction_tokens": 0, - "rejected_prediction_tokens": 0 + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 } - }, - "service_tier": "default", - "system_fingerprint": "fp_fc9f1d7035" + } } - CreateChatCompletionStreamResponse: + ImageGenPartialImageEvent: + type: object + description: > + Emitted when a partial image is available during image generation + streaming. + properties: + type: + type: string + description: | + The type of the event. Always `image_generation.partial_image`. + enum: + - image_generation.partial_image + x-stainless-const: true + b64_json: + type: string + description: > + Base64-encoded partial image data, suitable for rendering as an + image. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + type: string + description: | + The size of the requested image. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + quality: + type: string + description: | + The quality setting for the requested image. + enum: + - low + - medium + - high + - auto + background: + type: string + description: | + The background setting for the requested image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the requested image. + enum: + - png + - webp + - jpeg + partial_image_index: + type: integer + description: | + 0-based index for the partial image (streaming). + required: + - type + - b64_json + - created_at + - size + - quality + - background + - output_format + - partial_image_index + x-oaiMeta: + name: image_generation.partial_image + group: images + example: | + { + "type": "image_generation.partial_image", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "partial_image_index": 0 + } + ImageGenStreamEvent: + anyOf: + - $ref: '#/components/schemas/ImageGenPartialImageEvent' + - $ref: '#/components/schemas/ImageGenCompletedEvent' + discriminator: + propertyName: type + ImageGenTool: type: object + title: Image generation tool description: | - Represents a streamed chunk of a chat completion response returned - by the model, based on the provided input. - [Learn more](/docs/guides/streaming-responses). + A tool that generates images using the GPT image models. properties: - id: + type: + type: string + enum: + - image_generation + description: | + The type of the image generation tool. Always `image_generation`. + x-stainless-const: true + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: type: string + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto description: >- - A unique identifier for the chat completion. Each chunk has the same - ID. - choices: - type: array + The size of the generated images. For `gpt-image-2` and + `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as + `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height + must both be divisible by 16 and the requested aspect ratio must be + between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, + and the maximum supported resolution is `3840x2160`. The requested + size must also satisfy the model's current pixel and edge limits. + The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + supported by the GPT image models; `auto` is supported for models + that allow automatic sizing. For `dall-e-2`, use one of `256x256`, + `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, + `1792x1024`, or `1024x1792`. + default: auto + output_format: + type: string + enum: + - png + - webp + - jpeg + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: + anyOf: + - $ref: '#/components/schemas/InputFidelity' + - type: 'null' + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + required: [] + additionalProperties: false + partial_images: + type: integer + minimum: 0 + maximum: 3 description: > - A list of chat completion choices. Can contain more than one - elements if `n` is greater than 1. Can also be empty for the - - last chunk if you set `stream_options: {"include_usage": true}`. - items: - type: object - required: - - delta - - finish_reason - - index - properties: - delta: - $ref: '#/components/schemas/ChatCompletionStreamResponseDelta' - logprobs: - description: Log probability information for the choice. - type: object - nullable: true - properties: - content: - description: >- - A list of message content tokens with log probability - information. - type: array - items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' - nullable: true - refusal: - description: >- - A list of message refusal tokens with log probability - information. - type: array - items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' - nullable: true - required: - - content - - refusal - finish_reason: - type: string - description: > - The reason the model stopped generating tokens. This will be - `stop` if the model hit a natural stop point or a provided - stop sequence, - - `length` if the maximum number of tokens specified in the - request was reached, - - `content_filter` if content was omitted due to a flag from our - content filters, - - `tool_calls` if the model called a tool, or `function_call` - (deprecated) if the model called a function. - enum: - - stop - - length - - tool_calls - - content_filter - - function_call - nullable: true - index: - type: integer - description: The index of the choice in the list of choices. + Number of partial images to generate in streaming mode, from 0 + (default value) to 3. + default: 0 + action: + description: > + Whether to generate a new image or edit an existing image. Default: + `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' + required: + - type + ImageGenToolCall: + type: object + title: Image generation call + description: | + An image generation request made by the model. + properties: + type: + type: string + enum: + - image_generation_call + description: > + The type of the image generation call. Always + `image_generation_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the image generation call. + status: + type: string + enum: + - in_progress + - completed + - generating + - failed + description: | + The status of the image generation call. + result: + anyOf: + - type: string + description: | + The generated image encoded in base64. + - type: 'null' + required: + - type + - id + - status + - result + ImageRefParam: + type: object + description: | + Reference an input image by either URL or uploaded file ID. + Provide exactly one of `image_url` or `file_id`. + properties: + image_url: + type: string + format: uri + maxLength: 20971520 + description: A fully qualified URL or base64-encoded data URL. + example: https://example.com/source-image.png + file_id: + type: string + description: The File API ID of an uploaded image to use as input. + example: file-abc123 + anyOf: + - required: + - image_url + - required: + - file_id + not: + required: + - image_url + - file_id + additionalProperties: false + ImagesResponse: + type: object + title: Image generation response + description: The response from the image generation endpoint. + properties: created: type: integer format: unixtime + description: The Unix timestamp (in seconds) of when the image was created. + data: + type: array + description: The list of generated images. + items: + $ref: '#/components/schemas/Image' + background: + type: string description: >- - The Unix timestamp (in seconds) of when the chat completion was - created. Each chunk has the same timestamp. - model: + The background parameter used for the image generation. Either + `transparent` or `opaque`. + enum: + - transparent + - opaque + output_format: type: string - description: The model to generate the completion. - service_tier: - $ref: '#/components/schemas/ServiceTier' - system_fingerprint: + description: >- + The output format of the image generation. Either `png`, `webp`, or + `jpeg`. + enum: + - png + - webp + - jpeg + size: type: string - deprecated: true - description: > - This fingerprint represents the backend configuration that the model - runs with. - - Can be used in conjunction with the `seed` request parameter to - understand when backend changes have been made that might impact - determinism. - object: + description: >- + The size of the image generated. Either `1024x1024`, `1024x1536`, or + `1536x1024`. + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + quality: type: string - description: The object type, which is always `chat.completion.chunk`. + description: >- + The quality of the image generated. Either `low`, `medium`, or + `high`. enum: - - chat.completion.chunk - x-stainless-const: true + - low + - medium + - high usage: - $ref: '#/components/schemas/CompletionUsage' - nullable: true - description: > - An optional field that will only be present when you set - - `stream_options: {"include_usage": true}` in your request. When - present, it - - contains a null value **except for the last chunk** which contains - the - - token usage statistics for the entire request. - - - **NOTE:** If the stream is interrupted or cancelled, you may not - - receive the final usage chunk which contains the total token usage - for - - the request. - moderation: - anyOf: - - $ref: '#/components/schemas/ChatCompletionModeration' - description: > - Moderation results for the request input and generated output. - Present - - on the moderation chunk when moderated completions are - requested. - - type: 'null' + $ref: '#/components/schemas/ImageGenUsage' required: - - choices - created - - id - - model - - object x-oaiMeta: - name: The chat completion chunk object - group: chat - example: > - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", - "system_fingerprint": "fp_44709d6fcb", - "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}]} - - - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", - "system_fingerprint": "fp_44709d6fcb", - "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} - - - .... - - - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-4o-mini", - "system_fingerprint": "fp_44709d6fcb", - "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} - CreateCompletionRequest: + name: The image generation response + group: images + example: | + { + "created": 1713833628, + "data": [ + { + "b64_json": "..." + } + ], + "background": "transparent", + "output_format": "png", + "size": "1024x1024", + "quality": "high", + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 + } + } + } + ImagesUsage: type: object + description: > + For the GPT image models only, the token usage information for the image + generation. + required: + - total_tokens + - input_tokens + - output_tokens + - input_tokens_details properties: - model: - description: > - ID of the model to use. You can use the [List - models](/docs/api-reference/models/list) API to see all of your - available models, or see our [Model overview](/docs/models) for - descriptions of them. - anyOf: - - type: string - - type: string - enum: - - gpt-3.5-turbo-instruct - - davinci-002 - - babbage-002 - x-oaiTypeLabel: string - prompt: - description: > - The prompt(s) to generate completions for, encoded as a string, - array of strings, array of tokens, or array of token arrays. - - - Note that <|endoftext|> is the document separator that the model - sees during training, so if a prompt is not specified the model will - generate as if from the beginning of a new document. - default: <|endoftext|> - nullable: true - oneOf: - - type: string - default: '' - example: This is a test. - - type: array - items: - type: string - default: '' - example: This is a test. - - type: array - minItems: 1 - items: - type: integer - example: '[1212, 318, 257, 1332, 13]' - - type: array - minItems: 1 - items: - type: array - minItems: 1 - items: - type: integer - example: '[[1212, 318, 257, 1332, 13]]' - best_of: + total_tokens: type: integer - default: 1 - minimum: 0 - maximum: 20 - nullable: true - description: > - Generates `best_of` completions server-side and returns the "best" - (the one with the highest log probability per token). Results cannot - be streamed. - - - When used with `n`, `best_of` controls the number of candidate - completions and `n` specifies how many to return – `best_of` must be - greater than `n`. - - - **Note:** Because this parameter generates many completions, it can - quickly consume your token quota. Use carefully and ensure that you - have reasonable settings for `max_tokens` and `stop`. - echo: - type: boolean - default: false - nullable: true - description: | - Echo back the prompt in addition to the completion - frequency_penalty: - type: number - default: 0 - minimum: -2 - maximum: 2 - nullable: true - description: > - Number between -2.0 and 2.0. Positive values penalize new tokens - based on their existing frequency in the text so far, decreasing the - model's likelihood to repeat the same line verbatim. - - - [See more information about frequency and presence - penalties.](/docs/guides/text-generation) - logit_bias: - type: object - x-oaiTypeLabel: map - default: null - nullable: true - additionalProperties: - type: integer description: > - Modify the likelihood of specified tokens appearing in the - completion. - - - Accepts a JSON object that maps tokens (specified by their token ID - in the GPT tokenizer) to an associated bias value from -100 to 100. - You can use this [tokenizer tool](/tokenizer?view=bpe) to convert - text to token IDs. Mathematically, the bias is added to the logits - generated by the model prior to sampling. The exact effect will vary - per model, but values between -1 and 1 should decrease or increase - likelihood of selection; values like -100 or 100 should result in a - ban or exclusive selection of the relevant token. - - - As an example, you can pass `{"50256": -100}` to prevent the - <|endoftext|> token from being generated. - logprobs: + The total number of tokens (images and text) used for the image + generation. + input_tokens: type: integer - minimum: 0 - maximum: 5 - default: null - nullable: true - description: > - Include the log probabilities on the `logprobs` most likely output - tokens, as well the chosen tokens. For example, if `logprobs` is 5, - the API will return a list of the 5 most likely tokens. The API will - always return the `logprob` of the sampled token, so there may be up - to `logprobs+1` elements in the response. - - - The maximum value for `logprobs` is 5. - max_tokens: + description: The number of tokens (images and text) in the input prompt. + output_tokens: type: integer - minimum: 0 - default: 16 - example: 16 - nullable: true - description: > - The maximum number of [tokens](/tokenizer) that can be generated in - the completion. - + description: The number of image tokens in the output image. + input_tokens_details: + type: object + description: The input tokens detailed information for the image generation. + required: + - text_tokens + - image_tokens + properties: + text_tokens: + type: integer + description: The number of text tokens in the input prompt. + image_tokens: + type: integer + description: The number of image tokens in the input prompt. + InputAudio: + type: object + title: Input audio + description: | + An audio input to the model. + properties: + type: + type: string + description: | + The type of the input item. Always `input_audio`. + enum: + - input_audio + x-stainless-const: true + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: > + The format of the audio data. Currently supported formats are + `mp3` and - The token count of your prompt plus `max_tokens` cannot exceed the - model's context length. [Example Python - code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - for counting tokens. - 'n': - type: integer - minimum: 1 - maximum: 128 - default: 1 - example: 1 - nullable: true - description: > - How many completions to generate for each prompt. + `wav`. + enum: + - mp3 + - wav + required: + - data + - format + required: + - type + - input_audio + InputContent: + oneOf: + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/InputImageContent' + - $ref: '#/components/schemas/InputFileContent' + discriminator: + propertyName: type + InputItem: + oneOf: + - $ref: '#/components/schemas/EasyInputMessage' + - type: object + title: Item + description: | + An item representing part of the context for the response to be + generated by the model. Can contain text, images, and audio inputs, + as well as previous assistant responses and tool call outputs. + $ref: '#/components/schemas/Item' + - $ref: '#/components/schemas/CompactionTriggerItemParam' + - $ref: '#/components/schemas/ItemReferenceParam' + - $ref: '#/components/schemas/ProgramItemParam' + - $ref: '#/components/schemas/ProgramOutputItemParam' + discriminator: + propertyName: type + InputMessage: + type: object + title: Input message + description: > + A message input to the model with a role indicating instruction + following + hierarchy. Instructions given with the `developer` or `system` role take - **Note:** Because this parameter generates many completions, it can - quickly consume your token quota. Use carefully and ensure that you - have reasonable settings for `max_tokens` and `stop`. - presence_penalty: - type: number - default: 0 - minimum: -2 - maximum: 2 - nullable: true + precedence over instructions given with the `user` role. + properties: + type: + type: string + description: | + The type of the message input. Always set to `message`. + enum: + - message + x-stainless-const: true + role: + type: string description: > - Number between -2.0 and 2.0. Positive values penalize new tokens - based on whether they appear in the text so far, increasing the - model's likelihood to talk about new topics. + The role of the message input. One of `user`, `system`, or + `developer`. + enum: + - user + - system + - developer + status: + type: string + description: | + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + content: + $ref: '#/components/schemas/InputMessageContentList' + required: + - role + - content + InputMessageContentList: + type: array + title: Input item content list + description: > + A list of one or many input items to the model, containing different + content + types. + items: + $ref: '#/components/schemas/InputContent' + InputMessageResource: + allOf: + - $ref: '#/components/schemas/InputMessage' + - type: object + properties: + id: + type: string + description: | + The unique ID of the message input. + required: + - id + - type + InputParam: + description: | + Text, image, or file inputs to the model, used to generate a response. - [See more information about frequency and presence - penalties.](/docs/guides/text-generation) - seed: + Learn more: + - [Text inputs and outputs](/docs/guides/text) + - [Image inputs](/docs/guides/images) + - [File inputs](/docs/guides/pdf-files) + - [Conversation state](/docs/guides/conversation-state) + - [Function calling](/docs/guides/function-calling) + oneOf: + - type: string + title: Text input + description: | + A text input to the model, equivalent to a text input with the + `user` role. + - type: array + title: Input item list + description: | + A list of one or many input items to the model, containing + different content types. + items: + $ref: '#/components/schemas/InputItem' + Invite: + type: object + description: Represents an individual `invite` to the organization. + properties: + object: + type: string + enum: + - organization.invite + description: The object type, which is always `organization.invite` + x-stainless-const: true + id: + type: string + description: The identifier, which can be referenced in API endpoints + email: + type: string + description: The email address of the individual to whom the invite was sent + role: + type: string + enum: + - owner + - reader + description: '`owner` or `reader`' + status: + type: string + enum: + - accepted + - expired + - pending + description: '`accepted`,`expired`, or `pending`' + created_at: type: integer - format: int64 - nullable: true - description: > - If specified, our system will make a best effort to sample - deterministically, such that repeated requests with the same `seed` - and parameters should return the same result. - - - Determinism is not guaranteed, and you should refer to the - `system_fingerprint` response parameter to monitor changes in the - backend. - stop: - $ref: '#/components/schemas/StopConfiguration' - stream: - description: > - Whether to stream back partial progress. If set, tokens will be sent - as data-only [server-sent - events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - as they become available, with the stream terminated by a `data: - [DONE]` message. [Example Python - code](https://cookbook.openai.com/examples/how_to_stream_completions). + format: unixtime + description: The Unix timestamp (in seconds) of when the invite was sent. + expires_at: + anyOf: + - type: integer + format: unixtime + - type: 'null' + description: The Unix timestamp (in seconds) of when the invite expires. + accepted_at: + anyOf: + - type: integer + format: unixtime + - type: 'null' + description: The Unix timestamp (in seconds) of when the invite was accepted. + projects: + type: array + description: >- + The projects that were granted membership upon acceptance of the + invite. + items: + type: object + properties: + id: + type: string + description: Project's public ID + role: + type: string + enum: + - member + - owner + description: Project membership role + required: + - id + - role + required: + - object + - id + - email + - role + - status + - created_at + - projects + x-oaiMeta: + name: The invite object + example: | + { + "object": "organization.invite", + "id": "invite-abc", + "email": "user@example.com", + "role": "owner", + "status": "accepted", + "created_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": 1711471533, + "projects": [ + { + "id": "project-xyz", + "role": "member" + } + ] + } + InviteDeleteResponse: + type: object + properties: + object: + type: string + enum: + - organization.invite.deleted + description: The object type, which is always `organization.invite.deleted` + x-stainless-const: true + id: + type: string + deleted: type: boolean - nullable: true - default: false - stream_options: - $ref: '#/components/schemas/ChatCompletionStreamOptions' - suffix: - description: | - The suffix that comes after a completion of inserted text. - - This parameter is only supported for `gpt-3.5-turbo-instruct`. - default: null - nullable: true + required: + - object + - id + - deleted + InviteListResponse: + type: object + properties: + object: type: string - example: test. - temperature: - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 - nullable: true - description: > - What sampling temperature to use, between 0 and 2. Higher values - like 0.8 will make the output more random, while lower values like - 0.2 will make it more focused and deterministic. - - - We generally recommend altering this or `top_p` but not both. - top_p: - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 - nullable: true - description: > - An alternative to sampling with temperature, called nucleus - sampling, where the model considers the results of the tokens with - top_p probability mass. So 0.1 means only the tokens comprising the - top 10% probability mass are considered. - - - We generally recommend altering this or `temperature` but not both. - user: + enum: + - list + description: The object type, which is always `list` + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/Invite' + first_id: + anyOf: + - type: string + - type: 'null' + description: The first `invite_id` in the retrieved `list` + last_id: + anyOf: + - type: string + - type: 'null' + description: The last `invite_id` in the retrieved `list` + has_more: + type: boolean + description: >- + The `has_more` property is used for pagination to indicate there are + additional results. + required: + - object + - data + - has_more + InviteProjectGroupBody: + type: object + description: Request payload for granting a group access to a project. + properties: + group_id: type: string - example: user-1234 - description: > - A unique identifier representing your end-user, which can help - OpenAI to monitor and detect abuse. [Learn - more](/docs/guides/safety-best-practices#end-user-ids). + description: Identifier of the group to add to the project. + role: + type: string + description: Identifier of the project role to grant to the group. required: - - model - - prompt - CreateCompletionResponse: + - group_id + - role + x-oaiMeta: + example: | + { + "group_id": "group_01J1F8ABCDXYZ", + "role": "role_01J1F8PROJ" + } + InviteRequest: type: object - description: > - Represents a completion response from the API. Note: both the streamed - and non-streamed response objects share the same shape (unlike the chat - endpoint). properties: - id: + email: type: string - description: A unique identifier for the completion. - choices: + description: Send an email to this address + role: + type: string + enum: + - reader + - owner + description: '`owner` or `reader`' + projects: type: array description: >- - The list of completion choices the model generated for the input - prompt. + An array of projects to which membership is granted at the same time + the org invite is accepted. If omitted, the user will be invited to + the default project for compatibility with legacy behavior. If empty + list is passed, the user will not be invited to any projects, + including the default one. items: type: object - required: - - finish_reason - - index - - logprobs - - text properties: - finish_reason: + id: type: string - description: > - The reason the model stopped generating tokens. This will be - `stop` if the model hit a natural stop point or a provided - stop sequence, - - `length` if the maximum number of tokens specified in the - request was reached, - - or `content_filter` if content was omitted due to a flag from - our content filters. - enum: - - stop - - length - - content_filter - index: - type: integer - logprobs: - anyOf: - - type: object - properties: - text_offset: - type: array - items: - type: integer - token_logprobs: - type: array - items: - type: number - tokens: - type: array - items: - type: string - top_logprobs: - type: array - items: - type: object - additionalProperties: - type: number - - type: 'null' - text: + description: Project's public ID + role: type: string - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the completion was created. - model: + enum: + - member + - owner + description: Project membership role + required: + - id + - role + required: + - email + - role + Item: + type: object + description: | + Content item used to generate a response. + oneOf: + - $ref: '#/components/schemas/InputMessage' + - $ref: '#/components/schemas/OutputMessage' + - $ref: '#/components/schemas/FileSearchToolCall' + - $ref: '#/components/schemas/ComputerToolCall' + - $ref: '#/components/schemas/ComputerCallOutputItemParam' + - $ref: '#/components/schemas/WebSearchToolCall' + - $ref: '#/components/schemas/FunctionToolCall' + - $ref: '#/components/schemas/FunctionCallOutputItemParam' + - $ref: '#/components/schemas/ToolSearchCallItemParam' + - $ref: '#/components/schemas/ToolSearchOutputItemParam' + - $ref: '#/components/schemas/AdditionalToolsItemParam' + - $ref: '#/components/schemas/ReasoningItem' + - $ref: '#/components/schemas/CompactionSummaryItemParam' + - $ref: '#/components/schemas/ImageGenToolCall' + - $ref: '#/components/schemas/CodeInterpreterToolCall' + - $ref: '#/components/schemas/LocalShellToolCall' + - $ref: '#/components/schemas/LocalShellToolCallOutput' + - $ref: '#/components/schemas/FunctionShellCallItemParam' + - $ref: '#/components/schemas/FunctionShellCallOutputItemParam' + - $ref: '#/components/schemas/ApplyPatchToolCallItemParam' + - $ref: '#/components/schemas/ApplyPatchToolCallOutputItemParam' + - $ref: '#/components/schemas/MCPListTools' + - $ref: '#/components/schemas/MCPApprovalRequest' + - $ref: '#/components/schemas/MCPApprovalResponse' + - $ref: '#/components/schemas/MCPToolCall' + - $ref: '#/components/schemas/CustomToolCallOutput' + - $ref: '#/components/schemas/CustomToolCall' + discriminator: + propertyName: type + ItemResource: + description: | + Content item used to generate a response. + oneOf: + - $ref: '#/components/schemas/InputMessageResource' + - $ref: '#/components/schemas/OutputMessage' + - $ref: '#/components/schemas/FileSearchToolCall' + - $ref: '#/components/schemas/ComputerToolCall' + - $ref: '#/components/schemas/ComputerToolCallOutputResource' + - $ref: '#/components/schemas/WebSearchToolCall' + - $ref: '#/components/schemas/FunctionToolCallResource' + - $ref: '#/components/schemas/FunctionToolCallOutputResource' + - $ref: '#/components/schemas/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $ref: '#/components/schemas/AdditionalTools' + - $ref: '#/components/schemas/ReasoningItem' + - $ref: '#/components/schemas/Program' + - $ref: '#/components/schemas/ProgramOutput' + - $ref: '#/components/schemas/CompactionBody' + - $ref: '#/components/schemas/ImageGenToolCall' + - $ref: '#/components/schemas/CodeInterpreterToolCall' + - $ref: '#/components/schemas/LocalShellToolCall' + - $ref: '#/components/schemas/LocalShellToolCallOutput' + - $ref: '#/components/schemas/FunctionShellCall' + - $ref: '#/components/schemas/FunctionShellCallOutput' + - $ref: '#/components/schemas/ApplyPatchToolCall' + - $ref: '#/components/schemas/ApplyPatchToolCallOutput' + - $ref: '#/components/schemas/MCPListTools' + - $ref: '#/components/schemas/MCPApprovalRequest' + - $ref: '#/components/schemas/MCPApprovalResponseResource' + - $ref: '#/components/schemas/MCPToolCall' + - $ref: '#/components/schemas/CustomToolCallResource' + - $ref: '#/components/schemas/CustomToolCallOutputResource' + discriminator: + propertyName: type + ListAssistantsResponse: + type: object + properties: + object: type: string - description: The model used for completion. - system_fingerprint: + example: list + data: + type: array + items: + $ref: '#/components/schemas/AssistantObject' + first_id: type: string - description: > - This fingerprint represents the backend configuration that the model - runs with. - - - Can be used in conjunction with the `seed` request parameter to - understand when backend changes have been made that might impact - determinism. - object: + example: asst_abc123 + last_id: type: string - description: The object type, which is always "text_completion" - enum: - - text_completion - x-stainless-const: true - usage: - $ref: '#/components/schemas/CompletionUsage' + example: asst_abc456 + has_more: + type: boolean + example: false required: - - id - object - - created - - model - - choices + - data + - first_id + - last_id + - has_more x-oaiMeta: - name: The completion object - legacy: true + name: List assistants response object + group: chat example: | { - "id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7", - "object": "text_completion", - "created": 1589478378, - "model": "gpt-4-turbo", - "choices": [ + "object": "list", + "data": [ { - "text": "\n\nThis is indeed a test", - "index": 0, - "logprobs": null, - "finish_reason": "length" + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-4o", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-4o", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" } ], - "usage": { - "prompt_tokens": 5, - "completion_tokens": 7, - "total_tokens": 12 - } + "first_id": "asst_abc123", + "last_id": "asst_abc789", + "has_more": false } - CreateContainerBody: + ListAuditLogsResponse: type: object properties: - name: + object: type: string - description: Name of the container to create. - file_ids: + enum: + - list + x-stainless-const: true + data: type: array - description: IDs of files to copy to the container. items: - type: string - expires_after: - type: object - description: Container expiration time in seconds relative to the 'anchor' time. - properties: - anchor: - type: string - enum: - - last_active_at - description: >- - Time anchor for the expiration time. Currently only - 'last_active_at' is supported. - minutes: - type: integer - required: - - anchor - - minutes - skills: + $ref: '#/components/schemas/AuditLog' + first_id: + anyOf: + - type: string + - type: 'null' + example: audit_log-defb456h8dks + last_id: + anyOf: + - type: string + - type: 'null' + example: audit_log-hnbkd8s93s + has_more: + type: boolean + required: + - object + - data + - has_more + ListBatchesResponse: + type: object + properties: + data: type: array - description: An optional list of skills referenced by id or inline data. items: - oneOf: - - $ref: '#/components/schemas/SkillReferenceParam' - - $ref: '#/components/schemas/InlineSkillParam' - discriminator: - propertyName: type - memory_limit: + $ref: '#/components/schemas/Batch' + first_id: + type: string + example: batch_abc123 + last_id: + type: string + example: batch_abc456 + has_more: + type: boolean + object: type: string enum: - - 1g - - 4g - - 16g - - 64g - description: Optional memory limit for the container. Defaults to "1g". - network_policy: - description: Network access policy for the container. - oneOf: - - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' - - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' - discriminator: - propertyName: type + - list + x-stainless-const: true + required: + - object + - data + - has_more + ListCertificatesResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/OrganizationCertificate' + first_id: + anyOf: + - type: string + - type: 'null' + example: cert_abc + last_id: + anyOf: + - type: string + - type: 'null' + example: cert_abc + has_more: + type: boolean + object: + type: string + enum: + - list + x-stainless-const: true required: - - name - CreateContainerFileBody: + - object + - data + - has_more + - first_id + - last_id + ListFilesResponse: type: object properties: - file_id: + object: type: string - description: Name of the file to create. - file: - description: | - The File object (not file name) to be uploaded. + example: list + data: + type: array + items: + $ref: '#/components/schemas/OpenAIFile' + first_id: type: string - format: binary - required: [] - CreateEmbeddingRequest: + example: file-abc123 + last_id: + type: string + example: file-abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListFineTuningCheckpointPermissionResponse: type: object - additionalProperties: false properties: - input: - description: > - Input text to embed, encoded as a string or array of tokens. To - embed multiple inputs in a single request, pass an array of strings - or array of token arrays. The input must not exceed the max input - tokens for the model (8192 tokens for all embedding models), cannot - be an empty string, and any array must be 2048 dimensions or less. - [Example Python - code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - for counting tokens. In addition to the per-input token limit, all - embedding models enforce a maximum of 300,000 tokens summed across - all inputs in a single request. - example: The quick brown fox jumped over the lazy dog - oneOf: - - type: string - title: string - description: The string that will be turned into an embedding. - default: '' - example: This is a test. - - type: array - title: array - description: The array of strings that will be turned into an embedding. - minItems: 1 - maxItems: 2048 - items: - type: string - default: '' - example: '[''This is a test.'']' - - type: array - title: array - description: The array of integers that will be turned into an embedding. - minItems: 1 - maxItems: 2048 - items: - type: integer - example: '[1212, 318, 257, 1332, 13]' - - type: array - title: array - description: >- - The array of arrays containing integers that will be turned into - an embedding. - minItems: 1 - maxItems: 2048 - items: - type: array - minItems: 1 - items: - type: integer - example: '[[1212, 318, 257, 1332, 13]]' - model: - description: > - ID of the model to use. You can use the [List - models](/docs/api-reference/models/list) API to see all of your - available models, or see our [Model overview](/docs/models) for - descriptions of them. - example: text-embedding-3-small + data: + type: array + items: + $ref: '#/components/schemas/FineTuningCheckpointPermission' + object: + type: string + enum: + - list + x-stainless-const: true + first_id: anyOf: - type: string + - type: 'null' + last_id: + anyOf: - type: string - enum: - - text-embedding-ada-002 - - text-embedding-3-small - - text-embedding-3-large - x-oaiTypeLabel: string - encoding_format: - description: >- - The format to return the embeddings in. Can be either `float` or - [`base64`](https://pypi.org/project/pybase64/). - example: float - default: float - type: string - enum: - - float - - base64 - dimensions: - description: > - The number of dimensions the resulting output embeddings should - have. Only supported in `text-embedding-3` and later models. - type: integer - minimum: 1 - user: - type: string - example: user-1234 - description: > - A unique identifier representing your end-user, which can help - OpenAI to monitor and detect abuse. [Learn - more](/docs/guides/safety-best-practices#end-user-ids). + - type: 'null' + has_more: + type: boolean required: - - model - - input - CreateEmbeddingResponse: + - object + - data + - has_more + ListFineTuningJobCheckpointsResponse: type: object properties: data: type: array - description: The list of embeddings generated by the model. items: - $ref: '#/components/schemas/Embedding' - model: - type: string - description: The name of the model used to generate the embedding. + $ref: '#/components/schemas/FineTuningJobCheckpoint' object: type: string - description: The object type, which is always "list". enum: - list x-stainless-const: true - usage: - type: object - description: The usage information for the request. - properties: - prompt_tokens: - type: integer - description: The number of tokens used by the prompt. - total_tokens: - type: integer - description: The total number of tokens used by the request. - required: - - prompt_tokens - - total_tokens + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean required: - object - - model - data - - usage - CreateEvalCompletionsRunDataSource: + - has_more + ListFineTuningJobEventsResponse: type: object - title: CompletionsRunDataSource - description: > - A CompletionsRunDataSource object describing a model sampling - configuration. properties: - type: + data: + type: array + items: + $ref: '#/components/schemas/FineTuningJobEvent' + object: type: string enum: - - completions - default: completions - description: The type of run data source. Always `completions`. - input_messages: - description: >- - Used when sampling from a model. Dictates the structure of the - messages passed into the model. Can either be a reference to a - prebuilt trajectory (ie, `item.input_trajectory`), or a template - with variable references to the `item` namespace. - oneOf: - - type: object - title: TemplateInputMessages - properties: - type: - type: string - enum: - - template - description: The type of input messages. Always `template`. - template: - type: array - description: >- - A list of chat messages forming the prompt or context. May - include variable references to the `item` namespace, ie - {{item.name}}. - items: - oneOf: - - $ref: '#/components/schemas/EasyInputMessage' - - $ref: '#/components/schemas/EvalItem' - required: - - type - - template - - type: object - title: ItemReferenceInputMessages - properties: - type: - type: string - enum: - - item_reference - description: The type of input messages. Always `item_reference`. - item_reference: - type: string - description: >- - A reference to a variable in the `item` namespace. Ie, - "item.input_trajectory" - required: - - type - - item_reference - sampling_params: - type: object - properties: - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - temperature: - type: number - description: A higher temperature increases randomness in the outputs. - default: 1 - max_completion_tokens: - type: integer - description: The maximum number of tokens in the generated output. - top_p: - type: number - description: >- - An alternative to temperature for nucleus sampling; 1.0 includes - all tokens. - default: 1 - seed: - type: integer - description: A seed value to initialize the randomness, during sampling. - default: 42 - response_format: - description: > - An object specifying the format that the model must output. - - - Setting to `{ "type": "json_schema", "json_schema": {...} }` - enables - - Structured Outputs which ensures the model will match your - supplied JSON - - schema. Learn more in the [Structured Outputs - - guide](/docs/guides/structured-outputs). - - - Setting to `{ "type": "json_object" }` enables the older JSON - mode, which - - ensures the message the model generates is valid JSON. Using - `json_schema` - - is preferred for models that support it. - oneOf: - - $ref: '#/components/schemas/ResponseFormatText' - - $ref: '#/components/schemas/ResponseFormatJsonSchema' - - $ref: '#/components/schemas/ResponseFormatJsonObject' - tools: - type: array - description: > - A list of tools the model may call. Currently, only functions - are supported as a tool. Use this to provide a list of functions - the model may generate JSON inputs for. A max of 128 functions - are supported. - items: - $ref: '#/components/schemas/ChatCompletionTool' - model: + - list + x-stainless-const: true + has_more: + type: boolean + required: + - object + - data + - has_more + ListMessagesResponse: + properties: + object: type: string - description: >- - The name of the model to use for generating completions (e.g. - "o3-mini"). - source: - description: >- - Determines what populates the `item` namespace in this run's data - source. - oneOf: - - $ref: '#/components/schemas/EvalJsonlFileContentSource' - - $ref: '#/components/schemas/EvalJsonlFileIdSource' - - $ref: '#/components/schemas/EvalStoredCompletionsSource' + example: list + data: + type: array + items: + $ref: '#/components/schemas/MessageObject' + first_id: + type: string + example: msg_abc123 + last_id: + type: string + example: msg_abc123 + has_more: + type: boolean + example: false required: - - type - - source - x-oaiMeta: - name: The completions data source object used to configure an individual run - group: eval runs - example: | - { - "name": "gpt-4o-mini-2024-07-18", - "data_source": { - "type": "completions", - "input_messages": { - "type": "item_reference", - "item_reference": "item.input" - }, - "model": "gpt-4o-mini-2024-07-18", - "source": { - "type": "stored_completions", - "model": "gpt-4o-mini-2024-07-18" - } - } - } - CreateEvalCustomDataSourceConfig: + - object + - data + - first_id + - last_id + - has_more + ListModelsResponse: type: object - title: CustomDataSourceConfig - description: > - A CustomDataSourceConfig object that defines the schema for the data - source used for the evaluation runs. - - This schema is used to define the shape of the data that will be: - - - Used to define your testing criteria and - - - What data is required when creating a run properties: - type: + object: type: string enum: - - custom - default: custom - description: The type of data source. Always `custom`. + - list x-stainless-const: true - item_schema: - type: object - description: The json schema for each row in the data source. - additionalProperties: true - example: | - { - "type": "object", - "properties": { - "name": {"type": "string"}, - "age": {"type": "integer"} - }, - "required": ["name", "age"] - } - include_sample_schema: - type: boolean - default: false - description: >- - Whether the eval should expect you to populate the sample namespace - (ie, by generating responses off of your data source) + data: + type: array + items: + $ref: '#/components/schemas/Model' required: - - item_schema - - type - x-oaiMeta: - name: The eval file data source config object - group: evals - example: | - { - "type": "custom", - "item_schema": { - "type": "object", - "properties": { - "name": {"type": "string"}, - "age": {"type": "integer"} - }, - "required": ["name", "age"] - }, - "include_sample_schema": true - } - CreateEvalItem: - title: CreateEvalItem - description: >- - A chat message that makes up the prompt or context. May include variable - references to the `item` namespace, ie {{item.name}}. - type: object - oneOf: - - type: object - title: SimpleInputMessage - properties: - role: - type: string - description: The role of the message (e.g. "system", "assistant", "user"). - content: - type: string - description: The content of the message. - required: - - role - - content - - $ref: '#/components/schemas/EvalItem' - x-oaiMeta: - name: The chat message object used to configure an individual run - CreateEvalJsonlRunDataSource: + - object + - data + ListPaginatedFineTuningJobsResponse: type: object - title: JsonlRunDataSource - description: > - A JsonlRunDataSource object with that specifies a JSONL file that - matches the eval properties: - type: + data: + type: array + items: + $ref: '#/components/schemas/FineTuningJob' + has_more: + type: boolean + object: type: string enum: - - jsonl - default: jsonl - description: The type of data source. Always `jsonl`. + - list x-stainless-const: true - source: - description: Determines what populates the `item` namespace in the data source. - oneOf: - - $ref: '#/components/schemas/EvalJsonlFileContentSource' - - $ref: '#/components/schemas/EvalJsonlFileIdSource' required: - - type - - source - x-oaiMeta: - name: The file data source object for the eval run configuration - group: evals - example: | - { - "type": "jsonl", - "source": { - "type": "file_id", - "id": "file-9GYS6xbkWgWhmE7VoLUWFg" - } - } - CreateEvalLabelModelGrader: + - object + - data + - has_more + ListProjectCertificatesResponse: type: object - title: LabelModelGrader - description: > - A LabelModelGrader object which uses a model to assign labels to each - item - - in the evaluation. properties: - type: - description: The object type, which is always `label_model`. + data: + type: array + items: + $ref: '#/components/schemas/OrganizationProjectCertificate' + first_id: + anyOf: + - type: string + - type: 'null' + example: cert_abc + last_id: + anyOf: + - type: string + - type: 'null' + example: cert_abc + has_more: + type: boolean + object: type: string enum: - - label_model + - list x-stainless-const: true - name: + required: + - object + - data + - has_more + - first_id + - last_id + ListRunStepsResponse: + properties: + object: type: string - description: The name of the grader. - model: + example: list + data: + type: array + items: + $ref: '#/components/schemas/RunStepObject' + first_id: type: string - description: >- - The model to use for the evaluation. Must support structured - outputs. - input: + example: step_abc123 + last_id: + type: string + example: step_abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListRunsResponse: + type: object + properties: + object: + type: string + example: list + data: type: array - description: >- - A list of chat messages forming the prompt or context. May include - variable references to the `item` namespace, ie {{item.name}}. items: - $ref: '#/components/schemas/CreateEvalItem' - labels: + $ref: '#/components/schemas/RunObject' + first_id: + type: string + example: run_abc123 + last_id: + type: string + example: run_abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListVectorStoreFilesResponse: + properties: + object: + type: string + example: list + data: type: array items: - type: string - description: The labels to classify to each item in the evaluation. - passing_labels: + $ref: '#/components/schemas/VectorStoreFileObject' + first_id: + type: string + example: file-abc123 + last_id: + type: string + example: file-abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListVectorStoresResponse: + properties: + object: + type: string + example: list + data: type: array items: - type: string - description: >- - The labels that indicate a passing result. Must be a subset of - labels. + $ref: '#/components/schemas/VectorStoreObject' + first_id: + type: string + example: vs_abc123 + last_id: + type: string + example: vs_abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + LocalShellToolCall: + type: object + title: Local shell call + description: | + A tool call to run a command on the local shell. + properties: + type: + type: string + enum: + - local_shell_call + description: | + The type of the local shell call. Always `local_shell_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the local shell call. + call_id: + type: string + description: | + The unique ID of the local shell tool call generated by the model. + action: + $ref: '#/components/schemas/LocalShellExecAction' + status: + type: string + enum: + - in_progress + - completed + - incomplete + description: | + The status of the local shell call. required: - type - - model - - input - - passing_labels - - labels - - name - x-oaiMeta: - name: The eval label model grader object - group: evals - example: | - { - "type": "label_model", - "model": "gpt-4o-2024-08-06", - "input": [ - { - "role": "system", - "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" - }, - { - "role": "user", - "content": "Statement: {{item.response}}" - } - ], - "passing_labels": ["positive"], - "labels": ["positive", "neutral", "negative"], - "name": "Sentiment label grader" - } - CreateEvalLogsDataSourceConfig: + - id + - call_id + - action + - status + LocalShellToolCallOutput: type: object - title: LogsDataSourceConfig - description: > - A data source config which specifies the metadata property of your logs - query. - - This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, - etc. + title: Local shell call output + description: | + The output of a local shell tool call. properties: type: type: string enum: - - logs - default: logs - description: The type of data source. Always `logs`. + - local_shell_call_output + description: > + The type of the local shell tool call output. Always + `local_shell_call_output`. x-stainless-const: true - metadata: - type: object - description: Metadata filters for the logs data source. - additionalProperties: true - example: | - { - "use_case": "customer_support_agent" - } + id: + type: string + description: | + The unique ID of the local shell tool call generated by the model. + output: + type: string + description: | + A JSON string of the output of the local shell tool call. + status: + anyOf: + - type: string + enum: + - in_progress + - completed + - incomplete + description: > + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. + - type: 'null' required: + - id - type - x-oaiMeta: - name: The logs data source object for evals - group: evals - example: | - { - "type": "logs", - "metadata": { - "use_case": "customer_support_agent" - } - } - CreateEvalRequest: + - call_id + - output + LogProbProperties: type: object - title: CreateEvalRequest + description: | + A log probability object. properties: - name: + token: type: string - description: The name of the evaluation. - metadata: - $ref: '#/components/schemas/Metadata' - data_source_config: - type: object - description: >- - The configuration for the data source used for the evaluation runs. - Dictates the schema of the data used in the evaluation. - oneOf: - - $ref: '#/components/schemas/CreateEvalCustomDataSourceConfig' - - $ref: '#/components/schemas/CreateEvalLogsDataSourceConfig' - - $ref: '#/components/schemas/CreateEvalStoredCompletionsDataSourceConfig' - testing_criteria: + description: | + The token that was used to generate the log probability. + logprob: + type: number + description: | + The log probability of the token. + bytes: type: array - description: >- - A list of graders for all eval runs in this group. Graders can - reference variables in the data source using double curly braces - notation, like `{{item.variable_name}}`. To reference the model's - output, use the `sample` namespace (ie, `{{sample.output_text}}`). items: - oneOf: - - $ref: '#/components/schemas/CreateEvalLabelModelGrader' - - $ref: '#/components/schemas/EvalGraderStringCheck' - - $ref: '#/components/schemas/EvalGraderTextSimilarity' - - $ref: '#/components/schemas/EvalGraderPython' - - $ref: '#/components/schemas/EvalGraderScoreModel' + type: integer + description: | + The bytes that were used to generate the log probability. required: - - data_source_config - - testing_criteria - CreateEvalResponsesRunDataSource: + - token + - logprob + - bytes + MCPApprovalRequest: type: object - title: ResponsesRunDataSource - description: > - A ResponsesRunDataSource object describing a model sampling - configuration. + title: MCP approval request + description: | + A request for human approval of a tool invocation. properties: type: type: string enum: - - responses - default: responses - description: The type of run data source. Always `responses`. - input_messages: - description: >- - Used when sampling from a model. Dictates the structure of the - messages passed into the model. Can either be a reference to a - prebuilt trajectory (ie, `item.input_trajectory`), or a template - with variable references to the `item` namespace. - oneOf: - - type: object - title: InputMessagesTemplate - properties: - type: - type: string - enum: - - template - description: The type of input messages. Always `template`. - template: - type: array - description: >- - A list of chat messages forming the prompt or context. May - include variable references to the `item` namespace, ie - {{item.name}}. - items: - oneOf: - - type: object - title: ChatMessage - properties: - role: - type: string - description: >- - The role of the message (e.g. "system", - "assistant", "user"). - content: - type: string - description: The content of the message. - required: - - role - - content - - $ref: '#/components/schemas/EvalItem' - required: - - type - - template - - type: object - title: InputMessagesItemReference - properties: - type: - type: string - enum: - - item_reference - description: The type of input messages. Always `item_reference`. - item_reference: - type: string - description: >- - A reference to a variable in the `item` namespace. Ie, - "item.name" - required: - - type - - item_reference - sampling_params: - type: object - properties: - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - temperature: - type: number - description: A higher temperature increases randomness in the outputs. - default: 1 - max_completion_tokens: - type: integer - description: The maximum number of tokens in the generated output. - top_p: - type: number - description: >- - An alternative to temperature for nucleus sampling; 1.0 includes - all tokens. - default: 1 - seed: - type: integer - description: A seed value to initialize the randomness, during sampling. - default: 42 - tools: - type: array - description: > - An array of tools the model may call while generating a - response. You - - can specify which tool to use by setting the `tool_choice` - parameter. - - - The two categories of tools you can provide the model are: - - - - **Built-in tools**: Tools that are provided by OpenAI that - extend the - model's capabilities, like [web search](/docs/guides/tools-web-search) - or [file search](/docs/guides/tools-file-search). Learn more about - [built-in tools](/docs/guides/tools). - - **Function calls (custom tools)**: Functions that are defined - by you, - enabling the model to call your own code. Learn more about - [function calling](/docs/guides/function-calling). - items: - $ref: '#/components/schemas/Tool' - text: - type: object - description: > - Configuration options for a text response from the model. Can be - plain - - text or structured JSON data. Learn more: - - - [Text inputs and outputs](/docs/guides/text) - - - [Structured Outputs](/docs/guides/structured-outputs) - properties: - format: - $ref: '#/components/schemas/TextResponseFormatConfiguration' - model: + - mcp_approval_request + description: | + The type of the item. Always `mcp_approval_request`. + x-stainless-const: true + id: type: string - description: >- - The name of the model to use for generating completions (e.g. - "o3-mini"). - source: - description: >- - Determines what populates the `item` namespace in this run's data - source. - oneOf: - - $ref: '#/components/schemas/EvalJsonlFileContentSource' - - $ref: '#/components/schemas/EvalJsonlFileIdSource' - - $ref: '#/components/schemas/EvalResponsesSource' + description: | + The unique ID of the approval request. + server_label: + type: string + description: | + The label of the MCP server making the request. + name: + type: string + description: | + The name of the tool to run. + arguments: + type: string + description: | + A JSON string of arguments for the tool. required: - type - - source - x-oaiMeta: - name: The completions data source object used to configure an individual run - group: eval runs - example: | - { - "name": "gpt-4o-mini-2024-07-18", - "data_source": { - "type": "responses", - "input_messages": { - "type": "item_reference", - "item_reference": "item.input" - }, - "model": "gpt-4o-mini-2024-07-18", - "source": { - "type": "responses", - "model": "gpt-4o-mini-2024-07-18" - } - } - } - CreateEvalRunRequest: + - id + - server_label + - name + - arguments + MCPApprovalResponse: type: object - title: CreateEvalRunRequest + title: MCP approval response + description: | + A response to an MCP approval request. properties: - name: + type: type: string - description: The name of the run. - metadata: - $ref: '#/components/schemas/Metadata' - data_source: - type: object - description: Details about the run's data source. - oneOf: - - $ref: '#/components/schemas/CreateEvalJsonlRunDataSource' - - $ref: '#/components/schemas/CreateEvalCompletionsRunDataSource' - - $ref: '#/components/schemas/CreateEvalResponsesRunDataSource' + enum: + - mcp_approval_response + description: | + The type of the item. Always `mcp_approval_response`. + x-stainless-const: true + id: + anyOf: + - type: string + description: | + The unique ID of the approval response + - type: 'null' + approval_request_id: + type: string + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + anyOf: + - type: string + description: | + Optional reason for the decision. + - type: 'null' required: - - data_source - CreateEvalStoredCompletionsDataSourceConfig: + - type + - request_id + - approve + - approval_request_id + MCPApprovalResponseResource: type: object - title: StoredCompletionsDataSourceConfig + title: MCP approval response description: | - Deprecated in favor of LogsDataSourceConfig. + A response to an MCP approval request. properties: type: type: string enum: - - stored_completions - default: stored_completions - description: The type of data source. Always `stored_completions`. + - mcp_approval_response + description: | + The type of the item. Always `mcp_approval_response`. x-stainless-const: true - metadata: - type: object - description: Metadata filters for the stored completions data source. - additionalProperties: true - example: | - { - "use_case": "customer_support_agent" - } + id: + type: string + description: | + The unique ID of the approval response + approval_request_id: + type: string + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + anyOf: + - type: string + description: | + Optional reason for the decision. + - type: 'null' required: - type - deprecated: true - x-oaiMeta: - name: The stored completions data source object for evals - group: evals - example: | - { - "type": "stored_completions", - "metadata": { - "use_case": "customer_support_agent" - } - } - CreateFileRequest: + - id + - request_id + - approve + - approval_request_id + MCPListTools: type: object - additionalProperties: false + title: MCP list tools + description: | + A list of tools available on an MCP server. properties: - file: + type: + type: string + enum: + - mcp_list_tools description: | - The File object (not file name) to be uploaded. + The type of the item. Always `mcp_list_tools`. + x-stainless-const: true + id: type: string - format: binary - purpose: description: | - The intended purpose of the uploaded file. One of: - - `assistants`: Used in the Assistants API - - `batch`: Used in the Batch API - - `fine-tune`: Used for fine-tuning - - `vision`: Images used for vision fine-tuning - - `user_data`: Flexible file type for any purpose - - `evals`: Used for eval data sets + The unique ID of the list. + server_label: type: string - enum: - - assistants - - batch - - fine-tune - - vision - - user_data - - evals - expires_after: - $ref: '#/components/schemas/FileExpirationAfter' - required: - - file - - purpose - CreateFineTuningCheckpointPermissionRequest: - type: object - additionalProperties: false - properties: - project_ids: + description: | + The label of the MCP server. + tools: type: array - description: The project identifiers to grant access to. items: - type: string + $ref: '#/components/schemas/MCPListToolsTool' + description: | + The tools available on the server. + error: + anyOf: + - type: string + description: | + Error message if the server could not list tools. + - type: 'null' required: - - project_ids - CreateFineTuningJobRequest: + - type + - id + - server_label + - tools + MCPListToolsTool: type: object + title: MCP list tools tool + description: | + A tool available on an MCP server. properties: - model: - description: > - The name of the model to fine-tune. You can select one of the - - [supported - models](/docs/guides/fine-tuning#which-models-can-be-fine-tuned). - example: gpt-4o-mini + name: + type: string + description: | + The name of the tool. + description: anyOf: - type: string - - type: string - enum: - - babbage-002 - - davinci-002 - - gpt-3.5-turbo - - gpt-4o-mini - x-oaiTypeLabel: string - training_file: - description: > - The ID of an uploaded file that contains training data. - - - See [upload file](/docs/api-reference/files/create) for how to - upload a file. - - - Your dataset must be formatted as a JSONL file. Additionally, you - must upload your file with the purpose `fine-tune`. - - - The contents of the file should differ depending on if the model - uses the [chat](/docs/api-reference/fine-tuning/chat-input), - [completions](/docs/api-reference/fine-tuning/completions-input) - format, or if the fine-tuning method uses the - [preference](/docs/api-reference/fine-tuning/preference-input) - format. - - - See the [fine-tuning guide](/docs/guides/model-optimization) for - more details. - type: string - example: file-abc123 - hyperparameters: + description: | + The description of the tool. + - type: 'null' + input_schema: type: object - description: > - The hyperparameters used for the fine-tuning job. - - This value is now deprecated in favor of `method`, and should be - passed in under the `method` parameter. - properties: - batch_size: - description: > - Number of examples in each batch. A larger batch size means that - model parameters - - are updated less frequently, but with lower variance. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 256 - default: auto - learning_rate_multiplier: - description: > - Scaling factor for the learning rate. A smaller learning rate - may be useful to avoid - - overfitting. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0 - exclusiveMinimum: true - default: auto - n_epochs: - description: > - The number of epochs to train the model for. An epoch refers to - one full cycle - - through the training dataset. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 50 - default: auto - deprecated: true - suffix: - description: > - A string of up to 64 characters that will be added to your - fine-tuned model name. - + description: | + The JSON schema describing the tool's input. + annotations: + anyOf: + - type: object + description: | + Additional annotations about the tool. + - type: 'null' + required: + - name + - input_schema + MCPTool: + type: object + title: MCP tool + description: > + Give the model access to additional tools via remote Model Context + Protocol - For example, a `suffix` of "custom-model-name" would produce a model - name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. + (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). + properties: + type: type: string - minLength: 1 - maxLength: 64 - default: null - nullable: true - validation_file: + enum: + - mcp + description: The type of the MCP tool. Always `mcp`. + x-stainless-const: true + server_label: + type: string + description: | + A label for this MCP server, used to identify it in tool calls. + server_url: + type: string + format: uri + description: | + The URL for the MCP server. One of `server_url`, `connector_id`, or + `tunnel_id` must be provided. + connector_id: + type: string + enum: + - connector_dropbox + - connector_gmail + - connector_googlecalendar + - connector_googledrive + - connector_microsoftteams + - connector_outlookcalendar + - connector_outlookemail + - connector_sharepoint description: > - The ID of an uploaded file that contains validation data. + Identifier for service connectors, like those available in ChatGPT. + One of + `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn + more - If you provide this file, the data is used to generate validation + about service connectors + [here](/docs/guides/tools-remote-mcp#connectors). - metrics periodically during fine-tuning. These metrics can be viewed - in - the fine-tuning results file. + Currently supported `connector_id` values are: - The same data should not be present in both train and validation - files. + - Dropbox: `connector_dropbox` - Your dataset must be formatted as a JSONL file. You must upload your - file with the purpose `fine-tune`. + - Gmail: `connector_gmail` + - Google Calendar: `connector_googlecalendar` - See the [fine-tuning guide](/docs/guides/model-optimization) for - more details. - type: string - nullable: true - example: file-abc123 - integrations: - type: array - description: A list of integrations to enable for your fine-tuning job. - nullable: true - items: - type: object - required: - - type - - wandb - properties: - type: - description: > - The type of integration to enable. Currently, only "wandb" - (Weights and Biases) is supported. - oneOf: - - type: string - enum: - - wandb - x-stainless-const: true - wandb: - type: object - description: > - The settings for your integration with Weights and Biases. - This payload specifies the project that + - Google Drive: `connector_googledrive` - metrics will be sent to. Optionally, you can set an explicit - display name for your run, add tags + - Microsoft Teams: `connector_microsoftteams` - to your run, and set a default entity (team, username, etc) to - be associated with your run. - required: - - project - properties: - project: - description: > - The name of the project that the new run will be created - under. - type: string - example: my-wandb-project - name: - description: > - A display name to set for the run. If not set, we will use - the Job ID as the name. - nullable: true - type: string - entity: - description: > - The entity to use for the run. This allows you to set the - team or username of the WandB user that you would + - Outlook Calendar: `connector_outlookcalendar` - like associated with the run. If not set, the default - entity for the registered WandB API key is used. - nullable: true - type: string - tags: - description: > - A list of tags to be attached to the newly created run. - These tags are passed through directly to WandB. Some + - Outlook Email: `connector_outlookemail` - default tags are generated by OpenAI: "openai/finetune", - "openai/{base-model}", "openai/{ftjob-abcdef}". - type: array - items: - type: string - example: custom-tag - seed: + - SharePoint: `connector_sharepoint` + tunnel_id: + type: string + pattern: ^tunnel_[a-z0-9]{32}$ description: > - The seed controls the reproducibility of the job. Passing in the - same seed and job parameters should produce the same results, but - may differ in rare cases. + The Secure MCP Tunnel ID to use instead of a direct server URL. One + of - If a seed is not specified, one will be generated for you. - type: integer - nullable: true - minimum: 0 - maximum: 2147483647 - example: 42 - method: - $ref: '#/components/schemas/FineTuneMethod' - metadata: - $ref: '#/components/schemas/Metadata' - required: - - model - - training_file - CreateGroupBody: - type: object - description: Request payload for creating a new group in the organization. - properties: - name: - type: string - description: Human readable name for the group. - minLength: 1 - maxLength: 255 - required: - - name - x-oaiMeta: - example: | - { - "name": "Support Team" - } - CreateGroupUserBody: - type: object - description: Request payload for adding a user to a group. - properties: - user_id: + `server_url`, `connector_id`, or `tunnel_id` must be provided. + authorization: type: string - description: Identifier of the user to add to the group. - required: - - user_id - x-oaiMeta: - example: | - { - "user_id": "user_abc123" - } - CreateImageEditRequest: - type: object - properties: - image: - anyOf: - - type: string - format: binary - - type: array - maxItems: 16 - items: - type: string - format: binary description: > - The image(s) to edit. Must be a supported image file or an array of - images. - - - For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and - `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` - - file less than 50MB. You can provide up to 16 images. - - `chatgpt-image-latest` follows the same input constraints as GPT - image models. - + An OAuth access token that can be used with a remote MCP server, + either - For `dall-e-2`, you can only provide one image, and it should be a - square + with a custom MCP server URL or a service connector. Your + application - `png` file less than 4MB. - prompt: - description: >- - A text description of the desired image(s). The maximum length is - 1000 characters for `dall-e-2`, and 32000 characters for the GPT - image models. - type: string - example: A cute baby sea otter wearing a beret - mask: - description: >- - An additional image whose fully transparent areas (e.g. where alpha - is zero) indicate where `image` should be edited. If there are - multiple images provided, the mask will be applied on the first - image. Must be a valid PNG file, less than 4MB, and have the same - dimensions as `image`. - type: string - format: binary - background: + must handle the OAuth authorization flow and provide the token here. + server_description: type: string - enum: - - transparent - - opaque - - auto - default: auto - example: transparent - nullable: true description: > - Allows to set transparency for the background of the generated - image(s). - - This parameter is only supported for the GPT image models. Must be - one of + Optional description of the MCP server, used to provide more + context. + headers: + anyOf: + - type: object + additionalProperties: + type: string + description: > + Optional HTTP headers to send to the MCP server. Use for + authentication - `transparent`, `opaque` or `auto` (default value). When `auto` is - used, the + or other purposes. + - type: 'null' + allowed_tools: + anyOf: + - description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + - type: 'null' + allowed_callers: + anyOf: + - type: array + minItems: 1 + items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + description: The tool invocation context(s). + - type: 'null' + require_approval: + anyOf: + - description: Specify which of the MCP server's tools require approval. + oneOf: + - type: object + title: MCP tool approval filter + description: > + Specify which of the MCP server's tools require approval. + Can be - model will automatically determine the best background for the - image. + `always`, `never`, or a filter object associated with tools + that require approval. + properties: + always: + $ref: '#/components/schemas/MCPToolFilter' + never: + $ref: '#/components/schemas/MCPToolFilter' + additionalProperties: false + - type: string + title: MCP tool approval setting + description: > + Specify a single approval policy for all tools. One of + `always` or - If `transparent`, the output format needs to support transparency, - so it + `never`. When set to `always`, all tools will require + approval. When - should be set to either `png` (default value) or `webp`. - model: + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + - type: 'null' + defer_loading: + type: boolean + description: | + Whether this MCP tool is deferred and discovered via tool search. + required: + - type + - server_label + MCPToolCall: + type: object + title: MCP tool call + description: | + An invocation of a tool on an MCP server. + properties: + type: + type: string + enum: + - mcp_call + description: | + The type of the item. Always `mcp_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the tool call. + server_label: + type: string + description: | + The label of the MCP server running the tool. + name: + type: string + description: | + The name of the tool that was run. + arguments: + type: string + description: | + A JSON string of the arguments passed to the tool. + output: anyOf: - type: string - - type: string - enum: - - gpt-image-1.5 - - dall-e-2 - - gpt-image-1 - - gpt-image-1-mini - - chatgpt-image-latest - x-stainless-const: true - x-oaiTypeLabel: string - default: gpt-image-1.5 - example: gpt-image-1.5 - nullable: true - description: The model to use for image generation. Defaults to `gpt-image-1.5`. - 'n': - type: integer - minimum: 1 - maximum: 10 - default: 1 - example: 1 - nullable: true - description: The number of images to generate. Must be between 1 and 10. - size: + description: | + The output from the tool call. + - type: 'null' + error: anyOf: - type: string + description: | + The error from the tool call, if any. + - type: 'null' + status: + $ref: '#/components/schemas/MCPToolCallStatus' + description: > + The status of the tool call. One of `in_progress`, `completed`, + `incomplete`, `calling`, or `failed`. + approval_request_id: + anyOf: - type: string + description: > + Unique identifier for the MCP tool call approval request. + + Include this value in a subsequent `mcp_approval_response` input + to approve or reject the corresponding tool call. + - type: 'null' + required: + - type + - id + - server_label + - name + - arguments + MCPToolFilter: + type: object + title: MCP tool filter + description: | + A filter object to specify which tools are allowed. + properties: + tool_names: + type: array + title: MCP allowed tools + items: + type: string + description: List of allowed tool names. + read_only: + type: boolean + description: > + Indicates whether or not a tool modifies data or is read-only. If an + + MCP server is [annotated with + `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), + + it will match this filter. + required: [] + additionalProperties: false + MessageContentImageFileObject: + title: Image file + type: object + description: >- + References an image [File](/docs/api-reference/files) in the content of + a message. + properties: + type: + description: Always `image_file`. + type: string + enum: + - image_file + x-stainless-const: true + image_file: + type: object + properties: + file_id: + description: >- + The [File](/docs/api-reference/files) ID of the image in the + message content. Set `purpose="vision"` when uploading the File + if you need to later display the file content. + type: string + detail: + type: string + description: >- + Specifies the detail level of the image if specified by the + user. `low` uses fewer tokens, you can opt in to high resolution + using `high`. enum: - - 256x256 - - 512x512 - - 1024x1024 - - 1536x1024 - - 1024x1536 - auto - default: 1024x1024 - example: 1024x1024 - nullable: true - description: >- - The size of the generated images. For `gpt-image-2` and - `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as - `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height - must both be divisible by 16 and the requested aspect ratio must be - between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, - and the maximum supported resolution is `3840x2160`. The requested - size must also satisfy the model's current pixel and edge limits. - The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are - supported by the GPT image models; `auto` is supported for models - that allow automatic sizing. For `dall-e-2`, use one of `256x256`, - `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, - `1792x1024`, or `1024x1792`. - response_format: + - low + - high + default: auto + required: + - file_id + required: + - type + - image_file + MessageContentImageUrlObject: + title: Image URL + type: object + description: References an image URL in the content of a message. + properties: + type: type: string enum: + - image_url + description: The type of the content part. + x-stainless-const: true + image_url: + type: object + properties: + url: + type: string + description: >- + The external URL of the image, must be a supported image types: + jpeg, jpg, png, gif, webp. + format: uri + detail: + type: string + description: >- + Specifies the detail level of the image. `low` uses fewer + tokens, you can opt in to high resolution using `high`. Default + value is `auto` + enum: + - auto + - low + - high + default: auto + required: - url - - b64_json - example: url - nullable: true - description: >- - The format in which the generated images are returned. Must be one - of `url` or `b64_json`. URLs are only valid for 60 minutes after the - image has been generated. This parameter is only supported for - `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models - always return base64-encoded images. - output_format: + required: + - type + - image_url + MessageContentRefusalObject: + title: Refusal + type: object + description: The refusal content generated by the assistant. + properties: + type: + description: Always `refusal`. type: string enum: - - png - - jpeg - - webp - default: png - example: png - nullable: true - description: > - The format in which the generated images are returned. This - parameter is - - only supported for the GPT image models. Must be one of `png`, - `jpeg`, or `webp`. - - The default value is `png`. - output_compression: - type: integer - default: 100 - example: 100 - nullable: true - description: > - The compression level (0-100%) for the generated images. This - parameter - - is only supported for the GPT image models with the `webp` or `jpeg` - output - - formats, and defaults to 100. - user: + - refusal + x-stainless-const: true + refusal: type: string - example: user-1234 - description: > - A unique identifier representing your end-user, which can help - OpenAI to monitor and detect abuse. [Learn - more](/docs/guides/safety-best-practices#end-user-ids). - input_fidelity: - anyOf: - - $ref: '#/components/schemas/InputFidelity' - - type: 'null' - stream: - type: boolean - default: false - example: false - nullable: true - description: > - Edit the image in streaming mode. Defaults to `false`. See the - - [Image generation guide](/docs/guides/image-generation) for more - information. - partial_images: - $ref: '#/components/schemas/PartialImages' - quality: + required: + - type + - refusal + MessageContentTextAnnotationsFileCitationObject: + title: File citation + type: object + description: >- + A citation within the message that points to a specific quote from a + specific File associated with the assistant or the message. Generated + when the assistant uses the "file_search" tool to search files. + properties: + type: + description: Always `file_citation`. type: string enum: - - standard - - low - - medium - - high - - auto - default: auto - example: high - nullable: true - description: > - The quality of the image that will be generated for GPT image - models. Defaults to `auto`. + - file_citation + x-stainless-const: true + text: + description: The text in the message content that needs to be replaced. + type: string + file_citation: + type: object + properties: + file_id: + description: The ID of the specific File the citation is from. + type: string + required: + - file_id + start_index: + type: integer + minimum: 0 + end_index: + type: integer + minimum: 0 required: - - prompt - - image - CreateImageRequest: + - type + - text + - file_citation + - start_index + - end_index + MessageContentTextAnnotationsFilePathObject: + title: File path type: object + description: >- + A URL for the file that's generated when the assistant used the + `code_interpreter` tool to generate a file. properties: - prompt: - description: >- - A text description of the desired image(s). The maximum length is - 32000 characters for the GPT image models, 1000 characters for - `dall-e-2` and 4000 characters for `dall-e-3`. + type: + description: Always `file_path`. type: string - example: A cute baby sea otter - model: - anyOf: - - type: string - - type: string - enum: - - gpt-image-1.5 - - dall-e-2 - - dall-e-3 - - gpt-image-1 - - gpt-image-1-mini - x-oaiTypeLabel: string - default: dall-e-2 - example: gpt-image-1.5 - nullable: true - description: >- - The model to use for image generation. One of `dall-e-2`, - `dall-e-3`, or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, - `gpt-image-1.5`). Defaults to `dall-e-2` unless a parameter specific - to the GPT image models is used. - 'n': + enum: + - file_path + x-stainless-const: true + text: + description: The text in the message content that needs to be replaced. + type: string + file_path: + type: object + properties: + file_id: + description: The ID of the file that was generated. + type: string + required: + - file_id + start_index: type: integer - minimum: 1 - maximum: 10 - default: 1 - example: 1 - nullable: true - description: >- - The number of images to generate. Must be between 1 and 10. For - `dall-e-3`, only `n=1` is supported. - quality: + minimum: 0 + end_index: + type: integer + minimum: 0 + required: + - type + - text + - file_path + - start_index + - end_index + MessageContentTextObject: + title: Text + type: object + description: The text content that is part of a message. + properties: + type: + description: Always `text`. type: string enum: - - standard - - hd - - low - - medium - - high - - auto - default: auto - example: medium - nullable: true - description: > - The quality of the image that will be generated. - - - - `auto` (default value) will automatically select the best quality - for the given model. - - - `high`, `medium` and `low` are supported for the GPT image models. - - - `hd` and `standard` are supported for `dall-e-3`. - - - `standard` is the only option for `dall-e-2`. - response_format: + - text + x-stainless-const: true + text: + type: object + properties: + value: + description: The data that makes up the text. + type: string + annotations: + type: array + items: + oneOf: + - $ref: >- + #/components/schemas/MessageContentTextAnnotationsFileCitationObject + - $ref: >- + #/components/schemas/MessageContentTextAnnotationsFilePathObject + required: + - value + - annotations + required: + - type + - text + MessageDeltaContentImageFileObject: + title: Image file + type: object + description: >- + References an image [File](/docs/api-reference/files) in the content of + a message. + properties: + index: + type: integer + description: The index of the content part in the message. + type: + description: Always `image_file`. type: string enum: - - url - - b64_json - default: url - example: url - nullable: true - description: >- - The format in which generated images with `dall-e-2` and `dall-e-3` - are returned. Must be one of `url` or `b64_json`. URLs are only - valid for 60 minutes after the image has been generated. This - parameter isn't supported for the GPT image models, which always - return base64-encoded images. - output_format: + - image_file + x-stainless-const: true + image_file: + type: object + properties: + file_id: + description: >- + The [File](/docs/api-reference/files) ID of the image in the + message content. Set `purpose="vision"` when uploading the File + if you need to later display the file content. + type: string + detail: + type: string + description: >- + Specifies the detail level of the image if specified by the + user. `low` uses fewer tokens, you can opt in to high resolution + using `high`. + enum: + - auto + - low + - high + default: auto + required: + - index + - type + MessageDeltaContentImageUrlObject: + title: Image URL + type: object + description: References an image URL in the content of a message. + properties: + index: + type: integer + description: The index of the content part in the message. + type: + description: Always `image_url`. type: string enum: - - png - - jpeg - - webp - default: png - example: png - nullable: true - description: >- - The format in which the generated images are returned. This - parameter is only supported for the GPT image models. Must be one of - `png`, `jpeg`, or `webp`. - output_compression: - type: integer - default: 100 - example: 100 - nullable: true - description: >- - The compression level (0-100%) for the generated images. This - parameter is only supported for the GPT image models with the `webp` - or `jpeg` output formats, and defaults to 100. - stream: - type: boolean - default: false - example: false - nullable: true - description: > - Generate the image in streaming mode. Defaults to `false`. See the - - [Image generation guide](/docs/guides/image-generation) for more - information. - - This parameter is only supported for the GPT image models. - partial_images: - $ref: '#/components/schemas/PartialImages' - size: - anyOf: - - type: string - - type: string + - image_url + x-stainless-const: true + image_url: + type: object + properties: + url: + description: >- + The URL of the image, must be a supported image types: jpeg, + jpg, png, gif, webp. + type: string + format: uri + detail: + type: string + description: >- + Specifies the detail level of the image. `low` uses fewer + tokens, you can opt in to high resolution using `high`. enum: - auto - - 1024x1024 - - 1536x1024 - - 1024x1536 - - 256x256 - - 512x512 - - 1792x1024 - - 1024x1792 - default: auto - example: 1024x1024 - nullable: true - description: >- - The size of the generated images. For `gpt-image-2` and - `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as - `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height - must both be divisible by 16 and the requested aspect ratio must be - between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, - and the maximum supported resolution is `3840x2160`. The requested - size must also satisfy the model's current pixel and edge limits. - The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are - supported by the GPT image models; `auto` is supported for models - that allow automatic sizing. For `dall-e-2`, use one of `256x256`, - `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, - `1792x1024`, or `1024x1792`. - moderation: + - low + - high + default: auto + required: + - index + - type + MessageDeltaContentRefusalObject: + title: Refusal + type: object + description: The refusal content that is part of a message. + properties: + index: + type: integer + description: The index of the refusal part in the message. + type: + description: Always `refusal`. type: string enum: - - low - - auto - default: auto - example: low - nullable: true - description: >- - Control the content-moderation level for images generated by the GPT - image models. Must be either `low` for less restrictive filtering or - `auto` (default value). - background: + - refusal + x-stainless-const: true + refusal: type: string - enum: - - transparent - - opaque - - auto - default: auto - example: transparent - nullable: true - description: > - Allows to set transparency for the background of the generated - image(s). - - This parameter is only supported for the GPT image models. Must be - one of - - `transparent`, `opaque` or `auto` (default value). When `auto` is - used, the - - model will automatically determine the best background for the - image. - - - If `transparent`, the output format needs to support transparency, - so it - - should be set to either `png` (default value) or `webp`. - style: + required: + - index + - type + MessageDeltaContentTextAnnotationsFileCitationObject: + title: File citation + type: object + description: >- + A citation within the message that points to a specific quote from a + specific File associated with the assistant or the message. Generated + when the assistant uses the "file_search" tool to search files. + properties: + index: + type: integer + description: The index of the annotation in the text content part. + type: + description: Always `file_citation`. type: string enum: - - vivid - - natural - default: vivid - example: vivid - nullable: true - description: >- - The style of the generated images. This parameter is only supported - for `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes - the model to lean towards generating hyper-real and dramatic images. - Natural causes the model to produce more natural, less hyper-real - looking images. - user: + - file_citation + x-stainless-const: true + text: + description: The text in the message content that needs to be replaced. type: string - example: user-1234 - description: > - A unique identifier representing your end-user, which can help - OpenAI to monitor and detect abuse. [Learn - more](/docs/guides/safety-best-practices#end-user-ids). + file_citation: + type: object + properties: + file_id: + description: The ID of the specific File the citation is from. + type: string + quote: + description: The specific quote in the file. + type: string + start_index: + type: integer + minimum: 0 + end_index: + type: integer + minimum: 0 required: - - prompt - CreateImageVariationRequest: + - index + - type + MessageDeltaContentTextAnnotationsFilePathObject: + title: File path type: object + description: >- + A URL for the file that's generated when the assistant used the + `code_interpreter` tool to generate a file. properties: - image: - description: >- - The image to use as the basis for the variation(s). Must be a valid - PNG file, less than 4MB, and square. - type: string - format: binary - model: - anyOf: - - type: string - - type: string - enum: - - dall-e-2 - x-stainless-const: true - x-oaiTypeLabel: string - default: dall-e-2 - example: dall-e-2 - nullable: true - description: >- - The model to use for image generation. Only `dall-e-2` is supported - at this time. - 'n': + index: type: integer - minimum: 1 - maximum: 10 - default: 1 - example: 1 - nullable: true - description: The number of images to generate. Must be between 1 and 10. - response_format: - type: string - enum: - - url - - b64_json - default: url - example: url - nullable: true - description: >- - The format in which the generated images are returned. Must be one - of `url` or `b64_json`. URLs are only valid for 60 minutes after the - image has been generated. - size: + description: The index of the annotation in the text content part. + type: + description: Always `file_path`. type: string enum: - - 256x256 - - 512x512 - - 1024x1024 - default: 1024x1024 - example: 1024x1024 - nullable: true - description: >- - The size of the generated images. Must be one of `256x256`, - `512x512`, or `1024x1024`. - user: + - file_path + x-stainless-const: true + text: + description: The text in the message content that needs to be replaced. type: string - example: user-1234 - description: > - A unique identifier representing your end-user, which can help - OpenAI to monitor and detect abuse. [Learn - more](/docs/guides/safety-best-practices#end-user-ids). + file_path: + type: object + properties: + file_id: + description: The ID of the file that was generated. + type: string + start_index: + type: integer + minimum: 0 + end_index: + type: integer + minimum: 0 required: - - image - CreateMessageRequest: + - index + - type + MessageDeltaContentTextObject: + title: Text type: object - additionalProperties: false - required: - - role - - content + description: The text content that is part of a message. properties: - role: + index: + type: integer + description: The index of the content part in the message. + type: + description: Always `text`. type: string enum: - - user - - assistant - description: > - The role of the entity that is creating the message. Allowed values - include: - - - `user`: Indicates the message is sent by an actual user and should - be used in most cases to represent user-generated messages. - - - `assistant`: Indicates the message is generated by the assistant. - Use this value to insert messages from the assistant into the - conversation. - content: - oneOf: - - type: string - description: The text contents of the message. - title: Text content - - type: array - description: >- - An array of content parts with a defined type, each can be of - type `text` or images can be passed with `image_url` or - `image_file`. Image types are only supported on - [Vision-compatible models](/docs/models). - title: Array of content parts + - text + x-stainless-const: true + text: + type: object + properties: + value: + description: The data that makes up the text. + type: string + annotations: + type: array items: oneOf: - - $ref: '#/components/schemas/MessageContentImageFileObject' - - $ref: '#/components/schemas/MessageContentImageUrlObject' - - $ref: '#/components/schemas/MessageRequestContentTextObject' - minItems: 1 - attachments: - anyOf: - - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - description: The tools to add this file to. - type: array - items: - oneOf: - - $ref: '#/components/schemas/AssistantToolsCode' - - $ref: >- - #/components/schemas/AssistantToolsFileSearchTypeOnly - description: >- - A list of files attached to the message, and the tools they - should be added to. - required: - - file_id - - tools - - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - CreateModelResponseProperties: - allOf: - - $ref: '#/components/schemas/ModelResponseProperties' - - type: object - properties: - top_logprobs: - description: > - An integer between 0 and 20 specifying the maximum number of - most likely - - tokens to return at each token position, each with an associated - log - - probability. In some cases, the number of returned tokens may be - fewer than - - requested. - type: integer - minimum: 0 - maximum: 20 - CreateModerationRequest: + - $ref: >- + #/components/schemas/MessageDeltaContentTextAnnotationsFileCitationObject + - $ref: >- + #/components/schemas/MessageDeltaContentTextAnnotationsFilePathObject + required: + - index + - type + MessageDeltaObject: type: object + title: Message delta object + description: > + Represents a message delta i.e. any changed fields on a message during + streaming. properties: - input: - description: > - Input (or inputs) to classify. Can be a single string, an array of - strings, or - - an array of multi-modal input objects similar to other models. - oneOf: - - type: string - description: A string of text to classify for moderation. - default: '' - example: I want to kill them. - - type: array - description: An array of strings to classify for moderation. - items: - type: string - default: '' - example: I want to kill them. - - type: array - description: An array of multi-modal inputs to the moderation model. + id: + description: >- + The identifier of the message, which can be referenced in API + endpoints. + type: string + object: + description: The object type, which is always `thread.message.delta`. + type: string + enum: + - thread.message.delta + x-stainless-const: true + delta: + description: The delta containing the fields that have changed on the Message. + type: object + properties: + role: + description: >- + The entity that produced the message. One of `user` or + `assistant`. + type: string + enum: + - user + - assistant + content: + description: The content of the message in array of text and/or images. + type: array items: oneOf: - - type: object - description: An object describing an image to classify. - properties: - type: - description: Always `image_url`. - type: string - enum: - - image_url - x-stainless-const: true - image_url: - type: object - description: >- - Contains either an image URL or a data URL for a - base64 encoded image. - properties: - url: - type: string - description: >- - Either a URL of the image or the base64 encoded - image data. - format: uri - example: https://example.com/image.jpg - required: - - url - required: - - type - - image_url - - type: object - description: An object describing text to classify. - properties: - type: - description: Always `text`. - type: string - enum: - - text - x-stainless-const: true - text: - description: A string of text to classify. - type: string - example: I want to kill them - required: - - type - - text - model: - description: | - The content moderation model you would like to use. Learn more in - [the moderation guide](/docs/guides/moderation), and learn about - available models [here](/docs/models#moderation). - nullable: false - default: omni-moderation-latest - example: omni-moderation-2024-09-26 - anyOf: - - type: string - - type: string - enum: - - omni-moderation-latest - - omni-moderation-2024-09-26 - - text-moderation-latest - - text-moderation-stable - x-oaiTypeLabel: string + - $ref: '#/components/schemas/MessageDeltaContentImageFileObject' + - $ref: '#/components/schemas/MessageDeltaContentTextObject' + - $ref: '#/components/schemas/MessageDeltaContentRefusalObject' + - $ref: '#/components/schemas/MessageDeltaContentImageUrlObject' required: - - input - CreateModerationResponse: + - id + - object + - delta + x-oaiMeta: + name: The message delta object + beta: true + example: | + { + "id": "msg_123", + "object": "thread.message.delta", + "delta": { + "content": [ + { + "index": 0, + "type": "text", + "text": { "value": "Hello", "annotations": [] } + } + ] + } + } + MessageObject: type: object - description: Represents if a given text input is potentially harmful. + title: The message object + description: Represents a message within a [thread](/docs/api-reference/threads). properties: id: + description: The identifier, which can be referenced in API endpoints. type: string - description: The unique identifier for the moderation request. - model: + object: + description: The object type, which is always `thread.message`. type: string - description: The model used to generate the moderation results. - results: + enum: + - thread.message + x-stainless-const: true + created_at: + description: The Unix timestamp (in seconds) for when the message was created. + type: integer + format: unixtime + thread_id: + description: >- + The [thread](/docs/api-reference/threads) ID that this message + belongs to. + type: string + status: + description: >- + The status of the message, which can be either `in_progress`, + `incomplete`, or `completed`. + type: string + enum: + - in_progress + - incomplete + - completed + incomplete_details: + anyOf: + - description: >- + On an incomplete message, details about why the message is + incomplete. + type: object + properties: + reason: + type: string + description: The reason the message is incomplete. + enum: + - content_filter + - max_tokens + - run_cancelled + - run_expired + - run_failed + required: + - reason + - type: 'null' + completed_at: + anyOf: + - description: >- + The Unix timestamp (in seconds) for when the message was + completed. + type: integer + format: unixtime + - type: 'null' + incomplete_at: + anyOf: + - description: >- + The Unix timestamp (in seconds) for when the message was marked + as incomplete. + type: integer + format: unixtime + - type: 'null' + role: + description: The entity that produced the message. One of `user` or `assistant`. + type: string + enum: + - user + - assistant + content: + description: The content of the message in array of text and/or images. type: array - description: A list of moderation objects. items: - type: object - properties: - flagged: - type: boolean - description: Whether any of the below categories are flagged. - categories: - type: object - description: A list of the categories, and whether they are flagged or not. - properties: - hate: - type: boolean - description: >- - Content that expresses, incites, or promotes hate based on - race, gender, ethnicity, religion, nationality, sexual - orientation, disability status, or caste. Hateful content - aimed at non-protected groups (e.g., chess players) is - harassment. - hate/threatening: - type: boolean - description: >- - Hateful content that also includes violence or serious - harm towards the targeted group based on race, gender, - ethnicity, religion, nationality, sexual orientation, - disability status, or caste. - harassment: - type: boolean - description: >- - Content that expresses, incites, or promotes harassing - language towards any target. - harassment/threatening: - type: boolean - description: >- - Harassment content that also includes violence or serious - harm towards any target. - illicit: - anyOf: - - type: boolean - description: >- - Content that includes instructions or advice that - facilitate the planning or execution of wrongdoing, or - that gives advice or instruction on how to commit - illicit acts. For example, "how to shoplift" would fit - this category. - - type: 'null' - illicit/violent: - anyOf: - - type: boolean - description: >- - Content that includes instructions or advice that - facilitate the planning or execution of wrongdoing - that also includes violence, or that gives advice or - instruction on the procurement of any weapon. - - type: 'null' - self-harm: - type: boolean - description: >- - Content that promotes, encourages, or depicts acts of - self-harm, such as suicide, cutting, and eating disorders. - self-harm/intent: - type: boolean - description: >- - Content where the speaker expresses that they are engaging - or intend to engage in acts of self-harm, such as suicide, - cutting, and eating disorders. - self-harm/instructions: - type: boolean - description: >- - Content that encourages performing acts of self-harm, such - as suicide, cutting, and eating disorders, or that gives - instructions or advice on how to commit such acts. - sexual: - type: boolean - description: >- - Content meant to arouse sexual excitement, such as the - description of sexual activity, or that promotes sexual - services (excluding sex education and wellness). - sexual/minors: - type: boolean - description: >- - Sexual content that includes an individual who is under 18 - years old. - violence: - type: boolean - description: Content that depicts death, violence, or physical injury. - violence/graphic: - type: boolean - description: >- - Content that depicts death, violence, or physical injury - in graphic detail. - required: - - hate - - hate/threatening - - harassment - - harassment/threatening - - illicit - - illicit/violent - - self-harm - - self-harm/intent - - self-harm/instructions - - sexual - - sexual/minors - - violence - - violence/graphic - category_scores: - type: object - description: >- - A list of the categories along with their scores as predicted - by model. - properties: - hate: - type: number - description: The score for the category 'hate'. - hate/threatening: - type: number - description: The score for the category 'hate/threatening'. - harassment: - type: number - description: The score for the category 'harassment'. - harassment/threatening: - type: number - description: The score for the category 'harassment/threatening'. - illicit: - type: number - description: The score for the category 'illicit'. - illicit/violent: - type: number - description: The score for the category 'illicit/violent'. - self-harm: - type: number - description: The score for the category 'self-harm'. - self-harm/intent: - type: number - description: The score for the category 'self-harm/intent'. - self-harm/instructions: - type: number - description: The score for the category 'self-harm/instructions'. - sexual: - type: number - description: The score for the category 'sexual'. - sexual/minors: - type: number - description: The score for the category 'sexual/minors'. - violence: - type: number - description: The score for the category 'violence'. - violence/graphic: - type: number - description: The score for the category 'violence/graphic'. - required: - - hate - - hate/threatening - - harassment - - harassment/threatening - - illicit - - illicit/violent - - self-harm - - self-harm/intent - - self-harm/instructions - - sexual - - sexual/minors - - violence - - violence/graphic - category_applied_input_types: + oneOf: + - $ref: '#/components/schemas/MessageContentImageFileObject' + - $ref: '#/components/schemas/MessageContentImageUrlObject' + - $ref: '#/components/schemas/MessageContentTextObject' + - $ref: '#/components/schemas/MessageContentRefusalObject' + assistant_id: + anyOf: + - description: >- + If applicable, the ID of the + [assistant](/docs/api-reference/assistants) that authored this + message. + type: string + - type: 'null' + run_id: + anyOf: + - description: >- + The ID of the [run](/docs/api-reference/runs) associated with + the creation of this message. Value is `null` when messages are + created manually using the create message or create thread + endpoints. + type: string + - type: 'null' + attachments: + anyOf: + - type: array + items: type: object - description: >- - A list of the categories along with the input type(s) that the - score applies to. properties: - hate: - type: array - description: The applied input type(s) for the category 'hate'. - items: - type: string - enum: - - text - x-stainless-const: true - hate/threatening: - type: array - description: >- - The applied input type(s) for the category - 'hate/threatening'. - items: - type: string - enum: - - text - x-stainless-const: true - harassment: - type: array - description: The applied input type(s) for the category 'harassment'. - items: - type: string - enum: - - text - x-stainless-const: true - harassment/threatening: - type: array - description: >- - The applied input type(s) for the category - 'harassment/threatening'. - items: - type: string - enum: - - text - x-stainless-const: true - illicit: - type: array - description: The applied input type(s) for the category 'illicit'. - items: - type: string - enum: - - text - x-stainless-const: true - illicit/violent: - type: array - description: >- - The applied input type(s) for the category - 'illicit/violent'. - items: - type: string - enum: - - text - x-stainless-const: true - self-harm: - type: array - description: The applied input type(s) for the category 'self-harm'. - items: - type: string - enum: - - text - - image - self-harm/intent: - type: array - description: >- - The applied input type(s) for the category - 'self-harm/intent'. - items: - type: string - enum: - - text - - image - self-harm/instructions: - type: array - description: >- - The applied input type(s) for the category - 'self-harm/instructions'. - items: - type: string - enum: - - text - - image - sexual: - type: array - description: The applied input type(s) for the category 'sexual'. - items: - type: string - enum: - - text - - image - sexual/minors: - type: array - description: >- - The applied input type(s) for the category - 'sexual/minors'. - items: - type: string - enum: - - text - x-stainless-const: true - violence: - type: array - description: The applied input type(s) for the category 'violence'. - items: - type: string - enum: - - text - - image - violence/graphic: - type: array - description: >- - The applied input type(s) for the category - 'violence/graphic'. - items: - type: string - enum: - - text - - image - required: - - hate - - hate/threatening - - harassment - - harassment/threatening - - illicit - - illicit/violent - - self-harm - - self-harm/intent - - self-harm/instructions - - sexual - - sexual/minors - - violence - - violence/graphic - required: - - flagged - - categories - - category_scores - - category_applied_input_types - required: - - id - - model - - results - x-oaiMeta: - name: The moderation object - example: | - { - "id": "modr-0d9740456c391e43c445bf0f010940c7", - "model": "omni-moderation-latest", - "results": [ - { - "flagged": true, - "categories": { - "harassment": true, - "harassment/threatening": true, - "sexual": false, - "hate": false, - "hate/threatening": false, - "illicit": false, - "illicit/violent": false, - "self-harm/intent": false, - "self-harm/instructions": false, - "self-harm": false, - "sexual/minors": false, - "violence": true, - "violence/graphic": true - }, - "category_scores": { - "harassment": 0.8189693396524255, - "harassment/threatening": 0.804985420696006, - "sexual": 1.573112165348997e-6, - "hate": 0.007562942636942845, - "hate/threatening": 0.004208854591835476, - "illicit": 0.030535955153511665, - "illicit/violent": 0.008925306722380033, - "self-harm/intent": 0.00023023930975076432, - "self-harm/instructions": 0.0002293869201073356, - "self-harm": 0.012598046106750154, - "sexual/minors": 2.212566909570261e-8, - "violence": 0.9999992735124786, - "violence/graphic": 0.843064871157054 - }, - "category_applied_input_types": { - "harassment": [ - "text" - ], - "harassment/threatening": [ - "text" - ], - "sexual": [ - "text", - "image" - ], - "hate": [ - "text" - ], - "hate/threatening": [ - "text" - ], - "illicit": [ - "text" - ], - "illicit/violent": [ - "text" - ], - "self-harm/intent": [ - "text", - "image" - ], - "self-harm/instructions": [ - "text", - "image" - ], - "self-harm": [ - "text", - "image" - ], - "sexual/minors": [ - "text" - ], - "violence": [ - "text", - "image" - ], - "violence/graphic": [ - "text", - "image" - ] + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + description: The tools to add this file to. + type: array + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: >- + #/components/schemas/AssistantToolsFileSearchTypeOnly + description: >- + A list of files attached to the message, and the tools they were + added to. + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - id + - object + - created_at + - thread_id + - status + - incomplete_details + - completed_at + - incomplete_at + - role + - content + - assistant_id + - run_id + - attachments + - metadata + x-oaiMeta: + name: The message object + beta: true + example: | + { + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1698983503, + "thread_id": "thread_abc123", + "role": "assistant", + "content": [ + { + "type": "text", + "text": { + "value": "Hi! How can I help you today?", + "annotations": [] } } - ] + ], + "assistant_id": "asst_abc123", + "run_id": "run_abc123", + "attachments": [], + "metadata": {} } - CreateResponse: - allOf: - - $ref: '#/components/schemas/CreateModelResponseProperties' - - $ref: '#/components/schemas/ResponseProperties' - - type: object - properties: - input: - $ref: '#/components/schemas/InputParam' - include: - anyOf: - - type: array - description: >- - Specify additional output data to include in the model - response. Currently supported values are: - - - `web_search_call.action.sources`: Include the sources of - the web search tool call. - - - `code_interpreter_call.outputs`: Includes the outputs of - python code execution in code interpreter tool call items. - - - `computer_call_output.output.image_url`: Include image - urls from the computer call output. - - - `file_search_call.results`: Include the search results of - the file search tool call. - - - `message.input_image.image_url`: Include image urls from - the input message. - - - `message.output_text.logprobs`: Include logprobs with - assistant messages. - - - `reasoning.encrypted_content`: Includes an encrypted - version of reasoning tokens in reasoning item outputs. This - enables reasoning items to be used in multi-turn - conversations when using the Responses API statelessly (like - when the `store` parameter is set to `false`, or when an - organization is enrolled in the zero data retention - program). - items: - $ref: '#/components/schemas/IncludeEnum' - - type: 'null' - parallel_tool_calls: - anyOf: - - type: boolean - description: | - Whether to allow the model to run tool calls in parallel. - default: true - - type: 'null' - store: - anyOf: - - type: boolean - description: > - Whether to store the generated model response for later - retrieval via - - API. - default: true - - type: 'null' - instructions: - anyOf: - - type: string - description: > - A system (or developer) message inserted into the model's - context. + MessagePhase: + type: string + description: > + Labels an `assistant` message as intermediate commentary (`commentary`) + or the final answer (`final_answer`). + For models like `gpt-5.3-codex` and beyond, when sending follow-up + requests, preserve and resend - When using along with `previous_response_id`, the - instructions from a previous + phase on all assistant messages — dropping it can degrade performance. + Not used for user messages. + enum: + - commentary + - final_answer + MessageRequestContentTextObject: + title: Text + type: object + description: The text content that is part of a message. + properties: + type: + description: Always `text`. + type: string + enum: + - text + x-stainless-const: true + text: + type: string + description: Text content to be sent to the model + required: + - type + - text + MessageStreamEvent: + oneOf: + - type: object + properties: + event: + type: string + enum: + - thread.message.created + x-stainless-const: true + data: + $ref: '#/components/schemas/MessageObject' + required: + - event + - data + description: >- + Occurs when a [message](/docs/api-reference/messages/object) is + created. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + - type: object + properties: + event: + type: string + enum: + - thread.message.in_progress + x-stainless-const: true + data: + $ref: '#/components/schemas/MessageObject' + required: + - event + - data + description: >- + Occurs when a [message](/docs/api-reference/messages/object) moves + to an `in_progress` state. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + - type: object + properties: + event: + type: string + enum: + - thread.message.delta + x-stainless-const: true + data: + $ref: '#/components/schemas/MessageDeltaObject' + required: + - event + - data + description: >- + Occurs when parts of a + [Message](/docs/api-reference/messages/object) are being streamed. + x-oaiMeta: + dataDescription: >- + `data` is a [message + delta](/docs/api-reference/assistants-streaming/message-delta-object) + - type: object + properties: + event: + type: string + enum: + - thread.message.completed + x-stainless-const: true + data: + $ref: '#/components/schemas/MessageObject' + required: + - event + - data + description: >- + Occurs when a [message](/docs/api-reference/messages/object) is + completed. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + - type: object + properties: + event: + type: string + enum: + - thread.message.incomplete + x-stainless-const: true + data: + $ref: '#/components/schemas/MessageObject' + required: + - event + - data + description: >- + Occurs when a [message](/docs/api-reference/messages/object) ends + before it is completed. + x-oaiMeta: + dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' + Metadata: + anyOf: + - type: object + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be - response will not be carried over to the next response. This - makes it simple + useful for storing additional information about the object in a + structured - to swap out system (or developer) messages in new responses. - - type: 'null' - moderation: - anyOf: - - $ref: '#/components/schemas/ModerationParam' - description: > - Configuration for running moderation on the input and output - of this response. - - type: 'null' - stream: - anyOf: - - description: > - If set to true, the model response data will be streamed to - the client + format, and querying for objects via API or the dashboard. - as it is generated using [server-sent - events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). - See the [Streaming section - below](/docs/api-reference/responses-streaming) + Keys are strings with a maximum length of 64 characters. Values are + strings - for more information. - type: boolean - default: false - - type: 'null' - stream_options: - $ref: '#/components/schemas/ResponseStreamOptions' - conversation: - anyOf: - - $ref: '#/components/schemas/ConversationParam' - - type: 'null' - context_management: - anyOf: - - type: array - description: | - Context management configuration for this request. - minItems: 1 - items: - $ref: '#/components/schemas/ContextManagementParam' - - type: 'null' - max_output_tokens: - anyOf: - - description: > - An upper bound for the number of tokens that can be - generated for a response, including visible output tokens - and [reasoning tokens](/docs/guides/reasoning). - type: integer - minimum: 16 - - type: 'null' - CreateRunRequest: - type: object - additionalProperties: false + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + - type: 'null' + Model: + title: Model + description: Describes an OpenAI model offering that can be used with the API. properties: - assistant_id: - description: >- - The ID of the [assistant](/docs/api-reference/assistants) to use to - execute this run. + id: type: string - model: - description: >- - The ID of the [Model](/docs/api-reference/models) to be used to - execute this run. If a value is provided here, it will override the - model associated with the assistant. If not, the model associated - with the assistant will be used. - example: gpt-4o - anyOf: - - type: string - - $ref: '#/components/schemas/AssistantSupportedModels' - x-oaiTypeLabel: string - nullable: true - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - instructions: - description: >- - Overrides the - [instructions](/docs/api-reference/assistants/createAssistant) of - the assistant. This is useful for modifying the behavior on a - per-run basis. + description: The model identifier, which can be referenced in the API endpoints. + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) when the model was created. + object: type: string - nullable: true - additional_instructions: - description: >- - Appends additional instructions at the end of the instructions for - the run. This is useful for modifying the behavior on a per-run - basis without overriding other instructions. + description: The object type, which is always "model". + enum: + - model + x-stainless-const: true + owned_by: type: string - nullable: true - additional_messages: - description: Adds additional messages to the thread before creating the run. - type: array - items: - $ref: '#/components/schemas/CreateMessageRequest' - nullable: true - tools: - description: >- - Override the tools the assistant can use for this run. This is - useful for modifying the behavior on a per-run basis. - nullable: true - type: array - maxItems: 20 - items: - oneOf: - - $ref: '#/components/schemas/AssistantToolsCode' - - $ref: '#/components/schemas/AssistantToolsFileSearch' - - $ref: '#/components/schemas/AssistantToolsFunction' + description: The organization that owns the model. + required: + - id + - object + - created + - owned_by + x-oaiMeta: + name: The model object + example: | + { + "id": "VAR_chat_model_id", + "object": "model", + "created": 1686935002, + "owned_by": "openai" + } + ModelIds: + anyOf: + - $ref: '#/components/schemas/ModelIdsShared' + - $ref: '#/components/schemas/ModelIdsResponses' + ModelIdsCompaction: + anyOf: + - $ref: '#/components/schemas/ModelIdsResponses' + - type: string + - type: 'null' + description: >- + Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI + offers a wide range of models with different capabilities, performance + characteristics, and price points. Refer to the [model + guide](/docs/models) to browse and compare available models. + ModelIdsResponses: + example: gpt-5.1 + anyOf: + - $ref: '#/components/schemas/ModelIdsShared' + - type: string + title: ResponsesOnlyModel + enum: + - o1-pro + - o1-pro-2025-03-19 + - o3-pro + - o3-pro-2025-06-10 + - o3-deep-research + - o3-deep-research-2025-06-26 + - o4-mini-deep-research + - o4-mini-deep-research-2025-06-26 + - computer-use-preview + - computer-use-preview-2025-03-11 + - gpt-5-codex + - gpt-5-pro + - gpt-5-pro-2025-10-06 + - gpt-5.1-codex-max + ModelIdsShared: + example: gpt-5.4 + anyOf: + - type: string + - type: string + enum: + - gpt-5.6-sol + - gpt-5.6-terra + - gpt-5.6-luna + - gpt-5.4 + - gpt-5.4-mini + - gpt-5.4-nano + - gpt-5.4-mini-2026-03-17 + - gpt-5.4-nano-2026-03-17 + - gpt-5.3-chat-latest + - gpt-5.2 + - gpt-5.2-2025-12-11 + - gpt-5.2-chat-latest + - gpt-5.2-pro + - gpt-5.2-pro-2025-12-11 + - gpt-5.1 + - gpt-5.1-2025-11-13 + - gpt-5.1-codex + - gpt-5.1-mini + - gpt-5.1-chat-latest + - gpt-5 + - gpt-5-mini + - gpt-5-nano + - gpt-5-2025-08-07 + - gpt-5-mini-2025-08-07 + - gpt-5-nano-2025-08-07 + - gpt-5-chat-latest + - gpt-4.1 + - gpt-4.1-mini + - gpt-4.1-nano + - gpt-4.1-2025-04-14 + - gpt-4.1-mini-2025-04-14 + - gpt-4.1-nano-2025-04-14 + - o4-mini + - o4-mini-2025-04-16 + - o3 + - o3-2025-04-16 + - o3-mini + - o3-mini-2025-01-31 + - o1 + - o1-2024-12-17 + - o1-preview + - o1-preview-2024-09-12 + - o1-mini + - o1-mini-2024-09-12 + - gpt-4o + - gpt-4o-2024-11-20 + - gpt-4o-2024-08-06 + - gpt-4o-2024-05-13 + - gpt-4o-audio-preview + - gpt-4o-audio-preview-2024-10-01 + - gpt-4o-audio-preview-2024-12-17 + - gpt-4o-audio-preview-2025-06-03 + - gpt-4o-mini-audio-preview + - gpt-4o-mini-audio-preview-2024-12-17 + - gpt-4o-search-preview + - gpt-4o-mini-search-preview + - gpt-4o-search-preview-2025-03-11 + - gpt-4o-mini-search-preview-2025-03-11 + - chatgpt-4o-latest + - codex-mini-latest + - gpt-4o-mini + - gpt-4o-mini-2024-07-18 + - gpt-4-turbo + - gpt-4-turbo-2024-04-09 + - gpt-4-0125-preview + - gpt-4-turbo-preview + - gpt-4-1106-preview + - gpt-4-vision-preview + - gpt-4 + - gpt-4-0314 + - gpt-4-0613 + - gpt-4-32k + - gpt-4-32k-0314 + - gpt-4-32k-0613 + - gpt-3.5-turbo + - gpt-3.5-turbo-16k + - gpt-3.5-turbo-0301 + - gpt-3.5-turbo-0613 + - gpt-3.5-turbo-1106 + - gpt-3.5-turbo-0125 + - gpt-3.5-turbo-16k-0613 + ModelResponseProperties: + type: object + properties: metadata: $ref: '#/components/schemas/Metadata' + top_logprobs: + anyOf: + - description: > + An integer between 0 and 20 specifying the maximum number of + most likely + + tokens to return at each token position, each with an associated + log + + probability. In some cases, the number of returned tokens may be + fewer than + + requested. + type: integer + minimum: 0 + maximum: 20 + - type: 'null' temperature: - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 - nullable: true - description: > - What sampling temperature to use, between 0 and 2. Higher values - like 0.8 will make the output more random, while lower values like - 0.2 will make it more focused and deterministic. + anyOf: + - type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values + like 0.2 will make it more focused and deterministic. + + We generally recommend altering this or `top_p` but not both. + - type: 'null' top_p: - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 - nullable: true - description: > - An alternative to sampling with temperature, called nucleus - sampling, where the model considers the results of the tokens with - top_p probability mass. So 0.1 means only the tokens comprising the - top 10% probability mass are considered. + anyOf: + - type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + description: > + An alternative to sampling with temperature, called nucleus + sampling, + where the model considers the results of the tokens with top_p + probability - We generally recommend altering this or temperature but not both. - stream: - type: boolean - nullable: true - description: > - If `true`, returns a stream of events that happen during the Run as - server-sent events, terminating when the Run enters a terminal state - with a `data: [DONE]` message. - max_prompt_tokens: - type: integer - nullable: true + mass. So 0.1 means only the tokens comprising the top 10% + probability mass + + are considered. + + + We generally recommend altering this or `temperature` but not + both. + - type: 'null' + user: + type: string + example: user-1234 + deprecated: true description: > - The maximum number of prompt tokens that may be used over the course - of the run. The run will make a best effort to use only the number - of prompt tokens specified, across multiple turns of the run. If the - run exceeds the number of prompt tokens specified, the run will end - with status `incomplete`. See `incomplete_details` for more info. - minimum: 256 - max_completion_tokens: - type: integer - nullable: true + This field is being replaced by `safety_identifier` and + `prompt_cache_key`. Use `prompt_cache_key` instead to maintain + caching optimizations. + + A stable identifier for your end-users. + + Used to boost cache hit rates by better bucketing similar requests + and to help OpenAI detect and prevent abuse. [Learn + more](/docs/guides/safety-best-practices#safety-identifiers). + safety_identifier: + type: string + maxLength: 64 + example: safety-identifier-1234 description: > - The maximum number of completion tokens that may be used over the - course of the run. The run will make a best effort to use only the - number of completion tokens specified, across multiple turns of the - run. If the run exceeds the number of completion tokens specified, - the run will end with status `incomplete`. See `incomplete_details` - for more info. - minimum: 256 - truncation_strategy: - allOf: - - $ref: '#/components/schemas/TruncationObject' - - nullable: true - tool_choice: - allOf: - - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' - - nullable: true - parallel_tool_calls: - $ref: '#/components/schemas/ParallelToolCalls' - response_format: - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' - nullable: true - required: - - assistant_id - CreateSpeechRequest: - type: object - additionalProperties: false - properties: - model: + A stable identifier used to help detect users of your application + that may be violating OpenAI's usage policies. + + The IDs should be a string that uniquely identifies each user, with + a maximum length of 64 characters. We recommend hashing their + username or email address, in order to avoid sending us any + identifying information. [Learn + more](/docs/guides/safety-best-practices#safety-identifiers). + prompt_cache_key: + type: string + example: prompt-cache-key-1234 description: > - One of the available [TTS models](/docs/models#tts): `tts-1`, - `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`. + Used by OpenAI to cache responses for similar requests to optimize + your cache hit rates. Replaces the `user` field. [Learn + more](/docs/guides/prompt-caching). + service_tier: + $ref: '#/components/schemas/ServiceTier' + prompt_cache_retention: + deprecated: true anyOf: - - type: string - type: string enum: - - tts-1 - - tts-1-hd - - gpt-4o-mini-tts - - gpt-4o-mini-tts-2025-12-15 - x-oaiTypeLabel: string - input: - type: string - description: >- - The text to generate audio for. The maximum length is 4096 - characters. - maxLength: 4096 - instructions: - type: string - description: >- - Control the voice of your generated audio with additional - instructions. Does not work with `tts-1` or `tts-1-hd`. - maxLength: 4096 - voice: - description: >- - The voice to use when generating the audio. Supported built-in - voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, - `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. - You may also provide a custom voice object with an `id`, for example - `{ "id": "voice_1234" }`. Previews of the voices are available in - the [Text to speech - guide](/docs/guides/text-to-speech#voice-options). - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - response_format: - description: >- - The format to audio in. Supported formats are `mp3`, `opus`, `aac`, - `flac`, `wav`, and `pcm`. - default: mp3 - type: string - enum: - - mp3 - - opus - - aac - - flac - - wav - - pcm - speed: - description: >- - The speed of the generated audio. Select a value from `0.25` to - `4.0`. `1.0` is the default. - type: number - default: 1 - minimum: 0.25 - maximum: 4 - stream_format: - description: >- - The format to stream the audio in. Supported formats are `sse` and - `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`. - type: string - default: audio - enum: - - sse - - audio - required: - - model - - input - - voice - CreateSpeechResponseStreamEvent: - anyOf: - - $ref: '#/components/schemas/SpeechAudioDeltaEvent' - - $ref: '#/components/schemas/SpeechAudioDoneEvent' - discriminator: - propertyName: type - CreateSpendAlertBody: - type: object - description: Parameters for creating or updating a spend alert. - properties: - threshold_amount: - type: integer - minimum: 0 - description: The alert threshold amount, in cents. - currency: - type: string - enum: - - USD - description: The currency for the threshold amount. - interval: - type: string - enum: - - month - description: The time interval for evaluating spend against the threshold. - notification_channel: - $ref: '#/components/schemas/SpendAlertNotificationChannel' - required: - - threshold_amount - - currency - - interval - - notification_channel - CreateThreadAndRunRequest: + - in_memory + - 24h + description: > + Deprecated. Use `prompt_cache_options.ttl` instead. + + + The retention policy for the prompt cache. Set to `24h` to + enable extended prompt caching, which keeps cached prefixes + active for longer, up to a maximum of 24 hours. [Learn + more](/docs/guides/prompt-caching#prompt-cache-retention). + + This field expresses a maximum retention policy, while + + `prompt_cache_options.ttl` expresses a minimum cache lifetime. + The two + + fields are independent and do not interact. + + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is + supported. + + + For older models that support both `in_memory` and `24h`, the + default depends on your organization's data retention policy: + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified. + - type: 'null' + ModifyAssistantRequest: type: object additionalProperties: false properties: - assistant_id: - description: >- - The ID of the [assistant](/docs/api-reference/assistants) to use to - execute this run. - type: string - thread: - $ref: '#/components/schemas/CreateThreadRequest' model: - description: >- - The ID of the [Model](/docs/api-reference/models) to be used to - execute this run. If a value is provided here, it will override the - model associated with the assistant. If not, the model associated - with the assistant will be used. - example: gpt-4o + description: > + ID of the model to use. You can use the [List + models](/docs/api-reference/models/list) API to see all of your + available models, or see our [Model overview](/docs/models) for + descriptions of them. anyOf: - type: string - - type: string - enum: - - gpt-5 - - gpt-5-mini - - gpt-5-nano - - gpt-5-2025-08-07 - - gpt-5-mini-2025-08-07 - - gpt-5-nano-2025-08-07 - - gpt-4.1 - - gpt-4.1-mini - - gpt-4.1-nano - - gpt-4.1-2025-04-14 - - gpt-4.1-mini-2025-04-14 - - gpt-4.1-nano-2025-04-14 - - gpt-4o - - gpt-4o-2024-11-20 - - gpt-4o-2024-08-06 - - gpt-4o-2024-05-13 - - gpt-4o-mini - - gpt-4o-mini-2024-07-18 - - gpt-4.5-preview - - gpt-4.5-preview-2025-02-27 - - gpt-4-turbo - - gpt-4-turbo-2024-04-09 - - gpt-4-0125-preview - - gpt-4-turbo-preview - - gpt-4-1106-preview - - gpt-4-vision-preview - - gpt-4 - - gpt-4-0314 - - gpt-4-0613 - - gpt-4-32k - - gpt-4-32k-0314 - - gpt-4-32k-0613 - - gpt-3.5-turbo - - gpt-3.5-turbo-16k - - gpt-3.5-turbo-0613 - - gpt-3.5-turbo-1106 - - gpt-3.5-turbo-0125 - - gpt-3.5-turbo-16k-0613 - x-oaiTypeLabel: string - nullable: true + - $ref: '#/components/schemas/AssistantSupportedModels' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + name: + anyOf: + - description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + - type: 'null' + description: + anyOf: + - description: > + The description of the assistant. The maximum length is 512 + characters. + type: string + maxLength: 512 + - type: 'null' instructions: - description: >- - Override the default system message of the assistant. This is useful - for modifying the behavior on a per-run basis. - type: string - nullable: true + anyOf: + - description: > + The system instructions that the assistant uses. The maximum + length is 256,000 characters. + type: string + maxLength: 256000 + - type: 'null' tools: - description: >- - Override the tools the assistant can use for this run. This is - useful for modifying the behavior on a per-run basis. - nullable: true + description: > + A list of tool enabled on the assistant. There can be a maximum of + 128 tools per assistant. Tools can be of types `code_interpreter`, + `file_search`, or `function`. + default: [] type: array - maxItems: 20 + maxItems: 128 items: oneOf: - $ref: '#/components/schemas/AssistantToolsCode' - $ref: '#/components/schemas/AssistantToolsFileSearch' - $ref: '#/components/schemas/AssistantToolsFunction' tool_resources: - type: object - description: > - A set of resources that are used by the assistant's tools. The - resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the - `file_search` tool requires a list of vector store IDs. - properties: - code_interpreter: - type: object - properties: - file_ids: - type: array - description: > - A list of [file](/docs/api-reference/files) IDs made - available to the `code_interpreter` tool. There can be a - maximum of 20 files associated with the tool. - default: [] - maxItems: 20 - items: - type: string - file_search: - type: object + anyOf: + - type: object + description: > + A set of resources that are used by the assistant's tools. The + resources are specific to the type of tool. For example, the + `code_interpreter` tool requires a list of file IDs, while the + `file_search` tool requires a list of vector store IDs. properties: - vector_store_ids: - type: array - description: > - The ID of the [vector - store](/docs/api-reference/vector-stores/object) attached to - this assistant. There can be a maximum of 1 vector store - attached to the assistant. - maxItems: 1 - items: - type: string - nullable: true + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + Overrides the list of [file](/docs/api-reference/files) + IDs made available to the `code_interpreter` tool. There + can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + Overrides the [vector + store](/docs/api-reference/vector-stores/object) + attached to this assistant. There can be a maximum of 1 + vector store attached to the assistant. + maxItems: 1 + items: + type: string + - type: 'null' metadata: $ref: '#/components/schemas/Metadata' temperature: - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 - nullable: true - description: > - What sampling temperature to use, between 0 and 2. Higher values - like 0.8 will make the output more random, while lower values like - 0.2 will make it more focused and deterministic. + anyOf: + - description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values + like 0.2 will make it more focused and deterministic. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + - type: 'null' top_p: - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 - nullable: true - description: > - An alternative to sampling with temperature, called nucleus - sampling, where the model considers the results of the tokens with - top_p probability mass. So 0.1 means only the tokens comprising the - top 10% probability mass are considered. - - - We generally recommend altering this or temperature but not both. - stream: - type: boolean - nullable: true - description: > - If `true`, returns a stream of events that happen during the Run as - server-sent events, terminating when the Run enters a terminal state - with a `data: [DONE]` message. - max_prompt_tokens: - type: integer - nullable: true - description: > - The maximum number of prompt tokens that may be used over the course - of the run. The run will make a best effort to use only the number - of prompt tokens specified, across multiple turns of the run. If the - run exceeds the number of prompt tokens specified, the run will end - with status `incomplete`. See `incomplete_details` for more info. - minimum: 256 - max_completion_tokens: - type: integer - nullable: true - description: > - The maximum number of completion tokens that may be used over the - course of the run. The run will make a best effort to use only the - number of completion tokens specified, across multiple turns of the - run. If the run exceeds the number of completion tokens specified, - the run will end with status `incomplete`. See `incomplete_details` - for more info. - minimum: 256 - truncation_strategy: - allOf: - - $ref: '#/components/schemas/TruncationObject' - - nullable: true - tool_choice: - allOf: - - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' - - nullable: true - parallel_tool_calls: - $ref: '#/components/schemas/ParallelToolCalls' + anyOf: + - type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + description: > + An alternative to sampling with temperature, called nucleus + sampling, where the model considers the results of the tokens + with top_p probability mass. So 0.1 means only the tokens + comprising the top 10% probability mass are considered. + + + We generally recommend altering this or temperature but not + both. + - type: 'null' response_format: - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' - nullable: true - required: - - assistant_id - CreateThreadRequest: + anyOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + - type: 'null' + ModifyCertificateRequest: + type: object + properties: + name: + type: string + description: The updated name for the certificate + ModifyMessageRequest: + type: object + additionalProperties: false + properties: + metadata: + $ref: '#/components/schemas/Metadata' + ModifyRunRequest: + type: object + additionalProperties: false + properties: + metadata: + $ref: '#/components/schemas/Metadata' + ModifyThreadRequest: type: object - description: | - Options to create a new thread. If no thread is provided when running a - request, an empty thread will be created. additionalProperties: false properties: - messages: - description: >- - A list of [messages](/docs/api-reference/messages) to start the - thread with. - type: array - items: - $ref: '#/components/schemas/CreateMessageRequest' tool_resources: anyOf: - type: object @@ -50408,10905 +61381,11603 @@ components: maxItems: 1 items: type: string - vector_stores: - type: array - description: > - A helper to create a [vector - store](/docs/api-reference/vector-stores/object) with - file_ids and attach it to this thread. There can be a - maximum of 1 vector store attached to the thread. - maxItems: 1 - items: - type: object - properties: - file_ids: - type: array - description: > - A list of [file](/docs/api-reference/files) IDs to - add to the vector store. For vector stores created - before Nov 2025, there can be a maximum of 10,000 - files in a vector store. For vector stores created - starting in Nov 2025, the limit is 100,000,000 - files. - maxItems: 100000000 - items: - type: string - chunking_strategy: - type: object - description: >- - The chunking strategy used to chunk the file(s). - If not set, will use the `auto` strategy. - oneOf: - - type: object - title: Auto Chunking Strategy - description: >- - The default strategy. This strategy currently - uses a `max_chunk_size_tokens` of `800` and - `chunk_overlap_tokens` of `400`. - additionalProperties: false - properties: - type: - type: string - description: Always `auto`. - enum: - - auto - x-stainless-const: true - required: - - type - - type: object - title: Static Chunking Strategy - additionalProperties: false - properties: - type: - type: string - description: Always `static`. - enum: - - static - x-stainless-const: true - static: - type: object - additionalProperties: false - properties: - max_chunk_size_tokens: - type: integer - minimum: 100 - maximum: 4096 - description: >- - The maximum number of tokens in each - chunk. The default value is `800`. The - minimum value is `100` and the maximum - value is `4096`. - chunk_overlap_tokens: - type: integer - description: > - The number of tokens that overlap - between chunks. The default value is - `400`. - - - Note that the overlap must not exceed - half of `max_chunk_size_tokens`. - required: - - max_chunk_size_tokens - - chunk_overlap_tokens - required: - - type - - static - metadata: - $ref: '#/components/schemas/Metadata' - oneOf: - - required: - - vector_store_ids - - required: - - vector_stores - type: 'null' metadata: $ref: '#/components/schemas/Metadata' - CreateTranscriptionRequest: - type: object - additionalProperties: false + NoiseReductionType: + type: string + enum: + - near_field + - far_field + description: > + 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. + OpenAIFile: + title: OpenAIFile + description: >- + The `File` object represents a document that has been uploaded to + OpenAI. properties: - file: - description: > - The audio file object (not file name) to transcribe, in one of these - formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. - type: string - x-oaiTypeLabel: file - format: binary - model: - description: > - ID of the model to use. The options are `gpt-4o-transcribe`, - `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, - `whisper-1` (which is powered by our open source Whisper V2 model), - and `gpt-4o-transcribe-diarize`. - example: gpt-4o-transcribe - anyOf: - - type: string - - type: string - enum: - - whisper-1 - - gpt-4o-transcribe - - gpt-4o-mini-transcribe - - gpt-4o-mini-transcribe-2025-12-15 - - gpt-4o-transcribe-diarize - x-stainless-const: true - x-oaiTypeLabel: string - language: - description: > - The language of the input audio. Supplying the input language in - [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) - (e.g. `en`) format will improve accuracy and latency. + id: type: string - prompt: - description: > - An optional text to guide the model's style or continue a previous - audio segment. The [prompt](/docs/guides/speech-to-text#prompting) - should match the audio language. This field is not supported when - using `gpt-4o-transcribe-diarize`. + description: The file identifier, which can be referenced in the API endpoints. + bytes: + type: integer + description: The size of the file, in bytes. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the file was created. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the file will expire. + filename: type: string - response_format: - $ref: '#/components/schemas/AudioResponseFormat' - temperature: - description: > - The sampling temperature, between 0 and 1. Higher values like 0.8 - will make the output more random, while lower values like 0.2 will - make it more focused and deterministic. If set to 0, the model will - use [log probability](https://en.wikipedia.org/wiki/Log_probability) - to automatically increase the temperature until certain thresholds - are hit. - type: number - default: 0 - include: - description: > - Additional information to include in the transcription response. - - `logprobs` will return the log probabilities of the tokens in the - - response to understand the model's confidence in the transcription. - - `logprobs` only works with response_format set to `json` and only - with - - the models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and - `gpt-4o-mini-transcribe-2025-12-15`. This field is not supported - when using `gpt-4o-transcribe-diarize`. - type: array - items: - $ref: '#/components/schemas/TranscriptionInclude' - timestamp_granularities: - description: > - The timestamp granularities to populate for this transcription. - `response_format` must be set `verbose_json` to use timestamp - granularities. Either or both of these options are supported: - `word`, or `segment`. Note: There is no additional latency for - segment timestamps, but generating word timestamps incurs additional - latency. - - This option is not available for `gpt-4o-transcribe-diarize`. - type: array - items: - type: string - enum: - - word - - segment - default: - - segment - stream: - anyOf: - - description: > - If set to true, the model response data will be streamed to the - client - - as it is generated using [server-sent - events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). - - See the [Streaming section of the Speech-to-Text - guide](/docs/guides/speech-to-text?lang=curl#streaming-transcriptions) - - for more information. - - - Note: Streaming is not supported for the `whisper-1` model and - will be ignored. - type: boolean - default: false - - type: 'null' - chunking_strategy: - anyOf: - - description: >- - Controls how the audio is cut into chunks. When set to `"auto"`, - the server first normalizes loudness and then uses voice - activity detection (VAD) to choose boundaries. `server_vad` - object can be provided to tweak VAD detection parameters - manually. If unset, the audio is transcribed as a single block. - Required when using `gpt-4o-transcribe-diarize` for inputs - longer than 30 seconds. - anyOf: - - type: string - enum: - - auto - default: auto - description: > - Automatically set chunking parameters based on the audio. - Must be set to `"auto"`. - x-stainless-const: true - - $ref: '#/components/schemas/VadConfig' - x-oaiTypeLabel: string - - type: 'null' - known_speaker_names: - description: > - Optional list of speaker names that correspond to the audio samples - provided in `known_speaker_references[]`. Each entry should be a - short identifier (for example `customer` or `agent`). Up to 4 - speakers are supported. - type: array - maxItems: 4 - items: - type: string - known_speaker_references: - description: > - Optional list of audio samples (as [data - URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) - that contain known speaker references matching - `known_speaker_names[]`. Each sample must be between 2 and 10 - seconds, and can use any of the same input audio formats supported - by `file`. - type: array - maxItems: 4 - items: - type: string - required: - - file - - model - CreateTranscriptionResponseDiarizedJson: - type: object - description: > - Represents a diarized transcription response returned by the model, - including the combined transcript and speaker-segment annotations. - properties: - task: + description: The name of the file. + object: type: string - description: The type of task that was run. Always `transcribe`. + description: The object type, which is always `file`. enum: - - transcribe + - file x-stainless-const: true - duration: - type: number - format: double - description: Duration of the input audio in seconds. - text: + purpose: type: string - description: The concatenated transcript text for the entire audio input. - segments: - type: array description: >- - Segments of the transcript annotated with timestamps and speaker - labels. - items: - $ref: '#/components/schemas/TranscriptionDiarizedSegment' - usage: - type: object - description: Token or duration usage statistics for the request. - oneOf: - - $ref: '#/components/schemas/TranscriptTextUsageTokens' - title: Token Usage - - $ref: '#/components/schemas/TranscriptTextUsageDuration' - title: Duration Usage - discriminator: - propertyName: type - required: - - task - - duration - - text - - segments - x-oaiMeta: - name: The transcription object (Diarized JSON) - group: audio - example: | - { - "task": "transcribe", - "duration": 42.7, - "text": "Agent: Thanks for calling OpenAI support.\nCustomer: Hi, I need help with diarization.", - "segments": [ - { - "type": "transcript.text.segment", - "id": "seg_001", - "start": 0.0, - "end": 5.2, - "text": "Thanks for calling OpenAI support.", - "speaker": "agent" - }, - { - "type": "transcript.text.segment", - "id": "seg_002", - "start": 5.2, - "end": 12.8, - "text": "Hi, I need help with diarization.", - "speaker": "A" - } - ], - "usage": { - "type": "duration", - "seconds": 43 - } - } - CreateTranscriptionResponseJson: - type: object - description: >- - Represents a transcription response returned by model, based on the - provided input. - properties: - text: - type: string - description: The transcribed text. - logprobs: - type: array - optional: true - description: > - The log probabilities of the tokens in the transcription. Only - returned with the models `gpt-4o-transcribe` and - `gpt-4o-mini-transcribe` if `logprobs` is added to the `include` - array. - items: - type: object - properties: - token: - type: string - description: The token in the transcription. - logprob: - type: number - description: The log probability of the token. - bytes: - type: array - items: - type: number - description: The bytes of the token. - usage: - type: object - description: Token usage statistics for the request. - oneOf: - - $ref: '#/components/schemas/TranscriptTextUsageTokens' - title: Token Usage - - $ref: '#/components/schemas/TranscriptTextUsageDuration' - title: Duration Usage - required: - - text - x-oaiMeta: - name: The transcription object (JSON) - group: audio - example: | - { - "text": "Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.", - "usage": { - "type": "tokens", - "input_tokens": 14, - "input_token_details": { - "text_tokens": 10, - "audio_tokens": 4 - }, - "output_tokens": 101, - "total_tokens": 115 - } - } - CreateTranscriptionResponseStreamEvent: - anyOf: - - $ref: '#/components/schemas/TranscriptTextSegmentEvent' - - $ref: '#/components/schemas/TranscriptTextDeltaEvent' - - $ref: '#/components/schemas/TranscriptTextDoneEvent' - discriminator: - propertyName: type - CreateTranscriptionResponseVerboseJson: - type: object - description: >- - Represents a verbose json transcription response returned by model, - based on the provided input. - properties: - language: + The intended purpose of the file. Supported values are `assistants`, + `assistants_output`, `batch`, `batch_output`, `fine-tune`, + `fine-tune-results`, `vision`, and `user_data`. + enum: + - assistants + - assistants_output + - batch + - batch_output + - fine-tune + - fine-tune-results + - vision + - user_data + status: type: string - description: The language of the input audio. - duration: - type: number - format: double - description: The duration of the input audio. - text: + deprecated: true + description: >- + Deprecated. The current status of the file, which can be either + `uploaded`, `processed`, or `error`. + enum: + - uploaded + - processed + - error + status_details: type: string - description: The transcribed text. - words: - type: array - description: Extracted words and their corresponding timestamps. - items: - $ref: '#/components/schemas/TranscriptionWord' - segments: - type: array - description: Segments of the transcribed text and their corresponding details. - items: - $ref: '#/components/schemas/TranscriptionSegment' - usage: - $ref: '#/components/schemas/TranscriptTextUsageDuration' + deprecated: true + description: >- + Deprecated. For details on why a fine-tuning training file failed + validation, see the `error` field on `fine_tuning.job`. required: - - language - - duration - - text + - id + - object + - bytes + - created_at + - filename + - purpose + - status x-oaiMeta: - name: The transcription object (Verbose JSON) - group: audio + name: The file object example: | { - "task": "transcribe", - "language": "english", - "duration": 8.470000267028809, - "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.", - "segments": [ - { - "id": 0, - "seek": 0, - "start": 0.0, - "end": 3.319999933242798, - "text": " The beach was a popular spot on a hot summer day.", - "tokens": [ - 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530 - ], - "temperature": 0.0, - "avg_logprob": -0.2860786020755768, - "compression_ratio": 1.2363636493682861, - "no_speech_prob": 0.00985979475080967 - }, - ... - ], - "usage": { - "type": "duration", - "seconds": 9 - } + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1680202602, + "filename": "salesOverview.pdf", + "purpose": "assistants", } - CreateTranslationRequest: + OrganizationCertificate: type: object - additionalProperties: false + description: >- + Represents an individual certificate configured at the organization + level. properties: - file: - description: > - The audio file object (not file name) translate, in one of these - formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. + object: type: string - x-oaiTypeLabel: file - format: binary - model: - description: > - ID of the model to use. Only `whisper-1` (which is powered by our - open source Whisper V2 model) is currently available. - example: whisper-1 + enum: + - organization.certificate + description: The object type, which is always `organization.certificate`. + x-stainless-const: true + id: + type: string + description: The identifier, which can be referenced in API endpoints + name: anyOf: - type: string - - type: string - enum: - - whisper-1 - x-stainless-const: true - x-oaiTypeLabel: string - prompt: - description: > - An optional text to guide the model's style or continue a previous - audio segment. The [prompt](/docs/guides/speech-to-text#prompting) - should be in English. - type: string - response_format: - description: > - The format of the output, in one of these options: `json`, `text`, - `srt`, `verbose_json`, or `vtt`. - type: string - enum: - - json - - text - - srt - - verbose_json - - vtt - default: json - temperature: - description: > - The sampling temperature, between 0 and 1. Higher values like 0.8 - will make the output more random, while lower values like 0.2 will - make it more focused and deterministic. If set to 0, the model will - use [log probability](https://en.wikipedia.org/wiki/Log_probability) - to automatically increase the temperature until certain thresholds - are hit. - type: number - default: 0 + - type: 'null' + description: The name of the certificate. + created_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) of when the certificate was + uploaded. + certificate_details: + type: object + properties: + valid_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) of when the certificate becomes + valid. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the certificate expires. + active: + type: boolean + description: >- + Whether the certificate is currently active at the organization + level. required: - - file - - model - CreateTranslationResponseJson: + - object + - id + - name + - created_at + - certificate_details + - active + OrganizationCertificateActivationResponse: type: object properties: - text: + object: type: string + enum: + - organization.certificate.activation + description: The organization certificate activation result type. + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/OrganizationCertificate' required: - - text - CreateTranslationResponseVerboseJson: + - object + - data + OrganizationCertificateDeactivationResponse: type: object properties: - language: - type: string - description: The language of the output translation (always `english`). - duration: - type: number - format: double - description: The duration of the input audio. - text: + object: type: string - description: The translated text. - segments: + enum: + - organization.certificate.deactivation + description: The organization certificate deactivation result type. + x-stainless-const: true + data: type: array - description: Segments of the translated text and their corresponding details. items: - $ref: '#/components/schemas/TranscriptionSegment' + $ref: '#/components/schemas/OrganizationCertificate' required: - - language - - duration - - text - CreateUploadRequest: + - object + - data + OrganizationDataRetention: type: object - additionalProperties: false + description: Represents the organization's data retention control setting. properties: - filename: - description: | - The name of the file to upload. - type: string - purpose: - description: | - The intended purpose of the uploaded file. - - See the [documentation on File - purposes](/docs/api-reference/files/create#files-create-purpose). + object: type: string enum: - - assistants - - batch - - fine-tune - - vision - bytes: - description: | - The number of bytes in the file you are uploading. - type: integer - mime_type: - description: > - The MIME type of the file. - - - - This must fall within the supported MIME types for your file - purpose. See - - the supported MIME types for assistants and vision. + - organization.data_retention + description: The object type, which is always `organization.data_retention`. + x-stainless-const: true + type: type: string - expires_after: - $ref: '#/components/schemas/FileExpirationAfter' + enum: + - zero_data_retention + - modified_abuse_monitoring + - enhanced_zero_data_retention + - enhanced_modified_abuse_monitoring + description: The configured organization data retention type. required: - - filename - - purpose - - bytes - - mime_type - CreateVectorStoreFileBatchRequest: + - object + - type + x-oaiMeta: + name: The organization data retention object + example: | + { + "object": "organization.data_retention", + "type": "modified_abuse_monitoring" + } + OrganizationProjectCertificate: type: object - additionalProperties: false + description: Represents an individual certificate configured at the project level. properties: - file_ids: - description: >- - A list of [File](/docs/api-reference/files) IDs that the vector - store should use. Useful for tools like `file_search` that can - access files. If `attributes` or `chunking_strategy` are provided, - they will be applied to all files in the batch. The maximum batch - size is 2000 files. This endpoint is recommended for multi-file - ingestion and helps reduce per-vector-store write request pressure. - Mutually exclusive with `files`. - type: array - minItems: 1 - maxItems: 2000 - items: - type: string - files: + object: + type: string + enum: + - organization.project.certificate + description: The object type, which is always `organization.project.certificate`. + x-stainless-const: true + id: + type: string + description: The identifier, which can be referenced in API endpoints + name: + anyOf: + - type: string + - type: 'null' + description: The name of the certificate. + created_at: + type: integer + format: unixtime description: >- - A list of objects that each include a `file_id` plus optional - `attributes` or `chunking_strategy`. Use this when you need to - override metadata for specific files. The global `attributes` or - `chunking_strategy` will be ignored and must be specified for each - file. The maximum batch size is 2000 files. This endpoint is - recommended for multi-file ingestion and helps reduce - per-vector-store write request pressure. Mutually exclusive with - `file_ids`. - type: array - minItems: 1 - maxItems: 2000 - items: - $ref: '#/components/schemas/CreateVectorStoreFileRequest' - chunking_strategy: - $ref: '#/components/schemas/ChunkingStrategyRequestParam' - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' - anyOf: - - required: - - file_ids - - required: - - files - CreateVectorStoreFileRequest: + The Unix timestamp (in seconds) of when the certificate was + uploaded. + certificate_details: + type: object + properties: + valid_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) of when the certificate becomes + valid. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the certificate expires. + active: + type: boolean + description: Whether the certificate is currently active at the project level. + required: + - object + - id + - name + - created_at + - certificate_details + - active + OrganizationProjectCertificateActivationResponse: type: object - additionalProperties: false properties: - file_id: - description: >- - A [File](/docs/api-reference/files) ID that the vector store should - use. Useful for tools like `file_search` that can access files. For - multi-file ingestion, we recommend - [`file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch) - to minimize per-vector-store write requests. + object: type: string - chunking_strategy: - $ref: '#/components/schemas/ChunkingStrategyRequestParam' - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' + enum: + - organization.project.certificate.activation + description: The project certificate activation result type. + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/OrganizationProjectCertificate' required: - - file_id - CreateVectorStoreRequest: + - object + - data + OrganizationProjectCertificateDeactivationResponse: type: object - additionalProperties: false properties: - file_ids: - description: >- - A list of [File](/docs/api-reference/files) IDs that the vector - store should use. Useful for tools like `file_search` that can - access files. + object: + type: string + enum: + - organization.project.certificate.deactivation + description: The project certificate deactivation result type. + x-stainless-const: true + data: type: array - maxItems: 500 items: - type: string - name: - description: The name of the vector store. - type: string - description: - description: >- - A description for the vector store. Can be used to describe the - vector store's purpose. - type: string - expires_after: - $ref: '#/components/schemas/VectorStoreExpirationAfter' - chunking_strategy: - type: object - description: >- - The chunking strategy used to chunk the file(s). If not set, will - use the `auto` strategy. Only applicable if `file_ids` is non-empty. - oneOf: - - $ref: '#/components/schemas/AutoChunkingStrategyRequestParam' - - $ref: '#/components/schemas/StaticChunkingStrategyRequestParam' - metadata: - $ref: '#/components/schemas/Metadata' - CreateVoiceConsentRequest: + $ref: '#/components/schemas/OrganizationProjectCertificate' + required: + - object + - data + OrganizationSpendAlert: type: object - additionalProperties: false + description: Represents a spend alert configured at the organization level. properties: - name: + id: type: string - description: The label to use for this consent recording. - recording: + description: The identifier, which can be referenced in API endpoints. + object: type: string - format: binary - x-oaiTypeLabel: file - description: > - The consent audio recording file. Maximum size is 10 MiB. - - - Supported MIME types: - - `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, - `audio/flac`, `audio/webm`, `audio/mp4`. - language: + enum: + - organization.spend_alert + description: The object type, which is always `organization.spend_alert`. + x-stainless-const: true + threshold_amount: + type: integer + description: The alert threshold amount, in cents. + currency: type: string - description: >- - The BCP 47 language tag for the consent phrase (for example, - `en-US`). + enum: + - USD + description: The currency for the threshold amount. + interval: + type: string + enum: + - month + description: The time interval for evaluating spend against the threshold. + notification_channel: + $ref: '#/components/schemas/SpendAlertNotificationChannel' required: - - name - - recording - - language - CreateVoiceRequest: + - id + - object + - threshold_amount + - currency + - interval + - notification_channel + x-oaiMeta: + name: The organization spend alert object + example: | + { + "id": "alert_abc123", + "object": "organization.spend_alert", + "threshold_amount": 100000, + "currency": "USD", + "interval": "month", + "notification_channel": { + "type": "email", + "recipients": ["finance@example.com"], + "subject_prefix": "OpenAI spend alert" + } + } + OrganizationSpendAlertDeletedResource: type: object - additionalProperties: false + description: >- + Confirmation payload returned after deleting an organization spend + alert. properties: - name: + id: type: string - description: The name of the new voice. - audio_sample: + description: The deleted spend alert ID. + object: type: string - format: binary - x-oaiTypeLabel: file - description: > - The sample audio recording file. Maximum size is 10 MiB. - - - Supported MIME types: - - `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, - `audio/flac`, `audio/webm`, `audio/mp4`. - consent: + enum: + - organization.spend_alert.deleted + description: Always `organization.spend_alert.deleted`. + x-stainless-const: true + deleted: + type: boolean + description: Whether the spend alert was deleted. + required: + - id + - object + - deleted + OrganizationSpendAlertListResource: + type: object + description: Paginated list of organization spend alerts. + properties: + object: + type: string + enum: + - list + description: Always `list`. + x-stainless-const: true + data: + type: array + description: Spend alerts returned in the current page. + items: + $ref: '#/components/schemas/OrganizationSpendAlert' + first_id: + anyOf: + - type: string + - type: 'null' + description: The ID of the first spend alert in this page. + last_id: + anyOf: + - type: string + - type: 'null' + description: The ID of the last spend alert in this page. + has_more: + type: boolean + description: Whether more spend alerts are available when paginating. + required: + - object + - data + - first_id + - last_id + - has_more + OtherChunkingStrategyResponseParam: + type: object + title: Other Chunking Strategy + description: >- + This is returned when the chunking strategy is unknown. Typically, this + is because the file was indexed before the `chunking_strategy` concept + was introduced in the API. + additionalProperties: false + properties: + type: type: string - description: The consent recording ID (for example, `cons_1234`). + description: Always `other`. + enum: + - other + x-stainless-const: true required: - - name - - audio_sample - - consent - CustomToolCall: + - type + OutputAudio: type: object - title: Custom tool call + title: Output audio description: | - A call to a custom tool created by the model. + An audio output from the model. properties: type: type: string + description: | + The type of the output audio. Always `output_audio`. enum: - - custom_tool_call + - output_audio x-stainless-const: true - description: | - The type of the custom tool call. Always `custom_tool_call`. - id: + data: type: string description: | - The unique ID of the custom tool call in the OpenAI platform. - call_id: + Base64-encoded audio data from the model. + transcript: type: string - description: > - An identifier used to map this custom tool call to a tool call - output. - namespace: + description: | + The transcript of the audio data from the model. + required: + - type + - data + - transcript + OutputContent: + oneOf: + - $ref: '#/components/schemas/OutputTextContent' + - $ref: '#/components/schemas/RefusalContent' + - $ref: '#/components/schemas/ReasoningTextContent' + discriminator: + propertyName: type + OutputItem: + oneOf: + - $ref: '#/components/schemas/OutputMessage' + - $ref: '#/components/schemas/FileSearchToolCall' + - $ref: '#/components/schemas/FunctionToolCall' + - $ref: '#/components/schemas/FunctionToolCallOutputResource' + - $ref: '#/components/schemas/WebSearchToolCall' + - $ref: '#/components/schemas/ComputerToolCall' + - $ref: '#/components/schemas/ComputerToolCallOutputResource' + - $ref: '#/components/schemas/ReasoningItem' + - $ref: '#/components/schemas/Program' + - $ref: '#/components/schemas/ProgramOutput' + - $ref: '#/components/schemas/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $ref: '#/components/schemas/AdditionalTools' + - $ref: '#/components/schemas/CompactionBody' + - $ref: '#/components/schemas/ImageGenToolCall' + - $ref: '#/components/schemas/CodeInterpreterToolCall' + - $ref: '#/components/schemas/LocalShellToolCall' + - $ref: '#/components/schemas/LocalShellToolCallOutput' + - $ref: '#/components/schemas/FunctionShellCall' + - $ref: '#/components/schemas/FunctionShellCallOutput' + - $ref: '#/components/schemas/ApplyPatchToolCall' + - $ref: '#/components/schemas/ApplyPatchToolCallOutput' + - $ref: '#/components/schemas/MCPToolCall' + - $ref: '#/components/schemas/MCPListTools' + - $ref: '#/components/schemas/MCPApprovalRequest' + - $ref: '#/components/schemas/MCPApprovalResponseResource' + - $ref: '#/components/schemas/CustomToolCall' + - $ref: '#/components/schemas/CustomToolCallOutputResource' + discriminator: + propertyName: type + OutputMessage: + type: object + title: Output message + description: | + An output message from the model. + properties: + id: type: string description: | - The namespace of the custom tool being called. - name: + The unique ID of the output message. + type: type: string description: | - The name of the custom tool being called. - input: + The type of the output message. Always `message`. + enum: + - message + x-stainless-const: true + role: type: string description: | - The input for the custom tool call generated by the model. + The role of the output message. Always `assistant`. + enum: + - assistant + x-stainless-const: true + content: + type: array + description: | + The content of the output message. + items: + $ref: '#/components/schemas/OutputMessageContent' + phase: + anyOf: + - $ref: '#/components/schemas/MessagePhase' + - type: 'null' + status: + type: string + description: > + The status of the message input. One of `in_progress`, `completed`, + or + + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete required: + - id - type - - call_id - - name - - input - CustomToolCallOutput: + - role + - content + - status + OutputMessageContent: + oneOf: + - $ref: '#/components/schemas/OutputTextContent' + - $ref: '#/components/schemas/RefusalContent' + discriminator: + propertyName: type + ParallelToolCalls: + description: >- + Whether to enable [parallel function + calling](/docs/guides/function-calling#configuring-parallel-function-calling) + during tool use. + type: boolean + default: true + PartialImages: + anyOf: + - type: integer + maximum: 3 + minimum: 0 + default: 0 + example: 1 + description: > + The number of partial images to generate. This parameter is used for + + streaming responses that return partial images. Value must be + between 0 and 3. + + When set to 0, the response will be a single image sent in one + streaming event. + + + Note that the final image may be sent before the full number of + partial images + + are generated if the full image is generated more quickly. + - type: 'null' + PredictionContent: type: object - title: Custom tool call output + title: Static Content description: > - The output of a custom tool call from your code, being sent back to the - model. + Static predicted output content, such as the content of a text file that + is + + being regenerated. + required: + - type + - content properties: type: type: string enum: - - custom_tool_call_output - x-stainless-const: true - description: > - The type of the custom tool call output. Always - `custom_tool_call_output`. - id: - type: string + - content description: | - The unique ID of the custom tool call output in the OpenAI platform. - call_id: - type: string + The type of the predicted content you want to provide. This type is + currently always `content`. + x-stainless-const: true + content: description: > - The call ID, used to map this custom tool call output to a custom - tool call. - output: - description: | - The output from the custom tool call generated by your code. - Can be a string or an list of output content. + The content that should be matched when generating a model response. + + If generated tokens would match this content, the entire model + response + + can be returned much more quickly. oneOf: - type: string + title: Text content description: | - A string of the output of the custom tool call. - title: string output + The content used for a Predicted Output. This is often the + text of a file you are regenerating with minor changes. - type: array + description: >- + An array of content parts with a defined type. Supported options + differ based on the [model](/docs/models) being used to generate + the response. Can contain text inputs. + title: Array of content parts items: - $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' - title: output content list - description: | - Text, image, or file output of the custom tool call. - required: - - type - - call_id - - output - CustomToolCallOutputResource: - title: ResponseCustomToolCallOutputItem - allOf: - - $ref: '#/components/schemas/CustomToolCallOutput' - - type: object - properties: - id: - type: string - description: | - The unique ID of the custom tool call output item. - status: - description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. - $ref: '#/components/schemas/FunctionCallOutputStatusEnum' - created_by: - type: string - description: | - The identifier of the actor that created the item. - required: - - id - - status - CustomToolCallResource: - title: ResponseCustomToolCallItem - allOf: - - $ref: '#/components/schemas/CustomToolCall' - - type: object - properties: - id: - type: string - description: | - The unique ID of the custom tool call item. - status: - description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. - $ref: '#/components/schemas/FunctionCallStatus' - created_by: - type: string - description: | - The identifier of the actor that created the item. - required: - - id - - status - CustomToolChatCompletions: + $ref: >- + #/components/schemas/ChatCompletionRequestMessageContentPartText + minItems: 1 + Project: type: object - title: Custom tool - description: | - A custom tool that processes input using a specified format. + description: Represents an individual project. properties: - type: + id: + type: string + description: The identifier, which can be referenced in API endpoints + object: type: string enum: - - custom - description: The type of the custom tool. Always `custom`. + - organization.project + description: The object type, which is always `organization.project` x-stainless-const: true - custom: - type: object - title: Custom tool properties - description: | - Properties of the custom tool. - properties: - name: - type: string - description: The name of the custom tool, used to identify it in tool calls. - description: - type: string - description: > - Optional description of the custom tool, used to provide more - context. - format: - description: > - The input format for the custom tool. Default is unconstrained - text. - oneOf: - - type: object - title: Text format - description: Unconstrained free-form text. - properties: - type: - type: string - enum: - - text - description: Unconstrained text format. Always `text`. - x-stainless-const: true - required: - - type - additionalProperties: false - - type: object - title: Grammar format - description: A grammar defined by the user. - properties: - type: - type: string - enum: - - grammar - description: Grammar format. Always `grammar`. - x-stainless-const: true - grammar: - type: object - title: Grammar format - description: Your chosen grammar. - properties: - definition: - type: string - description: The grammar definition. - syntax: - type: string - description: >- - The syntax of the grammar definition. One of `lark` - or `regex`. - enum: - - lark - - regex - required: - - definition - - syntax - required: - - type - - grammar - additionalProperties: false - required: - - name + name: + anyOf: + - type: string + - type: 'null' + description: The name of the project. This appears in reporting. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the project was created. + archived_at: + anyOf: + - type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) of when the project was archived + or `null`. + - type: 'null' + status: + anyOf: + - type: string + - type: 'null' + description: '`active` or `archived`' + external_key_id: + anyOf: + - type: string + - type: 'null' + description: The external key associated with the project. required: - - type - - custom - DeleteAssistantResponse: + - id + - object + - created_at + x-oaiMeta: + name: The project object + example: | + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project example", + "created_at": 1711471533, + "archived_at": null, + "status": "active", + "external_key_id": null + } + ProjectApiKey: type: object + description: Represents an individual API key in a project. properties: - id: - type: string - deleted: - type: boolean object: type: string enum: - - assistant.deleted + - organization.project.api_key + description: The object type, which is always `organization.project.api_key` x-stainless-const: true + redacted_value: + type: string + description: The redacted value of the API key + name: + type: string + description: The name of the API key + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the API key was created + last_used_at: + anyOf: + - type: integer + format: unixtime + - type: 'null' + description: The Unix timestamp (in seconds) of when the API key was last used. + id: + type: string + description: The identifier, which can be referenced in API endpoints + owner: + type: object + properties: + type: + type: string + enum: + - user + - service_account + description: '`user` or `service_account`' + user: + $ref: '#/components/schemas/ProjectApiKeyOwnerUser' + service_account: + $ref: '#/components/schemas/ProjectApiKeyOwnerServiceAccount' required: - - id - object - - deleted - DeleteCertificateResponse: + - redacted_value + - name + - created_at + - last_used_at + - id + - owner + x-oaiMeta: + name: The project API key object + example: | + { + "object": "organization.project.api_key", + "redacted_value": "sk-abc...def", + "name": "My API Key", + "created_at": 1711471533, + "last_used_at": 1711471534, + "id": "key_abc", + "owner": { + "type": "user", + "user": { + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "created_at": 1711471533 + } + } + } + ProjectApiKeyDeleteResponse: type: object properties: object: type: string - description: The object type, must be `certificate.deleted`. enum: - - certificate.deleted + - organization.project.api_key.deleted x-stainless-const: true id: type: string - description: The ID of the certificate that was deleted. + deleted: + type: boolean required: - object - id - DeleteFileResponse: + - deleted + ProjectApiKeyListResponse: type: object properties: - id: - type: string object: type: string enum: - - file + - list x-stainless-const: true - deleted: + data: + type: array + items: + $ref: '#/components/schemas/ProjectApiKey' + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: type: boolean required: - - id - object - - deleted - DeleteFineTuningCheckpointPermissionResponse: + - data + - has_more + ProjectApiKeyOwnerServiceAccount: type: object + description: The service account that owns a project API key. properties: id: type: string - description: >- - The ID of the fine-tuned model checkpoint permission that was - deleted. - object: + description: The identifier, which can be referenced in API endpoints + name: type: string - description: The object type, which is always "checkpoint.permission". - enum: - - checkpoint.permission - x-stainless-const: true - deleted: - type: boolean + description: The name of the service account. + created_at: + type: integer + format: unixtime description: >- - Whether the fine-tuned model checkpoint permission was successfully - deleted. + The Unix timestamp (in seconds) of when the service account was + created. + role: + type: string + description: The service account's project role. required: - id - - object - - deleted - DeleteMessageResponse: + - name + - created_at + - role + ProjectApiKeyOwnerUser: type: object + description: The user that owns a project API key. properties: id: type: string - deleted: - type: boolean - object: + description: The identifier, which can be referenced in API endpoints + email: type: string - enum: - - thread.message.deleted - x-stainless-const: true + description: The email address of the user. + name: + type: string + description: The name of the user. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the user was created. + role: + type: string + description: The user's project role. required: - id - - object - - deleted - DeleteModelResponse: + - email + - name + - created_at + - role + ProjectCreateRequest: type: object properties: - id: - type: string - deleted: - type: boolean - object: + name: type: string + description: The friendly name of the project, this name appears in reports. + geography: + anyOf: + - type: string + - type: 'null' + description: >- + Create the project with the specified data residency region. Your + organization must have access to Data residency functionality in + order to use. See [data residency + controls](/docs/guides/your-data#data-residency-controls) to review + the functionality and limitations of setting this field. + external_key_id: + anyOf: + - type: string + - type: 'null' + description: External key ID to associate with the project. required: - - id - - object - - deleted - DeleteThreadResponse: + - name + ProjectDataRetention: type: object + description: Represents a project's data retention control setting. properties: - id: - type: string - deleted: - type: boolean object: type: string enum: - - thread.deleted + - project.data_retention + description: The object type, which is always `project.data_retention`. x-stainless-const: true + type: + type: string + enum: + - organization_default + - none + - zero_data_retention + - modified_abuse_monitoring + - enhanced_zero_data_retention + - enhanced_modified_abuse_monitoring + description: The configured project data retention type. required: - - id - object - - deleted - DeleteVectorStoreFileResponse: + - type + x-oaiMeta: + name: The project data retention object + example: | + { + "object": "project.data_retention", + "type": "organization_default" + } + ProjectGroup: type: object + description: Details about a group's membership in a project. properties: - id: - type: string - deleted: - type: boolean object: type: string enum: - - vector_store.file.deleted + - project.group + description: Always `project.group`. x-stainless-const: true - required: - - id - - object - - deleted - DeleteVectorStoreResponse: - type: object - properties: - id: + project_id: type: string - deleted: - type: boolean - object: + description: Identifier of the project. + group_id: + type: string + description: Identifier of the group that has access to the project. + group_name: + type: string + description: Display name of the group. + group_type: type: string enum: - - vector_store.deleted - x-stainless-const: true + - group + - tenant_group + description: The type of the group. + created_at: + type: integer + format: unixtime + description: >- + Unix timestamp (in seconds) when the group was granted project + access. required: - - id - object - - deleted - DeletedConversation: - title: The deleted conversation object - allOf: - - $ref: '#/components/schemas/DeletedConversationResource' + - project_id + - group_id + - group_name + - group_type + - created_at x-oaiMeta: - name: The deleted conversation object - group: conversations - DeletedRoleAssignmentResource: + name: The project group object + example: | + { + "object": "project.group", + "project_id": "proj_abc123", + "group_id": "group_01J1F8ABCDXYZ", + "group_name": "Support Team", + "group_type": "group", + "created_at": 1711471533 + } + ProjectGroupDeletedResource: type: object - description: Confirmation payload returned after unassigning a role. + description: Confirmation payload returned after removing a group from a project. properties: object: type: string - description: >- - Identifier for the deleted assignment, such as `group.role.deleted` - or `user.role.deleted`. + enum: + - project.group.deleted + description: Always `project.group.deleted`. + x-stainless-const: true deleted: type: boolean - description: Whether the assignment was removed. + description: Whether the group membership in the project was removed. required: - object - deleted x-oaiMeta: - name: Role assignment deletion confirmation + name: Project group deletion confirmation example: | { - "object": "group.role.deleted", + "object": "project.group.deleted", "deleted": true } - DoneEvent: + ProjectGroupListResource: type: object + description: Paginated list of groups that have access to a project. properties: - event: + object: type: string enum: - - done + - list + description: Always `list`. x-stainless-const: true data: - type: string - enum: - - '[DONE]' - x-stainless-const: true - required: - - event - - data - description: Occurs when a stream ends. - x-oaiMeta: - dataDescription: '`data` is `[DONE]`' - EasyInputMessage: - type: object - title: Input message - description: > - A message input to the model with a role indicating instruction - following - - hierarchy. Instructions given with the `developer` or `system` role take - - precedence over instructions given with the `user` role. Messages with - the - - `assistant` role are presumed to have been generated by the model in - previous - - interactions. - properties: - role: - type: string - description: > - The role of the message input. One of `user`, `assistant`, `system`, - or - - `developer`. - enum: - - user - - assistant - - system - - developer - content: - description: > - Text, image, or audio input to the model, used to generate a - response. - - Can also contain previous assistant responses. - oneOf: - - type: string - title: Text input - description: | - A text input to the model. - - $ref: '#/components/schemas/InputMessageContentList' - phase: - anyOf: - - $ref: '#/components/schemas/MessagePhase' - - type: 'null' - type: - type: string - description: | - The type of the message input. Always `message`. - enum: - - message - x-stainless-const: true - required: - - role - - content - EditImageBodyJsonParam: - type: object - description: > - JSON request body for image edits. - - - Use `images` (array of `ImageRefParam`) instead of multipart `image` - uploads. - - You can reference images via external URLs, data URLs, or uploaded file - IDs. - - JSON edits support GPT image models only; DALL-E edits require multipart - (`dall-e-2` only). - properties: - model: - anyOf: - - type: string - - type: string - enum: - - gpt-image-1.5 - - gpt-image-1 - - gpt-image-1-mini - - chatgpt-image-latest - - type: 'null' - x-oaiTypeLabel: string - default: gpt-image-1.5 - example: gpt-image-1.5 - description: The model to use for image editing. - images: type: array - minItems: 1 - maxItems: 16 - description: | - Input image references to edit. - For GPT image models, you can provide up to 16 images. + description: Project group memberships returned in the current page. items: - $ref: '#/components/schemas/ImageRefParam' - mask: - $ref: '#/components/schemas/ImageRefParam' - prompt: - type: string - minLength: 1 - maxLength: 32000 - example: Add a watercolor effect and keep the subject centered - description: A text description of the desired image edit. - 'n': - anyOf: - - type: integer - minimum: 1 - maximum: 10 - - type: 'null' - default: 1 - example: 1 - description: The number of edited images to generate. - quality: - anyOf: - - type: string - enum: - - low - - medium - - high - - auto - - type: 'null' - default: auto - example: high - description: | - Output quality for GPT image models. - input_fidelity: - anyOf: - - type: string - enum: - - high - - low - - type: 'null' - description: Controls fidelity to the original input image(s). - size: - anyOf: - - type: string - enum: - - auto - - 1024x1024 - - 1536x1024 - - 1024x1536 - - type: 'null' - default: auto - example: 1024x1024 - description: Requested output image size. - user: - type: string - example: user-1234 - description: > - A unique identifier representing your end-user, which can help - OpenAI - - monitor and detect abuse. - output_format: - anyOf: - - type: string - enum: - - png - - jpeg - - webp - - type: 'null' - default: png - example: png - description: Output image format. Supported for GPT image models. - output_compression: - anyOf: - - type: integer - minimum: 0 - maximum: 100 - - type: 'null' - example: 100 - description: Compression level for `jpeg` or `webp` output. - moderation: - anyOf: - - type: string - enum: - - low - - auto - - type: 'null' - default: auto - example: auto - description: Moderation level for GPT image models. - background: + $ref: '#/components/schemas/ProjectGroup' + has_more: + type: boolean + description: Whether additional project group memberships are available. + next: + description: >- + Cursor to fetch the next page of results, or `null` when there are + no more results. anyOf: - type: string - enum: - - transparent - - opaque - - auto - - type: 'null' - default: auto - example: transparent - description: Background behavior for generated image output. - stream: - anyOf: - - type: boolean - type: 'null' - default: false - example: false - description: Stream partial image results as events. - partial_images: - $ref: '#/components/schemas/PartialImages' required: - - images - - prompt - Embedding: + - object + - data + - has_more + - next + x-oaiMeta: + name: Project group list + example: | + { + "object": "list", + "data": [ + { + "object": "project.group", + "project_id": "proj_abc123", + "group_id": "group_01J1F8ABCDXYZ", + "group_name": "Support Team", + "created_at": 1711471533 + } + ], + "has_more": false, + "next": null + } + ProjectHostedToolPermissions: type: object - description: | - Represents an embedding vector returned by embedding endpoint. + description: Represents hosted tool permissions for a project. properties: - index: - type: integer - description: The index of the embedding in the list of embeddings. - embedding: - type: array - description: > - The embedding vector, which is a list of floats. The length of - vector depends on the model as listed in the [embedding - guide](/docs/guides/embeddings). - items: - type: number - format: float - object: - type: string - description: The object type, which is always "embedding". - enum: - - embedding - x-stainless-const: true + file_search: + $ref: '#/components/schemas/HostedToolPermission' + web_search: + $ref: '#/components/schemas/HostedToolPermission' + image_generation: + $ref: '#/components/schemas/HostedToolPermission' + mcp: + $ref: '#/components/schemas/HostedToolPermission' + code_interpreter: + $ref: '#/components/schemas/HostedToolPermission' required: - - index - - object - - embedding + - file_search + - web_search + - image_generation + - mcp + - code_interpreter x-oaiMeta: - name: The embedding object + name: The project hosted tool permissions object example: | { - "object": "embedding", - "embedding": [ - 0.0023064255, - -0.009327292, - .... (1536 floats total for ada-002) - -0.0028842222, - ], - "index": 0 + "file_search": { + "enabled": true + }, + "web_search": { + "enabled": true + }, + "image_generation": { + "enabled": true + }, + "mcp": { + "enabled": true + }, + "code_interpreter": { + "enabled": true + } } - Error: + ProjectHostedToolPermissionsUpdateRequest: type: object properties: - code: + file_search: + anyOf: + - $ref: '#/components/schemas/HostedToolPermissionUpdate' + - type: 'null' + description: The file search permission update. + web_search: anyOf: - - type: string + - $ref: '#/components/schemas/HostedToolPermissionUpdate' - type: 'null' - message: - type: string - param: + description: The web search permission update. + image_generation: anyOf: - - type: string + - $ref: '#/components/schemas/HostedToolPermissionUpdate' - type: 'null' - type: - type: string - required: - - type - - message - - param - - code - ErrorEvent: + description: The image generation permission update. + mcp: + anyOf: + - $ref: '#/components/schemas/HostedToolPermissionUpdate' + - type: 'null' + description: The MCP permission update. + code_interpreter: + anyOf: + - $ref: '#/components/schemas/HostedToolPermissionUpdate' + - type: 'null' + description: The code interpreter permission update. + ProjectListResponse: type: object properties: - event: + object: type: string enum: - - error + - list x-stainless-const: true data: - $ref: '#/components/schemas/Error' + type: array + items: + $ref: '#/components/schemas/Project' + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean required: - - event + - object - data - description: >- - Occurs when an [error](/docs/guides/error-codes#api-errors) occurs. This - can happen due to an internal server error or a timeout. - x-oaiMeta: - dataDescription: '`data` is an [error](/docs/guides/error-codes#api-errors)' - ErrorResponse: - type: object - properties: - error: - $ref: '#/components/schemas/Error' - required: - - error - Eval: + - has_more + ProjectModelPermissions: type: object - title: Eval - description: | - An Eval object with a data source config and testing criteria. - An Eval represents a task to be done for your LLM integration. - Like: - - Improve the quality of my chatbot - - See how well my chatbot handles customer support - - Check if o4-mini is better at my usecase than gpt-4o + description: Represents the model allowlist or denylist policy for a project. properties: object: type: string enum: - - eval - default: eval - description: The object type. + - project.model_permissions + description: The object type, which is always `project.model_permissions`. x-stainless-const: true - id: - type: string - description: Unique identifier for the evaluation. - name: + mode: type: string - description: The name of the evaluation. - example: Chatbot effectiveness Evaluation - data_source_config: - type: object - description: Configuration of data sources used in runs of the evaluation. - oneOf: - - $ref: '#/components/schemas/EvalCustomDataSourceConfig' - - $ref: '#/components/schemas/EvalLogsDataSourceConfig' - - $ref: '#/components/schemas/EvalStoredCompletionsDataSourceConfig' - testing_criteria: - default: eval - description: A list of testing criteria. + enum: + - allow_list + - deny_list + description: Whether the project uses an allowlist or a denylist. + model_ids: type: array items: - oneOf: - - $ref: '#/components/schemas/EvalGraderLabelModel' - - $ref: '#/components/schemas/EvalGraderStringCheck' - - $ref: '#/components/schemas/EvalGraderTextSimilarity' - - $ref: '#/components/schemas/EvalGraderPython' - - $ref: '#/components/schemas/EvalGraderScoreModel' - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the eval was created. - metadata: - $ref: '#/components/schemas/Metadata' + type: string + description: The model IDs included in the model permissions policy. required: - - id - - data_source_config - object - - testing_criteria - - name - - created_at - - metadata + - mode + - model_ids x-oaiMeta: - name: The eval object - group: evals + name: The project model permissions object example: | { - "object": "eval", - "id": "eval_67abd54d9b0081909a86353f6fb9317a", - "data_source_config": { - "type": "custom", - "item_schema": { - "type": "object", - "properties": { - "label": {"type": "string"}, - }, - "required": ["label"] - }, - "include_sample_schema": true - }, - "testing_criteria": [ - { - "name": "My string check grader", - "type": "string_check", - "input": "{{sample.output_text}}", - "reference": "{{item.label}}", - "operation": "eq", - } - ], - "name": "External Data Eval", - "created_at": 1739314509, - "metadata": { - "test": "synthetics", - } + "object": "project.model_permissions", + "mode": "allow_list", + "model_ids": [ + "gpt-4.1", + "o3" + ] } - EvalApiError: + ProjectModelPermissionsDeleteResponse: type: object - title: EvalApiError - description: | - An object representing an error response from the Eval API. + description: Confirmation payload returned after deleting project model permissions. properties: - code: - type: string - description: The error code. - message: + object: type: string - description: The error message. + enum: + - project.model_permissions.deleted + description: >- + The object type, which is always + `project.model_permissions.deleted`. + x-stainless-const: true + deleted: + type: boolean + description: Whether the project model permissions were deleted. required: - - code - - message + - object + - deleted x-oaiMeta: - name: The API error object - group: evals + name: Project model permissions deletion confirmation example: | { - "code": "internal_error", - "message": "The eval run failed due to an internal error." + "object": "project.model_permissions.deleted", + "deleted": true } - EvalCustomDataSourceConfig: + ProjectModelPermissionsUpdateRequest: type: object - title: CustomDataSourceConfig - description: > - A CustomDataSourceConfig which specifies the schema of your `item` and - optionally `sample` namespaces. - - The response schema defines the shape of the data that will be: - - - Used to define your testing criteria and - - - What data is required when creating a run properties: - type: + mode: type: string enum: - - custom - default: custom - description: The type of data source. Always `custom`. + - allow_list + - deny_list + description: The model permissions mode to apply. + model_ids: + type: array + items: + type: string + description: The model IDs included in this permissions policy. + required: + - mode + - model_ids + ProjectRateLimit: + type: object + description: Represents a project rate limit config. + properties: + object: + type: string + enum: + - project.rate_limit + description: The object type, which is always `project.rate_limit` x-stainless-const: true - schema: - type: object - description: | - The json schema for the run data source items. - Learn how to build JSON schemas [here](https://json-schema.org/). - additionalProperties: true - example: | - { - "type": "object", - "properties": { - "item": { - "type": "object", - "properties": { - "label": {"type": "string"}, - }, - "required": ["label"] - } - }, - "required": ["item"] - } + id: + type: string + description: The identifier, which can be referenced in API endpoints. + model: + type: string + description: The model this rate limit applies to. + max_requests_per_1_minute: + type: integer + description: The maximum requests per minute. + max_tokens_per_1_minute: + type: integer + description: The maximum tokens per minute. + max_images_per_1_minute: + type: integer + description: The maximum images per minute. Only present for relevant models. + max_audio_megabytes_per_1_minute: + type: integer + description: >- + The maximum audio megabytes per minute. Only present for relevant + models. + max_requests_per_1_day: + type: integer + description: The maximum requests per day. Only present for relevant models. + batch_1_day_max_input_tokens: + type: integer + description: >- + The maximum batch input tokens per day. Only present for relevant + models. required: - - type - - schema + - object + - id + - model + - max_requests_per_1_minute + - max_tokens_per_1_minute x-oaiMeta: - name: The eval custom data source config object - group: evals + name: The project rate limit object example: | { - "type": "custom", - "schema": { - "type": "object", - "properties": { - "item": { - "type": "object", - "properties": { - "label": {"type": "string"}, - }, - "required": ["label"] - } - }, - "required": ["item"] - } + "object": "project.rate_limit", + "id": "rl_ada", + "model": "ada", + "max_requests_per_1_minute": 600, + "max_tokens_per_1_minute": 150000, + "max_images_per_1_minute": 10 } - EvalGraderLabelModel: - type: object - title: LabelModelGrader - allOf: - - $ref: '#/components/schemas/GraderLabelModel' - EvalGraderPython: - type: object - title: PythonGrader - allOf: - - $ref: '#/components/schemas/GraderPython' - - type: object - properties: - pass_threshold: - type: number - description: The threshold for the score. - x-oaiMeta: - name: Eval Python Grader - group: graders - example: | - { - "type": "python", - "name": "Example python grader", - "image_tag": "2025-05-08", - "source": """ - def grade(sample: dict, item: dict) -> float: - \""" - Returns 1.0 if `output_text` equals `label`, otherwise 0.0. - \""" - output = sample.get("output_text") - label = item.get("label") - return 1.0 if output == label else 0.0 - """, - "pass_threshold": 0.8 - } - EvalGraderScoreModel: - type: object - title: ScoreModelGrader - allOf: - - $ref: '#/components/schemas/GraderScoreModel' - - type: object - properties: - pass_threshold: - type: number - description: The threshold for the score. - EvalGraderStringCheck: - type: object - title: StringCheckGrader - allOf: - - $ref: '#/components/schemas/GraderStringCheck' - EvalGraderTextSimilarity: - type: object - title: TextSimilarityGrader - allOf: - - $ref: '#/components/schemas/GraderTextSimilarity' - - type: object - properties: - pass_threshold: - type: number - description: The threshold for the score. - required: - - pass_threshold - x-oaiMeta: - name: Text Similarity Grader - group: graders - example: | - { - "type": "text_similarity", - "name": "Example text similarity grader", - "input": "{{sample.output_text}}", - "reference": "{{item.label}}", - "pass_threshold": 0.8, - "evaluation_metric": "fuzzy_match" - } - EvalItem: + ProjectRateLimitListResponse: type: object - title: Eval message object - description: > - A message input to the model with a role indicating instruction - following - - hierarchy. Instructions given with the `developer` or `system` role take - - precedence over instructions given with the `user` role. Messages with - the - - `assistant` role are presumed to have been generated by the model in - previous - - interactions. properties: - role: - type: string - description: > - The role of the message input. One of `user`, `assistant`, `system`, - or - - `developer`. - enum: - - user - - assistant - - system - - developer - content: - $ref: '#/components/schemas/EvalItemContent' - type: + object: type: string - description: | - The type of the message input. Always `message`. enum: - - message + - list x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/ProjectRateLimit' + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean required: - - role - - content - EvalItemContent: - title: Eval content - description: > - Inputs to the model - can contain template strings. Supports text, - output text, input images, and input audio, either as a single item or - an array of items. - oneOf: - - $ref: '#/components/schemas/EvalItemContentItem' - - $ref: '#/components/schemas/EvalItemContentArray' - EvalItemContentArray: - type: array - title: An array of Input text, Output text, Input image, and Input audio - description: > - A list of inputs, each of which may be either an input text, output - text, input - - image, or input audio object. - items: - $ref: '#/components/schemas/EvalItemContentItem' - EvalItemContentItem: - title: Eval content item - description: > - A single content item: input text, output text, input image, or input - audio. - oneOf: - - $ref: '#/components/schemas/EvalItemContentText' - - $ref: '#/components/schemas/InputTextContent' - - $ref: '#/components/schemas/EvalItemContentOutputText' - - $ref: '#/components/schemas/EvalItemInputImage' - - $ref: '#/components/schemas/InputAudio' - EvalItemContentOutputText: + - object + - data + - has_more + ProjectRateLimitUpdateRequest: type: object - title: Output text - description: | - A text output from the model. properties: - type: - type: string - description: | - The type of the output text. Always `output_text`. - enum: - - output_text - x-stainless-const: true - text: - type: string - description: | - The text output from the model. - required: - - type - - text - EvalItemContentText: - type: string - title: Text input - description: | - A text input to the model. - EvalItemInputImage: - title: Input image - description: An image input block used within EvalItem content arrays. + max_requests_per_1_minute: + type: integer + description: The maximum requests per minute. + max_tokens_per_1_minute: + type: integer + description: The maximum tokens per minute. + max_images_per_1_minute: + type: integer + description: The maximum images per minute. Only relevant for certain models. + max_audio_megabytes_per_1_minute: + type: integer + description: >- + The maximum audio megabytes per minute. Only relevant for certain + models. + max_requests_per_1_day: + type: integer + description: The maximum requests per day. Only relevant for certain models. + batch_1_day_max_input_tokens: + type: integer + description: >- + The maximum batch input tokens per day. Only relevant for certain + models. + ProjectServiceAccount: type: object + description: Represents an individual service account in a project. properties: - type: + object: type: string - description: | - The type of the image input. Always `input_image`. enum: - - input_image + - organization.project.service_account + description: >- + The object type, which is always + `organization.project.service_account` x-stainless-const: true - image_url: + id: type: string - format: uri - description: | - The URL of the image input. - detail: + description: The identifier, which can be referenced in API endpoints + name: type: string - description: > - The detail level of the image to be sent to the model. One of - `high`, `low`, or `auto`. Defaults to `auto`. - required: - - type - - image_url - EvalJsonlFileContentSource: - type: object - title: EvalJsonlFileContentSource - properties: - type: + description: The name of the service account + role: type: string enum: - - file_content - default: file_content - description: The type of jsonl source. Always `file_content`. - x-stainless-const: true - content: - type: array - items: - type: object - properties: - item: - type: object - additionalProperties: true - sample: - type: object - additionalProperties: true - required: - - item - description: The content of the jsonl file. + - owner + - member + description: '`owner` or `member`' + created_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) of when the service account was + created required: - - type - - content - EvalJsonlFileIdSource: + - object + - id + - name + - role + - created_at + x-oaiMeta: + name: The project service account object + example: | + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Service Account", + "role": "owner", + "created_at": 1711471533 + } + ProjectServiceAccountApiKey: type: object - title: EvalJsonlFileIdSource properties: - type: + object: type: string enum: - - file_id - default: file_id - description: The type of jsonl source. Always `file_id`. + - organization.project.service_account.api_key + description: >- + The object type, which is always + `organization.project.service_account.api_key` x-stainless-const: true + value: + type: string + name: + type: string + created_at: + type: integer + format: unixtime id: type: string - description: The identifier of the file. required: - - type + - object + - value + - name + - created_at - id - EvalList: + ProjectServiceAccountCreateRequest: + type: object + properties: + name: + type: string + description: The name of the service account being created. + required: + - name + ProjectServiceAccountCreateResponse: type: object - title: EvalList - description: | - An object representing a list of evals. properties: object: type: string enum: - - list - default: list - description: | - The type of this object. It is always set to "list". + - organization.project.service_account x-stainless-const: true - data: - type: array - description: | - An array of eval objects. - items: - $ref: '#/components/schemas/Eval' - first_id: + id: type: string - description: The identifier of the first eval in the data array. - last_id: + name: type: string - description: The identifier of the last eval in the data array. - has_more: - type: boolean - description: Indicates whether there are more evals available. + role: + type: string + enum: + - member + description: Service accounts can only have one role of type `member` + x-stainless-const: true + created_at: + type: integer + format: unixtime + api_key: + anyOf: + - $ref: '#/components/schemas/ProjectServiceAccountApiKey' + - type: 'null' required: - object - - data - - first_id - - last_id - - has_more - x-oaiMeta: - name: The eval list object - group: evals - example: | - { - "object": "list", - "data": [ - { - "object": "eval", - "id": "eval_67abd54d9b0081909a86353f6fb9317a", - "data_source_config": { - "type": "custom", - "schema": { - "type": "object", - "properties": { - "item": { - "type": "object", - "properties": { - "input": { - "type": "string" - }, - "ground_truth": { - "type": "string" - } - }, - "required": [ - "input", - "ground_truth" - ] - } - }, - "required": [ - "item" - ] - } - }, - "testing_criteria": [ - { - "name": "String check", - "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", - "type": "string_check", - "input": "{{item.input}}", - "reference": "{{item.ground_truth}}", - "operation": "eq" - } - ], - "name": "External Data Eval", - "created_at": 1739314509, - "metadata": {}, - } - ], - "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", - "last_id": "eval_67abd54d9b0081909a86353f6fb9317a", - "has_more": true - } - EvalLogsDataSourceConfig: + - id + - name + - role + - created_at + - api_key + ProjectServiceAccountDeleteResponse: type: object - title: LogsDataSourceConfig - description: > - A LogsDataSourceConfig which specifies the metadata property of your - logs query. - - This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, - etc. - - The schema returned by this data source config is used to defined what - variables are available in your evals. - - `item` and `sample` are both defined when using this data source config. properties: - type: + object: type: string enum: - - logs - default: logs - description: The type of data source. Always `logs`. + - organization.project.service_account.deleted x-stainless-const: true - metadata: - $ref: '#/components/schemas/Metadata' - schema: - type: object - description: | - The json schema for the run data source items. - Learn how to build JSON schemas [here](https://json-schema.org/). - additionalProperties: true + id: + type: string + deleted: + type: boolean required: - - type - - schema - x-oaiMeta: - name: The logs data source object for evals - group: evals - example: | - { - "type": "logs", - "metadata": { - "language": "english" - }, - "schema": { - "type": "object", - "properties": { - "item": { - "type": "object" - }, - "sample": { - "type": "object" - } - }, - "required": [ - "item", - "sample" - } - } - EvalResponsesSource: + - object + - id + - deleted + ProjectServiceAccountListResponse: type: object - title: EvalResponsesSource - description: | - A EvalResponsesSource object describing a run data source configuration. properties: - type: + object: type: string enum: - - responses - description: The type of run data source. Always `responses`. - metadata: - anyOf: - - type: object - description: >- - Metadata filter for the responses. This is a query parameter - used to select responses. - - type: 'null' - model: + - list + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/ProjectServiceAccount' + first_id: anyOf: - type: string - description: >- - The name of the model to find responses for. This is a query - parameter used to select responses. - type: 'null' - instructions_search: + last_id: anyOf: - type: string - description: >- - Optional string to search the 'instructions' field. This is a - query parameter used to select responses. - - type: 'null' - created_after: - anyOf: - - type: integer - minimum: 0 - description: >- - Only include items created after this timestamp (inclusive). - This is a query parameter used to select responses. - - type: 'null' - created_before: - anyOf: - - type: integer - minimum: 0 - description: >- - Only include items created before this timestamp (inclusive). - This is a query parameter used to select responses. - - type: 'null' - reasoning_effort: - anyOf: - - $ref: '#/components/schemas/ReasoningEffort' - description: >- - Optional reasoning effort parameter. This is a query parameter - used to select responses. - - type: 'null' - temperature: - anyOf: - - type: number - description: >- - Sampling temperature. This is a query parameter used to select - responses. - - type: 'null' - top_p: - anyOf: - - type: number - description: >- - Nucleus sampling parameter. This is a query parameter used to - select responses. - - type: 'null' - users: - anyOf: - - type: array - items: - type: string - description: >- - List of user identifiers. This is a query parameter used to - select responses. - - type: 'null' - tools: - anyOf: - - type: array - items: - type: string - description: >- - List of tool names. This is a query parameter used to select - responses. - type: 'null' + has_more: + type: boolean required: - - type - x-oaiMeta: - name: The run data source object used to configure an individual run - group: eval runs - example: | - { - "type": "responses", - "model": "gpt-4o-mini-2024-07-18", - "temperature": 0.7, - "top_p": 1.0, - "users": ["user1", "user2"], - "tools": ["tool1", "tool2"], - "instructions_search": "You are a coding assistant" - } - EvalRun: + - object + - data + - has_more + ProjectSpendAlert: type: object - title: EvalRun - description: | - A schema representing an evaluation run. + description: Represents a spend alert configured at the project level. properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. object: type: string enum: - - eval.run - default: eval.run - description: The type of the object. Always "eval.run". + - project.spend_alert + description: The object type, which is always `project.spend_alert`. x-stainless-const: true - id: - type: string - description: Unique identifier for the evaluation run. - eval_id: - type: string - description: The identifier of the associated evaluation. - status: - type: string - description: The status of the evaluation run. - model: - type: string - description: The model that is evaluated, if applicable. - name: - type: string - description: The name of the evaluation run. - created_at: + threshold_amount: type: integer - format: unixtime - description: Unix timestamp (in seconds) when the evaluation run was created. - report_url: + description: The alert threshold amount, in cents. + currency: type: string - format: uri - description: The URL to the rendered evaluation run report on the UI dashboard. - result_counts: - type: object - description: Counters summarizing the outcomes of the evaluation run. - properties: - total: - type: integer - description: Total number of executed output items. - errored: - type: integer - description: Number of output items that resulted in an error. - failed: - type: integer - description: Number of output items that failed to pass the evaluation. - passed: - type: integer - description: Number of output items that passed the evaluation. - required: - - total - - errored - - failed - - passed - per_model_usage: - type: array - description: Usage statistics for each model during the evaluation run. - items: - type: object - properties: - model_name: - type: string - description: The name of the model. - invocation_count: - type: integer - description: The number of invocations. - prompt_tokens: - type: integer - description: The number of prompt tokens used. - completion_tokens: - type: integer - description: The number of completion tokens generated. - total_tokens: - type: integer - description: The total number of tokens used. - cached_tokens: - type: integer - description: The number of tokens retrieved from cache. - required: - - model_name - - invocation_count - - prompt_tokens - - completion_tokens - - total_tokens - - cached_tokens - per_testing_criteria_results: - type: array - description: Results per testing criteria applied during the evaluation run. - items: - type: object - properties: - testing_criteria: - type: string - description: A description of the testing criteria. - passed: - type: integer - description: Number of tests passed for this criteria. - failed: - type: integer - description: Number of tests failed for this criteria. - required: - - testing_criteria - - passed - - failed - data_source: - type: object - description: Information about the run's data source. - oneOf: - - $ref: '#/components/schemas/CreateEvalJsonlRunDataSource' - - $ref: '#/components/schemas/CreateEvalCompletionsRunDataSource' - - $ref: '#/components/schemas/CreateEvalResponsesRunDataSource' - metadata: - $ref: '#/components/schemas/Metadata' - error: - $ref: '#/components/schemas/EvalApiError' + enum: + - USD + description: The currency for the threshold amount. + interval: + type: string + enum: + - month + description: The time interval for evaluating spend against the threshold. + notification_channel: + $ref: '#/components/schemas/SpendAlertNotificationChannel' required: - - object - id - - eval_id - - status - - model - - name - - created_at - - report_url - - result_counts - - per_model_usage - - per_testing_criteria_results - - data_source - - metadata - - error + - object + - threshold_amount + - currency + - interval + - notification_channel x-oaiMeta: - name: The eval run object - group: evals + name: The project spend alert object example: | { - "object": "eval.run", - "id": "evalrun_67e57965b480819094274e3a32235e4c", - "eval_id": "eval_67e579652b548190aaa83ada4b125f47", - "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47?run_id=evalrun_67e57965b480819094274e3a32235e4c", - "status": "queued", - "model": "gpt-4o-mini", - "name": "gpt-4o-mini", - "created_at": 1743092069, - "result_counts": { - "total": 0, - "errored": 0, - "failed": 0, - "passed": 0 - }, - "per_model_usage": null, - "per_testing_criteria_results": null, - "data_source": { - "type": "completions", - "source": { - "type": "file_content", - "content": [ - { - "item": { - "input": "Tech Company Launches Advanced Artificial Intelligence Platform", - "ground_truth": "Technology" - } - }, - { - "item": { - "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", - "ground_truth": "Markets" - } - }, - { - "item": { - "input": "International Summit Addresses Climate Change Strategies", - "ground_truth": "World" - } - }, - { - "item": { - "input": "Major Retailer Reports Record-Breaking Holiday Sales", - "ground_truth": "Business" - } - }, - { - "item": { - "input": "National Team Qualifies for World Championship Finals", - "ground_truth": "Sports" - } - }, - { - "item": { - "input": "Stock Markets Rally After Positive Economic Data Released", - "ground_truth": "Markets" - } - }, - { - "item": { - "input": "Global Manufacturer Announces Merger with Competitor", - "ground_truth": "Business" - } - }, - { - "item": { - "input": "Breakthrough in Renewable Energy Technology Unveiled", - "ground_truth": "Technology" - } - }, - { - "item": { - "input": "World Leaders Sign Historic Climate Agreement", - "ground_truth": "World" - } - }, - { - "item": { - "input": "Professional Athlete Sets New Record in Championship Event", - "ground_truth": "Sports" - } - }, - { - "item": { - "input": "Financial Institutions Adapt to New Regulatory Requirements", - "ground_truth": "Business" - } - }, - { - "item": { - "input": "Tech Conference Showcases Advances in Artificial Intelligence", - "ground_truth": "Technology" - } - }, - { - "item": { - "input": "Global Markets Respond to Oil Price Fluctuations", - "ground_truth": "Markets" - } - }, - { - "item": { - "input": "International Cooperation Strengthened Through New Treaty", - "ground_truth": "World" - } - }, - { - "item": { - "input": "Sports League Announces Revised Schedule for Upcoming Season", - "ground_truth": "Sports" - } - } - ] - }, - "input_messages": { - "type": "template", - "template": [ - { - "type": "message", - "role": "developer", - "content": { - "type": "input_text", - "text": "Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\n\n# Steps\n\n1. Analyze the content of the news headline to understand its primary focus.\n2. Extract the subject matter, identifying any key indicators or keywords.\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\n4. Ensure only one category is selected per headline.\n\n# Output Format\n\nRespond with the chosen category as a single word. For instance: \"Technology\", \"Markets\", \"World\", \"Business\", or \"Sports\".\n\n# Examples\n\n**Input**: \"Apple Unveils New iPhone Model, Featuring Advanced AI Features\" \n**Output**: \"Technology\"\n\n**Input**: \"Global Stocks Mixed as Investors Await Central Bank Decisions\" \n**Output**: \"Markets\"\n\n**Input**: \"War in Ukraine: Latest Updates on Negotiation Status\" \n**Output**: \"World\"\n\n**Input**: \"Microsoft in Talks to Acquire Gaming Company for $2 Billion\" \n**Output**: \"Business\"\n\n**Input**: \"Manchester United Secures Win in Premier League Football Match\" \n**Output**: \"Sports\" \n\n# Notes\n\n- If the headline appears to fit into more than one category, choose the most dominant theme.\n- Keywords or phrases such as \"stocks\", \"company acquisition\", \"match\", or technological brands can be good indicators for classification.\n" - } - }, - { - "type": "message", - "role": "user", - "content": { - "type": "input_text", - "text": "{{item.input}}" - } - } - ] - }, - "model": "gpt-4o-mini", - "sampling_params": { - "seed": 42, - "temperature": 1.0, - "top_p": 1.0, - "max_completions_tokens": 2048 + "id": "alert_abc123", + "object": "project.spend_alert", + "threshold_amount": 100000, + "currency": "USD", + "interval": "month", + "notification_channel": { + "type": "email", + "recipients": ["finance@example.com"], + "subject_prefix": "OpenAI spend alert" } - }, - "error": null, - "metadata": {} } - EvalRunList: + ProjectSpendAlertDeletedResource: type: object - title: EvalRunList - description: | - An object representing a list of runs for an evaluation. + description: Confirmation payload returned after deleting a project spend alert. + properties: + id: + type: string + description: The deleted spend alert ID. + object: + type: string + enum: + - project.spend_alert.deleted + description: Always `project.spend_alert.deleted`. + x-stainless-const: true + deleted: + type: boolean + description: Whether the spend alert was deleted. + required: + - id + - object + - deleted + ProjectSpendAlertListResource: + type: object + description: Paginated list of project spend alerts. properties: object: type: string enum: - list - default: list - description: | - The type of this object. It is always set to "list". + description: Always `list`. x-stainless-const: true data: type: array - description: | - An array of eval run objects. + description: Spend alerts returned in the current page. items: - $ref: '#/components/schemas/EvalRun' + $ref: '#/components/schemas/ProjectSpendAlert' first_id: - type: string - description: The identifier of the first eval run in the data array. + anyOf: + - type: string + - type: 'null' + description: The ID of the first spend alert in this page. last_id: - type: string - description: The identifier of the last eval run in the data array. + anyOf: + - type: string + - type: 'null' + description: The ID of the last spend alert in this page. has_more: type: boolean - description: Indicates whether there are more evals available. + description: Whether more spend alerts are available when paginating. required: - object - data - first_id - last_id - has_more - x-oaiMeta: - name: The eval run list object - group: evals - example: | - { - "object": "list", - "data": [ - { - "object": "eval.run", - "id": "evalrun_67b7fbdad46c819092f6fe7a14189620", - "eval_id": "eval_67b7fa9a81a88190ab4aa417e397ea21", - "report_url": "https://platform.openai.com/evaluations/eval_67b7fa9a81a88190ab4aa417e397ea21?run_id=evalrun_67b7fbdad46c819092f6fe7a14189620", - "status": "completed", - "model": "o3-mini", - "name": "Academic Assistant", - "created_at": 1740110812, - "result_counts": { - "total": 171, - "errored": 0, - "failed": 80, - "passed": 91 - }, - "per_model_usage": null, - "per_testing_criteria_results": [ - { - "testing_criteria": "String check grader", - "passed": 91, - "failed": 80 - } - ], - "run_data_source": { - "type": "completions", - "template_messages": [ - { - "type": "message", - "role": "system", - "content": { - "type": "input_text", - "text": "You are a helpful assistant." - } - }, - { - "type": "message", - "role": "user", - "content": { - "type": "input_text", - "text": "Hello, can you help me with my homework?" - } - } - ], - "datasource_reference": null, - "model": "o3-mini", - "max_completion_tokens": null, - "seed": null, - "temperature": null, - "top_p": null - }, - "error": null, - "metadata": {"test": "synthetics"} - } - ], - "first_id": "evalrun_67abd54d60ec8190832b46859da808f7", - "last_id": "evalrun_67abd54d60ec8190832b46859da808f7", - "has_more": false - } - EvalRunOutputItem: + ProjectUpdateRequest: type: object - title: EvalRunOutputItem - description: | - A schema representing an evaluation run output item. + properties: + name: + anyOf: + - type: string + - type: 'null' + description: The updated name of the project, this name appears in reports. + external_key_id: + anyOf: + - type: string + - type: 'null' + description: External key ID to associate with the project. + geography: + anyOf: + - type: string + - type: 'null' + description: Geography for the project. + ProjectUser: + type: object + description: Represents an individual user in a project. properties: object: type: string enum: - - eval.run.output_item - default: eval.run.output_item - description: The type of the object. Always "eval.run.output_item". + - organization.project.user + description: The object type, which is always `organization.project.user` x-stainless-const: true id: type: string - description: Unique identifier for the evaluation run output item. - run_id: - type: string - description: >- - The identifier of the evaluation run associated with this output - item. - eval_id: + description: The identifier, which can be referenced in API endpoints + name: + anyOf: + - type: string + - type: 'null' + description: The name of the user + email: + anyOf: + - type: string + - type: 'null' + description: The email address of the user + role: type: string - description: The identifier of the evaluation group. - created_at: + description: '`owner` or `member`' + added_at: type: integer format: unixtime - description: Unix timestamp (in seconds) when the evaluation run was created. - status: - type: string - description: The status of the evaluation run. - datasource_item_id: - type: integer - description: The identifier for the data source item. - datasource_item: - type: object - description: Details of the input data source item. - additionalProperties: true - results: - type: array - description: A list of grader results for this output item. - items: - $ref: '#/components/schemas/EvalRunOutputItemResult' - sample: - type: object - description: A sample containing the input and output of the evaluation run. - properties: - input: - type: array - description: An array of input messages. - items: - type: object - description: An input message. - properties: - role: - type: string - description: >- - The role of the message sender (e.g., system, user, - developer). - content: - type: string - description: The content of the message. - required: - - role - - content - output: - type: array - description: An array of output messages. - items: - type: object - properties: - role: - type: string - description: >- - The role of the message (e.g. "system", "assistant", - "user"). - content: - type: string - description: The content of the message. - finish_reason: - type: string - description: The reason why the sample generation was finished. - model: - type: string - description: The model used for generating the sample. - usage: - type: object - description: Token usage details for the sample. - properties: - total_tokens: - type: integer - description: The total number of tokens used. - completion_tokens: - type: integer - description: The number of completion tokens generated. - prompt_tokens: - type: integer - description: The number of prompt tokens used. - cached_tokens: - type: integer - description: The number of tokens retrieved from cache. - required: - - total_tokens - - completion_tokens - - prompt_tokens - - cached_tokens - error: - $ref: '#/components/schemas/EvalApiError' - temperature: - type: number - description: The sampling temperature used. - max_completion_tokens: - type: integer - description: The maximum number of tokens allowed for completion. - top_p: - type: number - description: The top_p value used for sampling. - seed: - type: integer - description: The seed used for generating the sample. - required: - - input - - output - - finish_reason - - model - - usage - - error - - temperature - - max_completion_tokens - - top_p - - seed + description: The Unix timestamp (in seconds) of when the project was added. required: - object - id - - run_id - - eval_id - - created_at - - status - - datasource_item_id - - datasource_item - - results - - sample + - role + - added_at x-oaiMeta: - name: The eval run output item object - group: evals + name: The project user object example: | { - "object": "eval.run.output_item", - "id": "outputitem_67abd55eb6548190bb580745d5644a33", - "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", - "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", - "created_at": 1739314509, - "status": "pass", - "datasource_item_id": 137, - "datasource_item": { - "teacher": "To grade essays, I only check for style, content, and grammar.", - "student": "I am a student who is trying to write the best essay." - }, - "results": [ - { - "name": "String Check Grader", - "type": "string-check-grader", - "score": 1.0, - "passed": true, - } - ], - "sample": { - "input": [ - { - "role": "system", - "content": "You are an evaluator bot..." - }, - { - "role": "user", - "content": "You are assessing..." - } - ], - "output": [ - { - "role": "assistant", - "content": "The rubric is not clear nor concise." - } - ], - "finish_reason": "stop", - "model": "gpt-4o-2024-08-06", - "usage": { - "total_tokens": 521, - "completion_tokens": 2, - "prompt_tokens": 519, - "cached_tokens": 0 - }, - "error": null, - "temperature": 1.0, - "max_completion_tokens": 2048, - "top_p": 1.0, - "seed": 42 - } + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 } - EvalRunOutputItemList: + ProjectUserCreateRequest: + type: object + properties: + user_id: + anyOf: + - type: string + - type: 'null' + description: The ID of the user. + email: + anyOf: + - type: string + - type: 'null' + description: Email of the user to add. + role: + type: string + description: '`owner` or `member`' + required: + - role + ProjectUserDeleteResponse: type: object - title: EvalRunOutputItemList - description: | - An object representing a list of output items for an evaluation run. properties: object: type: string enum: - - list - default: list - description: | - The type of this object. It is always set to "list". + - organization.project.user.deleted x-stainless-const: true + id: + type: string + deleted: + type: boolean + required: + - object + - id + - deleted + ProjectUserListResponse: + type: object + properties: + object: + type: string data: type: array - description: | - An array of eval run output item objects. items: - $ref: '#/components/schemas/EvalRunOutputItem' + $ref: '#/components/schemas/ProjectUser' first_id: - type: string - description: The identifier of the first eval run output item in the data array. + anyOf: + - type: string + - type: 'null' last_id: - type: string - description: The identifier of the last eval run output item in the data array. + anyOf: + - type: string + - type: 'null' has_more: type: boolean - description: Indicates whether there are more eval run output items available. required: - object - data - - first_id - - last_id - has_more + ProjectUserUpdateRequest: + type: object + properties: + role: + anyOf: + - type: string + - type: 'null' + description: '`owner` or `member`' + Prompt: + anyOf: + - type: object + description: | + Reference to a prompt template and its variables. + [Learn more](/docs/guides/text?api-mode=responses#reusable-prompts). + required: + - id + properties: + id: + type: string + description: The unique identifier of the prompt template to use. + version: + anyOf: + - type: string + description: Optional version of the prompt template. + - type: 'null' + variables: + $ref: '#/components/schemas/ResponsePromptVariables' + - type: 'null' + PublicAssignOrganizationGroupRoleBody: + type: object + description: Request payload for assigning a role to a group or user. + properties: + role_id: + type: string + description: Identifier of the role to assign. + required: + - role_id x-oaiMeta: - name: The eval run output item list object - group: evals example: | { - "object": "list", - "data": [ - { - "object": "eval.run.output_item", - "id": "outputitem_67abd55eb6548190bb580745d5644a33", - "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", - "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", - "created_at": 1739314509, - "status": "pass", - "datasource_item_id": 137, - "datasource_item": { - "teacher": "To grade essays, I only check for style, content, and grammar.", - "student": "I am a student who is trying to write the best essay." - }, - "results": [ - { - "name": "String Check Grader", - "type": "string-check-grader", - "score": 1.0, - "passed": true, - } - ], - "sample": { - "input": [ - { - "role": "system", - "content": "You are an evaluator bot..." - }, - { - "role": "user", - "content": "You are assessing..." - } - ], - "output": [ - { - "role": "assistant", - "content": "The rubric is not clear nor concise." - } - ], - "finish_reason": "stop", - "model": "gpt-4o-2024-08-06", - "usage": { - "total_tokens": 521, - "completion_tokens": 2, - "prompt_tokens": 519, - "cached_tokens": 0 - }, - "error": null, - "temperature": 1.0, - "max_completion_tokens": 2048, - "top_p": 1.0, - "seed": 42 - } - }, - ], - "first_id": "outputitem_67abd55eb6548190bb580745d5644a33", - "last_id": "outputitem_67abd55eb6548190bb580745d5644a33", - "has_more": false + "role_id": "role_01J1F8ROLE01" } - EvalRunOutputItemResult: + PublicCreateOrganizationRoleBody: type: object - title: EvalRunOutputItemResult - description: | - A single grader result for an evaluation run output item. + description: Request payload for creating a custom role. properties: - name: - type: string - description: The name of the grader. - type: + role_name: type: string - description: The grader type (for example, "string-check-grader"). - score: - type: number - description: The numeric score produced by the grader. - passed: - type: boolean - description: Whether the grader considered the output a pass. - sample: + description: Unique name for the role. + permissions: + type: array + description: Permissions to grant to the role. + items: + type: string + description: + description: Optional description of the role. anyOf: - - type: object - additionalProperties: true + - type: string - type: 'null' - description: Optional sample or intermediate data produced by the grader. - additionalProperties: true - required: - - name - - score - - passed - EvalStoredCompletionsDataSourceConfig: - type: object - title: StoredCompletionsDataSourceConfig - description: | - Deprecated in favor of LogsDataSourceConfig. - properties: - type: - type: string - enum: - - stored_completions - default: stored_completions - description: The type of data source. Always `stored_completions`. - x-stainless-const: true - metadata: - $ref: '#/components/schemas/Metadata' - schema: - type: object - description: | - The json schema for the run data source items. - Learn how to build JSON schemas [here](https://json-schema.org/). - additionalProperties: true required: - - type - - schema - deprecated: true + - role_name + - permissions x-oaiMeta: - name: The stored completions data source object for evals - group: evals example: | { - "type": "stored_completions", - "metadata": { - "language": "english" - }, - "schema": { - "type": "object", - "properties": { - "item": { - "type": "object" - }, - "sample": { - "type": "object" - } - }, - "required": [ - "item", - "sample" - } + "role_name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "description": "Allows managing organization groups" } - EvalStoredCompletionsSource: + PublicRoleListResource: type: object - title: StoredCompletionsRunDataSource - description: > - A StoredCompletionsRunDataSource configuration describing a set of - filters + description: Paginated list of roles available on an organization or project. properties: - type: + object: type: string enum: - - stored_completions - default: stored_completions - description: The type of source. Always `stored_completions`. + - list + description: Always `list`. x-stainless-const: true - metadata: - $ref: '#/components/schemas/Metadata' - model: + data: + type: array + description: Roles returned in the current page. + items: + $ref: '#/components/schemas/Role' + has_more: + type: boolean + description: Whether more roles are available when paginating. + next: + description: >- + Cursor to fetch the next page of results, or `null` when there are + no additional roles. anyOf: - type: string - description: An optional model to filter by (e.g., 'gpt-4o'). - type: 'null' - created_after: + required: + - object + - data + - has_more + - next + x-oaiMeta: + name: Role list + example: | + { + "object": "list", + "data": [ + { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + ], + "has_more": false, + "next": null + } + PublicUpdateOrganizationRoleBody: + type: object + description: Request payload for updating an existing role. + properties: + permissions: + description: Updated set of permissions for the role. anyOf: - - type: integer - description: >- - An optional Unix timestamp to filter items created after this - time. + - type: array + items: + type: string - type: 'null' - created_before: + description: + description: New description for the role. anyOf: - - type: integer - description: >- - An optional Unix timestamp to filter items created before this - time. + - type: string - type: 'null' - limit: + role_name: + description: New name for the role. anyOf: - - type: integer - description: An optional maximum number of items to return. + - type: string - type: 'null' - required: - - type x-oaiMeta: - name: >- - The stored completions data source object used to configure an - individual run - group: eval runs example: | { - "type": "stored_completions", - "model": "gpt-4o", - "created_after": 1668124800, - "created_before": 1668124900, - "limit": 100, - "metadata": {} + "role_name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "description": "Allows managing organization groups" } - FileExpirationAfter: + RealtimeAudioFormats: + anyOf: + - type: object + title: PCM audio format + description: The PCM audio format. Only a 24kHz sample rate is supported. + properties: + type: + type: string + description: The audio format. Always `audio/pcm`. + enum: + - audio/pcm + rate: + type: integer + description: The sample rate of the audio. Always `24000`. + enum: + - 24000 + - type: object + title: PCMU audio format + description: The G.711 μ-law format. + properties: + type: + type: string + description: The audio format. Always `audio/pcmu`. + enum: + - audio/pcmu + - type: object + title: PCMA audio format + description: The G.711 A-law format. + properties: + type: + type: string + description: The audio format. Always `audio/pcma`. + enum: + - audio/pcma + RealtimeBetaClientEventConversationItemCreate: type: object - title: File expiration policy - description: >- - The expiration policy for a file. By default, files with `purpose=batch` - expire after 30 days and all other files are persisted until they are - manually deleted. + description: > + Add a new Item to the Conversation's context, including messages, + function + + calls, and function call responses. This event can be used both to + populate a + + "history" of the conversation and to add new items mid-stream, but has + the + + current limitation that it cannot populate assistant audio messages. + + + If successful, the server will respond with a + `conversation.item.created` + + event, otherwise an `error` event will be sent. properties: - anchor: - description: >- - Anchor timestamp after which the expiration policy applies. - Supported anchors: `created_at`. + event_id: type: string - enum: - - created_at - x-stainless-const: true - seconds: - description: >- - The number of seconds after the anchor time that the file will - expire. Must be between 3600 (1 hour) and 2592000 (30 days). - type: integer - format: int64 - minimum: 3600 - maximum: 2592000 - required: - - anchor - - seconds - FilePath: - type: object - title: File path - description: | - A path to a file. - properties: + maxLength: 512 + description: Optional client-generated ID used to identify this event. type: type: string - description: | - The type of the file path. Always `file_path`. enum: - - file_path + - conversation.item.create + description: The event type, must be `conversation.item.create`. x-stainless-const: true - file_id: + previous_item_id: type: string - description: | - The ID of the file. - index: - type: integer - description: | - The index of the file in the list of files. - required: - - type - - file_id - - index - FileSearchRanker: - type: string - description: >- - The ranker to use for the file search. If not specified will use the - `auto` ranker. - enum: - - auto - - default_2024_08_21 - FileSearchRankingOptions: - title: File search tool call ranking options - type: object - description: > - The ranking options for the file search. If not specified, the file - search tool will use the `auto` ranker and a score_threshold of 0. + description: > + 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. - See the [file search tool - documentation](/docs/assistants/tools/file-search#customizing-file-search-settings) - for more information. - properties: - ranker: - $ref: '#/components/schemas/FileSearchRanker' - score_threshold: - type: number - description: >- - The score threshold for the file search. All values must be a - floating point number between 0 and 1. - minimum: 0 - maximum: 1 + If set to `root`, the new item will be added to the beginning of the + conversation. + + 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. + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - - score_threshold - FileSearchToolCall: + - type + - item + x-oaiMeta: + name: conversation.item.create + group: realtime + example: | + { + "type": "conversation.item.create", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + }, + "event_id": "b904fba0-0ec4-40af-8bbb-f908a9b26793", + } + RealtimeBetaClientEventConversationItemDelete: type: object - title: File search tool call description: > - The results of a file search tool call. See the + Send this event when you want to remove any item from the conversation - [file search guide](/docs/guides/tools-file-search) for more - information. + history. The server will respond with a `conversation.item.deleted` + event, + + unless the item does not exist in the conversation history, in which + case the + + server will respond with an error. properties: - id: + event_id: type: string - description: | - The unique ID of the file search tool call. + description: Optional client-generated ID used to identify this event. type: type: string enum: - - file_search_call - description: | - The type of the file search tool call. Always `file_search_call`. + - conversation.item.delete + description: The event type, must be `conversation.item.delete`. x-stainless-const: true - status: + item_id: type: string - description: | - The status of the file search tool call. One of `in_progress`, - `searching`, `incomplete` or `failed`, - enum: - - in_progress - - searching - - completed - - incomplete - - failed - queries: - type: array - items: - type: string - description: | - The queries used to search for files. - results: - anyOf: - - type: array - description: | - The results of the file search tool call. - items: - type: object - properties: - file_id: - type: string - description: | - The unique ID of the file. - text: - type: string - description: | - The text that was retrieved from the file. - filename: - type: string - description: | - The name of the file. - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' - score: - type: number - format: float - description: | - The relevance score of the file - a value between 0 and 1. - - type: 'null' + description: The ID of the item to delete. required: - - id - type - - status - - queries - FineTuneChatCompletionRequestAssistantMessage: - allOf: - - type: object - title: Assistant message - deprecated: false - properties: - weight: - type: integer - enum: - - 0 - - 1 - description: >- - Controls whether the assistant message is trained against (0 or - 1) - - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' - required: - - role - FineTuneDPOHyperparameters: - type: object - description: The hyperparameters used for the DPO fine-tuning job. - properties: - beta: - description: > - The beta value for the DPO method. A higher beta value will increase - the weight of the penalty between the policy and reference model. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0 - maximum: 2 - exclusiveMinimum: true - default: auto - batch_size: - description: > - Number of examples in each batch. A larger batch size means that - model parameters are updated less frequently, but with lower - variance. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 256 - default: auto - learning_rate_multiplier: - description: > - Scaling factor for the learning rate. A smaller learning rate may be - useful to avoid overfitting. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0 - exclusiveMinimum: true - default: auto - n_epochs: - description: > - The number of epochs to train the model for. An epoch refers to one - full cycle through the training dataset. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 50 - default: auto - FineTuneDPOMethod: - type: object - description: Configuration for the DPO fine-tuning method. - properties: - hyperparameters: - $ref: '#/components/schemas/FineTuneDPOHyperparameters' - FineTuneMethod: + - item_id + x-oaiMeta: + name: conversation.item.delete + group: realtime + example: | + { + "event_id": "event_901", + "type": "conversation.item.delete", + "item_id": "msg_003" + } + RealtimeBetaClientEventConversationItemRetrieve: type: object - description: The method used for fine-tuning. + description: > + Send 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. + + The server will respond with a `conversation.item.retrieved` event, + + unless the item does not exist in the conversation history, in which + case the + + server will respond with an error. properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. type: type: string - description: >- - The type of method. Is either `supervised`, `dpo`, or - `reinforcement`. enum: - - supervised - - dpo - - reinforcement - supervised: - $ref: '#/components/schemas/FineTuneSupervisedMethod' - dpo: - $ref: '#/components/schemas/FineTuneDPOMethod' - reinforcement: - $ref: '#/components/schemas/FineTuneReinforcementMethod' + - conversation.item.retrieve + description: The event type, must be `conversation.item.retrieve`. + x-stainless-const: true + item_id: + type: string + description: The ID of the item to retrieve. required: - type - FineTuneReinforcementHyperparameters: + - item_id + x-oaiMeta: + name: conversation.item.retrieve + group: realtime + example: | + { + "event_id": "event_901", + "type": "conversation.item.retrieve", + "item_id": "msg_003" + } + RealtimeBetaClientEventConversationItemTruncate: type: object - description: The hyperparameters used for the reinforcement fine-tuning job. + description: > + Send this event to truncate a previous assistant message’s audio. The + server + + will produce audio faster than realtime, so this event is useful when + the user + + interrupts to truncate audio that has already been sent to the client + but not + + yet played. This will synchronize the server's understanding of the + audio with + + the client's playback. + + + Truncating audio will delete the server-side text transcript to ensure + there + + is not text in the context that hasn't been heard by the user. + + + If successful, the server will respond with a + `conversation.item.truncated` + + event. properties: - batch_size: - description: > - Number of examples in each batch. A larger batch size means that - model parameters are updated less frequently, but with lower - variance. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 256 - default: auto - learning_rate_multiplier: - description: > - Scaling factor for the learning rate. A smaller learning rate may be - useful to avoid overfitting. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0 - exclusiveMinimum: true - default: auto - n_epochs: - description: > - The number of epochs to train the model for. An epoch refers to one - full cycle through the training dataset. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 50 - default: auto - reasoning_effort: - description: | - Level of reasoning effort. + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: type: string enum: - - default - - low - - medium - - high - default: default - compute_multiplier: - description: > - Multiplier on amount of compute used for exploring search space - during training. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0.00001 - maximum: 10 - exclusiveMinimum: true - default: auto - eval_interval: - description: | - The number of training steps between evaluation runs. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - default: auto - eval_samples: - description: | - Number of evaluation samples to generate per training step. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - default: auto - FineTuneReinforcementMethod: - type: object - description: Configuration for the reinforcement fine-tuning method. - properties: - grader: - type: object - description: The grader used for the fine-tuning job. - oneOf: - - $ref: '#/components/schemas/GraderStringCheck' - - $ref: '#/components/schemas/GraderTextSimilarity' - - $ref: '#/components/schemas/GraderPython' - - $ref: '#/components/schemas/GraderScoreModel' - - $ref: '#/components/schemas/GraderMulti' - hyperparameters: - $ref: '#/components/schemas/FineTuneReinforcementHyperparameters' - required: - - grader - FineTuneSupervisedHyperparameters: - type: object - description: The hyperparameters used for the fine-tuning job. - properties: - batch_size: - description: > - Number of examples in each batch. A larger batch size means that - model parameters are updated less frequently, but with lower - variance. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 256 - default: auto - learning_rate_multiplier: + - conversation.item.truncate + description: The event type, must be `conversation.item.truncate`. + x-stainless-const: true + item_id: + type: string description: > - Scaling factor for the learning rate. A smaller learning rate may be - useful to avoid overfitting. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0 - exclusiveMinimum: true - default: auto - n_epochs: + The ID of the assistant message item to truncate. Only assistant + message + + items can be truncated. + content_index: + type: integer + description: The index of the content part to truncate. Set this to 0. + audio_end_ms: + type: integer description: > - The number of epochs to train the model for. An epoch refers to one - full cycle through the training dataset. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 50 - default: auto - FineTuneSupervisedMethod: - type: object - description: Configuration for the supervised fine-tuning method. - properties: - hyperparameters: - $ref: '#/components/schemas/FineTuneSupervisedHyperparameters' - FineTuningCheckpointPermission: + Inclusive duration up to which audio is truncated, in milliseconds. + If + + the audio_end_ms is greater than the actual audio duration, the + server + + will respond with an error. + required: + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncate + group: realtime + example: | + { + "event_id": "event_678", + "type": "conversation.item.truncate", + "item_id": "msg_002", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeBetaClientEventInputAudioBufferAppend: type: object - title: FineTuningCheckpointPermission description: > - The `checkpoint.permission` object represents a permission for a - fine-tuned model checkpoint. + Send this event to append audio bytes to the input audio buffer. The + audio + + buffer is temporary storage you can write to and later commit. In Server + VAD + + mode, the audio buffer is used to detect speech and the server will + decide + + when to commit. When Server VAD is disabled, you must commit the audio + buffer + + manually. + + + The client may choose how much audio to place in each event up to a + maximum + + of 15 MiB, for example streaming smaller chunks from the client may + allow the + + VAD to be more responsive. Unlike made other client events, the server + will + + not send a confirmation response to this event. properties: - id: - type: string - description: >- - The permission identifier, which can be referenced in the API - endpoints. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the permission was created. - project_id: + event_id: type: string - description: The project identifier that the permission is for. - object: + description: Optional client-generated ID used to identify this event. + type: type: string - description: The object type, which is always "checkpoint.permission". enum: - - checkpoint.permission + - input_audio_buffer.append + description: The event type, must be `input_audio_buffer.append`. x-stainless-const: true + audio: + type: string + description: > + Base64-encoded audio bytes. This must be in the format specified by + the + + `input_audio_format` field in the session configuration. required: - - created_at - - id - - object - - project_id + - type + - audio x-oaiMeta: - name: The fine-tuned model checkpoint permission object + name: input_audio_buffer.append + group: realtime example: | { - "object": "checkpoint.permission", - "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", - "created_at": 1712211699, - "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" + "event_id": "event_456", + "type": "input_audio_buffer.append", + "audio": "Base64EncodedAudioData" } - FineTuningIntegration: + RealtimeBetaClientEventInputAudioBufferClear: type: object - title: Fine-Tuning Job Integration - required: - - type - - wandb + description: | + Send this event to clear the audio bytes in the buffer. The server will + respond with an `input_audio_buffer.cleared` event. properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. type: type: string - description: The type of the integration being enabled for the fine-tuning job enum: - - wandb + - input_audio_buffer.clear + description: The event type, must be `input_audio_buffer.clear`. x-stainless-const: true - wandb: - type: object - description: > - The settings for your integration with Weights and Biases. This - payload specifies the project that + required: + - type + x-oaiMeta: + name: input_audio_buffer.clear + group: realtime + example: | + { + "event_id": "event_012", + "type": "input_audio_buffer.clear" + } + RealtimeBetaClientEventInputAudioBufferCommit: + type: object + description: > + Send this event to commit the user input audio buffer, which will create + a - metrics will be sent to. Optionally, you can set an explicit display - name for your run, add tags + new user message item in the conversation. This event will produce an + error - to your run, and set a default entity (team, username, etc) to be - associated with your run. - required: - - project - properties: - project: - description: | - The name of the project that the new run will be created under. - type: string - example: my-wandb-project - name: - anyOf: - - description: > - A display name to set for the run. If not set, we will use - the Job ID as the name. - type: string - - type: 'null' - entity: - anyOf: - - description: > - The entity to use for the run. This allows you to set the - team or username of the WandB user that you would + if the input audio buffer is empty. When in Server VAD mode, the client + does - like associated with the run. If not set, the default entity - for the registered WandB API key is used. - type: string - - type: 'null' - tags: - description: > - A list of tags to be attached to the newly created run. These - tags are passed through directly to WandB. Some + not need to send this event, the server will commit the audio buffer - default tags are generated by OpenAI: "openai/finetune", - "openai/{base-model}", "openai/{ftjob-abcdef}". - type: array - items: - type: string - example: custom-tag - FineTuningJob: - type: object - title: FineTuningJob - description: > - The `fine_tuning.job` object represents a fine-tuning job that has been - created through the API. - properties: - id: - type: string - description: The object identifier, which can be referenced in the API endpoints. - created_at: - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) for when the fine-tuning job was - created. - error: - anyOf: - - type: object - description: >- - For fine-tuning jobs that have `failed`, this will contain more - information on the cause of the failure. - properties: - code: - type: string - description: A machine-readable error code. - message: - type: string - description: A human-readable error message. - param: - anyOf: - - type: string - description: >- - The parameter that was invalid, usually `training_file` - or `validation_file`. This field will be null if the - failure was not parameter-specific. - - type: 'null' - required: - - code - - message - - param - - type: 'null' - fine_tuned_model: - anyOf: - - type: string - description: >- - The name of the fine-tuned model that is being created. The - value will be null if the fine-tuning job is still running. - - type: 'null' - finished_at: - anyOf: - - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) for when the fine-tuning job was - finished. The value will be null if the fine-tuning job is still - running. - - type: 'null' - hyperparameters: - type: object - description: >- - The hyperparameters used for the fine-tuning job. This value will - only be returned when running `supervised` jobs. - properties: - batch_size: - anyOf: - - description: > - Number of examples in each batch. A larger batch size means - that model parameters + automatically. - are updated less frequently, but with lower variance. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 256 - default: auto - - type: 'null' - learning_rate_multiplier: - description: > - Scaling factor for the learning rate. A smaller learning rate - may be useful to avoid - overfitting. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0 - exclusiveMinimum: true - default: auto - n_epochs: - description: > - The number of epochs to train the model for. An epoch refers to - one full cycle + Committing the input audio buffer will trigger input audio + transcription - through the training dataset. - oneOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 50 - default: auto - model: + (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. + properties: + event_id: type: string - description: The base model that is being fine-tuned. - object: + description: Optional client-generated ID used to identify this event. + type: type: string - description: The object type, which is always "fine_tuning.job". enum: - - fine_tuning.job + - input_audio_buffer.commit + description: The event type, must be `input_audio_buffer.commit`. x-stainless-const: true - organization_id: - type: string - description: The organization that owns the fine-tuning job. - result_files: - type: array - description: >- - The compiled results file ID(s) for the fine-tuning job. You can - retrieve the results with the [Files - API](/docs/api-reference/files/retrieve-contents). - items: - type: string - example: file-abc123 - status: - type: string - description: >- - The current status of the fine-tuning job, which can be either - `validating_files`, `queued`, `running`, `succeeded`, `failed`, or - `cancelled`. - enum: - - validating_files - - queued - - running - - succeeded - - failed - - cancelled - trained_tokens: - anyOf: - - type: integer - description: >- - The total number of billable tokens processed by this - fine-tuning job. The value will be null if the fine-tuning job - is still running. - - type: 'null' - training_file: - type: string - description: >- - The file ID used for training. You can retrieve the training data - with the [Files API](/docs/api-reference/files/retrieve-contents). - validation_file: - anyOf: - - type: string - description: >- - The file ID used for validation. You can retrieve the validation - results with the [Files - API](/docs/api-reference/files/retrieve-contents). - - type: 'null' - integrations: - anyOf: - - type: array - description: A list of integrations to enable for this fine-tuning job. - maxItems: 5 - items: - oneOf: - - $ref: '#/components/schemas/FineTuningIntegration' - - type: 'null' - seed: - type: integer - description: The seed used for the fine-tuning job. - estimated_finish: - anyOf: - - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) for when the fine-tuning job is - estimated to finish. The value will be null if the fine-tuning - job is not running. - - type: 'null' - method: - $ref: '#/components/schemas/FineTuneMethod' - metadata: - $ref: '#/components/schemas/Metadata' required: - - created_at - - error - - finished_at - - fine_tuned_model - - hyperparameters - - id - - model - - object - - organization_id - - result_files - - status - - trained_tokens - - training_file - - validation_file - - seed + - type x-oaiMeta: - name: The fine-tuning job object + name: input_audio_buffer.commit + group: realtime example: | { - "object": "fine_tuning.job", - "id": "ftjob-abc123", - "model": "davinci-002", - "created_at": 1692661014, - "finished_at": 1692661190, - "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", - "organization_id": "org-123", - "result_files": [ - "file-abc123" - ], - "status": "succeeded", - "validation_file": null, - "training_file": "file-abc123", - "hyperparameters": { - "n_epochs": 4, - "batch_size": 1, - "learning_rate_multiplier": 1.0 - }, - "trained_tokens": 5768, - "integrations": [], - "seed": 0, - "estimated_finish": 0, - "method": { - "type": "supervised", - "supervised": { - "hyperparameters": { - "n_epochs": 4, - "batch_size": 1, - "learning_rate_multiplier": 1.0 - } - } - }, - "metadata": { - "key": "value" - } + "event_id": "event_789", + "type": "input_audio_buffer.commit" } - FineTuningJobCheckpoint: + RealtimeBetaClientEventOutputAudioBufferClear: type: object - title: FineTuningJobCheckpoint description: > - The `fine_tuning.job.checkpoint` object represents a model checkpoint - for a fine-tuning job that is ready to use. + **WebRTC/SIP Only:** Emit to cut off the current audio response. This + will trigger the server to + + stop generating audio and emit a `output_audio_buffer.cleared` event. + This + + event should be preceded by a `response.cancel` client event to stop the + + generation of the current response. + + [Learn + more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). properties: - id: - type: string - description: >- - The checkpoint identifier, which can be referenced in the API - endpoints. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the checkpoint was created. - fine_tuned_model_checkpoint: - type: string - description: The name of the fine-tuned checkpoint model that is created. - step_number: - type: integer - description: The step number that the checkpoint was created at. - metrics: - type: object - description: Metrics at the step number during the fine-tuning job. - properties: - step: - type: number - train_loss: - type: number - train_mean_token_accuracy: - type: number - valid_loss: - type: number - valid_mean_token_accuracy: - type: number - full_valid_loss: - type: number - full_valid_mean_token_accuracy: - type: number - fine_tuning_job_id: + event_id: type: string - description: >- - The name of the fine-tuning job that this checkpoint was created - from. - object: + description: The unique ID of the client event used for error handling. + type: type: string - description: The object type, which is always "fine_tuning.job.checkpoint". enum: - - fine_tuning.job.checkpoint + - output_audio_buffer.clear + description: The event type, must be `output_audio_buffer.clear`. x-stainless-const: true required: - - created_at - - fine_tuning_job_id - - fine_tuned_model_checkpoint - - id - - metrics - - object - - step_number + - type x-oaiMeta: - name: The fine-tuning job checkpoint object + name: output_audio_buffer.clear + group: realtime example: | { - "object": "fine_tuning.job.checkpoint", - "id": "ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P", - "created_at": 1712211699, - "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88", - "fine_tuning_job_id": "ftjob-fpbNQ3H1GrMehXRf8cO97xTN", - "metrics": { - "step": 88, - "train_loss": 0.478, - "train_mean_token_accuracy": 0.924, - "valid_loss": 10.112, - "valid_mean_token_accuracy": 0.145, - "full_valid_loss": 0.567, - "full_valid_mean_token_accuracy": 0.944 - }, - "step_number": 88 + "event_id": "optional_client_event_id", + "type": "output_audio_buffer.clear" } - FineTuningJobEvent: + RealtimeBetaClientEventResponseCancel: type: object - description: Fine-tuning job event object + description: > + Send this event to cancel an in-progress response. The server will + respond + + with a `response.done` event with a status of + `response.status=cancelled`. If + + there is no response to cancel, the server will respond with an error. properties: - object: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: type: string - description: The object type, which is always "fine_tuning.job.event". enum: - - fine_tuning.job.event + - response.cancel + description: The event type, must be `response.cancel`. x-stainless-const: true - id: - type: string - description: The object identifier. - created_at: - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) for when the fine-tuning job was - created. - level: + response_id: type: string - description: The log level of the event. - enum: - - info - - warn - - error - message: + description: | + A specific response ID to cancel - if not provided, will cancel an + in-progress response in the default conversation. + required: + - type + x-oaiMeta: + name: response.cancel + group: realtime + example: | + { + "event_id": "event_567", + "type": "response.cancel" + } + RealtimeBetaClientEventResponseCreate: + type: object + description: > + This event instructs the server to create a Response, which means + triggering + + model inference. When in Server VAD mode, the server will create + Responses + + automatically. + + + A Response will include at least one Item, and may have two, in which + case + + the second will be a function call. These Items will be appended to the + + conversation history. + + + The server will respond with a `response.created` event, events for + Items + + and content created, and finally a `response.done` event to indicate + the + + Response is complete. + + + The `response.create` event can optionally include inference + configuration like + + `instructions`, and `temperature`. These fields will override the + Session's + + configuration for this Response only. + + + Responses can be created out-of-band of the default Conversation, + meaning that they can + + have arbitrary input, and it's possible to disable writing the output to + the Conversation. + + Only one Response can write to the default Conversation at a time, but + otherwise multiple + + Responses can be created in parallel. + + + Clients can set `conversation` to `none` to create a Response that does + not write to the default + + Conversation. Arbitrary input can be provided with the `input` field, + which is an array accepting + + raw Items and references to existing Items. + properties: + event_id: type: string - description: The message of the event. + description: Optional client-generated ID used to identify this event. type: type: string - description: The type of event. enum: - - message - - metrics - data: - type: object - description: The data associated with the event. + - response.create + description: The event type, must be `response.create`. + x-stainless-const: true + response: + $ref: '#/components/schemas/RealtimeBetaResponseCreateParams' required: - - id - - object - - created_at - - level - - message + - type x-oaiMeta: - name: The fine-tuning job event object - example: | + name: response.create + group: realtime + example: > + // Trigger a response with the default Conversation and no special + parameters + { - "object": "fine_tuning.job.event", - "id": "ftevent-abc123" - "created_at": 1677610602, - "level": "info", - "message": "Created fine-tuning job", - "data": {}, - "type": "message" + "type": "response.create", } - FunctionAndCustomToolCallOutput: - oneOf: - - $ref: '#/components/schemas/InputTextContent' - - $ref: '#/components/schemas/InputImageContent' - - $ref: '#/components/schemas/InputFileContent' - discriminator: - propertyName: type - FunctionObject: - type: object - properties: - description: - type: string - description: >- - A description of what the function does, used by the model to choose - when and how to call the function. - name: - type: string - description: >- - The name of the function to be called. Must be a-z, A-Z, 0-9, or - contain underscores and dashes, with a maximum length of 64. - parameters: - $ref: '#/components/schemas/FunctionParameters' - strict: - anyOf: - - type: boolean - default: false - description: >- - Whether to enable strict schema adherence when generating the - function call. If set to true, the model will follow the exact - schema defined in the `parameters` field. Only a subset of JSON - Schema is supported when `strict` is `true`. Learn more about - Structured Outputs in the [function calling - guide](/docs/guides/function-calling). - - type: 'null' - required: - - name - FunctionParameters: - type: object - description: >- - The parameters the functions accepts, described as a JSON Schema object. - See the [guide](/docs/guides/function-calling) for examples, and the - [JSON Schema - reference](https://json-schema.org/understanding-json-schema/) for - documentation about the format. - Omitting `parameters` defines a function with an empty parameter list. - additionalProperties: true - FunctionToolCall: + // Trigger an out-of-band response that does not write to the default + Conversation + + { + "type": "response.create", + "response": { + "instructions": "Provide a concise answer.", + "tools": [], // clear any session tools + "conversation": "none", + "output_modalities": ["text"], + "input": [ + { + "type": "item_reference", + "id": "item_12345", + }, + { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Summarize the above message in one sentence." + } + ] + } + ], + } + } + RealtimeBetaClientEventSessionUpdate: type: object - title: Function tool call description: > - A tool call to run a function. See the + Send this event to update the session’s default configuration. - [function calling guide](/docs/guides/function-calling) for more - information. + The client may send this event at any time to update any field, + + except for `voice`. However, note that once a session has been + + initialized with a particular `model`, it can’t be changed to + + another model using `session.update`. + + + When the server receives a `session.update`, it will respond + + with a `session.updated` event showing the full, effective + configuration. + + Only the fields that are present are updated. To clear a field like + + `instructions`, pass an empty string. properties: - id: + event_id: type: string - description: | - The unique ID of the function tool call. + description: Optional client-generated ID used to identify this event. type: type: string enum: - - function_call - description: | - The type of the function tool call. Always `function_call`. + - session.update + description: The event type, must be `session.update`. x-stainless-const: true - call_id: - type: string - description: | - The unique ID of the function tool call generated by the model. - namespace: - type: string - description: | - The namespace of the function to run. - name: - type: string - description: | - The name of the function to run. - arguments: + session: + $ref: '#/components/schemas/RealtimeSessionCreateRequest' + required: + - type + - session + x-oaiMeta: + name: session.update + group: realtime + example: | + { + "type": "session.update", + "session": { + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "Call this function when a user asks for a color palette.", + "parameters": { + "type": "object", + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto" + } + } + RealtimeBetaClientEventTranscriptionSessionUpdate: + type: object + description: | + Send this event to update a transcription session. + properties: + event_id: type: string - description: | - A JSON string of the arguments to pass to the function. - status: + description: Optional client-generated ID used to identify this event. + type: type: string - description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. enum: - - in_progress - - completed - - incomplete + - transcription_session.update + description: The event type, must be `transcription_session.update`. + x-stainless-const: true + session: + $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequest' required: - type - - call_id - - name - - arguments - FunctionToolCallOutput: + - session + x-oaiMeta: + name: transcription_session.update + group: realtime + example: | + { + "type": "transcription_session.update", + "session": { + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.logprobs", + ] + } + } + RealtimeBetaResponse: type: object - title: Function tool call output - description: | - The output of a function tool call. + description: The response resource. properties: id: type: string - description: > - The unique ID of the function tool call output. Populated when this - item - - is returned via API. - type: + description: The unique ID of the response. + object: type: string enum: - - function_call_output - description: > - The type of the function tool call output. Always - `function_call_output`. + - realtime.response + description: The object type, must be `realtime.response`. x-stainless-const: true - call_id: - type: string - description: | - The unique ID of the function tool call generated by the model. - output: - description: | - The output from the function call generated by your code. - Can be a string or an list of output content. - oneOf: - - type: string - description: | - A string of the output of the function call. - title: string output - - type: array - items: - $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' - title: output content list - description: | - Text, image, or file output of the function call. status: type: string - description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. enum: - - in_progress - completed + - cancelled + - failed - incomplete - required: - - type - - call_id - - output - FunctionToolCallOutputResource: - allOf: - - $ref: '#/components/schemas/FunctionToolCallOutput' - - type: object + - in_progress + description: > + The final status of the response (`completed`, `cancelled`, + `failed`, or + + `incomplete`, `in_progress`). + status_details: + type: object + description: Additional details about the status. properties: - id: + type: type: string - description: | - The unique ID of the function call tool output. - status: - description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. - $ref: '#/components/schemas/FunctionCallOutputStatusEnum' - created_by: + enum: + - completed + - cancelled + - failed + - incomplete + description: > + The type of error that caused the response to fail, + corresponding + + with the `status` field (`completed`, `cancelled`, + `incomplete`, + + `failed`). + reason: type: string + enum: + - turn_detected + - client_cancelled + - max_output_tokens + - content_filter + description: > + The reason the Response did not complete. For a `cancelled` + Response, + + one of `turn_detected` (the server VAD detected a new start of + speech) + + or `client_cancelled` (the client sent a cancel event). For an + + `incomplete` Response, one of `max_output_tokens` or + `content_filter` + + (the server-side safety filter activated and cut off the + response). + error: + type: object description: | - The identifier of the actor that created the item. - required: - - id - - status - FunctionToolCallResource: - allOf: - - $ref: '#/components/schemas/FunctionToolCall' - - type: object + A description of the error that caused the response to fail, + populated when the `status` is `failed`. + properties: + type: + type: string + description: The type of error. + code: + type: string + description: Error code, if any. + output: + type: array + description: The list of output items generated by the response. + items: + $ref: '#/components/schemas/RealtimeConversationItem' + metadata: + $ref: '#/components/schemas/Metadata' + usage: + type: object + description: > + Usage statistics for the Response, this will correspond to billing. + A + + Realtime API session will maintain a conversation context and append + new + + Items to the Conversation, thus output from previous turns (text + and + + audio tokens) will become the input for later turns. properties: - id: - type: string - description: | - The unique ID of the function tool call. - status: - description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. - $ref: '#/components/schemas/FunctionCallStatus' - created_by: - type: string - description: | - The identifier of the actor that created the item. - required: - - id - - status - GraderLabelModel: - type: object - title: LabelModelGrader - description: > - A LabelModelGrader object which uses a model to assign labels to each - item + total_tokens: + type: integer + description: > + The total number of tokens in the Response including input and + output + + text and audio tokens. + input_tokens: + type: integer + description: > + The number of input tokens used in the Response, including text + and + + audio tokens. + output_tokens: + type: integer + description: > + The number of output tokens sent in the Response, including text + and + + audio tokens. + input_token_details: + type: object + description: Details about the input tokens used in the Response. + properties: + cached_tokens: + type: integer + description: The number of cached tokens used as input for the Response. + text_tokens: + type: integer + description: The number of text tokens used as input for the Response. + image_tokens: + type: integer + description: The number of image tokens used as input for the Response. + audio_tokens: + type: integer + description: The number of audio tokens used as input for the Response. + cached_tokens_details: + type: object + description: >- + Details about the cached tokens used as input for the + Response. + properties: + text_tokens: + type: integer + description: >- + The number of cached text tokens used as input for the + Response. + image_tokens: + type: integer + description: >- + The number of cached image tokens used as input for the + Response. + audio_tokens: + type: integer + description: >- + The number of cached audio tokens used as input for the + Response. + output_token_details: + type: object + description: Details about the output tokens used in the Response. + properties: + text_tokens: + type: integer + description: The number of text tokens used in the Response. + audio_tokens: + type: integer + description: The number of audio tokens used in the Response. + conversation_id: + description: > + Which conversation the response is added to, determined by the + `conversation` + + field in the `response.create` event. If `auto`, the response will + be added to + + the default conversation and the value of `conversation_id` will be + an id like + + `conv_1234`. If `none`, the response will not be added to any + conversation and + + the value of `conversation_id` will be `null`. If responses are + being triggered - in the evaluation. - properties: - type: - description: The object type, which is always `label_model`. - type: string - enum: - - label_model - x-stainless-const: true - name: - type: string - description: The name of the grader. - model: + by server VAD, the response will be added to the default + conversation, thus + + the `conversation_id` will be an id like `conv_1234`. type: string - description: >- - The model to use for the evaluation. Must support structured - outputs. - input: - type: array - items: - $ref: '#/components/schemas/EvalItem' - labels: - type: array - items: - type: string - description: The labels to assign to each item in the evaluation. - passing_labels: + voice: + $ref: '#/components/schemas/VoiceIdsShared' + description: > + The voice the model used to respond. + + Current voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, + `sage`, + + `shimmer`, and `verse`. + modalities: type: array + description: > + The set of modalities the model used to respond. If there are + multiple modalities, + + the model will pick one, for example if `modalities` is `["text", + "audio"]`, the model + + could be responding in either text or audio. items: type: string - description: >- - The labels that indicate a passing result. Must be a subset of - labels. - required: - - type - - model - - input - - passing_labels - - labels - - name - x-oaiMeta: - name: Label Model Grader - group: graders - example: | - { - "name": "First label grader", - "type": "label_model", - "model": "gpt-4o-2024-08-06", - "input": [ - { - "type": "message", - "role": "system", - "content": { - "type": "input_text", - "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" - } - }, - { - "type": "message", - "role": "user", - "content": { - "type": "input_text", - "text": "Statement: {{item.response}}" - } - } - ], - "passing_labels": [ - "positive" - ], - "labels": [ - "positive", - "neutral", - "negative" - ] - } - GraderMulti: - type: object - title: MultiGrader - description: >- - A MultiGrader object combines the output of multiple graders to produce - a single score. - properties: - type: + enum: + - text + - audio + output_audio_format: type: string enum: - - multi - default: multi - description: The object type, which is always `multi`. - x-stainless-const: true - name: - type: string - description: The name of the grader. - graders: + - pcm16 + - g711_ulaw + - g711_alaw + description: > + The format of output audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + temperature: + type: number + description: > + Sampling temperature for the model, limited to [0.6, 1.2]. Defaults + to 0.8. + max_output_tokens: oneOf: - - $ref: '#/components/schemas/GraderStringCheck' - - $ref: '#/components/schemas/GraderTextSimilarity' - - $ref: '#/components/schemas/GraderPython' - - $ref: '#/components/schemas/GraderScoreModel' - - $ref: '#/components/schemas/GraderLabelModel' - calculate_output: - type: string - description: A formula to calculate the output based on grader results. - required: - - name - - type - - graders - - calculate_output - x-oaiMeta: - name: Multi Grader - group: graders - example: | - { - "type": "multi", - "name": "example multi grader", - "graders": [ - { - "type": "text_similarity", - "name": "example text similarity grader", - "input": "The graded text", - "reference": "The reference text", - "evaluation_metric": "fuzzy_match" - }, - { - "type": "string_check", - "name": "Example string check grader", - "input": "{{sample.output_text}}", - "reference": "{{item.label}}", - "operation": "eq" - } - ], - "calculate_output": "0.5 * text_similarity_score + 0.5 * string_check_score)" - } - GraderPython: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls, that was used in this response. + RealtimeBetaResponseCreateParams: type: object - title: PythonGrader - description: | - A PythonGrader object that runs a python script on the input. + description: Create a new Realtime response with these parameters properties: - type: - type: string - enum: - - python - description: The object type, which is always `python`. - x-stainless-const: true - name: - type: string - description: The name of the grader. - source: + modalities: + type: array + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + items: + type: string + enum: + - text + - audio + instructions: type: string - description: The source code of the python script. - image_tag: + description: > + 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. + + + 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. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + description: > + The voice the model uses to respond. Supported built-in voices are + + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, + `verse`, + + `marin`, and `cedar`. You may also provide a custom voice object + with an + + `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed + during + + the session once the model has responded with audio at least once. + output_audio_format: type: string - description: The image tag to use for the python script. - required: - - type - - name - - source - x-oaiMeta: - name: Python Grader - group: graders - example: | - { - "type": "python", - "name": "Example python grader", - "image_tag": "2025-05-08", - "source": """ - def grade(sample: dict, item: dict) -> float: - \""" - Returns 1.0 if `output_text` equals `label`, otherwise 0.0. - \""" - output = sample.get("output_text") - label = item.get("label") - return 1.0 if output == label else 0.0 - """, - } - GraderScoreModel: + enum: + - pcm16 + - g711_ulaw + - g711_alaw + description: > + The format of output audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + tools: + type: array + description: Tools (functions) available to the model. + items: + type: object + properties: + type: + type: string + enum: + - function + description: The type of the tool, i.e. `function`. + x-stainless-const: true + name: + type: string + description: The name of the function. + description: + type: string + description: > + The description of the function, including guidance on when + and how + + to call it, and guidance about what to tell the user when + calling + + (if anything). + parameters: + type: object + description: Parameters of the function in JSON Schema. + tool_choice: + description: > + How the model chooses tools. Provide one of the string modes or + force a specific + + function/MCP tool. + oneOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + default: auto + temperature: + type: number + description: > + Sampling temperature for the model, limited to [0.6, 1.2]. Defaults + to 0.8. + max_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + conversation: + description: > + Controls which conversation the response is added to. Currently + supports + + `auto` and `none`, with `auto` as the default value. The `auto` + value + + means that the contents of the response will be added to the default + + conversation. Set this to `none` to create an out-of-band response + which + + will not add items to default conversation. + oneOf: + - type: string + - type: string + default: auto + enum: + - auto + - none + metadata: + $ref: '#/components/schemas/Metadata' + prompt: + $ref: '#/components/schemas/Prompt' + input: + type: array + description: > + Input items to include in the prompt for the model. Using this field + + creates a new context for this Response instead of using the default + + conversation. An empty array `[]` will clear the context for this + Response. + + Note that this can include references to items from the default + conversation. + items: + $ref: '#/components/schemas/RealtimeConversationItem' + RealtimeBetaServerEventConversationItemCreated: type: object - title: ScoreModelGrader description: > - A ScoreModelGrader object that uses a model to assign a score to the - input. + Returned when a conversation item is created. There are several + scenarios that produce this event: + - The server is generating a Response, which if successful will produce + either one or two Items, which will be of type `message` + (role `assistant`) or type `function_call`. + - The input audio buffer has been committed, either by the client or the + server (in `server_vad` mode). The server will take the content of the + input audio buffer and add it to a new user message Item. + - The client has sent a `conversation.item.create` event to add a new Item + to the Conversation. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string enum: - - score_model - description: The object type, which is always `score_model`. + - conversation.item.created + description: The event type, must be `conversation.item.created`. x-stainless-const: true - name: - type: string - description: The name of the grader. - model: - type: string - description: The model to use for the evaluation. - sampling_params: - type: object - description: The sampling parameters for the model. - properties: - seed: - anyOf: - - type: integer - description: | - A seed value to initialize the randomness, during sampling. - - type: 'null' - top_p: - anyOf: - - type: number - default: 1 - example: 1 - description: > - An alternative to temperature for nucleus sampling; 1.0 - includes all tokens. - - type: 'null' - temperature: - anyOf: - - type: number - description: | - A higher temperature increases randomness in the outputs. - - type: 'null' - max_completions_tokens: - anyOf: - - type: integer - minimum: 1 - description: > - The maximum number of tokens the grader model may generate - in its response. - - type: 'null' - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - input: - type: array - items: - $ref: '#/components/schemas/EvalItem' - description: > - The input messages evaluated by the grader. Supports text, output - text, input image, and input audio content blocks, and may include - template strings. - range: - type: array - items: - type: number - min_items: 2 - max_items: 2 - description: The range of the score. Defaults to `[0, 1]`. + previous_item_id: + anyOf: + - type: string + description: > + The ID of the preceding item in the Conversation context, allows + the + + client to understand the order of the conversation. Can be + `null` if the + + item has no predecessor. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: + - event_id - type - - name - - input - - model + - item x-oaiMeta: - name: Score Model Grader - group: graders + name: conversation.item.created + group: realtime example: | { - "type": "score_model", - "name": "Example score model grader", - "input": [ - { - "role": "user", - "content": [ - { - "type": "input_text", - "text": ( - "Score how close the reference answer is to the model answer. Score 1.0 if they are the same and 0.0 if they are different." - " Return just a floating point score\n\n" - " Reference answer: {{item.label}}\n\n" - " Model answer: {{sample.output_text}}" - ) - }, - { - "type": "input_image", - "image_url": "https://example.com/reference.png", - "file_id": null, - "detail": "auto" - } - ], - } - ], - "model": "gpt-5-mini", - "sampling_params": { - "temperature": 1, - "top_p": 1, - "seed": 42, - "max_completions_tokens": 32768, - "reasoning_effort": "medium" - }, + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [] + } } - GraderStringCheck: + RealtimeBetaServerEventConversationItemDeleted: type: object - title: StringCheckGrader description: > - A StringCheckGrader object that performs a string comparison between - input and reference using a specified operation. + Returned when an item in the conversation is deleted by the client with + a + + `conversation.item.delete` event. This event is used to synchronize the + + server's understanding of the conversation history with the client's + view. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string enum: - - string_check - description: The object type, which is always `string_check`. + - conversation.item.deleted + description: The event type, must be `conversation.item.deleted`. x-stainless-const: true - name: - type: string - description: The name of the grader. - input: - type: string - description: The input text. This may include template strings. - reference: - type: string - description: The reference text. This may include template strings. - operation: + item_id: type: string - enum: - - eq - - ne - - like - - ilike - description: >- - The string check operation to perform. One of `eq`, `ne`, `like`, or - `ilike`. + description: The ID of the item that was deleted. required: + - event_id - type - - name - - input - - reference - - operation + - item_id x-oaiMeta: - name: String Check Grader - group: graders + name: conversation.item.deleted + group: realtime example: | { - "type": "string_check", - "name": "Example string check grader", - "input": "{{sample.output_text}}", - "reference": "{{item.label}}", - "operation": "eq" + "event_id": "event_2728", + "type": "conversation.item.deleted", + "item_id": "msg_005" } - GraderTextSimilarity: + RealtimeBetaServerEventConversationItemInputAudioTranscriptionCompleted: type: object - title: TextSimilarityGrader description: > - A TextSimilarityGrader object which grades text based on similarity - metrics. + This event is the output of audio transcription for user audio written + to the + + user audio buffer. Transcription begins when the input audio buffer is + + committed by the client or server (in `server_vad` mode). Transcription + runs + + asynchronously with Response creation, so this event may come before or + after + + the Response events. + + + Realtime API models accept audio natively, and thus input transcription + is a + + separate process run on a separate ASR (Automatic Speech Recognition) + model. + + The transcript may diverge somewhat from the model's interpretation, and + + should be treated as a rough guide. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string enum: - - text_similarity - default: text_similarity - description: The type of grader. + - conversation.item.input_audio_transcription.completed + description: | + The event type, must be + `conversation.item.input_audio_transcription.completed`. x-stainless-const: true - name: - type: string - description: The name of the grader. - input: - type: string - description: The text being graded. - reference: + item_id: type: string - description: The text being graded against. - evaluation_metric: + description: The ID of the user message item containing the audio. + content_index: + type: integer + description: The index of the content part containing the audio. + transcript: type: string - enum: - - cosine - - fuzzy_match - - bleu - - gleu - - meteor - - rouge_1 - - rouge_2 - - rouge_3 - - rouge_4 - - rouge_5 - - rouge_l - description: > - The evaluation metric to use. One of `cosine`, `fuzzy_match`, - `bleu`, - - `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, - `rouge_5`, - - or `rouge_l`. + description: The transcribed text. + logprobs: + anyOf: + - type: array + description: The log probabilities of the transcription. + items: + $ref: '#/components/schemas/LogProbProperties' + - type: 'null' + usage: + type: object + description: Usage statistics for the transcription. + oneOf: + - $ref: '#/components/schemas/TranscriptTextUsageTokens' + title: Token Usage + - $ref: '#/components/schemas/TranscriptTextUsageDuration' + title: Duration Usage required: + - event_id - type - - name - - input - - reference - - evaluation_metric + - item_id + - content_index + - transcript + - usage x-oaiMeta: - name: Text Similarity Grader - group: graders + name: conversation.item.input_audio_transcription.completed + group: realtime example: | { - "type": "text_similarity", - "name": "Example text similarity grader", - "input": "{{sample.output_text}}", - "reference": "{{item.label}}", - "evaluation_metric": "fuzzy_match" + "event_id": "event_2122", + "type": "conversation.item.input_audio_transcription.completed", + "item_id": "msg_003", + "content_index": 0, + "transcript": "Hello, how are you?", + "usage": { + "type": "tokens", + "total_tokens": 48, + "input_tokens": 38, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 28, + }, + "output_tokens": 10, + } } - Group: + RealtimeBetaServerEventConversationItemInputAudioTranscriptionDelta: type: object - description: Summary information about a group returned in role assignment responses. + description: > + Returned when the text value of an input audio transcription content + part is updated. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - group - description: Always `group`. + - conversation.item.input_audio_transcription.delta + description: >- + The event type, must be + `conversation.item.input_audio_transcription.delta`. x-stainless-const: true - id: - type: string - description: Identifier for the group. - name: + item_id: type: string - description: Display name of the group. - created_at: + description: The ID of the item. + content_index: type: integer - format: unixtime - description: Unix timestamp (in seconds) when the group was created. - scim_managed: - type: boolean - description: Whether the group is managed through SCIM. + description: The index of the content part in the item's content array. + delta: + type: string + description: The text delta. + logprobs: + anyOf: + - type: array + description: The log probabilities of the transcription. + items: + $ref: '#/components/schemas/LogProbProperties' + - type: 'null' required: - - object - - id - - name - - created_at - - scim_managed + - event_id + - type + - item_id x-oaiMeta: - name: The group object + name: conversation.item.input_audio_transcription.delta + group: realtime example: | { - "object": "group", - "id": "group_01J1F8ABCDXYZ", - "name": "Support Team", - "created_at": 1711471533, - "scim_managed": false + "type": "conversation.item.input_audio_transcription.delta", + "event_id": "event_001", + "item_id": "item_001", + "content_index": 0, + "delta": "Hello" } - GroupDeletedResource: + RealtimeBetaServerEventConversationItemInputAudioTranscriptionFailed: type: object - description: Confirmation payload returned after deleting a group. + description: > + Returned when input audio transcription is configured, and a + transcription + + request for a user message failed. These events are separate from other + + `error` events so that the client can identify the related Item. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - group.deleted - description: Always `group.deleted`. + - conversation.item.input_audio_transcription.failed + description: | + The event type, must be + `conversation.item.input_audio_transcription.failed`. x-stainless-const: true - id: + item_id: type: string - description: Identifier of the deleted group. - deleted: - type: boolean - description: Whether the group was deleted. + description: The ID of the user message item. + content_index: + type: integer + description: The index of the content part containing the audio. + error: + type: object + description: Details of the transcription error. + properties: + type: + type: string + description: The type of error. + code: + type: string + description: Error code, if any. + message: + type: string + description: A human-readable error message. + param: + type: string + description: Parameter related to the error, if any. required: - - object - - id - - deleted + - event_id + - type + - item_id + - content_index + - error x-oaiMeta: + name: conversation.item.input_audio_transcription.failed + group: realtime example: | { - "object": "group.deleted", - "id": "group_01J1F8ABCDXYZ", - "deleted": true + "event_id": "event_2324", + "type": "conversation.item.input_audio_transcription.failed", + "item_id": "msg_003", + "content_index": 0, + "error": { + "type": "transcription_error", + "code": "audio_unintelligible", + "message": "The audio could not be transcribed.", + "param": null + } } - GroupListResource: + RealtimeBetaServerEventConversationItemInputAudioTranscriptionSegment: type: object - description: Paginated list of organization groups. + description: >- + Returned when an input audio transcription segment is identified for an + item. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list - description: Always `list`. - x-stainless-const: true - data: - type: array - description: Groups returned in the current page. - items: - $ref: '#/components/schemas/GroupResponse' - has_more: - type: boolean - description: Whether additional groups are available when paginating. - next: + - conversation.item.input_audio_transcription.segment description: >- - Cursor to fetch the next page of results, or `null` if there are no - more results. - anyOf: - - type: string - - type: 'null' + The event type, must be + `conversation.item.input_audio_transcription.segment`. + x-stainless-const: true + item_id: + type: string + description: The ID of the item containing the input audio content. + content_index: + type: integer + description: The index of the input audio content part within the item. + text: + type: string + description: The text for this segment. + id: + type: string + description: The segment identifier. + speaker: + type: string + description: The detected speaker label for this segment. + start: + type: number + format: double + description: Start time of the segment in seconds. + end: + type: number + format: double + description: End time of the segment in seconds. required: - - object - - data - - has_more - - next + - event_id + - type + - item_id + - content_index + - text + - id + - speaker + - start + - end x-oaiMeta: - name: Group list + name: conversation.item.input_audio_transcription.segment + group: realtime example: | { - "object": "list", - "data": [ - { - "id": "group_01J1F8ABCDXYZ", - "name": "Support Team", - "created_at": 1711471533, - "is_scim_managed": false - }, - { - "id": "group_01J1F8PQRMNO", - "name": "Sales", - "created_at": 1711472599, - "is_scim_managed": true - } - ], - "has_more": false, - "next": null + "event_id": "event_6501", + "type": "conversation.item.input_audio_transcription.segment", + "item_id": "msg_011", + "content_index": 0, + "text": "hello", + "id": "seg_0001", + "speaker": "spk_1", + "start": 0.0, + "end": 0.4 } - GroupMemberUser: + RealtimeBetaServerEventConversationItemRetrieved: type: object - description: >- - Details about a user returned from an organization group membership - lookup. + description: > + Returned when a conversation item is retrieved with + `conversation.item.retrieve`. properties: - id: - type: string - description: Identifier for the user. - name: + event_id: type: string - description: Display name of the user. - email: - description: Email address of the user, or `null` for users without an email. - anyOf: - - type: string - - type: 'null' - picture: - description: URL of the user's profile picture, if available. - anyOf: - - type: string - - type: 'null' - is_service_account: - description: Whether the user is a service account. - anyOf: - - type: boolean - - type: 'null' - user_type: + description: The unique ID of the server event. + type: type: string enum: - - user - - tenant_user - description: The type of user. + - conversation.item.retrieved + description: The event type, must be `conversation.item.retrieved`. + x-stainless-const: true + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - - id - - name - - email - - picture - - is_service_account - - user_type + - event_id + - type + - item x-oaiMeta: - name: The group member user object + name: conversation.item.retrieved + group: realtime example: | { - "id": "user_abc123", - "name": "Ada Lovelace", - "email": "ada@example.com", - "picture": null, - "is_service_account": false, - "user_type": "user" + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [ + { + "type": "input_audio", + "transcript": "hello how are you", + "audio": "base64encodedaudio==" + } + ] + } } - GroupResourceWithSuccess: + RealtimeBetaServerEventConversationItemTruncated: type: object - description: Response returned after updating a group. + description: > + Returned when an earlier assistant audio message item is truncated by + the + + client with a `conversation.item.truncate` event. This event is used to + + synchronize the server's understanding of the audio with the client's + playback. + + + This action will truncate the audio and remove the server-side text + transcript + + to ensure there is no text in the context that hasn't been heard by the + user. properties: - id: + event_id: + type: string + description: The unique ID of the server event. + type: type: string - description: Identifier for the group. - name: + enum: + - conversation.item.truncated + description: The event type, must be `conversation.item.truncated`. + x-stainless-const: true + item_id: type: string - description: Updated display name for the group. - created_at: + description: The ID of the assistant message item that was truncated. + content_index: type: integer - format: unixtime - description: Unix timestamp (in seconds) when the group was created. - is_scim_managed: - type: boolean - description: >- - Whether the group is managed through SCIM and controlled by your - identity provider. + description: The index of the content part that was truncated. + audio_end_ms: + type: integer + description: | + The duration up to which the audio was truncated, in milliseconds. required: - - id - - name - - created_at - - is_scim_managed + - event_id + - type + - item_id + - content_index + - audio_end_ms x-oaiMeta: + name: conversation.item.truncated + group: realtime example: | { - "id": "group_01J1F8ABCDXYZ", - "name": "Escalations", - "created_at": 1711471533, - "is_scim_managed": false + "event_id": "event_2526", + "type": "conversation.item.truncated", + "item_id": "msg_004", + "content_index": 0, + "audio_end_ms": 1500 } - GroupResponse: + RealtimeBetaServerEventError: type: object - description: Details about an organization group. + description: > + Returned when an error occurs, which could be a client problem or a + server + + problem. Most errors are recoverable and the session will stay open, we + + recommend to implementors to monitor and log error messages by default. properties: - id: - type: string - description: Identifier for the group. - name: + event_id: type: string - description: Display name of the group. - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the group was created. - is_scim_managed: - type: boolean - description: >- - Whether the group is managed through SCIM and controlled by your - identity provider. - group_type: + description: The unique ID of the server event. + type: type: string enum: - - group - - tenant_group - description: The type of the group. + - error + description: The event type, must be `error`. + x-stainless-const: true + error: + type: object + description: Details of the error. + required: + - type + - message + properties: + type: + type: string + description: > + The type of error (e.g., "invalid_request_error", + "server_error"). + code: + anyOf: + - type: string + description: Error code, if any. + - type: 'null' + message: + type: string + description: A human-readable error message. + param: + anyOf: + - type: string + description: Parameter related to the error, if any. + - type: 'null' + event_id: + anyOf: + - type: string + description: > + The event_id of the client event that caused the error, if + applicable. + - type: 'null' required: - - id - - name - - created_at - - is_scim_managed - - group_type + - event_id + - type + - error x-oaiMeta: - name: Group + name: error + group: realtime example: | { - "id": "group_01J1F8ABCDXYZ", - "name": "Support Team", - "created_at": 1711471533, - "is_scim_managed": false, - "group_type": "group" + "event_id": "event_890", + "type": "error", + "error": { + "type": "invalid_request_error", + "code": "invalid_event", + "message": "The 'type' field is missing.", + "param": null, + "event_id": "event_567" + } } - GroupRoleAssignment: + RealtimeBetaServerEventInputAudioBufferCleared: type: object - description: Role assignment linking a group to a role. + description: | + Returned when the input audio buffer is cleared by the client with a + `input_audio_buffer.clear` event. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - group.role - description: Always `group.role`. + - input_audio_buffer.cleared + description: The event type, must be `input_audio_buffer.cleared`. x-stainless-const: true - group: - $ref: '#/components/schemas/Group' - role: - $ref: '#/components/schemas/Role' required: - - object - - group - - role + - event_id + - type x-oaiMeta: - name: The group role object + name: input_audio_buffer.cleared + group: realtime example: | { - "object": "group.role", - "group": { - "object": "group", - "id": "group_01J1F8ABCDXYZ", - "name": "Support Team", - "created_at": 1711471533, - "scim_managed": false - }, - "role": { - "object": "role", - "id": "role_01J1F8ROLE01", - "name": "API Group Manager", - "description": "Allows managing organization groups", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "resource_type": "api.organization", - "predefined_role": false - } + "event_id": "event_1314", + "type": "input_audio_buffer.cleared" } - GroupUser: + RealtimeBetaServerEventInputAudioBufferCommitted: type: object - description: Represents an individual user returned when inspecting group membership. + description: > + Returned when an input audio buffer is committed, either by the client + or + + automatically in server VAD mode. The `item_id` property is the ID of + the user + + message item that will be created, thus a `conversation.item.created` + event + + will also be sent to the client. properties: - id: + event_id: type: string - description: The identifier, which can be referenced in API endpoints - name: + description: The unique ID of the server event. + type: type: string - description: The name of the user. - email: + enum: + - input_audio_buffer.committed + description: The event type, must be `input_audio_buffer.committed`. + x-stainless-const: true + previous_item_id: anyOf: - type: string + description: > + The ID of the preceding item after which the new item will be + inserted. + + Can be `null` if the item has no predecessor. - type: 'null' - description: The email address of the user. + item_id: + type: string + description: The ID of the user message item that will be created. required: - - id - - name - - email - GroupUserAssignment: + - event_id + - type + - item_id + x-oaiMeta: + name: input_audio_buffer.committed + group: realtime + example: | + { + "event_id": "event_1121", + "type": "input_audio_buffer.committed", + "previous_item_id": "msg_001", + "item_id": "msg_002" + } + RealtimeBetaServerEventInputAudioBufferSpeechStarted: type: object - description: Confirmation payload returned after adding a user to a group. + description: > + Sent by the server when in `server_vad` mode to indicate that speech has + been + + detected in the audio buffer. This can happen any time audio is added to + the + + buffer (unless speech is already detected). The client may want to use + this + + event to interrupt audio playback or provide visual feedback to the + user. + + + The client should expect to receive a + `input_audio_buffer.speech_stopped` event + + when speech stops. The `item_id` property is the ID of the user message + item + + that will be created when speech stops and will also be included in the + + `input_audio_buffer.speech_stopped` event (unless the client manually + commits + + the audio buffer during VAD activation). properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - group.user - description: Always `group.user`. + - input_audio_buffer.speech_started + description: The event type, must be `input_audio_buffer.speech_started`. x-stainless-const: true - user_id: - type: string - description: Identifier of the user that was added. - group_id: + audio_start_ms: + type: integer + description: > + Milliseconds from the start of all audio written to the buffer + during the + + session when speech was first detected. This will correspond to the + + beginning of audio sent to the model, and thus includes the + + `prefix_padding_ms` configured in the Session. + item_id: type: string - description: Identifier of the group the user was added to. + description: > + The ID of the user message item that will be created when speech + stops. required: - - object - - user_id - - group_id + - event_id + - type + - audio_start_ms + - item_id x-oaiMeta: - name: The group user object + name: input_audio_buffer.speech_started + group: realtime example: | { - "object": "group.user", - "user_id": "user_abc123", - "group_id": "group_01J1F8ABCDXYZ" + "event_id": "event_1516", + "type": "input_audio_buffer.speech_started", + "audio_start_ms": 1000, + "item_id": "msg_003" } - GroupUserDeletedResource: + RealtimeBetaServerEventInputAudioBufferSpeechStopped: type: object - description: Confirmation payload returned after removing a user from a group. + description: > + Returned in `server_vad` mode when the server detects the end of speech + in + + the audio buffer. The server will also send an + `conversation.item.created` + + event with the user message item that is created from the audio buffer. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - group.user.deleted - description: Always `group.user.deleted`. + - input_audio_buffer.speech_stopped + description: The event type, must be `input_audio_buffer.speech_stopped`. x-stainless-const: true - deleted: - type: boolean - description: Whether the group membership was removed. + audio_end_ms: + type: integer + description: > + Milliseconds since the session started when speech stopped. This + will + + correspond to the end of audio sent to the model, and thus includes + the + + `min_silence_duration_ms` configured in the Session. + item_id: + type: string + description: The ID of the user message item that will be created. required: - - object - - deleted + - event_id + - type + - audio_end_ms + - item_id x-oaiMeta: - name: Group user deletion confirmation + name: input_audio_buffer.speech_stopped + group: realtime example: | { - "object": "group.user.deleted", - "deleted": true + "event_id": "event_1718", + "type": "input_audio_buffer.speech_stopped", + "audio_end_ms": 2000, + "item_id": "msg_003" } - HostedToolPermission: - type: object - description: Permission state for a single hosted tool on a project. - properties: - enabled: - type: boolean - description: Whether the hosted tool is enabled for the project. - required: - - enabled - HostedToolPermissionUpdate: - type: object - properties: - enabled: - type: boolean - description: Whether to enable the hosted tool for the project. - required: - - enabled - Image: + RealtimeBetaServerEventMCPListToolsCompleted: type: object - description: >- - Represents the content or the URL of an image generated by the OpenAI - API. + description: Returned when listing MCP tools has completed for an item. properties: - b64_json: - type: string - description: >- - The base64-encoded JSON of the generated image. Returned by default - for the GPT image models, and only present if `response_format` is - set to `b64_json` for `dall-e-2` and `dall-e-3`. - url: - type: string - format: uri - description: >- - When using `dall-e-2` or `dall-e-3`, the URL of the generated image - if `response_format` is set to `url` (default value). Unsupported - for the GPT image models. - revised_prompt: + event_id: type: string - description: >- - For `dall-e-3` only, the revised prompt that was used to generate - the image. - ImageEditCompletedEvent: - type: object - description: > - Emitted when image editing has completed and the final image is - available. - properties: + description: The unique ID of the server event. type: type: string - description: | - The type of the event. Always `image_edit.completed`. enum: - - image_edit.completed + - mcp_list_tools.completed + description: The event type, must be `mcp_list_tools.completed`. x-stainless-const: true - b64_json: - type: string - description: > - Base64-encoded final edited image data, suitable for rendering as an - image. - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp when the event was created. - size: + item_id: type: string - description: | - The size of the edited image. - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto - quality: + description: The ID of the MCP list tools item. + required: + - event_id + - type + - item_id + x-oaiMeta: + name: mcp_list_tools.completed + group: realtime + example: | + { + "event_id": "event_6102", + "type": "mcp_list_tools.completed", + "item_id": "mcp_list_tools_001" + } + RealtimeBetaServerEventMCPListToolsFailed: + type: object + description: Returned when listing MCP tools has failed for an item. + properties: + event_id: type: string - description: | - The quality setting for the edited image. - enum: - - low - - medium - - high - - auto - background: + description: The unique ID of the server event. + type: type: string - description: | - The background setting for the edited image. enum: - - transparent - - opaque - - auto - output_format: + - mcp_list_tools.failed + description: The event type, must be `mcp_list_tools.failed`. + x-stainless-const: true + item_id: type: string - description: | - The output format for the edited image. - enum: - - png - - webp - - jpeg - usage: - $ref: '#/components/schemas/ImagesUsage' + description: The ID of the MCP list tools item. required: + - event_id - type - - b64_json - - created_at - - size - - quality - - background - - output_format - - usage - x-oaiMeta: - name: image_edit.completed - group: images - example: | - { - "type": "image_edit.completed", - "b64_json": "...", - "created_at": 1620000000, - "size": "1024x1024", - "quality": "high", - "background": "transparent", - "output_format": "png", - "usage": { - "total_tokens": 100, - "input_tokens": 50, - "output_tokens": 50, - "input_tokens_details": { - "text_tokens": 10, - "image_tokens": 40 - } - } + - item_id + x-oaiMeta: + name: mcp_list_tools.failed + group: realtime + example: | + { + "event_id": "event_6103", + "type": "mcp_list_tools.failed", + "item_id": "mcp_list_tools_001" } - ImageEditPartialImageEvent: + RealtimeBetaServerEventMCPListToolsInProgress: type: object - description: > - Emitted when a partial image is available during image editing - streaming. + description: Returned when listing MCP tools is in progress for an item. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string - description: | - The type of the event. Always `image_edit.partial_image`. enum: - - image_edit.partial_image + - mcp_list_tools.in_progress + description: The event type, must be `mcp_list_tools.in_progress`. x-stainless-const: true - b64_json: - type: string - description: > - Base64-encoded partial image data, suitable for rendering as an - image. - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp when the event was created. - size: - type: string - description: | - The size of the requested edited image. - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto - quality: - type: string - description: | - The quality setting for the requested edited image. - enum: - - low - - medium - - high - - auto - background: - type: string - description: | - The background setting for the requested edited image. - enum: - - transparent - - opaque - - auto - output_format: + item_id: type: string - description: | - The output format for the requested edited image. - enum: - - png - - webp - - jpeg - partial_image_index: - type: integer - description: | - 0-based index for the partial image (streaming). + description: The ID of the MCP list tools item. required: + - event_id - type - - b64_json - - created_at - - size - - quality - - background - - output_format - - partial_image_index + - item_id x-oaiMeta: - name: image_edit.partial_image - group: images + name: mcp_list_tools.in_progress + group: realtime example: | { - "type": "image_edit.partial_image", - "b64_json": "...", - "created_at": 1620000000, - "size": "1024x1024", - "quality": "high", - "background": "transparent", - "output_format": "png", - "partial_image_index": 0 + "event_id": "event_6101", + "type": "mcp_list_tools.in_progress", + "item_id": "mcp_list_tools_001" } - ImageEditStreamEvent: - anyOf: - - $ref: '#/components/schemas/ImageEditPartialImageEvent' - - $ref: '#/components/schemas/ImageEditCompletedEvent' - discriminator: - propertyName: type - ImageGenCompletedEvent: + RealtimeBetaServerEventRateLimitsUpdated: type: object description: > - Emitted when image generation has completed and the final image is - available. + Emitted at the beginning of a Response to indicate the updated rate + limits. + + When a Response is created some tokens will be "reserved" for the + output + + tokens, the rate limits shown here reflect that reservation, which is + then + + adjusted accordingly once the Response is completed. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string - description: | - The type of the event. Always `image_generation.completed`. enum: - - image_generation.completed + - rate_limits.updated + description: The event type, must be `rate_limits.updated`. x-stainless-const: true - b64_json: + rate_limits: + type: array + description: List of rate limit information. + items: + type: object + properties: + name: + type: string + enum: + - requests + - tokens + description: | + The name of the rate limit (`requests`, `tokens`). + limit: + type: integer + description: The maximum allowed value for the rate limit. + remaining: + type: integer + description: The remaining value before the limit is reached. + reset_seconds: + type: number + description: Seconds until the rate limit resets. + required: + - event_id + - type + - rate_limits + x-oaiMeta: + name: rate_limits.updated + group: realtime + example: | + { + "event_id": "event_5758", + "type": "rate_limits.updated", + "rate_limits": [ + { + "name": "requests", + "limit": 1000, + "remaining": 999, + "reset_seconds": 60 + }, + { + "name": "tokens", + "limit": 50000, + "remaining": 49950, + "reset_seconds": 60 + } + ] + } + RealtimeBetaServerEventResponseAudioDelta: + type: object + description: Returned when the model-generated audio is updated. + properties: + event_id: type: string - description: | - Base64-encoded image data, suitable for rendering as an image. - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp when the event was created. - size: + description: The unique ID of the server event. + type: type: string - description: | - The size of the generated image. enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto - quality: + - response.output_audio.delta + description: The event type, must be `response.output_audio.delta`. + x-stainless-const: true + response_id: type: string - description: | - The quality setting for the generated image. - enum: - - low - - medium - - high - - auto - background: + description: The ID of the response. + item_id: type: string - description: | - The background setting for the generated image. - enum: - - transparent - - opaque - - auto - output_format: + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: type: string - description: | - The output format for the generated image. - enum: - - png - - webp - - jpeg - usage: - $ref: '#/components/schemas/ImagesUsage' + description: Base64-encoded audio data delta. required: + - event_id - type - - b64_json - - created_at - - size - - quality - - background - - output_format - - usage + - response_id + - item_id + - output_index + - content_index + - delta x-oaiMeta: - name: image_generation.completed - group: images + name: response.output_audio.delta + group: realtime example: | { - "type": "image_generation.completed", - "b64_json": "...", - "created_at": 1620000000, - "size": "1024x1024", - "quality": "high", - "background": "transparent", - "output_format": "png", - "usage": { - "total_tokens": 100, - "input_tokens": 50, - "output_tokens": 50, - "input_tokens_details": { - "text_tokens": 10, - "image_tokens": 40 - } - } + "event_id": "event_4950", + "type": "response.output_audio.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Base64EncodedAudioDelta" } - ImageGenPartialImageEvent: + RealtimeBetaServerEventResponseAudioDone: type: object description: > - Emitted when a partial image is available during image generation - streaming. + Returned when the model-generated audio is done. Also emitted when a + Response + + is interrupted, incomplete, or cancelled. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string - description: | - The type of the event. Always `image_generation.partial_image`. enum: - - image_generation.partial_image + - response.output_audio.done + description: The event type, must be `response.output_audio.done`. x-stainless-const: true - b64_json: - type: string - description: > - Base64-encoded partial image data, suitable for rendering as an - image. - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp when the event was created. - size: - type: string - description: | - The size of the requested image. - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto - quality: - type: string - description: | - The quality setting for the requested image. - enum: - - low - - medium - - high - - auto - background: + response_id: type: string - description: | - The background setting for the requested image. - enum: - - transparent - - opaque - - auto - output_format: + description: The ID of the response. + item_id: type: string - description: | - The output format for the requested image. - enum: - - png - - webp - - jpeg - partial_image_index: + description: The ID of the item. + output_index: type: integer - description: | - 0-based index for the partial image (streaming). + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. required: + - event_id - type - - b64_json - - created_at - - size - - quality - - background - - output_format - - partial_image_index + - response_id + - item_id + - output_index + - content_index x-oaiMeta: - name: image_generation.partial_image - group: images + name: response.output_audio.done + group: realtime example: | { - "type": "image_generation.partial_image", - "b64_json": "...", - "created_at": 1620000000, - "size": "1024x1024", - "quality": "high", - "background": "transparent", - "output_format": "png", - "partial_image_index": 0 + "event_id": "event_5152", + "type": "response.output_audio.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0 } - ImageGenStreamEvent: - anyOf: - - $ref: '#/components/schemas/ImageGenPartialImageEvent' - - $ref: '#/components/schemas/ImageGenCompletedEvent' - discriminator: - propertyName: type - ImageGenTool: + RealtimeBetaServerEventResponseAudioTranscriptDelta: type: object - title: Image generation tool - description: | - A tool that generates images using the GPT image models. + description: > + Returned when the model-generated transcription of audio output is + updated. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string enum: - - image_generation - description: | - The type of the image generation tool. Always `image_generation`. + - response.output_audio_transcript.delta + description: The event type, must be `response.output_audio_transcript.delta`. x-stainless-const: true - model: - anyOf: - - type: string - - type: string - enum: - - gpt-image-1 - - gpt-image-1-mini - - gpt-image-1.5 - description: | - The image generation model to use. Default: `gpt-image-1`. - default: gpt-image-1 - quality: + response_id: type: string - enum: - - low - - medium - - high - - auto - description: | - The quality of the generated image. One of `low`, `medium`, `high`, - or `auto`. Default: `auto`. - default: auto - size: - anyOf: - - type: string - - type: string - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto - description: >- - The size of the generated images. For `gpt-image-2` and - `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as - `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height - must both be divisible by 16 and the requested aspect ratio must be - between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, - and the maximum supported resolution is `3840x2160`. The requested - size must also satisfy the model's current pixel and edge limits. - The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are - supported by the GPT image models; `auto` is supported for models - that allow automatic sizing. For `dall-e-2`, use one of `256x256`, - `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, - `1792x1024`, or `1024x1792`. - default: auto - output_format: + description: The ID of the response. + item_id: type: string - enum: - - png - - webp - - jpeg - description: | - The output format of the generated image. One of `png`, `webp`, or - `jpeg`. Default: `png`. - default: png - output_compression: + description: The ID of the item. + output_index: type: integer - minimum: 0 - maximum: 100 - description: | - Compression level for the output image. Default: 100. - default: 100 - moderation: - type: string - enum: - - auto - - low - description: | - Moderation level for the generated image. Default: `auto`. - default: auto - background: - type: string - enum: - - transparent - - opaque - - auto - description: | - Background type for the generated image. One of `transparent`, - `opaque`, or `auto`. Default: `auto`. - default: auto - input_fidelity: - anyOf: - - $ref: '#/components/schemas/InputFidelity' - - type: 'null' - input_image_mask: - type: object - description: | - Optional mask for inpainting. Contains `image_url` - (string, optional) and `file_id` (string, optional). - properties: - image_url: - type: string - description: | - Base64-encoded mask image. - file_id: - type: string - description: | - File ID for the mask image. - required: [] - additionalProperties: false - partial_images: + description: The index of the output item in the response. + content_index: type: integer - minimum: 0 - maximum: 3 - description: > - Number of partial images to generate in streaming mode, from 0 - (default value) to 3. - default: 0 - action: - description: > - Whether to generate a new image or edit an existing image. Default: - `auto`. - $ref: '#/components/schemas/ImageGenActionEnum' + description: The index of the content part in the item's content array. + delta: + type: string + description: The transcript delta. required: + - event_id - type - ImageGenToolCall: + - response_id + - item_id + - output_index + - content_index + - delta + x-oaiMeta: + name: response.output_audio_transcript.delta + group: realtime + example: | + { + "event_id": "event_4546", + "type": "response.output_audio_transcript.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Hello, how can I a" + } + RealtimeBetaServerEventResponseAudioTranscriptDone: type: object - title: Image generation call description: | - An image generation request made by the model. + Returned when the model-generated transcription of audio output is done + streaming. Also emitted when a Response is interrupted, incomplete, or + cancelled. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string enum: - - image_generation_call - description: > - The type of the image generation call. Always - `image_generation_call`. + - response.output_audio_transcript.done + description: The event type, must be `response.output_audio_transcript.done`. x-stainless-const: true - id: + response_id: type: string - description: | - The unique ID of the image generation call. - status: + description: The ID of the response. + item_id: type: string - enum: - - in_progress - - completed - - generating - - failed - description: | - The status of the image generation call. - result: - anyOf: - - type: string - description: | - The generated image encoded in base64. - - type: 'null' + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + transcript: + type: string + description: The final transcript of the audio. required: + - event_id - type - - id - - status - - result - ImageRefParam: - type: object - description: | - Reference an input image by either URL or uploaded file ID. - Provide exactly one of `image_url` or `file_id`. - properties: - image_url: - type: string - format: uri - maxLength: 20971520 - description: A fully qualified URL or base64-encoded data URL. - example: https://example.com/source-image.png - file_id: - type: string - description: The File API ID of an uploaded image to use as input. - example: file-abc123 - anyOf: - - required: - - image_url - - required: - - file_id - not: - required: - - image_url - - file_id - additionalProperties: false - ImagesResponse: + - response_id + - item_id + - output_index + - content_index + - transcript + x-oaiMeta: + name: response.output_audio_transcript.done + group: realtime + example: | + { + "event_id": "event_4748", + "type": "response.output_audio_transcript.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "transcript": "Hello, how can I assist you today?" + } + RealtimeBetaServerEventResponseContentPartAdded: type: object - title: Image generation response - description: The response from the image generation endpoint. + description: > + Returned when a new content part is added to an assistant message item + during + + response generation. properties: - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the image was created. - data: - type: array - description: The list of generated images. - items: - $ref: '#/components/schemas/Image' - background: + event_id: type: string - description: >- - The background parameter used for the image generation. Either - `transparent` or `opaque`. - enum: - - transparent - - opaque - output_format: + description: The unique ID of the server event. + type: type: string - description: >- - The output format of the image generation. Either `png`, `webp`, or - `jpeg`. enum: - - png - - webp - - jpeg - size: + - response.content_part.added + description: The event type, must be `response.content_part.added`. + x-stainless-const: true + response_id: type: string - description: >- - The size of the image generated. Either `1024x1024`, `1024x1536`, or - `1536x1024`. - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - quality: + description: The ID of the response. + item_id: type: string - description: >- - The quality of the image generated. Either `low`, `medium`, or - `high`. - enum: - - low - - medium - - high - usage: - $ref: '#/components/schemas/ImageGenUsage' + description: The ID of the item to which the content part was added. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + part: + type: object + description: The content part that was added. + properties: + type: + type: string + enum: + - audio + - text + description: The content type ("text", "audio"). + text: + type: string + description: The text content (if type is "text"). + audio: + type: string + description: Base64-encoded audio data (if type is "audio"). + transcript: + type: string + description: The transcript of the audio (if type is "audio"). required: - - created + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - part x-oaiMeta: - name: The image generation response - group: images + name: response.content_part.added + group: realtime example: | { - "created": 1713833628, - "data": [ - { - "b64_json": "..." - } - ], - "background": "transparent", - "output_format": "png", - "size": "1024x1024", - "quality": "high", - "usage": { - "total_tokens": 100, - "input_tokens": 50, - "output_tokens": 50, - "input_tokens_details": { - "text_tokens": 10, - "image_tokens": 40 + "event_id": "event_3738", + "type": "response.content_part.added", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "" } - } } - ImagesUsage: + RealtimeBetaServerEventResponseContentPartDone: type: object description: > - For the GPT image models only, the token usage information for the image - generation. - required: - - total_tokens - - input_tokens - - output_tokens - - input_tokens_details - properties: - total_tokens: - type: integer - description: > - The total number of tokens (images and text) used for the image - generation. - input_tokens: - type: integer - description: The number of tokens (images and text) in the input prompt. - output_tokens: - type: integer - description: The number of image tokens in the output image. - input_tokens_details: - type: object - description: The input tokens detailed information for the image generation. - required: - - text_tokens - - image_tokens - properties: - text_tokens: - type: integer - description: The number of text tokens in the input prompt. - image_tokens: - type: integer - description: The number of image tokens in the input prompt. - InputAudio: - type: object - title: Input audio - description: | - An audio input to the model. + Returned when a content part is done streaming in an assistant message + item. + + Also emitted when a Response is interrupted, incomplete, or cancelled. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string - description: | - The type of the input item. Always `input_audio`. enum: - - input_audio + - response.content_part.done + description: The event type, must be `response.content_part.done`. x-stainless-const: true - input_audio: + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + part: type: object + description: The content part that is done. properties: - data: - type: string - description: | - Base64-encoded audio data. - format: + type: type: string - description: > - The format of the audio data. Currently supported formats are - `mp3` and - - `wav`. enum: - - mp3 - - wav - required: - - data - - format + - audio + - text + description: The content type ("text", "audio"). + text: + type: string + description: The text content (if type is "text"). + audio: + type: string + description: Base64-encoded audio data (if type is "audio"). + transcript: + type: string + description: The transcript of the audio (if type is "audio"). required: + - event_id - type - - input_audio - InputContent: - oneOf: - - $ref: '#/components/schemas/InputTextContent' - - $ref: '#/components/schemas/InputImageContent' - - $ref: '#/components/schemas/InputFileContent' - discriminator: - propertyName: type - InputItem: - oneOf: - - $ref: '#/components/schemas/EasyInputMessage' - - type: object - title: Item - description: | - An item representing part of the context for the response to be - generated by the model. Can contain text, images, and audio inputs, - as well as previous assistant responses and tool call outputs. - $ref: '#/components/schemas/Item' - - $ref: '#/components/schemas/CompactionTriggerItemParam' - - $ref: '#/components/schemas/ItemReferenceParam' - discriminator: - propertyName: type - InputMessage: + - response_id + - item_id + - output_index + - content_index + - part + x-oaiMeta: + name: response.content_part.done + group: realtime + example: | + { + "event_id": "event_3940", + "type": "response.content_part.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "Sure, I can help with that." + } + } + RealtimeBetaServerEventResponseCreated: type: object - title: Input message description: > - A message input to the model with a role indicating instruction - following - - hierarchy. Instructions given with the `developer` or `system` role take + Returned when a new Response is created. The first event of response + creation, - precedence over instructions given with the `user` role. + where the response is in an initial state of `in_progress`. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string - description: | - The type of the message input. Always set to `message`. enum: - - message + - response.created + description: The event type, must be `response.created`. x-stainless-const: true - role: - type: string - description: > - The role of the message input. One of `user`, `system`, or - `developer`. - enum: - - user - - system - - developer - status: - type: string - description: | - The status of item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. - enum: - - in_progress - - completed - - incomplete - content: - $ref: '#/components/schemas/InputMessageContentList' + response: + $ref: '#/components/schemas/RealtimeBetaResponse' required: - - role - - content - InputMessageContentList: - type: array - title: Input item content list + - event_id + - type + - response + x-oaiMeta: + name: response.created + group: realtime + example: | + { + "type": "response.created", + "event_id": "event_C9G8pqbTEddBSIxbBN6Os", + "response": { + "object": "realtime.response", + "id": "resp_C9G8p7IH2WxLbkgPNouYL", + "status": "in_progress", + "status_details": null, + "output": [], + "conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN", + "output_modalities": [ + "audio" + ], + "max_output_tokens": "inf", + "audio": { + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin" + } + }, + "usage": null, + "metadata": null + }, + "timestamp": "2:30:35 PM" + } + RealtimeBetaServerEventResponseDone: + type: object description: > - A list of one or many input items to the model, containing different - content + Returned when a Response is done streaming. Always emitted, no matter + the - types. - items: - $ref: '#/components/schemas/InputContent' - InputMessageResource: - allOf: - - $ref: '#/components/schemas/InputMessage' - - type: object - properties: - id: - type: string - description: | - The unique ID of the message input. - required: - - id - - type - InputParam: - description: | - Text, image, or file inputs to the model, used to generate a response. + final state. The Response object included in the `response.done` event + will - Learn more: - - [Text inputs and outputs](/docs/guides/text) - - [Image inputs](/docs/guides/images) - - [File inputs](/docs/guides/pdf-files) - - [Conversation state](/docs/guides/conversation-state) - - [Function calling](/docs/guides/function-calling) - oneOf: - - type: string - title: Text input - description: | - A text input to the model, equivalent to a text input with the - `user` role. - - type: array - title: Input item list - description: | - A list of one or many input items to the model, containing - different content types. - items: - $ref: '#/components/schemas/InputItem' - Invite: + include all output Items in the Response but will omit the raw audio + data. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - response.done + description: The event type, must be `response.done`. + x-stainless-const: true + response: + $ref: '#/components/schemas/RealtimeBetaResponse' + required: + - event_id + - type + - response + x-oaiMeta: + name: response.done + group: realtime + example: | + { + "event_id": "event_3132", + "type": "response.done", + "response": { + "id": "resp_001", + "object": "realtime.response", + "status": "completed", + "status_details": null, + "output": [ + { + "id": "msg_006", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, how can I assist you today?" + } + ] + } + ], + "usage": { + "total_tokens":275, + "input_tokens":127, + "output_tokens":148, + "input_token_details": { + "cached_tokens":384, + "text_tokens":119, + "audio_tokens":8, + "cached_tokens_details": { + "text_tokens": 128, + "audio_tokens": 256 + } + }, + "output_token_details": { + "text_tokens":36, + "audio_tokens":112 + } + } + } + } + RealtimeBetaServerEventResponseFunctionCallArgumentsDelta: type: object - description: Represents an individual `invite` to the organization. + description: | + Returned when the model-generated function call arguments are updated. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - organization.invite - description: The object type, which is always `organization.invite` + - response.function_call_arguments.delta + description: | + The event type, must be `response.function_call_arguments.delta`. x-stainless-const: true - id: + response_id: type: string - description: The identifier, which can be referenced in API endpoints - email: + description: The ID of the response. + item_id: type: string - description: The email address of the individual to whom the invite was sent - role: + description: The ID of the function call item. + output_index: + type: integer + description: The index of the output item in the response. + call_id: type: string - enum: - - owner - - reader - description: '`owner` or `reader`' - status: + description: The ID of the function call. + delta: type: string - enum: - - accepted - - expired - - pending - description: '`accepted`,`expired`, or `pending`' - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the invite was sent. - expires_at: - anyOf: - - type: integer - format: unixtime - - type: 'null' - description: The Unix timestamp (in seconds) of when the invite expires. - accepted_at: - anyOf: - - type: integer - format: unixtime - - type: 'null' - description: The Unix timestamp (in seconds) of when the invite was accepted. - projects: - type: array - description: >- - The projects that were granted membership upon acceptance of the - invite. - items: - type: object - properties: - id: - type: string - description: Project's public ID - role: - type: string - enum: - - member - - owner - description: Project membership role - required: - - id - - role + description: The arguments delta as a JSON string. required: - - object - - id - - email - - role - - status - - created_at - - projects + - event_id + - type + - response_id + - item_id + - output_index + - call_id + - delta x-oaiMeta: - name: The invite object + name: response.function_call_arguments.delta + group: realtime example: | { - "object": "organization.invite", - "id": "invite-abc", - "email": "user@example.com", - "role": "owner", - "status": "accepted", - "created_at": 1711471533, - "expires_at": 1711471533, - "accepted_at": 1711471533, - "projects": [ - { - "id": "project-xyz", - "role": "member" - } - ] + "event_id": "event_5354", + "type": "response.function_call_arguments.delta", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "delta": "{\"location\": \"San\"" } - InviteDeleteResponse: + RealtimeBetaServerEventResponseFunctionCallArgumentsDone: type: object + description: > + Returned when the model-generated function call arguments are done + streaming. + + Also emitted when a Response is interrupted, incomplete, or cancelled. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - organization.invite.deleted - description: The object type, which is always `organization.invite.deleted` + - response.function_call_arguments.done + description: | + The event type, must be `response.function_call_arguments.done`. x-stainless-const: true - id: + response_id: type: string - deleted: - type: boolean + description: The ID of the response. + item_id: + type: string + description: The ID of the function call item. + output_index: + type: integer + description: The index of the output item in the response. + call_id: + type: string + description: The ID of the function call. + name: + type: string + description: The name of the function that was called. + arguments: + type: string + description: The final arguments as a JSON string. required: - - object - - id - - deleted - InviteListResponse: + - event_id + - type + - response_id + - item_id + - output_index + - call_id + - name + - arguments + x-oaiMeta: + name: response.function_call_arguments.done + group: realtime + example: | + { + "event_id": "event_5556", + "type": "response.function_call_arguments.done", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\"}" + } + RealtimeBetaServerEventResponseMCPCallArgumentsDelta: type: object + description: >- + Returned when MCP tool call arguments are updated during response + generation. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list - description: The object type, which is always `list` + - response.mcp_call_arguments.delta + description: The event type, must be `response.mcp_call_arguments.delta`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/Invite' - first_id: - anyOf: - - type: string - - type: 'null' - description: The first `invite_id` in the retrieved `list` - last_id: + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the MCP tool call item. + output_index: + type: integer + description: The index of the output item in the response. + delta: + type: string + description: The JSON-encoded arguments delta. + obfuscation: anyOf: - type: string + description: If present, indicates the delta text was obfuscated. - type: 'null' - description: The last `invite_id` in the retrieved `list` - has_more: - type: boolean - description: >- - The `has_more` property is used for pagination to indicate there are - additional results. - required: - - object - - data - - has_more - InviteProjectGroupBody: - type: object - description: Request payload for granting a group access to a project. - properties: - group_id: - type: string - description: Identifier of the group to add to the project. - role: - type: string - description: Identifier of the project role to grant to the group. required: - - group_id - - role + - event_id + - type + - response_id + - item_id + - output_index + - delta x-oaiMeta: + name: response.mcp_call_arguments.delta + group: realtime example: | { - "group_id": "group_01J1F8ABCDXYZ", - "role": "role_01J1F8PROJ" + "event_id": "event_6201", + "type": "response.mcp_call_arguments.delta", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "delta": "{\"partial\":true}" } - InviteRequest: + RealtimeBetaServerEventResponseMCPCallArgumentsDone: type: object + description: >- + Returned when MCP tool call arguments are finalized during response + generation. properties: - email: + event_id: type: string - description: Send an email to this address - role: + description: The unique ID of the server event. + type: type: string enum: - - reader - - owner - description: '`owner` or `reader`' - projects: - type: array - description: >- - An array of projects to which membership is granted at the same time - the org invite is accepted. If omitted, the user will be invited to - the default project for compatibility with legacy behavior. If empty - list is passed, the user will not be invited to any projects, - including the default one. - items: - type: object - properties: - id: - type: string - description: Project's public ID - role: - type: string - enum: - - member - - owner - description: Project membership role - required: - - id - - role - required: - - email - - role - Item: - type: object - description: | - Content item used to generate a response. - oneOf: - - $ref: '#/components/schemas/InputMessage' - - $ref: '#/components/schemas/OutputMessage' - - $ref: '#/components/schemas/FileSearchToolCall' - - $ref: '#/components/schemas/ComputerToolCall' - - $ref: '#/components/schemas/ComputerCallOutputItemParam' - - $ref: '#/components/schemas/WebSearchToolCall' - - $ref: '#/components/schemas/FunctionToolCall' - - $ref: '#/components/schemas/FunctionCallOutputItemParam' - - $ref: '#/components/schemas/ToolSearchCallItemParam' - - $ref: '#/components/schemas/ToolSearchOutputItemParam' - - $ref: '#/components/schemas/AdditionalToolsItemParam' - - $ref: '#/components/schemas/ReasoningItem' - - $ref: '#/components/schemas/CompactionSummaryItemParam' - - $ref: '#/components/schemas/ImageGenToolCall' - - $ref: '#/components/schemas/CodeInterpreterToolCall' - - $ref: '#/components/schemas/LocalShellToolCall' - - $ref: '#/components/schemas/LocalShellToolCallOutput' - - $ref: '#/components/schemas/FunctionShellCallItemParam' - - $ref: '#/components/schemas/FunctionShellCallOutputItemParam' - - $ref: '#/components/schemas/ApplyPatchToolCallItemParam' - - $ref: '#/components/schemas/ApplyPatchToolCallOutputItemParam' - - $ref: '#/components/schemas/MCPListTools' - - $ref: '#/components/schemas/MCPApprovalRequest' - - $ref: '#/components/schemas/MCPApprovalResponse' - - $ref: '#/components/schemas/MCPToolCall' - - $ref: '#/components/schemas/CustomToolCallOutput' - - $ref: '#/components/schemas/CustomToolCall' - discriminator: - propertyName: type - ItemResource: - description: | - Content item used to generate a response. - oneOf: - - $ref: '#/components/schemas/InputMessageResource' - - $ref: '#/components/schemas/OutputMessage' - - $ref: '#/components/schemas/FileSearchToolCall' - - $ref: '#/components/schemas/ComputerToolCall' - - $ref: '#/components/schemas/ComputerToolCallOutputResource' - - $ref: '#/components/schemas/WebSearchToolCall' - - $ref: '#/components/schemas/FunctionToolCallResource' - - $ref: '#/components/schemas/FunctionToolCallOutputResource' - - $ref: '#/components/schemas/ToolSearchCall' - - $ref: '#/components/schemas/ToolSearchOutput' - - $ref: '#/components/schemas/AdditionalTools' - - $ref: '#/components/schemas/ReasoningItem' - - $ref: '#/components/schemas/CompactionBody' - - $ref: '#/components/schemas/ImageGenToolCall' - - $ref: '#/components/schemas/CodeInterpreterToolCall' - - $ref: '#/components/schemas/LocalShellToolCall' - - $ref: '#/components/schemas/LocalShellToolCallOutput' - - $ref: '#/components/schemas/FunctionShellCall' - - $ref: '#/components/schemas/FunctionShellCallOutput' - - $ref: '#/components/schemas/ApplyPatchToolCall' - - $ref: '#/components/schemas/ApplyPatchToolCallOutput' - - $ref: '#/components/schemas/MCPListTools' - - $ref: '#/components/schemas/MCPApprovalRequest' - - $ref: '#/components/schemas/MCPApprovalResponseResource' - - $ref: '#/components/schemas/MCPToolCall' - - $ref: '#/components/schemas/CustomToolCallResource' - - $ref: '#/components/schemas/CustomToolCallOutputResource' - discriminator: - propertyName: type - ListAssistantsResponse: - type: object - properties: - object: + - response.mcp_call_arguments.done + description: The event type, must be `response.mcp_call_arguments.done`. + x-stainless-const: true + response_id: type: string - example: list - data: - type: array - items: - $ref: '#/components/schemas/AssistantObject' - first_id: + description: The ID of the response. + item_id: type: string - example: asst_abc123 - last_id: + description: The ID of the MCP tool call item. + output_index: + type: integer + description: The index of the output item in the response. + arguments: type: string - example: asst_abc456 - has_more: - type: boolean - example: false + description: The final JSON-encoded arguments string. required: - - object - - data - - first_id - - last_id - - has_more + - event_id + - type + - response_id + - item_id + - output_index + - arguments x-oaiMeta: - name: List assistants response object - group: chat + name: response.mcp_call_arguments.done + group: realtime example: | { - "object": "list", - "data": [ - { - "id": "asst_abc123", - "object": "assistant", - "created_at": 1698982736, - "name": "Coding Tutor", - "description": null, - "model": "gpt-4o", - "instructions": "You are a helpful assistant designed to make me better at coding!", - "tools": [], - "tool_resources": {}, - "metadata": {}, - "top_p": 1.0, - "temperature": 1.0, - "response_format": "auto" - }, - { - "id": "asst_abc456", - "object": "assistant", - "created_at": 1698982718, - "name": "My Assistant", - "description": null, - "model": "gpt-4o", - "instructions": "You are a helpful assistant designed to make me better at coding!", - "tools": [], - "tool_resources": {}, - "metadata": {}, - "top_p": 1.0, - "temperature": 1.0, - "response_format": "auto" - }, - { - "id": "asst_abc789", - "object": "assistant", - "created_at": 1698982643, - "name": null, - "description": null, - "model": "gpt-4o", - "instructions": null, - "tools": [], - "tool_resources": {}, - "metadata": {}, - "top_p": 1.0, - "temperature": 1.0, - "response_format": "auto" - } - ], - "first_id": "asst_abc123", - "last_id": "asst_abc789", - "has_more": false + "event_id": "event_6202", + "type": "response.mcp_call_arguments.done", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "arguments": "{\"q\":\"docs\"}" } - ListAuditLogsResponse: + RealtimeBetaServerEventResponseMCPCallCompleted: type: object + description: Returned when an MCP tool call has completed successfully. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list + - response.mcp_call.completed + description: The event type, must be `response.mcp_call.completed`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/AuditLog' - first_id: - anyOf: - - type: string - - type: 'null' - example: audit_log-defb456h8dks - last_id: - anyOf: - - type: string - - type: 'null' - example: audit_log-hnbkd8s93s - has_more: - type: boolean + output_index: + type: integer + description: The index of the output item in the response. + item_id: + type: string + description: The ID of the MCP tool call item. required: - - object - - data - - has_more - ListBatchesResponse: + - event_id + - type + - output_index + - item_id + x-oaiMeta: + name: response.mcp_call.completed + group: realtime + example: | + { + "event_id": "event_6302", + "type": "response.mcp_call.completed", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeBetaServerEventResponseMCPCallFailed: type: object + description: Returned when an MCP tool call has failed. properties: - data: - type: array - items: - $ref: '#/components/schemas/Batch' - first_id: - type: string - example: batch_abc123 - last_id: + event_id: type: string - example: batch_abc456 - has_more: - type: boolean - object: + description: The unique ID of the server event. + type: type: string enum: - - list + - response.mcp_call.failed + description: The event type, must be `response.mcp_call.failed`. x-stainless-const: true + output_index: + type: integer + description: The index of the output item in the response. + item_id: + type: string + description: The ID of the MCP tool call item. required: - - object - - data - - has_more - ListCertificatesResponse: + - event_id + - type + - output_index + - item_id + x-oaiMeta: + name: response.mcp_call.failed + group: realtime + example: | + { + "event_id": "event_6303", + "type": "response.mcp_call.failed", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeBetaServerEventResponseMCPCallInProgress: type: object + description: Returned when an MCP tool call has started and is in progress. properties: - data: - type: array - items: - $ref: '#/components/schemas/OrganizationCertificate' - first_id: - anyOf: - - type: string - - type: 'null' - example: cert_abc - last_id: - anyOf: - - type: string - - type: 'null' - example: cert_abc - has_more: - type: boolean - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list + - response.mcp_call.in_progress + description: The event type, must be `response.mcp_call.in_progress`. x-stainless-const: true + output_index: + type: integer + description: The index of the output item in the response. + item_id: + type: string + description: The ID of the MCP tool call item. required: - - object - - data - - has_more - - first_id - - last_id - ListFilesResponse: + - event_id + - type + - output_index + - item_id + x-oaiMeta: + name: response.mcp_call.in_progress + group: realtime + example: | + { + "event_id": "event_6301", + "type": "response.mcp_call.in_progress", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeBetaServerEventResponseOutputItemAdded: type: object + description: Returned when a new Item is created during Response generation. properties: - object: + event_id: type: string - example: list - data: - type: array - items: - $ref: '#/components/schemas/OpenAIFile' - first_id: + description: The unique ID of the server event. + type: type: string - example: file-abc123 - last_id: + enum: + - response.output_item.added + description: The event type, must be `response.output_item.added`. + x-stainless-const: true + response_id: type: string - example: file-abc456 - has_more: - type: boolean - example: false + description: The ID of the Response to which the item belongs. + output_index: + type: integer + description: The index of the output item in the Response. + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - - object - - data - - first_id - - last_id - - has_more - ListFineTuningCheckpointPermissionResponse: + - event_id + - type + - response_id + - output_index + - item + x-oaiMeta: + name: response.output_item.added + group: realtime + example: | + { + "event_id": "event_3334", + "type": "response.output_item.added", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "in_progress", + "role": "assistant", + "content": [] + } + } + RealtimeBetaServerEventResponseOutputItemDone: type: object + description: > + Returned when an Item is done streaming. Also emitted when a Response + is + + interrupted, incomplete, or cancelled. properties: - data: - type: array - items: - $ref: '#/components/schemas/FineTuningCheckpointPermission' - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list + - response.output_item.done + description: The event type, must be `response.output_item.done`. x-stainless-const: true - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean + response_id: + type: string + description: The ID of the Response to which the item belongs. + output_index: + type: integer + description: The index of the output item in the Response. + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - - object - - data - - has_more - ListFineTuningJobCheckpointsResponse: + - event_id + - type + - response_id + - output_index + - item + x-oaiMeta: + name: response.output_item.done + group: realtime + example: | + { + "event_id": "event_3536", + "type": "response.output_item.done", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, I can help with that." + } + ] + } + } + RealtimeBetaServerEventResponseTextDelta: type: object + description: >- + Returned when the text value of an "output_text" content part is + updated. properties: - data: - type: array - items: - $ref: '#/components/schemas/FineTuningJobCheckpoint' - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list + - response.output_text.delta + description: The event type, must be `response.output_text.delta`. x-stainless-const: true - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: The text delta. required: - - object - - data - - has_more - ListFineTuningJobEventsResponse: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - delta + x-oaiMeta: + name: response.output_text.delta + group: realtime + example: | + { + "event_id": "event_4142", + "type": "response.output_text.delta", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "delta": "Sure, I can h" + } + RealtimeBetaServerEventResponseTextDone: type: object + description: > + Returned when the text value of an "output_text" content part is done + streaming. Also + + emitted when a Response is interrupted, incomplete, or cancelled. properties: - data: - type: array - items: - $ref: '#/components/schemas/FineTuningJobEvent' - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list + - response.output_text.done + description: The event type, must be `response.output_text.done`. x-stainless-const: true - has_more: - type: boolean + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + text: + type: string + description: The final text content. required: - - object - - data - - has_more - ListMessagesResponse: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - text + x-oaiMeta: + name: response.output_text.done + group: realtime + example: | + { + "event_id": "event_4344", + "type": "response.output_text.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "text": "Sure, I can help with that." + } + RealtimeBetaServerEventSessionCreated: + type: object + description: > + Returned when a Session is created. Emitted automatically when a new + + connection is established as the first server event. This event will + contain + + the default Session configuration. properties: - object: + event_id: type: string - example: list - data: - type: array - items: - $ref: '#/components/schemas/MessageObject' - first_id: + description: The unique ID of the server event. + type: type: string - example: msg_abc123 - last_id: + enum: + - session.created + description: The event type, must be `session.created`. + x-stainless-const: true + session: + $ref: '#/components/schemas/RealtimeSession' + required: + - event_id + - type + - session + x-oaiMeta: + name: session.created + group: realtime + example: | + { + "type": "session.created", + "event_id": "event_C9G5RJeJ2gF77mV7f2B1j", + "session": { + "object": "realtime.session", + "id": "sess_C9G5QPteg4UIbotdKLoYQ", + "model": "gpt-realtime-2025-08-28", + "modalities": [ + "audio" + ], + "instructions": "Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.", + "tools": [], + "tool_choice": "auto", + "max_response_output_tokens": "inf", + "tracing": null, + "prompt": null, + "expires_at": 1756324625, + "input_audio_format": "pcm16", + "input_audio_transcription": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + }, + "output_audio_format": "pcm16", + "voice": "marin", + "include": null + } + } + RealtimeBetaServerEventSessionUpdated: + type: object + description: | + Returned when a session is updated with a `session.update` event, unless + there is an error. + properties: + event_id: type: string - example: msg_abc123 - has_more: - type: boolean - example: false + description: The unique ID of the server event. + type: + type: string + enum: + - session.updated + description: The event type, must be `session.updated`. + x-stainless-const: true + session: + $ref: '#/components/schemas/RealtimeSession' required: - - object - - data - - first_id - - last_id - - has_more - ListModelsResponse: + - event_id + - type + - session + x-oaiMeta: + name: session.updated + group: realtime + example: | + { + "event_id": "event_5678", + "type": "session.updated", + "session": { + "id": "sess_001", + "object": "realtime.session", + "model": "gpt-realtime", + "modalities": ["text"], + "instructions": "New instructions", + "voice": "sage", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": { + "model": "whisper-1" + }, + "turn_detection": null, + "tools": [], + "tool_choice": "none", + "temperature": 0.7, + "max_response_output_tokens": 200, + "speed": 1.1, + "tracing": "auto" + } + } + RealtimeBetaServerEventTranscriptionSessionCreated: type: object + description: | + Returned when a transcription session is created. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list + - transcription_session.created + description: The event type, must be `transcription_session.created`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/Model' + session: + $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' required: - - object - - data - ListPaginatedFineTuningJobsResponse: + - event_id + - type + - session + x-oaiMeta: + name: transcription_session.created + group: realtime + example: | + { + "event_id": "event_5566", + "type": "transcription_session.created", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500 + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [] + } + } + RealtimeBetaServerEventTranscriptionSessionUpdated: type: object + description: > + Returned when a transcription session is updated with a + `transcription_session.update` event, unless + + there is an error. properties: - data: - type: array - items: - $ref: '#/components/schemas/FineTuningJob' - has_more: - type: boolean - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list + - transcription_session.updated + description: The event type, must be `transcription_session.updated`. x-stainless-const: true + session: + $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' required: - - object - - data - - has_more - ListProjectCertificatesResponse: + - event_id + - type + - session + x-oaiMeta: + name: transcription_session.updated + group: realtime + example: | + { + "event_id": "event_5678", + "type": "transcription_session.updated", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + // "interrupt_response": false -- this will NOT be returned + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.avg_logprob", + ], + } + } + RealtimeCallCreateRequest: + title: Realtime call creation request type: object + description: >- + Parameters required to initiate a realtime call and receive the SDP + answer + + needed to complete a WebRTC peer connection. Provide an SDP offer + generated + + by your client and optionally configure the session that will answer the + call. + required: + - sdp properties: - data: - type: array - items: - $ref: '#/components/schemas/OrganizationProjectCertificate' - first_id: - anyOf: - - type: string - - type: 'null' - example: cert_abc - last_id: - anyOf: - - type: string - - type: 'null' - example: cert_abc - has_more: - type: boolean - object: + sdp: type: string - enum: - - list - x-stainless-const: true + description: >- + WebRTC Session Description Protocol (SDP) offer generated by the + caller. + session: + title: Session configuration + allOf: + - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' + description: >- + Optional session configuration to apply before the realtime session + is + + created. Use the same parameters you would send in a [`create client + secret`](/docs/api-reference/realtime-sessions/create-realtime-client-secret) + + request. + additionalProperties: false + RealtimeCallReferRequest: + title: Realtime call refer request + type: object + description: >- + Parameters required to transfer a SIP call to a new destination using + the + + Realtime API. required: - - object - - data - - has_more - - first_id - - last_id - ListRunStepsResponse: + - target_uri properties: - object: - type: string - example: list - data: - type: array - items: - $ref: '#/components/schemas/RunStepObject' - first_id: - type: string - example: step_abc123 - last_id: + target_uri: type: string - example: step_abc456 - has_more: - type: boolean - example: false - required: - - object - - data - - first_id - - last_id - - has_more - ListRunsResponse: + description: >- + URI that should appear in the SIP Refer-To header. Supports values + like + + `tel:+14155550123` or `sip:agent@example.com`. + example: tel:+14155550123 + additionalProperties: false + RealtimeCallRejectRequest: + title: Realtime call reject request type: object + description: >- + Parameters used to decline an incoming SIP call handled by the Realtime + API. properties: - object: + status_code: + type: integer + description: >- + SIP response code to send back to the caller. Defaults to `603` + (Decline) + + when omitted. + example: 486 + additionalProperties: false + RealtimeClientEvent: + discriminator: + propertyName: type + description: | + A realtime client event. + anyOf: + - $ref: '#/components/schemas/RealtimeClientEventConversationItemCreate' + - $ref: '#/components/schemas/RealtimeClientEventConversationItemDelete' + - $ref: '#/components/schemas/RealtimeClientEventConversationItemRetrieve' + - $ref: '#/components/schemas/RealtimeClientEventConversationItemTruncate' + - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferAppend' + - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferClear' + - $ref: '#/components/schemas/RealtimeClientEventOutputAudioBufferClear' + - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferCommit' + - $ref: '#/components/schemas/RealtimeClientEventResponseCancel' + - $ref: '#/components/schemas/RealtimeClientEventResponseCreate' + - $ref: '#/components/schemas/RealtimeClientEventSessionUpdate' + RealtimeClientEventConversationItemCreate: + type: object + description: > + Add a new Item to the Conversation's context, including messages, + function + + calls, and function call responses. This event can be used both to + populate a + + "history" of the conversation and to add new items mid-stream, but has + the + + current limitation that it cannot populate assistant audio messages. + + + If successful, the server will respond with a + `conversation.item.created` + + event, otherwise an `error` event will be sent. + properties: + event_id: type: string - example: list - data: - type: array - items: - $ref: '#/components/schemas/RunObject' - first_id: + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: type: string - example: run_abc123 - last_id: + enum: + - conversation.item.create + description: The event type, must be `conversation.item.create`. + x-stainless-const: true + previous_item_id: type: string - example: run_abc456 - has_more: - type: boolean - example: false + description: > + 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. + + + If set to `root`, the new item will be added to the beginning of the + conversation. + + + 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. + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - - object - - data - - first_id - - last_id - - has_more - ListVectorStoreFilesResponse: + - type + - item + x-oaiMeta: + name: conversation.item.create + group: realtime + example: | + { + "type": "conversation.item.create", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + } + } + RealtimeClientEventConversationItemDelete: + type: object + description: > + Send this event when you want to remove any item from the conversation + + history. The server will respond with a `conversation.item.deleted` + event, + + unless the item does not exist in the conversation history, in which + case the + + server will respond with an error. properties: - object: + event_id: type: string - example: list - data: - type: array - items: - $ref: '#/components/schemas/VectorStoreFileObject' - first_id: + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: type: string - example: file-abc123 - last_id: + enum: + - conversation.item.delete + description: The event type, must be `conversation.item.delete`. + x-stainless-const: true + item_id: type: string - example: file-abc456 - has_more: - type: boolean - example: false + description: The ID of the item to delete. required: - - object - - data - - first_id - - last_id - - has_more - ListVectorStoresResponse: + - type + - item_id + x-oaiMeta: + name: conversation.item.delete + group: realtime + example: | + { + "event_id": "event_901", + "type": "conversation.item.delete", + "item_id": "item_003" + } + RealtimeClientEventConversationItemRetrieve: + type: object + description: > + Send 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. + + The server will respond with a `conversation.item.retrieved` event, + + unless the item does not exist in the conversation history, in which + case the + + server will respond with an error. properties: - object: + event_id: type: string - example: list - data: - type: array - items: - $ref: '#/components/schemas/VectorStoreObject' - first_id: + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: type: string - example: vs_abc123 - last_id: + enum: + - conversation.item.retrieve + description: The event type, must be `conversation.item.retrieve`. + x-stainless-const: true + item_id: type: string - example: vs_abc456 - has_more: - type: boolean - example: false + description: The ID of the item to retrieve. required: - - object - - data - - first_id - - last_id - - has_more - LocalShellToolCall: + - type + - item_id + x-oaiMeta: + name: conversation.item.retrieve + group: realtime + example: | + { + "event_id": "event_901", + "type": "conversation.item.retrieve", + "item_id": "item_003" + } + RealtimeClientEventConversationItemTruncate: type: object - title: Local shell call - description: | - A tool call to run a command on the local shell. + description: > + Send this event to truncate a previous assistant message’s audio. The + server + + will produce audio faster than realtime, so this event is useful when + the user + + interrupts to truncate audio that has already been sent to the client + but not + + yet played. This will synchronize the server's understanding of the + audio with + + the client's playback. + + + Truncating audio will delete the server-side text transcript to ensure + there + + is not text in the context that hasn't been heard by the user. + + + If successful, the server will respond with a + `conversation.item.truncated` + + event. properties: + event_id: + type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. type: type: string enum: - - local_shell_call - description: | - The type of the local shell call. Always `local_shell_call`. + - conversation.item.truncate + description: The event type, must be `conversation.item.truncate`. x-stainless-const: true - id: - type: string - description: | - The unique ID of the local shell call. - call_id: - type: string - description: | - The unique ID of the local shell tool call generated by the model. - action: - $ref: '#/components/schemas/LocalShellExecAction' - status: + item_id: type: string - enum: - - in_progress - - completed - - incomplete - description: | - The status of the local shell call. + description: > + The ID of the assistant message item to truncate. Only assistant + message + + items can be truncated. + content_index: + type: integer + description: The index of the content part to truncate. Set this to `0`. + audio_end_ms: + type: integer + description: > + Inclusive duration up to which audio is truncated, in milliseconds. + If + + the audio_end_ms is greater than the actual audio duration, the + server + + will respond with an error. required: - type - - id - - call_id - - action - - status - LocalShellToolCallOutput: + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncate + group: realtime + example: | + { + "event_id": "event_678", + "type": "conversation.item.truncate", + "item_id": "item_002", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeClientEventInputAudioBufferAppend: type: object - title: Local shell call output - description: | - The output of a local shell tool call. + description: > + Send this event to append audio bytes to the input audio buffer. The + audio + + buffer is temporary storage you can write to and later commit. A + "commit" will create a new + + user message item in the conversation history from the buffer content + and clear the buffer. + + Input audio transcription (if enabled) will be generated when the buffer + is committed. + + + If VAD is enabled the audio buffer is used to detect speech and the + server will decide + + when to commit. When Server VAD is disabled, you must commit the audio + buffer + + manually. Input audio noise reduction operates on writes to the audio + buffer. + + + The client may choose how much audio to place in each event up to a + maximum + + of 15 MiB, for example streaming smaller chunks from the client may + allow the + + VAD to be more responsive. Unlike most other client events, the server + will + + not send a confirmation response to this event. properties: + event_id: + type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. type: type: string enum: - - local_shell_call_output - description: > - The type of the local shell tool call output. Always - `local_shell_call_output`. + - input_audio_buffer.append + description: The event type, must be `input_audio_buffer.append`. x-stainless-const: true - id: - type: string - description: | - The unique ID of the local shell tool call generated by the model. - output: + audio: type: string - description: | - A JSON string of the output of the local shell tool call. - status: - anyOf: - - type: string - enum: - - in_progress - - completed - - incomplete - description: > - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. - - type: 'null' + description: > + Base64-encoded audio bytes. This must be in the format specified by + the + + `input_audio_format` field in the session configuration. required: - - id - type - - call_id - - output - LogProbProperties: + - audio + x-oaiMeta: + name: input_audio_buffer.append + group: realtime + example: | + { + "event_id": "event_456", + "type": "input_audio_buffer.append", + "audio": "Base64EncodedAudioData" + } + RealtimeClientEventInputAudioBufferClear: type: object description: | - A log probability object. + Send this event to clear the audio bytes in the buffer. The server will + respond with an `input_audio_buffer.cleared` event. properties: - token: + event_id: type: string - description: | - The token that was used to generate the log probability. - logprob: - type: number - description: | - The log probability of the token. - bytes: - type: array - items: - type: integer - description: | - The bytes that were used to generate the log probability. - required: - - token - - logprob - - bytes - MCPApprovalRequest: - type: object - title: MCP approval request - description: | - A request for human approval of a tool invocation. - properties: + maxLength: 512 + description: Optional client-generated ID used to identify this event. type: type: string enum: - - mcp_approval_request - description: | - The type of the item. Always `mcp_approval_request`. + - input_audio_buffer.clear + description: The event type, must be `input_audio_buffer.clear`. x-stainless-const: true - id: - type: string - description: | - The unique ID of the approval request. - server_label: - type: string - description: | - The label of the MCP server making the request. - name: - type: string - description: | - The name of the tool to run. - arguments: - type: string - description: | - A JSON string of arguments for the tool. required: - type - - id - - server_label - - name - - arguments - MCPApprovalResponse: + x-oaiMeta: + name: input_audio_buffer.clear + group: realtime + example: | + { + "event_id": "event_012", + "type": "input_audio_buffer.clear" + } + RealtimeClientEventInputAudioBufferCommit: type: object - title: MCP approval response - description: | - A response to an MCP approval request. + description: > + Send 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. + + + Committing 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. properties: + event_id: + type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. type: type: string enum: - - mcp_approval_response - description: | - The type of the item. Always `mcp_approval_response`. + - input_audio_buffer.commit + description: The event type, must be `input_audio_buffer.commit`. x-stainless-const: true - id: - anyOf: - - type: string - description: | - The unique ID of the approval response - - type: 'null' - approval_request_id: - type: string - description: | - The ID of the approval request being answered. - approve: - type: boolean - description: | - Whether the request was approved. - reason: - anyOf: - - type: string - description: | - Optional reason for the decision. - - type: 'null' required: - type - - request_id - - approve - - approval_request_id - MCPApprovalResponseResource: + x-oaiMeta: + name: input_audio_buffer.commit + group: realtime + example: | + { + "event_id": "event_789", + "type": "input_audio_buffer.commit" + } + RealtimeClientEventOutputAudioBufferClear: type: object - title: MCP approval response - description: | - A response to an MCP approval request. + description: > + **WebRTC/SIP Only:** Emit to cut off the current audio response. This + will trigger the server to + + stop generating audio and emit a `output_audio_buffer.cleared` event. + This + + event should be preceded by a `response.cancel` client event to stop the + + generation of the current response. + + [Learn + more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). properties: + event_id: + type: string + description: The unique ID of the client event used for error handling. type: type: string enum: - - mcp_approval_response - description: | - The type of the item. Always `mcp_approval_response`. + - output_audio_buffer.clear + description: The event type, must be `output_audio_buffer.clear`. x-stainless-const: true - id: - type: string - description: | - The unique ID of the approval response - approval_request_id: - type: string - description: | - The ID of the approval request being answered. - approve: - type: boolean - description: | - Whether the request was approved. - reason: - anyOf: - - type: string - description: | - Optional reason for the decision. - - type: 'null' required: - type - - id - - request_id - - approve - - approval_request_id - MCPListTools: + x-oaiMeta: + name: output_audio_buffer.clear + group: realtime + example: | + { + "event_id": "optional_client_event_id", + "type": "output_audio_buffer.clear" + } + RealtimeClientEventResponseCancel: type: object - title: MCP list tools - description: | - A list of tools available on an MCP server. + description: > + Send this event to cancel an in-progress response. The server will + respond + + with a `response.done` event with a status of + `response.status=cancelled`. If + + there is no response to cancel, the server will respond with an error. + It's safe + + to call `response.cancel` even if no response is in progress, an error + will be + + returned the session will remain unaffected. properties: + event_id: + type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. type: type: string enum: - - mcp_list_tools - description: | - The type of the item. Always `mcp_list_tools`. + - response.cancel + description: The event type, must be `response.cancel`. x-stainless-const: true - id: - type: string - description: | - The unique ID of the list. - server_label: + response_id: type: string description: | - The label of the MCP server. - tools: - type: array - items: - $ref: '#/components/schemas/MCPListToolsTool' - description: | - The tools available on the server. - error: - anyOf: - - type: string - description: | - Error message if the server could not list tools. - - type: 'null' + A specific response ID to cancel - if not provided, will cancel an + in-progress response in the default conversation. required: - type - - id - - server_label - - tools - MCPListToolsTool: - type: object - title: MCP list tools tool - description: | - A tool available on an MCP server. - properties: - name: - type: string - description: | - The name of the tool. - description: - anyOf: - - type: string - description: | - The description of the tool. - - type: 'null' - input_schema: - type: object - description: | - The JSON schema describing the tool's input. - annotations: - anyOf: - - type: object - description: | - Additional annotations about the tool. - - type: 'null' - required: - - name - - input_schema - MCPTool: + x-oaiMeta: + name: response.cancel + group: realtime + example: | + { + "type": "response.cancel", + "response_id": "resp_12345" + } + RealtimeClientEventResponseCreate: type: object - title: MCP tool description: > - Give the model access to additional tools via remote Model Context - Protocol + This event instructs the server to create a Response, which means + triggering - (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). + model inference. When in Server VAD mode, the server will create + Responses + + automatically. + + + A Response will include at least one Item, and may have two, in which + case + + the second will be a function call. These Items will be appended to the + + conversation history by default. + + + The server will respond with a `response.created` event, events for + Items + + and content created, and finally a `response.done` event to indicate + the + + Response is complete. + + + The `response.create` event includes inference configuration like + + `instructions` and `tools`. If these are set, they will override the + Session's + + configuration for this Response only. + + + Responses can be created out-of-band of the default Conversation, + meaning that they can + + have arbitrary input, and it's possible to disable writing the output to + the Conversation. + + Only one Response can write to the default Conversation at a time, but + otherwise multiple + + Responses can be created in parallel. The `metadata` field is a good way + to disambiguate + + multiple simultaneous Responses. + + + Clients can set `conversation` to `none` to create a Response that does + not write to the default + + Conversation. Arbitrary input can be provided with the `input` field, + which is an array accepting + + raw Items and references to existing Items. properties: + event_id: + type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. type: type: string enum: - - mcp - description: The type of the MCP tool. Always `mcp`. + - response.create + description: The event type, must be `response.create`. x-stainless-const: true - server_label: - type: string - description: | - A label for this MCP server, used to identify it in tool calls. - server_url: - type: string - format: uri - description: > - The URL for the MCP server. One of `server_url` or `connector_id` - must be - - provided. - connector_id: - type: string - enum: - - connector_dropbox - - connector_gmail - - connector_googlecalendar - - connector_googledrive - - connector_microsoftteams - - connector_outlookcalendar - - connector_outlookemail - - connector_sharepoint - description: > - Identifier for service connectors, like those available in ChatGPT. - One of - - `server_url` or `connector_id` must be provided. Learn more about - service + response: + $ref: '#/components/schemas/RealtimeResponseCreateParams' + required: + - type + x-oaiMeta: + name: response.create + group: realtime + example: > + // Trigger a response with the default Conversation and no special + parameters - connectors [here](/docs/guides/tools-remote-mcp#connectors). + { + "type": "response.create", + } - Currently supported `connector_id` values are: + // Trigger an out-of-band response that does not write to the default + Conversation + { + "type": "response.create", + "response": { + "instructions": "Provide a concise answer.", + "tools": [], // clear any session tools + "conversation": "none", + "output_modalities": ["text"], + "metadata": { + "response_purpose": "summarization" + }, + "input": [ + { + "type": "item_reference", + "id": "item_12345" + }, + { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Summarize the above message in one sentence." + } + ] + } + ] + } + } + RealtimeClientEventSessionUpdate: + type: object + description: > + Send this event to update the session’s configuration. - - Dropbox: `connector_dropbox` + The client may send this event at any time to update any field - - Gmail: `connector_gmail` + except for `voice` and `model`. `voice` can be updated only if there + have been no other audio outputs yet. - - Google Calendar: `connector_googlecalendar` - - Google Drive: `connector_googledrive` + When the server receives a `session.update`, it will respond - - Microsoft Teams: `connector_microsoftteams` + with a `session.updated` event showing the full, effective + configuration. - - Outlook Calendar: `connector_outlookcalendar` + Only the fields that are present in the `session.update` are updated. To + clear a field like - - Outlook Email: `connector_outlookemail` + `instructions`, pass an empty string. To clear a field like `tools`, + pass an empty array. - - SharePoint: `connector_sharepoint` - authorization: + To clear a field like `turn_detection`, pass `null`. + properties: + event_id: type: string - description: > - An OAuth access token that can be used with a remote MCP server, - either - - with a custom MCP server URL or a service connector. Your - application - - must handle the OAuth authorization flow and provide the token here. - server_description: + maxLength: 512 + description: >- + 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. + type: type: string - description: > - Optional description of the MCP server, used to provide more - context. - headers: - anyOf: - - type: object - additionalProperties: - type: string - description: > - Optional HTTP headers to send to the MCP server. Use for - authentication - - or other purposes. - - type: 'null' - allowed_tools: - anyOf: - - description: | - List of allowed tool names or a filter object. - oneOf: - - type: array - title: MCP allowed tools - description: A string array of allowed tool names - items: - type: string - - $ref: '#/components/schemas/MCPToolFilter' - - type: 'null' - require_approval: - anyOf: - - description: Specify which of the MCP server's tools require approval. - oneOf: - - type: object - title: MCP tool approval filter - description: > - Specify which of the MCP server's tools require approval. - Can be - - `always`, `never`, or a filter object associated with tools - - that require approval. - properties: - always: - $ref: '#/components/schemas/MCPToolFilter' - never: - $ref: '#/components/schemas/MCPToolFilter' - additionalProperties: false - - type: string - title: MCP tool approval setting - description: > - Specify a single approval policy for all tools. One of - `always` or - - `never`. When set to `always`, all tools will require - approval. When - - set to `never`, all tools will not require approval. - enum: - - always - - never - default: always - - type: 'null' - defer_loading: - type: boolean + enum: + - session.update + description: The event type, must be `session.update`. + x-stainless-const: true + session: + type: object description: | - Whether this MCP tool is deferred and discovered via tool search. + Update the Realtime session. Choose either a realtime + session or a transcription session. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' required: - type - - server_label - MCPToolCall: + - session + x-oaiMeta: + name: session.update + group: realtime + example: | + { + "type": "session.update", + "session": { + "type": "realtime", + "instructions": "You are a creative assistant that helps with design tasks.", + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "Call this function when a user asks for a color palette.", + "parameters": { + "type": "object", + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto" + } + } + RealtimeClientEventTranscriptionSessionUpdate: type: object - title: MCP tool call description: | - An invocation of a tool on an MCP server. + Send this event to update a transcription session. properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. type: type: string enum: - - mcp_call - description: | - The type of the item. Always `mcp_call`. + - transcription_session.update + description: The event type, must be `transcription_session.update`. x-stainless-const: true + session: + $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequest' + required: + - type + - session + x-oaiMeta: + name: transcription_session.update + group: realtime + example: | + { + "type": "transcription_session.update", + "session": { + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.logprobs", + ] + } + } + RealtimeConversationItem: + description: A single item within a Realtime conversation. + anyOf: + - $ref: '#/components/schemas/RealtimeConversationItemMessageSystem' + - $ref: '#/components/schemas/RealtimeConversationItemMessageUser' + - $ref: '#/components/schemas/RealtimeConversationItemMessageAssistant' + - $ref: '#/components/schemas/RealtimeConversationItemFunctionCall' + - $ref: '#/components/schemas/RealtimeConversationItemFunctionCallOutput' + - $ref: '#/components/schemas/RealtimeMCPApprovalResponse' + - $ref: '#/components/schemas/RealtimeMCPListTools' + - $ref: '#/components/schemas/RealtimeMCPToolCall' + - $ref: '#/components/schemas/RealtimeMCPApprovalRequest' + discriminator: + propertyName: type + RealtimeConversationItemFunctionCall: + type: object + title: Realtime function call item + description: A function call item in a Realtime conversation. + properties: id: type: string - description: | - The unique ID of the tool call. - server_label: + description: >- + The unique ID of the item. This may be provided by the client or + generated by the server. + object: type: string - description: | - The label of the MCP server running the tool. + enum: + - realtime.item + description: >- + Identifier for the API object being returned - always + `realtime.item`. Optional when creating a new item. + x-stainless-const: true + type: + type: string + enum: + - function_call + description: The type of the item. Always `function_call`. + x-stainless-const: true + status: + type: string + enum: + - completed + - incomplete + - in_progress + description: The status of the item. Has no effect on the conversation. + call_id: + type: string + description: The ID of the function call. name: type: string - description: | - The name of the tool that was run. + description: The name of the function being called. arguments: type: string - description: | - A JSON string of the arguments passed to the tool. - output: - anyOf: - - type: string - description: | - The output from the tool call. - - type: 'null' - error: - anyOf: - - type: string - description: | - The error from the tool call, if any. - - type: 'null' - status: - $ref: '#/components/schemas/MCPToolCallStatus' - description: > - The status of the tool call. One of `in_progress`, `completed`, - `incomplete`, `calling`, or `failed`. - approval_request_id: - anyOf: - - type: string - description: > - Unique identifier for the MCP tool call approval request. - - Include this value in a subsequent `mcp_approval_response` input - to approve or reject the corresponding tool call. - - type: 'null' + description: >- + 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}`. required: - type - - id - - server_label - name - arguments - MCPToolFilter: - type: object - title: MCP tool filter - description: | - A filter object to specify which tools are allowed. - properties: - tool_names: - type: array - title: MCP allowed tools - items: - type: string - description: List of allowed tool names. - read_only: - type: boolean - description: > - Indicates whether or not a tool modifies data or is read-only. If an - - MCP server is [annotated with - `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), - - it will match this filter. - required: [] - additionalProperties: false - MessageContentImageFileObject: - title: Image file + RealtimeConversationItemFunctionCallOutput: type: object - description: >- - References an image [File](/docs/api-reference/files) in the content of - a message. + title: Realtime function call output item + description: A function call output item in a Realtime conversation. properties: - type: - description: Always `image_file`. + id: + type: string + description: >- + The unique ID of the item. This may be provided by the client or + generated by the server. + object: type: string enum: - - image_file + - realtime.item + description: >- + Identifier for the API object being returned - always + `realtime.item`. Optional when creating a new item. x-stainless-const: true - image_file: - type: object - properties: - file_id: - description: >- - The [File](/docs/api-reference/files) ID of the image in the - message content. Set `purpose="vision"` when uploading the File - if you need to later display the file content. - type: string - detail: - type: string - description: >- - Specifies the detail level of the image if specified by the - user. `low` uses fewer tokens, you can opt in to high resolution - using `high`. - enum: - - auto - - low - - high - default: auto - required: - - file_id - required: - - type - - image_file - MessageContentImageUrlObject: - title: Image URL - type: object - description: References an image URL in the content of a message. - properties: type: type: string enum: - - image_url - description: The type of the content part. + - function_call_output + description: The type of the item. Always `function_call_output`. x-stainless-const: true - image_url: - type: object - properties: - url: - type: string - description: >- - The external URL of the image, must be a supported image types: - jpeg, jpg, png, gif, webp. - format: uri - detail: - type: string - description: >- - Specifies the detail level of the image. `low` uses fewer - tokens, you can opt in to high resolution using `high`. Default - value is `auto` - enum: - - auto - - low - - high - default: auto - required: - - url + status: + type: string + enum: + - completed + - incomplete + - in_progress + description: The status of the item. Has no effect on the conversation. + call_id: + type: string + description: The ID of the function call this output is for. + output: + type: string + description: >- + The output of the function call, this is free text and can contain + any information or simply be empty. required: - type - - image_url - MessageContentRefusalObject: - title: Refusal + - call_id + - output + RealtimeConversationItemMessageAssistant: type: object - description: The refusal content generated by the assistant. + title: Realtime assistant message item + description: An assistant message item in a Realtime conversation. properties: + id: + type: string + description: >- + The unique ID of the item. This may be provided by the client or + generated by the server. + object: + type: string + enum: + - realtime.item + description: >- + Identifier for the API object being returned - always + `realtime.item`. Optional when creating a new item. + x-stainless-const: true type: - description: Always `refusal`. type: string enum: - - refusal + - message + description: The type of the item. Always `message`. x-stainless-const: true - refusal: + status: type: string + enum: + - completed + - incomplete + - in_progress + description: The status of the item. Has no effect on the conversation. + role: + type: string + enum: + - assistant + description: The role of the message sender. Always `assistant`. + x-stainless-const: true + content: + type: array + description: The content of the message. + items: + type: object + properties: + type: + type: string + enum: + - output_text + - output_audio + description: >- + The content type, `output_text` or `output_audio` depending on + the session `output_modalities` configuration. + text: + type: string + description: The text content. + audio: + type: string + description: >- + 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. + transcript: + type: string + description: >- + The transcript of the audio content, this will always be + present if the output type is `audio`. required: - type - - refusal - MessageContentTextAnnotationsFileCitationObject: - title: File citation + - role + - content + RealtimeConversationItemMessageSystem: type: object + title: Realtime system message item description: >- - A citation within the message that points to a specific quote from a - specific File associated with the assistant or the message. Generated - when the assistant uses the "file_search" tool to search files. + 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. properties: + id: + type: string + description: >- + The unique ID of the item. This may be provided by the client or + generated by the server. + object: + type: string + enum: + - realtime.item + description: >- + Identifier for the API object being returned - always + `realtime.item`. Optional when creating a new item. + x-stainless-const: true type: - description: Always `file_citation`. type: string enum: - - file_citation + - message + description: The type of the item. Always `message`. + x-stainless-const: true + status: + type: string + enum: + - completed + - incomplete + - in_progress + description: The status of the item. Has no effect on the conversation. + role: + type: string + enum: + - system + description: The role of the message sender. Always `system`. x-stainless-const: true - text: - description: The text in the message content that needs to be replaced. - type: string - file_citation: - type: object - properties: - file_id: - description: The ID of the specific File the citation is from. - type: string - required: - - file_id - start_index: - type: integer - minimum: 0 - end_index: - type: integer - minimum: 0 + content: + type: array + description: The content of the message. + items: + type: object + properties: + type: + type: string + enum: + - input_text + description: The content type. Always `input_text` for system messages. + x-stainless-const: true + text: + type: string + description: The text content. required: - type - - text - - file_citation - - start_index - - end_index - MessageContentTextAnnotationsFilePathObject: - title: File path + - role + - content + RealtimeConversationItemMessageUser: type: object - description: >- - A URL for the file that's generated when the assistant used the - `code_interpreter` tool to generate a file. + title: Realtime user message item + description: A user message item in a Realtime conversation. properties: + id: + type: string + description: >- + The unique ID of the item. This may be provided by the client or + generated by the server. + object: + type: string + enum: + - realtime.item + description: >- + Identifier for the API object being returned - always + `realtime.item`. Optional when creating a new item. + x-stainless-const: true type: - description: Always `file_path`. type: string enum: - - file_path + - message + description: The type of the item. Always `message`. x-stainless-const: true - text: - description: The text in the message content that needs to be replaced. + status: type: string - file_path: - type: object - properties: - file_id: - description: The ID of the file that was generated. - type: string - required: - - file_id - start_index: - type: integer - minimum: 0 - end_index: - type: integer - minimum: 0 - required: - - type - - text - - file_path - - start_index - - end_index - MessageContentTextObject: - title: Text - type: object - description: The text content that is part of a message. - properties: - type: - description: Always `text`. + enum: + - completed + - incomplete + - in_progress + description: The status of the item. Has no effect on the conversation. + role: type: string enum: - - text + - user + description: The role of the message sender. Always `user`. x-stainless-const: true - text: - type: object - properties: - value: - description: The data that makes up the text. - type: string - annotations: - type: array - items: - oneOf: - - $ref: >- - #/components/schemas/MessageContentTextAnnotationsFileCitationObject - - $ref: >- - #/components/schemas/MessageContentTextAnnotationsFilePathObject - required: - - value - - annotations + content: + type: array + description: The content of the message. + items: + type: object + properties: + type: + type: string + enum: + - input_text + - input_audio + - input_image + description: >- + The content type (`input_text`, `input_audio`, or + `input_image`). + text: + type: string + description: The text content (for `input_text`). + audio: + type: string + description: >- + 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. + image_url: + type: string + format: uri + description: >- + Base64-encoded image bytes (for `input_image`) as a data URI. + For example + `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...`. Supported + formats are PNG and JPEG. + detail: + type: string + description: >- + The detail level of the image (for `input_image`). `auto` will + default to `high`. + default: auto + enum: + - auto + - low + - high + transcript: + type: string + description: >- + Transcript of the audio (for `input_audio`). This is not sent + to the model, but will be attached to the message item for + reference. required: - type - - text - MessageDeltaContentImageFileObject: - title: Image file + - role + - content + RealtimeConversationItemWithReference: type: object - description: >- - References an image [File](/docs/api-reference/files) in the content of - a message. + description: The item to add to the conversation. properties: - index: - type: integer - description: The index of the content part in the message. + id: + type: string + description: > + For an item of type (`message` | `function_call` | + `function_call_output`) + + this field allows the client to assign the unique ID of the item. It + is + + not required because the server will generate one if not provided. + + + For an item of type `item_reference`, this field is required and is + a + + reference to any item that has previously existed in the + conversation. type: - description: Always `image_file`. type: string enum: - - image_file + - message + - function_call + - function_call_output + description: > + The type of the item (`message`, `function_call`, + `function_call_output`, `item_reference`). + object: + type: string + enum: + - realtime.item + description: > + Identifier for the API object being returned - always + `realtime.item`. x-stainless-const: true - image_file: + status: + type: string + enum: + - completed + - incomplete + - in_progress + description: > + The status of the item (`completed`, `incomplete`, `in_progress`). + These have no effect + + on the conversation, but are accepted for consistency with the + + `conversation.item.created` event. + role: + type: string + enum: + - user + - assistant + - system + description: > + The role of the message sender (`user`, `assistant`, `system`), + only + + applicable for `message` items. + content: + type: array + description: > + The content of the message, applicable for `message` items. + + - Message items of role `system` support only `input_text` content + + - Message items of role `user` support `input_text` and + `input_audio` + content + - Message items of role `assistant` support `text` content. + items: + type: object + properties: + type: + type: string + enum: + - input_audio + - input_text + - item_reference + - text + description: > + The content type (`input_text`, `input_audio`, + `item_reference`, `text`). + text: + type: string + description: > + The text content, used for `input_text` and `text` content + types. + id: + type: string + description: > + ID of a previous conversation item to reference (for + `item_reference` + + content types in `response.create` events). These can + reference both + + client and server created items. + audio: + type: string + description: > + Base64-encoded audio bytes, used for `input_audio` content + type. + transcript: + type: string + description: > + The transcript of the audio, used for `input_audio` content + type. + call_id: + type: string + description: > + The ID of the function call (for `function_call` and + + `function_call_output` items). If passed on a + `function_call_output` + + item, the server will check that a `function_call` item with the + same + + ID exists in the conversation history. + name: + type: string + description: | + The name of the function being called (for `function_call` items). + arguments: + type: string + description: | + The arguments of the function call (for `function_call` items). + output: + type: string + description: | + The output of the function call (for `function_call_output` items). + RealtimeCreateClientSecretRequest: + type: object + title: Realtime client secret creation request + description: > + Create a session and client secret for the Realtime API. The request can + specify + + either a realtime or a transcription session configuration. + + [Learn more about the Realtime API](/docs/guides/realtime). + properties: + expires_after: type: object + title: Client secret expiration + description: > + Configuration for the client secret expiration. Expiration refers to + the time after which + + a client secret will no longer be valid for creating sessions. The + session itself may + + continue after that time once started. A secret can be used to + create multiple sessions + + until it expires. properties: - file_id: - description: >- - The [File](/docs/api-reference/files) ID of the image in the - message content. Set `purpose="vision"` when uploading the File - if you need to later display the file content. - type: string - detail: + anchor: type: string - description: >- - Specifies the detail level of the image if specified by the - user. `low` uses fewer tokens, you can opt in to high resolution - using `high`. enum: - - auto - - low - - high - default: auto - required: - - index - - type - MessageDeltaContentImageUrlObject: - title: Image URL + - created_at + description: > + The anchor point for the client secret expiration, meaning that + `seconds` will be added to the `created_at` time of the client + secret to produce an expiration timestamp. Only `created_at` is + currently supported. + default: created_at + x-stainless-const: true + seconds: + type: integer + format: int64 + description: > + The number of seconds from the anchor point to the expiration. + Select a value between `10` and `7200` (2 hours). This default + to 600 seconds (10 minutes) if not specified. + minimum: 10 + maximum: 7200 + default: 600 + session: + title: Session configuration + description: > + Session configuration to use for the client secret. Choose either a + realtime + + session or a transcription session. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' + RealtimeCreateClientSecretResponse: type: object - description: References an image URL in the content of a message. + title: Realtime session and client secret + description: | + Response from creating a session and client secret for the Realtime API. properties: - index: + value: + type: string + description: The generated client secret value. + expires_at: type: integer - description: The index of the content part in the message. + format: unixtime + description: Expiration timestamp for the client secret, in seconds since epoch. + session: + title: Session configuration + description: > + The session configuration for either a realtime or transcription + session. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' + - $ref: >- + #/components/schemas/RealtimeTranscriptionSessionCreateResponseGA + discriminator: + propertyName: type + required: + - value + - expires_at + - session + x-oaiMeta: + name: Session response object + group: realtime + example: | + { + "value": "ek_68af296e8e408191a1120ab6383263c2", + "expires_at": 1756310470, + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9CiUVUzUzYIssh3ELY1d", + "model": "gpt-realtime-2025-08-25", + "output_modalities": [ + "audio" + ], + "instructions": "You are a friendly assistant.", + "tools": [], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "truncation": "auto", + "prompt": null, + "expires_at": 0, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy", + "speed": 1.0 + } + }, + "include": null + } + } + RealtimeFunctionTool: + type: object + title: Function tool + properties: type: - description: Always `image_url`. type: string enum: - - image_url + - function + description: The type of the tool, i.e. `function`. x-stainless-const: true - image_url: + name: + type: string + description: The name of the function. + description: + type: string + description: | + The description of the function, including guidance on when and how + to call it, and guidance about what to tell the user when calling + (if anything). + parameters: type: object - properties: - url: - description: >- - The URL of the image, must be a supported image types: jpeg, - jpg, png, gif, webp. - type: string - format: uri - detail: - type: string - description: >- - Specifies the detail level of the image. `low` uses fewer - tokens, you can opt in to high resolution using `high`. - enum: - - auto - - low - - high - default: auto - required: - - index - - type - MessageDeltaContentRefusalObject: - title: Refusal + description: Parameters of the function in JSON Schema. + RealtimeMCPApprovalRequest: type: object - description: The refusal content that is part of a message. + title: Realtime MCP approval request + description: | + A Realtime item requesting human approval of a tool invocation. properties: - index: - type: integer - description: The index of the refusal part in the message. type: - description: Always `refusal`. type: string enum: - - refusal + - mcp_approval_request + description: The type of the item. Always `mcp_approval_request`. x-stainless-const: true - refusal: + id: + type: string + description: The unique ID of the approval request. + server_label: + type: string + description: The label of the MCP server making the request. + name: + type: string + description: The name of the tool to run. + arguments: type: string + description: A JSON string of arguments for the tool. required: - - index - type - MessageDeltaContentTextAnnotationsFileCitationObject: - title: File citation + - id + - server_label + - name + - arguments + RealtimeMCPApprovalResponse: type: object - description: >- - A citation within the message that points to a specific quote from a - specific File associated with the assistant or the message. Generated - when the assistant uses the "file_search" tool to search files. + title: Realtime MCP approval response + description: | + A Realtime item responding to an MCP approval request. properties: - index: - type: integer - description: The index of the annotation in the text content part. type: - description: Always `file_citation`. type: string enum: - - file_citation + - mcp_approval_response + description: The type of the item. Always `mcp_approval_response`. x-stainless-const: true - text: - description: The text in the message content that needs to be replaced. + id: type: string - file_citation: - type: object - properties: - file_id: - description: The ID of the specific File the citation is from. - type: string - quote: - description: The specific quote in the file. - type: string - start_index: - type: integer - minimum: 0 - end_index: - type: integer - minimum: 0 + description: The unique ID of the approval response. + approval_request_id: + type: string + description: The ID of the approval request being answered. + approve: + type: boolean + description: Whether the request was approved. + reason: + anyOf: + - type: string + description: Optional reason for the decision. + - type: 'null' required: - - index - type - MessageDeltaContentTextAnnotationsFilePathObject: - title: File path + - id + - approval_request_id + - approve + RealtimeMCPHTTPError: type: object - description: >- - A URL for the file that's generated when the assistant used the - `code_interpreter` tool to generate a file. + title: Realtime MCP HTTP error properties: - index: - type: integer - description: The index of the annotation in the text content part. type: - description: Always `file_path`. type: string enum: - - file_path + - http_error x-stainless-const: true - text: - description: The text in the message content that needs to be replaced. - type: string - file_path: - type: object - properties: - file_id: - description: The ID of the file that was generated. - type: string - start_index: - type: integer - minimum: 0 - end_index: + code: type: integer - minimum: 0 + message: + type: string required: - - index - type - MessageDeltaContentTextObject: - title: Text + - code + - message + RealtimeMCPListTools: type: object - description: The text content that is part of a message. + title: Realtime MCP list tools + description: | + A Realtime item listing tools available on an MCP server. properties: - index: - type: integer - description: The index of the content part in the message. type: - description: Always `text`. type: string enum: - - text + - mcp_list_tools + description: The type of the item. Always `mcp_list_tools`. x-stainless-const: true - text: - type: object - properties: - value: - description: The data that makes up the text. - type: string - annotations: - type: array - items: - oneOf: - - $ref: >- - #/components/schemas/MessageDeltaContentTextAnnotationsFileCitationObject - - $ref: >- - #/components/schemas/MessageDeltaContentTextAnnotationsFilePathObject - required: - - index - - type - MessageDeltaObject: - type: object - title: Message delta object - description: > - Represents a message delta i.e. any changed fields on a message during - streaming. - properties: id: - description: >- - The identifier of the message, which can be referenced in API - endpoints. type: string - object: - description: The object type, which is always `thread.message.delta`. + description: The unique ID of the list. + server_label: type: string - enum: - - thread.message.delta - x-stainless-const: true - delta: - description: The delta containing the fields that have changed on the Message. - type: object - properties: - role: - description: >- - The entity that produced the message. One of `user` or - `assistant`. - type: string - enum: - - user - - assistant - content: - description: The content of the message in array of text and/or images. - type: array - items: - oneOf: - - $ref: '#/components/schemas/MessageDeltaContentImageFileObject' - - $ref: '#/components/schemas/MessageDeltaContentTextObject' - - $ref: '#/components/schemas/MessageDeltaContentRefusalObject' - - $ref: '#/components/schemas/MessageDeltaContentImageUrlObject' + description: The label of the MCP server. + tools: + type: array + items: + $ref: '#/components/schemas/MCPListToolsTool' + description: The tools available on the server. required: - - id - - object - - delta - x-oaiMeta: - name: The message delta object - beta: true - example: | - { - "id": "msg_123", - "object": "thread.message.delta", - "delta": { - "content": [ - { - "index": 0, - "type": "text", - "text": { "value": "Hello", "annotations": [] } - } - ] - } - } - MessageObject: + - type + - server_label + - tools + RealtimeMCPProtocolError: type: object - title: The message object - description: Represents a message within a [thread](/docs/api-reference/threads). + title: Realtime MCP protocol error properties: - id: - description: The identifier, which can be referenced in API endpoints. - type: string - object: - description: The object type, which is always `thread.message`. + type: type: string enum: - - thread.message + - protocol_error x-stainless-const: true - created_at: - description: The Unix timestamp (in seconds) for when the message was created. + code: type: integer - format: unixtime - thread_id: - description: >- - The [thread](/docs/api-reference/threads) ID that this message - belongs to. - type: string - status: - description: >- - The status of the message, which can be either `in_progress`, - `incomplete`, or `completed`. - type: string - enum: - - in_progress - - incomplete - - completed - incomplete_details: - anyOf: - - description: >- - On an incomplete message, details about why the message is - incomplete. - type: object - properties: - reason: - type: string - description: The reason the message is incomplete. - enum: - - content_filter - - max_tokens - - run_cancelled - - run_expired - - run_failed - required: - - reason - - type: 'null' - completed_at: - anyOf: - - description: >- - The Unix timestamp (in seconds) for when the message was - completed. - type: integer - format: unixtime - - type: 'null' - incomplete_at: - anyOf: - - description: >- - The Unix timestamp (in seconds) for when the message was marked - as incomplete. - type: integer - format: unixtime - - type: 'null' - role: - description: The entity that produced the message. One of `user` or `assistant`. + message: type: string - enum: - - user - - assistant - content: - description: The content of the message in array of text and/or images. - type: array - items: - oneOf: - - $ref: '#/components/schemas/MessageContentImageFileObject' - - $ref: '#/components/schemas/MessageContentImageUrlObject' - - $ref: '#/components/schemas/MessageContentTextObject' - - $ref: '#/components/schemas/MessageContentRefusalObject' - assistant_id: - anyOf: - - description: >- - If applicable, the ID of the - [assistant](/docs/api-reference/assistants) that authored this - message. - type: string - - type: 'null' - run_id: - anyOf: - - description: >- - The ID of the [run](/docs/api-reference/runs) associated with - the creation of this message. Value is `null` when messages are - created manually using the create message or create thread - endpoints. - type: string - - type: 'null' - attachments: - anyOf: - - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - description: The tools to add this file to. - type: array - items: - oneOf: - - $ref: '#/components/schemas/AssistantToolsCode' - - $ref: >- - #/components/schemas/AssistantToolsFileSearchTypeOnly - description: >- - A list of files attached to the message, and the tools they were - added to. - - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' required: - - id - - object - - created_at - - thread_id - - status - - incomplete_details - - completed_at - - incomplete_at - - role - - content - - assistant_id - - run_id - - attachments - - metadata - x-oaiMeta: - name: The message object - beta: true - example: | - { - "id": "msg_abc123", - "object": "thread.message", - "created_at": 1698983503, - "thread_id": "thread_abc123", - "role": "assistant", - "content": [ - { - "type": "text", - "text": { - "value": "Hi! How can I help you today?", - "annotations": [] - } - } - ], - "assistant_id": "asst_abc123", - "run_id": "run_abc123", - "attachments": [], - "metadata": {} - } - MessagePhase: - type: string - description: > - Labels an `assistant` message as intermediate commentary (`commentary`) - or the final answer (`final_answer`). - - For models like `gpt-5.3-codex` and beyond, when sending follow-up - requests, preserve and resend - - phase on all assistant messages — dropping it can degrade performance. - Not used for user messages. - enum: - - commentary - - final_answer - MessageRequestContentTextObject: - title: Text + - type + - code + - message + RealtimeMCPToolCall: type: object - description: The text content that is part of a message. + title: Realtime MCP tool call + description: | + A Realtime item representing an invocation of a tool on an MCP server. properties: type: - description: Always `text`. type: string enum: - - text + - mcp_call + description: The type of the item. Always `mcp_call`. x-stainless-const: true - text: + id: type: string - description: Text content to be sent to the model - required: - - type - - text - MessageStreamEvent: - oneOf: - - type: object - properties: - event: - type: string - enum: - - thread.message.created - x-stainless-const: true - data: - $ref: '#/components/schemas/MessageObject' - required: - - event - - data - description: >- - Occurs when a [message](/docs/api-reference/messages/object) is - created. - x-oaiMeta: - dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' - - type: object - properties: - event: - type: string - enum: - - thread.message.in_progress - x-stainless-const: true - data: - $ref: '#/components/schemas/MessageObject' - required: - - event - - data - description: >- - Occurs when a [message](/docs/api-reference/messages/object) moves - to an `in_progress` state. - x-oaiMeta: - dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' - - type: object - properties: - event: - type: string - enum: - - thread.message.delta - x-stainless-const: true - data: - $ref: '#/components/schemas/MessageDeltaObject' - required: - - event - - data - description: >- - Occurs when parts of a - [Message](/docs/api-reference/messages/object) are being streamed. - x-oaiMeta: - dataDescription: >- - `data` is a [message - delta](/docs/api-reference/assistants-streaming/message-delta-object) - - type: object - properties: - event: - type: string - enum: - - thread.message.completed - x-stainless-const: true - data: - $ref: '#/components/schemas/MessageObject' - required: - - event - - data - description: >- - Occurs when a [message](/docs/api-reference/messages/object) is - completed. - x-oaiMeta: - dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' - - type: object - properties: - event: - type: string - enum: - - thread.message.incomplete - x-stainless-const: true - data: - $ref: '#/components/schemas/MessageObject' - required: - - event - - data - description: >- - Occurs when a [message](/docs/api-reference/messages/object) ends - before it is completed. - x-oaiMeta: - dataDescription: '`data` is a [message](/docs/api-reference/messages/object)' - Metadata: - anyOf: - - type: object - description: > - Set of 16 key-value pairs that can be attached to an object. This - can be - - useful for storing additional information about the object in a - structured - - format, and querying for objects via API or the dashboard. - - - Keys are strings with a maximum length of 64 characters. Values are - strings + description: The unique ID of the tool call. + server_label: + type: string + description: The label of the MCP server running the tool. + name: + type: string + description: The name of the tool that was run. + arguments: + type: string + description: A JSON string of the arguments passed to the tool. + approval_request_id: + anyOf: + - type: string + description: The ID of an associated approval request, if any. + - type: 'null' + output: + anyOf: + - type: string + description: The output from the tool call. + - type: 'null' + error: + anyOf: + - description: The error from the tool call, if any. + oneOf: + - $ref: '#/components/schemas/RealtimeMCPProtocolError' + - $ref: '#/components/schemas/RealtimeMCPToolExecutionError' + - $ref: '#/components/schemas/RealtimeMCPHTTPError' + - type: 'null' + required: + - type + - id + - server_label + - name + - arguments + RealtimeMCPToolExecutionError: + type: object + title: Realtime MCP tool execution error + properties: + type: + type: string + enum: + - tool_execution_error + x-stainless-const: true + message: + type: string + required: + - type + - message + RealtimeReasoning: + type: object + title: Realtime reasoning configuration + description: > + Configuration for reasoning-capable Realtime models such as + `gpt-realtime-2`. + properties: + effort: + $ref: '#/components/schemas/RealtimeReasoningEffort' + RealtimeReasoningEffort: + type: string + description: > + Constrains effort on reasoning for reasoning-capable Realtime models + such as - with a maximum length of 512 characters. - additionalProperties: - type: string - x-oaiTypeLabel: map - - type: 'null' - Model: - title: Model - description: Describes an OpenAI model offering that can be used with the API. + `gpt-realtime-2`. + enum: + - minimal + - low + - medium + - high + - xhigh + default: low + RealtimeResponse: + type: object + description: The response resource. properties: id: type: string - description: The model identifier, which can be referenced in the API endpoints. - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) when the model was created. + description: The unique ID of the response, will look like `resp_1234`. object: type: string - description: The object type, which is always "model". enum: - - model + - realtime.response + description: The object type, must be `realtime.response`. x-stainless-const: true - owned_by: + status: type: string - description: The organization that owns the model. - required: - - id - - object - - created - - owned_by - x-oaiMeta: - name: The model object - example: | - { - "id": "VAR_chat_model_id", - "object": "model", - "created": 1686935002, - "owned_by": "openai" - } - ModelIds: - anyOf: - - $ref: '#/components/schemas/ModelIdsShared' - - $ref: '#/components/schemas/ModelIdsResponses' - ModelIdsCompaction: - anyOf: - - $ref: '#/components/schemas/ModelIdsResponses' - - type: string - - type: 'null' - description: >- - Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI - offers a wide range of models with different capabilities, performance - characteristics, and price points. Refer to the [model - guide](/docs/models) to browse and compare available models. - ModelIdsResponses: - example: gpt-5.1 - anyOf: - - $ref: '#/components/schemas/ModelIdsShared' - - type: string - title: ResponsesOnlyModel - enum: - - o1-pro - - o1-pro-2025-03-19 - - o3-pro - - o3-pro-2025-06-10 - - o3-deep-research - - o3-deep-research-2025-06-26 - - o4-mini-deep-research - - o4-mini-deep-research-2025-06-26 - - computer-use-preview - - computer-use-preview-2025-03-11 - - gpt-5-codex - - gpt-5-pro - - gpt-5-pro-2025-10-06 - - gpt-5.1-codex-max - ModelIdsShared: - example: gpt-5.4 - anyOf: - - type: string - - type: string enum: - - gpt-5.4 - - gpt-5.4-mini - - gpt-5.4-nano - - gpt-5.4-mini-2026-03-17 - - gpt-5.4-nano-2026-03-17 - - gpt-5.3-chat-latest - - gpt-5.2 - - gpt-5.2-2025-12-11 - - gpt-5.2-chat-latest - - gpt-5.2-pro - - gpt-5.2-pro-2025-12-11 - - gpt-5.1 - - gpt-5.1-2025-11-13 - - gpt-5.1-codex - - gpt-5.1-mini - - gpt-5.1-chat-latest - - gpt-5 - - gpt-5-mini - - gpt-5-nano - - gpt-5-2025-08-07 - - gpt-5-mini-2025-08-07 - - gpt-5-nano-2025-08-07 - - gpt-5-chat-latest - - gpt-4.1 - - gpt-4.1-mini - - gpt-4.1-nano - - gpt-4.1-2025-04-14 - - gpt-4.1-mini-2025-04-14 - - gpt-4.1-nano-2025-04-14 - - o4-mini - - o4-mini-2025-04-16 - - o3 - - o3-2025-04-16 - - o3-mini - - o3-mini-2025-01-31 - - o1 - - o1-2024-12-17 - - o1-preview - - o1-preview-2024-09-12 - - o1-mini - - o1-mini-2024-09-12 - - gpt-4o - - gpt-4o-2024-11-20 - - gpt-4o-2024-08-06 - - gpt-4o-2024-05-13 - - gpt-4o-audio-preview - - gpt-4o-audio-preview-2024-10-01 - - gpt-4o-audio-preview-2024-12-17 - - gpt-4o-audio-preview-2025-06-03 - - gpt-4o-mini-audio-preview - - gpt-4o-mini-audio-preview-2024-12-17 - - gpt-4o-search-preview - - gpt-4o-mini-search-preview - - gpt-4o-search-preview-2025-03-11 - - gpt-4o-mini-search-preview-2025-03-11 - - chatgpt-4o-latest - - codex-mini-latest - - gpt-4o-mini - - gpt-4o-mini-2024-07-18 - - gpt-4-turbo - - gpt-4-turbo-2024-04-09 - - gpt-4-0125-preview - - gpt-4-turbo-preview - - gpt-4-1106-preview - - gpt-4-vision-preview - - gpt-4 - - gpt-4-0314 - - gpt-4-0613 - - gpt-4-32k - - gpt-4-32k-0314 - - gpt-4-32k-0613 - - gpt-3.5-turbo - - gpt-3.5-turbo-16k - - gpt-3.5-turbo-0301 - - gpt-3.5-turbo-0613 - - gpt-3.5-turbo-1106 - - gpt-3.5-turbo-0125 - - gpt-3.5-turbo-16k-0613 - ModelResponseProperties: - type: object - properties: + - completed + - cancelled + - failed + - incomplete + - in_progress + description: > + The final status of the response (`completed`, `cancelled`, + `failed`, or + + `incomplete`, `in_progress`). + status_details: + type: object + description: Additional details about the status. + properties: + type: + type: string + enum: + - completed + - cancelled + - failed + - incomplete + description: > + The type of error that caused the response to fail, + corresponding + + with the `status` field (`completed`, `cancelled`, + `incomplete`, + + `failed`). + reason: + type: string + enum: + - turn_detected + - client_cancelled + - max_output_tokens + - content_filter + description: > + The reason the Response did not complete. For a `cancelled` + Response, one of `turn_detected` (the server VAD detected a new + start of speech) or `client_cancelled` (the client sent a + cancel event). For an `incomplete` Response, one of + `max_output_tokens` or `content_filter` (the server-side safety + filter activated and cut off the response). + error: + type: object + description: | + A description of the error that caused the response to fail, + populated when the `status` is `failed`. + properties: + type: + type: string + description: The type of error. + code: + type: string + description: Error code, if any. + output: + type: array + description: The list of output items generated by the response. + items: + $ref: '#/components/schemas/RealtimeConversationItem' metadata: $ref: '#/components/schemas/Metadata' - top_logprobs: - anyOf: - - description: > - An integer between 0 and 20 specifying the maximum number of - most likely + audio: + type: object + description: Configuration for audio output. + properties: + output: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the output audio. + voice: + $ref: '#/components/schemas/VoiceIdsShared' + default: alloy + description: > + The voice the model uses to respond. Voice cannot be changed + during the - tokens to return at each token position, each with an associated - log + session once the model has responded with audio at least + once. Current - probability. In some cases, the number of returned tokens may be - fewer than + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, + `sage`, - requested. + `shimmer`, `verse`, `marin`, and `cedar`. We recommend + `marin` and `cedar` for + + best quality. + usage: + type: object + description: > + Usage statistics for the Response, this will correspond to billing. + A + + Realtime API session will maintain a conversation context and append + new + + Items to the Conversation, thus output from previous turns (text + and + + audio tokens) will become the input for later turns. + properties: + total_tokens: type: integer - minimum: 0 - maximum: 20 - - type: 'null' - temperature: - anyOf: - - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 description: > - What sampling temperature to use, between 0 and 2. Higher values - like 0.8 will make the output more random, while lower values - like 0.2 will make it more focused and deterministic. + The total number of tokens in the Response including input and + output - We generally recommend altering this or `top_p` but not both. - - type: 'null' - top_p: - anyOf: - - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 + text and audio tokens. + input_tokens: + type: integer description: > - An alternative to sampling with temperature, called nucleus - sampling, + The number of input tokens used in the Response, including text + and + + audio tokens. + output_tokens: + type: integer + description: > + The number of output tokens sent in the Response, including text + and + + audio tokens. + input_token_details: + type: object + description: >- + Details about the input tokens used in the Response. Cached + tokens are tokens from previous turns in the conversation that + are included as context for the current response. Cached tokens + here are counted as a subset of input tokens, meaning input + tokens will include cached and uncached tokens. + properties: + cached_tokens: + type: integer + description: The number of cached tokens used as input for the Response. + text_tokens: + type: integer + description: The number of text tokens used as input for the Response. + image_tokens: + type: integer + description: The number of image tokens used as input for the Response. + audio_tokens: + type: integer + description: The number of audio tokens used as input for the Response. + cached_tokens_details: + type: object + description: >- + Details about the cached tokens used as input for the + Response. + properties: + text_tokens: + type: integer + description: >- + The number of cached text tokens used as input for the + Response. + image_tokens: + type: integer + description: >- + The number of cached image tokens used as input for the + Response. + audio_tokens: + type: integer + description: >- + The number of cached audio tokens used as input for the + Response. + output_token_details: + type: object + description: Details about the output tokens used in the Response. + properties: + text_tokens: + type: integer + description: The number of text tokens used in the Response. + audio_tokens: + type: integer + description: The number of audio tokens used in the Response. + conversation_id: + description: > + Which conversation the response is added to, determined by the + `conversation` + + field in the `response.create` event. If `auto`, the response will + be added to + + the default conversation and the value of `conversation_id` will be + an id like + + `conv_1234`. If `none`, the response will not be added to any + conversation and + + the value of `conversation_id` will be `null`. If responses are + being triggered + + automatically by VAD the response will be added to the default + conversation + type: string + output_modalities: + type: array + description: > + The set of modalities the model used to respond, currently the only + possible values are + + `[\"audio\"]`, `[\"text\"]`. Audio output always include a text + transcript. Setting the + + output to mode `text` will disable audio output from the model. + items: + type: string + enum: + - text + - audio + max_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls, that was used in this response. + RealtimeResponseCreateParams: + type: object + description: Create a new Realtime response with these parameters + properties: + output_modalities: + type: array + description: > + The set of modalities the model used to respond, currently the only + possible values are + + `[\"audio\"]`, `[\"text\"]`. Audio output always include a text + transcript. Setting the + + output to mode `text` will disable audio output from the model. + items: + type: string + enum: + - text + - audio + instructions: + type: string + description: > + 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. + + 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. + audio: + type: object + description: Configuration for audio input and output. + properties: + output: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the output audio. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + default: alloy + description: > + The voice the model uses to respond. Supported built-in + voices are - where the model considers the results of the tokens with top_p - probability + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, `verse`, - mass. So 0.1 means only the tokens comprising the top 10% - probability mass + `marin`, and `cedar`. You may also provide a custom voice + object with - are considered. + an `id`, for example `{ "id": "voice_1234" }`. Voice cannot + be changed + during the session once the model has responded with audio + at least once. - We generally recommend altering this or `temperature` but not - both. - - type: 'null' - user: - type: string - example: user-1234 - deprecated: true + We recommend `marin` and `cedar` for best quality. + tools: + type: array + description: Tools available to the model. + items: + oneOf: + - $ref: '#/components/schemas/RealtimeFunctionTool' + - $ref: '#/components/schemas/MCPTool' + tool_choice: description: > - This field is being replaced by `safety_identifier` and - `prompt_cache_key`. Use `prompt_cache_key` instead to maintain - caching optimizations. - - A stable identifier for your end-users. + How the model chooses tools. Provide one of the string modes or + force a specific - Used to boost cache hit rates by better bucketing similar requests - and to help OpenAI detect and prevent abuse. [Learn - more](/docs/guides/safety-best-practices#safety-identifiers). - safety_identifier: - type: string - maxLength: 64 - example: safety-identifier-1234 + function/MCP tool. + oneOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + default: auto + parallel_tool_calls: + type: boolean description: > - A stable identifier used to help detect users of your application - that may be violating OpenAI's usage policies. + Whether the model may call multiple tools in parallel. Only + supported by - The IDs should be a string that uniquely identifies each user, with - a maximum length of 64 characters. We recommend hashing their - username or email address, in order to avoid sending us any - identifying information. [Learn - more](/docs/guides/safety-best-practices#safety-identifiers). - prompt_cache_key: - type: string - example: prompt-cache-key-1234 + reasoning Realtime models such as `gpt-realtime-2`. + reasoning: + $ref: '#/components/schemas/RealtimeReasoning' + max_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + conversation: description: > - Used by OpenAI to cache responses for similar requests to optimize - your cache hit rates. Replaces the `user` field. [Learn - more](/docs/guides/prompt-caching). - service_tier: - $ref: '#/components/schemas/ServiceTier' - prompt_cache_retention: - anyOf: + Controls which conversation the response is added to. Currently + supports + + `auto` and `none`, with `auto` as the default value. The `auto` + value + + means that the contents of the response will be added to the default + + conversation. Set this to `none` to create an out-of-band response + which + + will not add items to default conversation. + oneOf: + - type: string - type: string + default: auto enum: - - in_memory - - 24h - description: > - The retention policy for the prompt cache. Set to `24h` to - enable extended prompt caching, which keeps cached prefixes - active for longer, up to a maximum of 24 hours. [Learn - more](/docs/guides/prompt-caching#prompt-cache-retention). + - auto + - none + metadata: + $ref: '#/components/schemas/Metadata' + prompt: + $ref: '#/components/schemas/Prompt' + input: + type: array + description: > + Input items to include in the prompt for the model. Using this field - For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is - supported. + creates a new context for this Response instead of using the default + conversation. An empty array `[]` will clear the context for this + Response. - For older models that support both `in_memory` and `24h`, the - default depends on your organization's data retention policy: - - Organizations without ZDR enabled default to `24h`. - - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified. - - type: 'null' - ModifyAssistantRequest: + Note that this can include references to items that previously + appeared in the session + + using their id. + items: + $ref: '#/components/schemas/RealtimeConversationItem' + RealtimeServerEvent: + discriminator: + propertyName: type + description: | + A realtime server event. + anyOf: + - $ref: '#/components/schemas/RealtimeServerEventConversationCreated' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemCreated' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemDeleted' + - $ref: >- + #/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionCompleted + - $ref: >- + #/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionDelta + - $ref: >- + #/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionFailed + - $ref: '#/components/schemas/RealtimeServerEventConversationItemRetrieved' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemTruncated' + - $ref: '#/components/schemas/RealtimeServerEventError' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCleared' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCommitted' + - $ref: >- + #/components/schemas/RealtimeServerEventInputAudioBufferDtmfEventReceived + - $ref: >- + #/components/schemas/RealtimeServerEventInputAudioBufferSpeechStarted + - $ref: >- + #/components/schemas/RealtimeServerEventInputAudioBufferSpeechStopped + - $ref: '#/components/schemas/RealtimeServerEventRateLimitsUpdated' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartAdded' + - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseCreated' + - $ref: '#/components/schemas/RealtimeServerEventResponseDone' + - $ref: >- + #/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDelta + - $ref: >- + #/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDone + - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemAdded' + - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseTextDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseTextDone' + - $ref: '#/components/schemas/RealtimeServerEventSessionCreated' + - $ref: '#/components/schemas/RealtimeServerEventSessionUpdated' + - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStarted' + - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStopped' + - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferCleared' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemAdded' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemDone' + - $ref: >- + #/components/schemas/RealtimeServerEventInputAudioBufferTimeoutTriggered + - $ref: >- + #/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionSegment + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsInProgress' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsCompleted' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsFailed' + - $ref: >- + #/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDelta + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallInProgress' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallCompleted' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallFailed' + RealtimeServerEventConversationCreated: type: object - additionalProperties: false + description: > + Returned when a conversation is created. Emitted right after session + creation. properties: - model: - description: > - ID of the model to use. You can use the [List - models](/docs/api-reference/models/list) API to see all of your - available models, or see our [Model overview](/docs/models) for - descriptions of them. - anyOf: - - type: string - - $ref: '#/components/schemas/AssistantSupportedModels' - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - name: - anyOf: - - description: | - The name of the assistant. The maximum length is 256 characters. - type: string - maxLength: 256 - - type: 'null' - description: - anyOf: - - description: > - The description of the assistant. The maximum length is 512 - characters. + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - conversation.created + description: The event type, must be `conversation.created`. + x-stainless-const: true + conversation: + type: object + description: The conversation resource. + properties: + id: type: string - maxLength: 512 - - type: 'null' - instructions: - anyOf: - - description: > - The system instructions that the assistant uses. The maximum - length is 256,000 characters. + description: The unique ID of the conversation. + object: type: string - maxLength: 256000 - - type: 'null' - tools: - description: > - A list of tool enabled on the assistant. There can be a maximum of - 128 tools per assistant. Tools can be of types `code_interpreter`, - `file_search`, or `function`. - default: [] - type: array - maxItems: 128 - items: - oneOf: - - $ref: '#/components/schemas/AssistantToolsCode' - - $ref: '#/components/schemas/AssistantToolsFileSearch' - - $ref: '#/components/schemas/AssistantToolsFunction' - tool_resources: + description: The object type, must be `realtime.conversation`. + required: + - event_id + - type + - conversation + x-oaiMeta: + name: conversation.created + group: realtime + example: | + { + "event_id": "event_9101", + "type": "conversation.created", + "conversation": { + "id": "conv_001", + "object": "realtime.conversation" + } + } + RealtimeServerEventConversationItemAdded: + type: object + description: > + Sent by the server when an Item is added to the default Conversation. + This can happen in several cases: + + - When the client sends a `conversation.item.create` event. + + - When the input audio buffer is committed. In this case the item will + be a user message containing the audio from the buffer. + + - When the model is generating a Response. In this case the + `conversation.item.added` event will be sent when the model starts + generating a specific Item, and thus it will not yet have any content + (and `status` will be `in_progress`). + + + The event will include the full content of the Item (except when model + is generating a Response) except for audio data, which can be retrieved + separately with a `conversation.item.retrieve` event if necessary. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - conversation.item.added + description: The event type, must be `conversation.item.added`. + x-stainless-const: true + previous_item_id: anyOf: - - type: object + - type: string description: > - A set of resources that are used by the assistant's tools. The - resources are specific to the type of tool. For example, the - `code_interpreter` tool requires a list of file IDs, while the - `file_search` tool requires a list of vector store IDs. - properties: - code_interpreter: - type: object - properties: - file_ids: - type: array - description: > - Overrides the list of [file](/docs/api-reference/files) - IDs made available to the `code_interpreter` tool. There - can be a maximum of 20 files associated with the tool. - default: [] - maxItems: 20 - items: - type: string - file_search: - type: object - properties: - vector_store_ids: - type: array - description: > - Overrides the [vector - store](/docs/api-reference/vector-stores/object) - attached to this assistant. There can be a maximum of 1 - vector store attached to the assistant. - maxItems: 1 - items: - type: string - - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - temperature: - anyOf: - - description: > - What sampling temperature to use, between 0 and 2. Higher values - like 0.8 will make the output more random, while lower values - like 0.2 will make it more focused and deterministic. - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 + The ID of the item that precedes this one, if any. This is used + to + + maintain ordering when items are inserted. - type: 'null' - top_p: + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.added + group: realtime + example: | + { + "type": "conversation.item.added", + "event_id": "event_C9G8pjSJCfRNEhMEnYAVy", + "previous_item_id": null, + "item": { + "id": "item_C9G8pGVKYnaZu8PH5YQ9O", + "type": "message", + "status": "completed", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + } + } + RealtimeServerEventConversationItemCreated: + type: object + description: > + Returned when a conversation item is created. There are several + scenarios that produce this event: + - The server is generating a Response, which if successful will produce + either one or two Items, which will be of type `message` + (role `assistant`) or type `function_call`. + - The input audio buffer has been committed, either by the client or the + server (in `server_vad` mode). The server will take the content of the + input audio buffer and add it to a new user message Item. + - The client has sent a `conversation.item.create` event to add a new Item + to the Conversation. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - conversation.item.created + description: The event type, must be `conversation.item.created`. + x-stainless-const: true + previous_item_id: anyOf: - - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 + - type: string description: > - An alternative to sampling with temperature, called nucleus - sampling, where the model considers the results of the tokens - with top_p probability mass. So 0.1 means only the tokens - comprising the top 10% probability mass are considered. + The ID of the preceding item in the Conversation context, allows + the + client to understand the order of the conversation. Can be + `null` if the - We generally recommend altering this or temperature but not - both. - - type: 'null' - response_format: - anyOf: - - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + item has no predecessor. - type: 'null' - ModifyCertificateRequest: + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.created + group: realtime + example: | + { + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [] + } + } + RealtimeServerEventConversationItemDeleted: type: object + description: > + Returned when an item in the conversation is deleted by the client with + a + + `conversation.item.delete` event. This event is used to synchronize the + + server's understanding of the conversation history with the client's + view. properties: - name: + event_id: type: string - description: The updated name for the certificate - ModifyMessageRequest: - type: object - additionalProperties: false - properties: - metadata: - $ref: '#/components/schemas/Metadata' - ModifyRunRequest: - type: object - additionalProperties: false - properties: - metadata: - $ref: '#/components/schemas/Metadata' - ModifyThreadRequest: + description: The unique ID of the server event. + type: + type: string + enum: + - conversation.item.deleted + description: The event type, must be `conversation.item.deleted`. + x-stainless-const: true + item_id: + type: string + description: The ID of the item that was deleted. + required: + - event_id + - type + - item_id + x-oaiMeta: + name: conversation.item.deleted + group: realtime + example: | + { + "event_id": "event_2728", + "type": "conversation.item.deleted", + "item_id": "msg_005" + } + RealtimeServerEventConversationItemDone: type: object - additionalProperties: false + description: > + Returned when a conversation item is finalized. + + + The event will include the full content of the Item except for audio + data, which can be retrieved separately with a + `conversation.item.retrieve` event if needed. properties: - tool_resources: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - conversation.item.done + description: The event type, must be `conversation.item.done`. + x-stainless-const: true + previous_item_id: anyOf: - - type: object + - type: string description: > - A set of resources that are made available to the assistant's - tools in this thread. The resources are specific to the type of - tool. For example, the `code_interpreter` tool requires a list - of file IDs, while the `file_search` tool requires a list of - vector store IDs. - properties: - code_interpreter: - type: object - properties: - file_ids: - type: array - description: > - A list of [file](/docs/api-reference/files) IDs made - available to the `code_interpreter` tool. There can be a - maximum of 20 files associated with the tool. - default: [] - maxItems: 20 - items: - type: string - file_search: - type: object - properties: - vector_store_ids: - type: array - description: > - The [vector - store](/docs/api-reference/vector-stores/object) - attached to this thread. There can be a maximum of 1 - vector store attached to the thread. - maxItems: 1 - items: - type: string + The ID of the item that precedes this one, if any. This is used + to + + maintain ordering when items are inserted. - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - NoiseReductionType: - type: string - enum: - - near_field - - far_field + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.done + group: realtime + example: | + { + "type": "conversation.item.done", + "event_id": "event_CCXLgMZPo3qioWCeQa4WH", + "previous_item_id": "item_CCXLecNJVIVR2HUy3ABLj", + "item": { + "id": "item_CCXLfxmM5sXVJVz4mCa2S", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_audio", + "transcript": "Oh, I can hear you loud and clear! Sounds like we're connected just fine. What can I help you with today?" + } + ] + } + } + RealtimeServerEventConversationItemInputAudioTranscriptionCompleted: + type: object description: > - 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. - OpenAIFile: - title: OpenAIFile - description: >- - The `File` object represents a document that has been uploaded to - OpenAI. + This event is the output of audio transcription for user audio written + to the + + user audio buffer. Transcription begins when the input audio buffer is + + committed by the client or server (when VAD is enabled). Transcription + runs + + asynchronously with Response creation, so this event may come before or + after + + the Response events. + + + Realtime API models accept audio natively, and thus input transcription + is a + + separate process run on a separate ASR (Automatic Speech Recognition) + model. + + The transcript may diverge somewhat from the model's interpretation, and + + should be treated as a rough guide. properties: - id: - type: string - description: The file identifier, which can be referenced in the API endpoints. - bytes: - type: integer - description: The size of the file, in bytes. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the file was created. - expires_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the file will expire. - filename: + event_id: type: string - description: The name of the file. - object: + description: The unique ID of the server event. + type: type: string - description: The object type, which is always `file`. enum: - - file + - conversation.item.input_audio_transcription.completed + description: | + The event type, must be + `conversation.item.input_audio_transcription.completed`. x-stainless-const: true - purpose: - type: string - description: >- - The intended purpose of the file. Supported values are `assistants`, - `assistants_output`, `batch`, `batch_output`, `fine-tune`, - `fine-tune-results`, `vision`, and `user_data`. - enum: - - assistants - - assistants_output - - batch - - batch_output - - fine-tune - - fine-tune-results - - vision - - user_data - status: + item_id: type: string - deprecated: true - description: >- - Deprecated. The current status of the file, which can be either - `uploaded`, `processed`, or `error`. - enum: - - uploaded - - processed - - error - status_details: + description: The ID of the item containing the audio that is being transcribed. + content_index: + type: integer + description: The index of the content part containing the audio. + transcript: type: string - deprecated: true + description: The transcribed text. + logprobs: + anyOf: + - type: array + description: The log probabilities of the transcription. + items: + $ref: '#/components/schemas/LogProbProperties' + - type: 'null' + usage: + type: object description: >- - Deprecated. For details on why a fine-tuning training file failed - validation, see the `error` field on `fine_tuning.job`. + Usage statistics for the transcription, this is billed according to + the ASR model's pricing rather than the realtime model's pricing. + oneOf: + - $ref: '#/components/schemas/TranscriptTextUsageTokens' + title: Token Usage + - $ref: '#/components/schemas/TranscriptTextUsageDuration' + title: Duration Usage required: - - id - - object - - bytes - - created_at - - filename - - purpose - - status + - event_id + - type + - item_id + - content_index + - transcript + - usage x-oaiMeta: - name: The file object + name: conversation.item.input_audio_transcription.completed + group: realtime example: | { - "id": "file-abc123", - "object": "file", - "bytes": 120000, - "created_at": 1677610602, - "expires_at": 1680202602, - "filename": "salesOverview.pdf", - "purpose": "assistants", + "type": "conversation.item.input_audio_transcription.completed", + "event_id": "event_CCXGRvtUVrax5SJAnNOWZ", + "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", + "content_index": 0, + "transcript": "Hey, can you hear me?", + "usage": { + "type": "tokens", + "total_tokens": 22, + "input_tokens": 13, + "input_token_details": { + "text_tokens": 0, + "audio_tokens": 13 + }, + "output_tokens": 9 + } } - OrganizationCertificate: + RealtimeServerEventConversationItemInputAudioTranscriptionDelta: type: object - description: >- - Represents an individual certificate configured at the organization - level. + description: > + Returned when the text value of an input audio transcription content + part is updated with incremental transcription results. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - organization.certificate - description: The object type, which is always `organization.certificate`. + - conversation.item.input_audio_transcription.delta + description: >- + The event type, must be + `conversation.item.input_audio_transcription.delta`. x-stainless-const: true - id: + item_id: type: string - description: The identifier, which can be referenced in API endpoints - name: + description: The ID of the item containing the audio that is being transcribed. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: The text delta. + logprobs: anyOf: - - type: string + - type: array + description: >- + The log probabilities of the transcription. These can be enabled + by configurating the session with `"include": + ["item.input_audio_transcription.logprobs"]`. Each entry in the + array corresponds a log probability of which token would be + selected for this chunk of transcription. This can help to + identify if it was possible there were multiple valid options + for a given chunk of transcription. + items: + $ref: '#/components/schemas/LogProbProperties' - type: 'null' - description: The name of the certificate. - created_at: + required: + - event_id + - type + - item_id + x-oaiMeta: + name: conversation.item.input_audio_transcription.delta + group: realtime + example: | + { + "type": "conversation.item.input_audio_transcription.delta", + "event_id": "event_CCXGRxsAimPAs8kS2Wc7Z", + "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", + "content_index": 0, + "delta": "Hey", + "obfuscation": "aLxx0jTEciOGe" + } + RealtimeServerEventConversationItemInputAudioTranscriptionFailed: + type: object + description: > + Returned when input audio transcription is configured, and a + transcription + + request for a user message failed. These events are separate from other + + `error` events so that the client can identify the related Item. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - conversation.item.input_audio_transcription.failed + description: | + The event type, must be + `conversation.item.input_audio_transcription.failed`. + x-stainless-const: true + item_id: + type: string + description: The ID of the user message item. + content_index: type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) of when the certificate was - uploaded. - certificate_details: + description: The index of the content part containing the audio. + error: type: object + description: Details of the transcription error. properties: - valid_at: - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) of when the certificate becomes - valid. - expires_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate expires. - active: - type: boolean + type: + type: string + description: The type of error. + code: + type: string + description: Error code, if any. + message: + type: string + description: A human-readable error message. + param: + type: string + description: Parameter related to the error, if any. + required: + - event_id + - type + - item_id + - content_index + - error + x-oaiMeta: + name: conversation.item.input_audio_transcription.failed + group: realtime + example: | + { + "event_id": "event_2324", + "type": "conversation.item.input_audio_transcription.failed", + "item_id": "msg_003", + "content_index": 0, + "error": { + "type": "transcription_error", + "code": "audio_unintelligible", + "message": "The audio could not be transcribed.", + "param": null + } + } + RealtimeServerEventConversationItemInputAudioTranscriptionSegment: + type: object + description: >- + Returned when an input audio transcription segment is identified for an + item. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - conversation.item.input_audio_transcription.segment description: >- - Whether the certificate is currently active at the organization - level. + The event type, must be + `conversation.item.input_audio_transcription.segment`. + x-stainless-const: true + item_id: + type: string + description: The ID of the item containing the input audio content. + content_index: + type: integer + description: The index of the input audio content part within the item. + text: + type: string + description: The text for this segment. + id: + type: string + description: The segment identifier. + speaker: + type: string + description: The detected speaker label for this segment. + start: + type: number + format: double + description: Start time of the segment in seconds. + end: + type: number + format: double + description: End time of the segment in seconds. required: - - object + - event_id + - type + - item_id + - content_index + - text - id - - name - - created_at - - certificate_details - - active - OrganizationCertificateActivationResponse: + - speaker + - start + - end + x-oaiMeta: + name: conversation.item.input_audio_transcription.segment + group: realtime + example: | + { + "event_id": "event_6501", + "type": "conversation.item.input_audio_transcription.segment", + "item_id": "msg_011", + "content_index": 0, + "text": "hello", + "id": "seg_0001", + "speaker": "spk_1", + "start": 0.0, + "end": 0.4 + } + RealtimeServerEventConversationItemRetrieved: + type: object + description: > + Returned when a conversation item is retrieved with + `conversation.item.retrieve`. This is provided as a way to fetch the + server's representation of an item, for example to get access to the + post-processed audio data after noise cancellation and VAD. It includes + the full content of the Item, including audio data. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - conversation.item.retrieved + description: The event type, must be `conversation.item.retrieved`. + x-stainless-const: true + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.retrieved + group: realtime + example: | + { + "type": "conversation.item.retrieved", + "event_id": "event_CCXGSizgEppa2d4XbKA7K", + "item": { + "id": "item_CCXGRxbY0n6WE4EszhF5w", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "audio", + "transcript": "Yes, I can hear you loud and clear. How can I help you today?", + "audio": "8//2//v/9//q/+//+P/s...", + "format": "pcm16" + } + ] + } + } + RealtimeServerEventConversationItemTruncated: type: object + description: > + Returned when an earlier assistant audio message item is truncated by + the + + client with a `conversation.item.truncate` event. This event is used to + + synchronize the server's understanding of the audio with the client's + playback. + + + This action will truncate the audio and remove the server-side text + transcript + + to ensure there is no text in the context that hasn't been heard by the + user. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - organization.certificate.activation - description: The organization certificate activation result type. + - conversation.item.truncated + description: The event type, must be `conversation.item.truncated`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/OrganizationCertificate' + item_id: + type: string + description: The ID of the assistant message item that was truncated. + content_index: + type: integer + description: The index of the content part that was truncated. + audio_end_ms: + type: integer + description: | + The duration up to which the audio was truncated, in milliseconds. required: - - object - - data - OrganizationCertificateDeactivationResponse: + - event_id + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncated + group: realtime + example: | + { + "event_id": "event_2526", + "type": "conversation.item.truncated", + "item_id": "msg_004", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeServerEventError: type: object + description: > + Returned when an error occurs, which could be a client problem or a + server + + problem. Most errors are recoverable and the session will stay open, we + + recommend to implementors to monitor and log error messages by default. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - organization.certificate.deactivation - description: The organization certificate deactivation result type. + - error + description: The event type, must be `error`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/OrganizationCertificate' + error: + type: object + description: Details of the error. + required: + - type + - message + properties: + type: + type: string + description: > + The type of error (e.g., "invalid_request_error", + "server_error"). + code: + anyOf: + - type: string + description: Error code, if any. + - type: 'null' + message: + type: string + description: A human-readable error message. + param: + anyOf: + - type: string + description: Parameter related to the error, if any. + - type: 'null' + event_id: + anyOf: + - type: string + description: > + The event_id of the client event that caused the error, if + applicable. + - type: 'null' required: - - object - - data - OrganizationDataRetention: + - event_id + - type + - error + x-oaiMeta: + name: error + group: realtime + example: | + { + "event_id": "event_890", + "type": "error", + "error": { + "type": "invalid_request_error", + "code": "invalid_event", + "message": "The 'type' field is missing.", + "param": null, + "event_id": "event_567" + } + } + RealtimeServerEventInputAudioBufferCleared: type: object - description: Represents the organization's data retention control setting. + description: | + Returned when the input audio buffer is cleared by the client with a + `input_audio_buffer.clear` event. properties: - object: + event_id: type: string - enum: - - organization.data_retention - description: The object type, which is always `organization.data_retention`. - x-stainless-const: true + description: The unique ID of the server event. type: type: string enum: - - zero_data_retention - - modified_abuse_monitoring - - enhanced_zero_data_retention - - enhanced_modified_abuse_monitoring - description: The configured organization data retention type. + - input_audio_buffer.cleared + description: The event type, must be `input_audio_buffer.cleared`. + x-stainless-const: true required: - - object + - event_id - type x-oaiMeta: - name: The organization data retention object + name: input_audio_buffer.cleared + group: realtime example: | { - "object": "organization.data_retention", - "type": "modified_abuse_monitoring" + "event_id": "event_1314", + "type": "input_audio_buffer.cleared" } - OrganizationProjectCertificate: + RealtimeServerEventInputAudioBufferCommitted: type: object - description: Represents an individual certificate configured at the project level. + description: > + Returned when an input audio buffer is committed, either by the client + or + + automatically in server VAD mode. The `item_id` property is the ID of + the user + + message item that will be created, thus a `conversation.item.created` + event + + will also be sent to the client. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - organization.project.certificate - description: The object type, which is always `organization.project.certificate`. + - input_audio_buffer.committed + description: The event type, must be `input_audio_buffer.committed`. x-stainless-const: true - id: - type: string - description: The identifier, which can be referenced in API endpoints - name: + previous_item_id: anyOf: - type: string + description: > + The ID of the preceding item after which the new item will be + inserted. + + Can be `null` if the item has no predecessor. - type: 'null' - description: The name of the certificate. - created_at: - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) of when the certificate was - uploaded. - certificate_details: - type: object - properties: - valid_at: - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) of when the certificate becomes - valid. - expires_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate expires. - active: - type: boolean - description: Whether the certificate is currently active at the project level. - required: - - object - - id - - name - - created_at - - certificate_details - - active - OrganizationProjectCertificateActivationResponse: - type: object - properties: - object: + item_id: type: string - enum: - - organization.project.certificate.activation - description: The project certificate activation result type. - x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/OrganizationProjectCertificate' + description: The ID of the user message item that will be created. required: - - object - - data - OrganizationProjectCertificateDeactivationResponse: + - event_id + - type + - item_id + x-oaiMeta: + name: input_audio_buffer.committed + group: realtime + example: | + { + "event_id": "event_1121", + "type": "input_audio_buffer.committed", + "previous_item_id": "msg_001", + "item_id": "msg_002" + } + RealtimeServerEventInputAudioBufferDtmfEventReceived: type: object + description: > + **SIP Only:** Returned when an DTMF event is received. A DTMF event is a + message that + + represents a telephone keypad press (0–9, *, #, A–D). The `event` + property + + is the keypad that the user press. The `received_at` is the UTC Unix + Timestamp + + that the server received the event. properties: - object: + type: type: string enum: - - organization.project.certificate.deactivation - description: The project certificate deactivation result type. + - input_audio_buffer.dtmf_event_received + description: The event type, must be `input_audio_buffer.dtmf_event_received`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/OrganizationProjectCertificate' + event: + type: string + description: The telephone keypad that was pressed by the user. + received_at: + type: integer + description: | + UTC Unix Timestamp when DTMF Event was received by server. required: - - object - - data - OrganizationSpendAlert: + - type + - event + - received_at + x-oaiMeta: + name: input_audio_buffer.dtmf_event_received + group: realtime + example: | + { + "type":" input_audio_buffer.dtmf_event_received", + "event": "9", + "received_at": 1763605109, + } + RealtimeServerEventInputAudioBufferSpeechStarted: type: object - description: Represents a spend alert configured at the organization level. + description: > + Sent by the server when in `server_vad` mode to indicate that speech has + been + + detected in the audio buffer. This can happen any time audio is added to + the + + buffer (unless speech is already detected). The client may want to use + this + + event to interrupt audio playback or provide visual feedback to the + user. + + + The client should expect to receive a + `input_audio_buffer.speech_stopped` event + + when speech stops. The `item_id` property is the ID of the user message + item + + that will be created when speech stops and will also be included in the + + `input_audio_buffer.speech_stopped` event (unless the client manually + commits + + the audio buffer during VAD activation). properties: - id: + event_id: type: string - description: The identifier, which can be referenced in API endpoints. - object: + description: The unique ID of the server event. + type: type: string enum: - - organization.spend_alert - description: The object type, which is always `organization.spend_alert`. + - input_audio_buffer.speech_started + description: The event type, must be `input_audio_buffer.speech_started`. x-stainless-const: true - threshold_amount: + audio_start_ms: type: integer - description: The alert threshold amount, in cents. - currency: - type: string - enum: - - USD - description: The currency for the threshold amount. - interval: + description: > + Milliseconds from the start of all audio written to the buffer + during the + + session when speech was first detected. This will correspond to the + + beginning of audio sent to the model, and thus includes the + + `prefix_padding_ms` configured in the Session. + item_id: type: string - enum: - - month - description: The time interval for evaluating spend against the threshold. - notification_channel: - $ref: '#/components/schemas/SpendAlertNotificationChannel' + description: > + The ID of the user message item that will be created when speech + stops. required: - - id - - object - - threshold_amount - - currency - - interval - - notification_channel + - event_id + - type + - audio_start_ms + - item_id x-oaiMeta: - name: The organization spend alert object + name: input_audio_buffer.speech_started + group: realtime example: | { - "id": "alert_abc123", - "object": "organization.spend_alert", - "threshold_amount": 100000, - "currency": "USD", - "interval": "month", - "notification_channel": { - "type": "email", - "recipients": ["finance@example.com"], - "subject_prefix": "OpenAI spend alert" - } + "event_id": "event_1516", + "type": "input_audio_buffer.speech_started", + "audio_start_ms": 1000, + "item_id": "msg_003" } - OrganizationSpendAlertDeletedResource: + RealtimeServerEventInputAudioBufferSpeechStopped: type: object - description: >- - Confirmation payload returned after deleting an organization spend - alert. + description: > + Returned in `server_vad` mode when the server detects the end of speech + in + + the audio buffer. The server will also send an + `conversation.item.created` + + event with the user message item that is created from the audio buffer. properties: - id: + event_id: type: string - description: The deleted spend alert ID. - object: + description: The unique ID of the server event. + type: type: string enum: - - organization.spend_alert.deleted - description: Always `organization.spend_alert.deleted`. + - input_audio_buffer.speech_stopped + description: The event type, must be `input_audio_buffer.speech_stopped`. x-stainless-const: true - deleted: - type: boolean - description: Whether the spend alert was deleted. - required: - - id - - object - - deleted - OrganizationSpendAlertListResource: - type: object - description: Paginated list of organization spend alerts. - properties: - object: + audio_end_ms: + type: integer + description: > + Milliseconds since the session started when speech stopped. This + will + + correspond to the end of audio sent to the model, and thus includes + the + + `min_silence_duration_ms` configured in the Session. + item_id: type: string - enum: - - list - description: Always `list`. - x-stainless-const: true - data: - type: array - description: Spend alerts returned in the current page. - items: - $ref: '#/components/schemas/OrganizationSpendAlert' - first_id: - anyOf: - - type: string - - type: 'null' - description: The ID of the first spend alert in this page. - last_id: - anyOf: - - type: string - - type: 'null' - description: The ID of the last spend alert in this page. - has_more: - type: boolean - description: Whether more spend alerts are available when paginating. + description: The ID of the user message item that will be created. required: - - object - - data - - first_id - - last_id - - has_more - OtherChunkingStrategyResponseParam: + - event_id + - type + - audio_end_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.speech_stopped + group: realtime + example: | + { + "event_id": "event_1718", + "type": "input_audio_buffer.speech_stopped", + "audio_end_ms": 2000, + "item_id": "msg_003" + } + RealtimeServerEventInputAudioBufferTimeoutTriggered: type: object - title: Other Chunking Strategy - description: >- - This is returned when the chunking strategy is unknown. Typically, this - is because the file was indexed before the `chunking_strategy` concept - was introduced in the API. - additionalProperties: false + description: > + Returned when the Server VAD timeout is triggered for the input audio + buffer. This is configured + + with `idle_timeout_ms` in the `turn_detection` settings of the session, + and it indicates that + + there hasn't been any speech detected for the configured duration. + + + The `audio_start_ms` and `audio_end_ms` fields indicate the segment of + audio after the last + + model response up to the triggering time, as an offset from the + beginning of audio written + + to the input audio buffer. This means it demarcates the segment of audio + that was silent and + + the difference between the start and end values will roughly match the + configured timeout. + + + The empty audio will be committed to the conversation as an + `input_audio` item (there will be a + + `input_audio_buffer.committed` event) and a model response will be + generated. There may be speech + + that didn't trigger VAD but is still detected by the model, so the model + may respond with + + something relevant to the conversation or a prompt to continue speaking. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string - description: Always `other`. enum: - - other + - input_audio_buffer.timeout_triggered + description: The event type, must be `input_audio_buffer.timeout_triggered`. x-stainless-const: true + audio_start_ms: + type: integer + description: >- + Millisecond offset of audio written to the input audio buffer that + was after the playback time of the last model response. + audio_end_ms: + type: integer + description: >- + Millisecond offset of audio written to the input audio buffer at the + time the timeout was triggered. + item_id: + type: string + description: The ID of the item associated with this segment. required: + - event_id - type - OutputAudio: + - audio_start_ms + - audio_end_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.timeout_triggered + group: realtime + example: | + { + "type":"input_audio_buffer.timeout_triggered", + "event_id":"event_CEKKrf1KTGvemCPyiJTJ2", + "audio_start_ms":13216, + "audio_end_ms":19232, + "item_id":"item_CEKKrWH0GiwN0ET97NUZc" + } + RealtimeServerEventMCPListToolsCompleted: type: object - title: Output audio - description: | - An audio output from the model. + description: Returned when listing MCP tools has completed for an item. properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string - description: | - The type of the output audio. Always `output_audio`. enum: - - output_audio + - mcp_list_tools.completed + description: The event type, must be `mcp_list_tools.completed`. x-stainless-const: true - data: - type: string - description: | - Base64-encoded audio data from the model. - transcript: + item_id: type: string - description: | - The transcript of the audio data from the model. + description: The ID of the MCP list tools item. required: + - event_id - type - - data - - transcript - OutputContent: - oneOf: - - $ref: '#/components/schemas/OutputTextContent' - - $ref: '#/components/schemas/RefusalContent' - - $ref: '#/components/schemas/ReasoningTextContent' - discriminator: - propertyName: type - OutputItem: - oneOf: - - $ref: '#/components/schemas/OutputMessage' - - $ref: '#/components/schemas/FileSearchToolCall' - - $ref: '#/components/schemas/FunctionToolCall' - - $ref: '#/components/schemas/FunctionToolCallOutputResource' - - $ref: '#/components/schemas/WebSearchToolCall' - - $ref: '#/components/schemas/ComputerToolCall' - - $ref: '#/components/schemas/ComputerToolCallOutputResource' - - $ref: '#/components/schemas/ReasoningItem' - - $ref: '#/components/schemas/ToolSearchCall' - - $ref: '#/components/schemas/ToolSearchOutput' - - $ref: '#/components/schemas/AdditionalTools' - - $ref: '#/components/schemas/CompactionBody' - - $ref: '#/components/schemas/ImageGenToolCall' - - $ref: '#/components/schemas/CodeInterpreterToolCall' - - $ref: '#/components/schemas/LocalShellToolCall' - - $ref: '#/components/schemas/LocalShellToolCallOutput' - - $ref: '#/components/schemas/FunctionShellCall' - - $ref: '#/components/schemas/FunctionShellCallOutput' - - $ref: '#/components/schemas/ApplyPatchToolCall' - - $ref: '#/components/schemas/ApplyPatchToolCallOutput' - - $ref: '#/components/schemas/MCPToolCall' - - $ref: '#/components/schemas/MCPListTools' - - $ref: '#/components/schemas/MCPApprovalRequest' - - $ref: '#/components/schemas/MCPApprovalResponseResource' - - $ref: '#/components/schemas/CustomToolCall' - - $ref: '#/components/schemas/CustomToolCallOutputResource' - discriminator: - propertyName: type - OutputMessage: + - item_id + x-oaiMeta: + name: mcp_list_tools.completed + group: realtime + example: | + { + "event_id": "event_6102", + "type": "mcp_list_tools.completed", + "item_id": "mcp_list_tools_001" + } + RealtimeServerEventMCPListToolsFailed: type: object - title: Output message - description: | - An output message from the model. + description: Returned when listing MCP tools has failed for an item. properties: - id: + event_id: type: string - description: | - The unique ID of the output message. + description: The unique ID of the server event. type: type: string - description: | - The type of the output message. Always `message`. enum: - - message + - mcp_list_tools.failed + description: The event type, must be `mcp_list_tools.failed`. x-stainless-const: true - role: + item_id: + type: string + description: The ID of the MCP list tools item. + required: + - event_id + - type + - item_id + x-oaiMeta: + name: mcp_list_tools.failed + group: realtime + example: | + { + "event_id": "event_6103", + "type": "mcp_list_tools.failed", + "item_id": "mcp_list_tools_001" + } + RealtimeServerEventMCPListToolsInProgress: + type: object + description: Returned when listing MCP tools is in progress for an item. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: type: string - description: | - The role of the output message. Always `assistant`. enum: - - assistant + - mcp_list_tools.in_progress + description: The event type, must be `mcp_list_tools.in_progress`. x-stainless-const: true - content: - type: array - description: | - The content of the output message. - items: - $ref: '#/components/schemas/OutputMessageContent' - phase: - anyOf: - - $ref: '#/components/schemas/MessagePhase' - - type: 'null' - status: + item_id: type: string - description: > - The status of the message input. One of `in_progress`, `completed`, - or - - `incomplete`. Populated when input items are returned via API. - enum: - - in_progress - - completed - - incomplete + description: The ID of the MCP list tools item. required: - - id + - event_id - type - - role - - content - - status - OutputMessageContent: - oneOf: - - $ref: '#/components/schemas/OutputTextContent' - - $ref: '#/components/schemas/RefusalContent' - discriminator: - propertyName: type - ParallelToolCalls: - description: >- - Whether to enable [parallel function - calling](/docs/guides/function-calling#configuring-parallel-function-calling) - during tool use. - type: boolean - default: true - PartialImages: - anyOf: - - type: integer - maximum: 3 - minimum: 0 - default: 0 - example: 1 - description: > - The number of partial images to generate. This parameter is used for - - streaming responses that return partial images. Value must be - between 0 and 3. - - When set to 0, the response will be a single image sent in one - streaming event. + - item_id + x-oaiMeta: + name: mcp_list_tools.in_progress + group: realtime + example: | + { + "event_id": "event_6101", + "type": "mcp_list_tools.in_progress", + "item_id": "mcp_list_tools_001" + } + RealtimeServerEventOutputAudioBufferCleared: + type: object + description: > + **WebRTC/SIP Only:** Emitted when the output audio buffer is cleared. + This happens either in VAD + mode when the user has interrupted + (`input_audio_buffer.speech_started`), - Note that the final image may be sent before the full number of - partial images + or when the client has emitted the `output_audio_buffer.clear` event to + manually - are generated if the full image is generated more quickly. - - type: 'null' - PredictionContent: - type: object - title: Static Content - description: > - Static predicted output content, such as the content of a text file that - is + cut off the current audio response. - being regenerated. - required: - - type - - content + [Learn + more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). properties: + event_id: + type: string + description: The unique ID of the server event. type: type: string enum: - - content - description: | - The type of the predicted content you want to provide. This type is - currently always `content`. + - output_audio_buffer.cleared + description: The event type, must be `output_audio_buffer.cleared`. x-stainless-const: true - content: - description: > - The content that should be matched when generating a model response. + response_id: + type: string + description: The unique ID of the response that produced the audio. + required: + - event_id + - type + - response_id + x-oaiMeta: + name: output_audio_buffer.cleared + group: realtime + example: | + { + "event_id": "event_abc123", + "type": "output_audio_buffer.cleared", + "response_id": "resp_abc123" + } + RealtimeServerEventOutputAudioBufferStarted: + type: object + description: > + **WebRTC/SIP Only:** Emitted when the server begins streaming audio to + the client. This event is - If generated tokens would match this content, the entire model - response + emitted after an audio content part has been added + (`response.content_part.added`) - can be returned much more quickly. - oneOf: - - type: string - title: Text content - description: | - The content used for a Predicted Output. This is often the - text of a file you are regenerating with minor changes. - - type: array - description: >- - An array of content parts with a defined type. Supported options - differ based on the [model](/docs/models) being used to generate - the response. Can contain text inputs. - title: Array of content parts - items: - $ref: >- - #/components/schemas/ChatCompletionRequestMessageContentPartText - minItems: 1 - Project: - type: object - description: Represents an individual project. + to the response. + + [Learn + more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). properties: - id: + event_id: type: string - description: The identifier, which can be referenced in API endpoints - object: + description: The unique ID of the server event. + type: type: string enum: - - organization.project - description: The object type, which is always `organization.project` + - output_audio_buffer.started + description: The event type, must be `output_audio_buffer.started`. x-stainless-const: true - name: - anyOf: - - type: string - - type: 'null' - description: The name of the project. This appears in reporting. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the project was created. - archived_at: - anyOf: - - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) of when the project was archived - or `null`. - - type: 'null' - status: - anyOf: - - type: string - - type: 'null' - description: '`active` or `archived`' - external_key_id: - anyOf: - - type: string - - type: 'null' - description: The external key associated with the project. + response_id: + type: string + description: The unique ID of the response that produced the audio. required: - - id - - object - - created_at + - event_id + - type + - response_id x-oaiMeta: - name: The project object + name: output_audio_buffer.started + group: realtime example: | { - "id": "proj_abc", - "object": "organization.project", - "name": "Project example", - "created_at": 1711471533, - "archived_at": null, - "status": "active", - "external_key_id": null + "event_id": "event_abc123", + "type": "output_audio_buffer.started", + "response_id": "resp_abc123" } - ProjectApiKey: + RealtimeServerEventOutputAudioBufferStopped: type: object - description: Represents an individual API key in a project. + description: > + **WebRTC/SIP Only:** Emitted when the output audio buffer has been + completely drained on the server, + + and no more audio is forthcoming. This event is emitted after the full + response + + data has been sent to the client (`response.done`). + + [Learn + more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - organization.project.api_key - description: The object type, which is always `organization.project.api_key` + - output_audio_buffer.stopped + description: The event type, must be `output_audio_buffer.stopped`. x-stainless-const: true - redacted_value: + response_id: type: string - description: The redacted value of the API key - name: + description: The unique ID of the response that produced the audio. + required: + - event_id + - type + - response_id + x-oaiMeta: + name: output_audio_buffer.stopped + group: realtime + example: | + { + "event_id": "event_abc123", + "type": "output_audio_buffer.stopped", + "response_id": "resp_abc123" + } + RealtimeServerEventRateLimitsUpdated: + type: object + description: > + Emitted at the beginning of a Response to indicate the updated rate + limits. + + When a Response is created some tokens will be "reserved" for the + output + + tokens, the rate limits shown here reflect that reservation, which is + then + + adjusted accordingly once the Response is completed. + properties: + event_id: type: string - description: The name of the API key - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the API key was created - last_used_at: - anyOf: - - type: integer - format: unixtime - - type: 'null' - description: The Unix timestamp (in seconds) of when the API key was last used. - id: + description: The unique ID of the server event. + type: type: string - description: The identifier, which can be referenced in API endpoints - owner: - type: object - properties: - type: - type: string - enum: - - user - - service_account - description: '`user` or `service_account`' - user: - $ref: '#/components/schemas/ProjectApiKeyOwnerUser' - service_account: - $ref: '#/components/schemas/ProjectApiKeyOwnerServiceAccount' + enum: + - rate_limits.updated + description: The event type, must be `rate_limits.updated`. + x-stainless-const: true + rate_limits: + type: array + description: List of rate limit information. + items: + type: object + properties: + name: + type: string + enum: + - requests + - tokens + description: | + The name of the rate limit (`requests`, `tokens`). + limit: + type: integer + description: The maximum allowed value for the rate limit. + remaining: + type: integer + description: The remaining value before the limit is reached. + reset_seconds: + type: number + description: Seconds until the rate limit resets. required: - - object - - redacted_value - - name - - created_at - - last_used_at - - id - - owner + - event_id + - type + - rate_limits x-oaiMeta: - name: The project API key object + name: rate_limits.updated + group: realtime example: | { - "object": "organization.project.api_key", - "redacted_value": "sk-abc...def", - "name": "My API Key", - "created_at": 1711471533, - "last_used_at": 1711471534, - "id": "key_abc", - "owner": { - "type": "user", - "user": { - "id": "user_abc", - "name": "First Last", - "email": "user@example.com", - "role": "owner", - "created_at": 1711471533 + "event_id": "event_5758", + "type": "rate_limits.updated", + "rate_limits": [ + { + "name": "requests", + "limit": 1000, + "remaining": 999, + "reset_seconds": 60 + }, + { + "name": "tokens", + "limit": 50000, + "remaining": 49950, + "reset_seconds": 60 } - } + ] } - ProjectApiKeyDeleteResponse: + RealtimeServerEventResponseAudioDelta: type: object + description: Returned when the model-generated audio is updated. properties: - object: - type: string - enum: - - organization.project.api_key.deleted - x-stainless-const: true - id: + event_id: type: string - deleted: - type: boolean - required: - - object - - id - - deleted - ProjectApiKeyListResponse: - type: object - properties: - object: + description: The unique ID of the server event. + type: type: string enum: - - list + - response.output_audio.delta + description: The event type, must be `response.output_audio.delta`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/ProjectApiKey' - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean - required: - - object - - data - - has_more - ProjectApiKeyOwnerServiceAccount: - type: object - description: The service account that owns a project API key. - properties: - id: + response_id: type: string - description: The identifier, which can be referenced in API endpoints - name: + description: The ID of the response. + item_id: type: string - description: The name of the service account. - created_at: + description: The ID of the item. + output_index: type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) of when the service account was - created. - role: - type: string - description: The service account's project role. - required: - - id - - name - - created_at - - role - ProjectApiKeyOwnerUser: - type: object - description: The user that owns a project API key. - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints - email: - type: string - description: The email address of the user. - name: - type: string - description: The name of the user. - created_at: + description: The index of the output item in the response. + content_index: type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the user was created. - role: + description: The index of the content part in the item's content array. + delta: type: string - description: The user's project role. + description: Base64-encoded audio data delta. required: - - id - - email - - name - - created_at - - role - ProjectCreateRequest: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - delta + x-oaiMeta: + name: response.output_audio.delta + group: realtime + example: | + { + "event_id": "event_4950", + "type": "response.output_audio.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Base64EncodedAudioDelta" + } + RealtimeServerEventResponseAudioDone: type: object + description: > + Returned when the model-generated audio is done. Also emitted when a + Response + + is interrupted, incomplete, or cancelled. properties: - name: + event_id: type: string - description: The friendly name of the project, this name appears in reports. - geography: - anyOf: - - type: string - - type: 'null' - description: >- - Create the project with the specified data residency region. Your - organization must have access to Data residency functionality in - order to use. See [data residency - controls](/docs/guides/your-data#data-residency-controls) to review - the functionality and limitations of setting this field. - external_key_id: - anyOf: - - type: string - - type: 'null' - description: External key ID to associate with the project. - required: - - name - ProjectDataRetention: - type: object - description: Represents a project's data retention control setting. - properties: - object: + description: The unique ID of the server event. + type: type: string enum: - - project.data_retention - description: The object type, which is always `project.data_retention`. + - response.output_audio.done + description: The event type, must be `response.output_audio.done`. x-stainless-const: true - type: + response_id: type: string - enum: - - organization_default - - none - - zero_data_retention - - modified_abuse_monitoring - - enhanced_zero_data_retention - - enhanced_modified_abuse_monitoring - description: The configured project data retention type. + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. required: - - object + - event_id - type + - response_id + - item_id + - output_index + - content_index x-oaiMeta: - name: The project data retention object + name: response.output_audio.done + group: realtime example: | { - "object": "project.data_retention", - "type": "organization_default" + "event_id": "event_5152", + "type": "response.output_audio.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0 } - ProjectGroup: + RealtimeServerEventResponseAudioTranscriptDelta: type: object - description: Details about a group's membership in a project. + description: > + Returned when the model-generated transcription of audio output is + updated. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - project.group - description: Always `project.group`. + - response.output_audio_transcript.delta + description: The event type, must be `response.output_audio_transcript.delta`. x-stainless-const: true - project_id: - type: string - description: Identifier of the project. - group_id: - type: string - description: Identifier of the group that has access to the project. - group_name: + response_id: type: string - description: Display name of the group. - group_type: + description: The ID of the response. + item_id: type: string - enum: - - group - - tenant_group - description: The type of the group. - created_at: + description: The ID of the item. + output_index: type: integer - format: unixtime - description: >- - Unix timestamp (in seconds) when the group was granted project - access. + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: The transcript delta. required: - - object - - project_id - - group_id - - group_name - - group_type - - created_at + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - delta x-oaiMeta: - name: The project group object + name: response.output_audio_transcript.delta + group: realtime example: | { - "object": "project.group", - "project_id": "proj_abc123", - "group_id": "group_01J1F8ABCDXYZ", - "group_name": "Support Team", - "group_type": "group", - "created_at": 1711471533 + "event_id": "event_4546", + "type": "response.output_audio_transcript.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Hello, how can I a" } - ProjectGroupDeletedResource: + RealtimeServerEventResponseAudioTranscriptDone: type: object - description: Confirmation payload returned after removing a group from a project. + description: | + Returned when the model-generated transcription of audio output is done + streaming. Also emitted when a Response is interrupted, incomplete, or + cancelled. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - project.group.deleted - description: Always `project.group.deleted`. + - response.output_audio_transcript.done + description: The event type, must be `response.output_audio_transcript.done`. x-stainless-const: true - deleted: - type: boolean - description: Whether the group membership in the project was removed. + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + transcript: + type: string + description: The final transcript of the audio. required: - - object - - deleted + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - transcript x-oaiMeta: - name: Project group deletion confirmation + name: response.output_audio_transcript.done + group: realtime example: | { - "object": "project.group.deleted", - "deleted": true + "event_id": "event_4748", + "type": "response.output_audio_transcript.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "transcript": "Hello, how can I assist you today?" } - ProjectGroupListResource: + RealtimeServerEventResponseContentPartAdded: type: object - description: Paginated list of groups that have access to a project. + description: > + Returned when a new content part is added to an assistant message item + during + + response generation. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list - description: Always `list`. + - response.content_part.added + description: The event type, must be `response.content_part.added`. x-stainless-const: true - data: - type: array - description: Project group memberships returned in the current page. - items: - $ref: '#/components/schemas/ProjectGroup' - has_more: - type: boolean - description: Whether additional project group memberships are available. - next: - description: >- - Cursor to fetch the next page of results, or `null` when there are - no more results. - anyOf: - - type: string - - type: 'null' + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item to which the content part was added. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + part: + type: object + description: The content part that was added. + properties: + type: + type: string + enum: + - audio + - text + description: The content type ("text", "audio"). + text: + type: string + description: The text content (if type is "text"). + audio: + type: string + description: Base64-encoded audio data (if type is "audio"). + transcript: + type: string + description: The transcript of the audio (if type is "audio"). required: - - object - - data - - has_more - - next + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - part x-oaiMeta: - name: Project group list + name: response.content_part.added + group: realtime example: | { - "object": "list", - "data": [ - { - "object": "project.group", - "project_id": "proj_abc123", - "group_id": "group_01J1F8ABCDXYZ", - "group_name": "Support Team", - "created_at": 1711471533 - } - ], - "has_more": false, - "next": null + "event_id": "event_3738", + "type": "response.content_part.added", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "" + } } - ProjectHostedToolPermissions: + RealtimeServerEventResponseContentPartDone: type: object - description: Represents hosted tool permissions for a project. + description: > + Returned when a content part is done streaming in an assistant message + item. + + Also emitted when a Response is interrupted, incomplete, or cancelled. properties: - file_search: - $ref: '#/components/schemas/HostedToolPermission' - web_search: - $ref: '#/components/schemas/HostedToolPermission' - image_generation: - $ref: '#/components/schemas/HostedToolPermission' - mcp: - $ref: '#/components/schemas/HostedToolPermission' - code_interpreter: - $ref: '#/components/schemas/HostedToolPermission' + event_id: + type: string + description: The unique ID of the server event. + type: + type: string + enum: + - response.content_part.done + description: The event type, must be `response.content_part.done`. + x-stainless-const: true + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + part: + type: object + description: The content part that is done. + properties: + type: + type: string + enum: + - audio + - text + description: The content type ("text", "audio"). + text: + type: string + description: The text content (if type is "text"). + audio: + type: string + description: Base64-encoded audio data (if type is "audio"). + transcript: + type: string + description: The transcript of the audio (if type is "audio"). required: - - file_search - - web_search - - image_generation - - mcp - - code_interpreter + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - part x-oaiMeta: - name: The project hosted tool permissions object - example: | - { - "file_search": { - "enabled": true - }, - "web_search": { - "enabled": true - }, - "image_generation": { - "enabled": true - }, - "mcp": { - "enabled": true - }, - "code_interpreter": { - "enabled": true + name: response.content_part.done + group: realtime + example: | + { + "event_id": "event_3940", + "type": "response.content_part.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "Sure, I can help with that." } } - ProjectHostedToolPermissionsUpdateRequest: - type: object - properties: - file_search: - anyOf: - - $ref: '#/components/schemas/HostedToolPermissionUpdate' - - type: 'null' - description: The file search permission update. - web_search: - anyOf: - - $ref: '#/components/schemas/HostedToolPermissionUpdate' - - type: 'null' - description: The web search permission update. - image_generation: - anyOf: - - $ref: '#/components/schemas/HostedToolPermissionUpdate' - - type: 'null' - description: The image generation permission update. - mcp: - anyOf: - - $ref: '#/components/schemas/HostedToolPermissionUpdate' - - type: 'null' - description: The MCP permission update. - code_interpreter: - anyOf: - - $ref: '#/components/schemas/HostedToolPermissionUpdate' - - type: 'null' - description: The code interpreter permission update. - ProjectListResponse: + RealtimeServerEventResponseCreated: type: object + description: > + Returned when a new Response is created. The first event of response + creation, + + where the response is in an initial state of `in_progress`. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list + - response.created + description: The event type, must be `response.created`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/Project' - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean + response: + $ref: '#/components/schemas/RealtimeResponse' required: - - object - - data - - has_more - ProjectModelPermissions: + - event_id + - type + - response + x-oaiMeta: + name: response.created + group: realtime + example: | + { + "type": "response.created", + "event_id": "event_C9G8pqbTEddBSIxbBN6Os", + "response": { + "object": "realtime.response", + "id": "resp_C9G8p7IH2WxLbkgPNouYL", + "status": "in_progress", + "status_details": null, + "output": [], + "conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN", + "output_modalities": [ + "audio" + ], + "max_output_tokens": "inf", + "audio": { + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin" + } + }, + "usage": null, + "metadata": null + }, + } + RealtimeServerEventResponseDone: type: object - description: Represents the model allowlist or denylist policy for a project. + description: > + Returned when a Response is done streaming. Always emitted, no matter + the + + final state. The Response object included in the `response.done` event + will + + include all output Items in the Response but will omit the raw audio + data. + + + Clients should check the `status` field of the Response to determine if + it was successful + + (`completed`) or if there was another outcome: `cancelled`, `failed`, or + `incomplete`. + + + A response will contain all output items that were generated during the + response, excluding + + any audio content. properties: - object: + event_id: type: string - enum: - - project.model_permissions - description: The object type, which is always `project.model_permissions`. - x-stainless-const: true - mode: + description: The unique ID of the server event. + type: type: string enum: - - allow_list - - deny_list - description: Whether the project uses an allowlist or a denylist. - model_ids: - type: array - items: - type: string - description: The model IDs included in the model permissions policy. + - response.done + description: The event type, must be `response.done`. + x-stainless-const: true + response: + $ref: '#/components/schemas/RealtimeResponse' required: - - object - - mode - - model_ids + - event_id + - type + - response x-oaiMeta: - name: The project model permissions object + name: response.done + group: realtime example: | { - "object": "project.model_permissions", - "mode": "allow_list", - "model_ids": [ - "gpt-4.1", - "o3" - ] + "type": "response.done", + "event_id": "event_CCXHxcMy86rrKhBLDdqCh", + "response": { + "object": "realtime.response", + "id": "resp_CCXHw0UJld10EzIUXQCNh", + "status": "completed", + "status_details": null, + "output": [ + { + "id": "item_CCXHwGjjDUfOXbiySlK7i", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_audio", + "transcript": "Loud and clear! I can hear you perfectly. How can I help you today?" + } + ] + } + ], + "conversation_id": "conv_CCXHsurMKcaVxIZvaCI5m", + "output_modalities": [ + "audio" + ], + "max_output_tokens": "inf", + "audio": { + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy" + } + }, + "usage": { + "total_tokens": 253, + "input_tokens": 132, + "output_tokens": 121, + "input_token_details": { + "text_tokens": 119, + "audio_tokens": 13, + "image_tokens": 0, + "cached_tokens": 64, + "cached_tokens_details": { + "text_tokens": 64, + "audio_tokens": 0, + "image_tokens": 0 + } + }, + "output_token_details": { + "text_tokens": 30, + "audio_tokens": 91 + } + }, + "metadata": null + } } - ProjectModelPermissionsDeleteResponse: + RealtimeServerEventResponseFunctionCallArgumentsDelta: type: object - description: Confirmation payload returned after deleting project model permissions. + description: | + Returned when the model-generated function call arguments are updated. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - project.model_permissions.deleted - description: >- - The object type, which is always - `project.model_permissions.deleted`. + - response.function_call_arguments.delta + description: | + The event type, must be `response.function_call_arguments.delta`. x-stainless-const: true - deleted: - type: boolean - description: Whether the project model permissions were deleted. + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the function call item. + output_index: + type: integer + description: The index of the output item in the response. + call_id: + type: string + description: The ID of the function call. + delta: + type: string + description: The arguments delta as a JSON string. required: - - object - - deleted + - event_id + - type + - response_id + - item_id + - output_index + - call_id + - delta x-oaiMeta: - name: Project model permissions deletion confirmation + name: response.function_call_arguments.delta + group: realtime example: | { - "object": "project.model_permissions.deleted", - "deleted": true + "event_id": "event_5354", + "type": "response.function_call_arguments.delta", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "delta": "{\"location\": \"San\"" } - ProjectModelPermissionsUpdateRequest: + RealtimeServerEventResponseFunctionCallArgumentsDone: type: object + description: > + Returned when the model-generated function call arguments are done + streaming. + + Also emitted when a Response is interrupted, incomplete, or cancelled. properties: - mode: + event_id: type: string - enum: - - allow_list - - deny_list - description: The model permissions mode to apply. - model_ids: - type: array - items: - type: string - description: The model IDs included in this permissions policy. - required: - - mode - - model_ids - ProjectRateLimit: - type: object - description: Represents a project rate limit config. - properties: - object: + description: The unique ID of the server event. + type: type: string enum: - - project.rate_limit - description: The object type, which is always `project.rate_limit` + - response.function_call_arguments.done + description: | + The event type, must be `response.function_call_arguments.done`. x-stainless-const: true - id: + response_id: type: string - description: The identifier, which can be referenced in API endpoints. - model: + description: The ID of the response. + item_id: type: string - description: The model this rate limit applies to. - max_requests_per_1_minute: - type: integer - description: The maximum requests per minute. - max_tokens_per_1_minute: - type: integer - description: The maximum tokens per minute. - max_images_per_1_minute: - type: integer - description: The maximum images per minute. Only present for relevant models. - max_audio_megabytes_per_1_minute: - type: integer - description: >- - The maximum audio megabytes per minute. Only present for relevant - models. - max_requests_per_1_day: - type: integer - description: The maximum requests per day. Only present for relevant models. - batch_1_day_max_input_tokens: + description: The ID of the function call item. + output_index: type: integer - description: >- - The maximum batch input tokens per day. Only present for relevant - models. + description: The index of the output item in the response. + call_id: + type: string + description: The ID of the function call. + name: + type: string + description: The name of the function that was called. + arguments: + type: string + description: The final arguments as a JSON string. required: - - object - - id - - model - - max_requests_per_1_minute - - max_tokens_per_1_minute + - event_id + - type + - response_id + - item_id + - output_index + - call_id + - name + - arguments x-oaiMeta: - name: The project rate limit object + name: response.function_call_arguments.done + group: realtime example: | { - "object": "project.rate_limit", - "id": "rl_ada", - "model": "ada", - "max_requests_per_1_minute": 600, - "max_tokens_per_1_minute": 150000, - "max_images_per_1_minute": 10 + "event_id": "event_5556", + "type": "response.function_call_arguments.done", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\"}" } - ProjectRateLimitListResponse: + RealtimeServerEventResponseMCPCallArgumentsDelta: type: object + description: >- + Returned when MCP tool call arguments are updated during response + generation. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list + - response.mcp_call_arguments.delta + description: The event type, must be `response.mcp_call_arguments.delta`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/ProjectRateLimit' - first_id: - anyOf: - - type: string - - type: 'null' - last_id: + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the MCP tool call item. + output_index: + type: integer + description: The index of the output item in the response. + delta: + type: string + description: The JSON-encoded arguments delta. + obfuscation: anyOf: - type: string + description: If present, indicates the delta text was obfuscated. - type: 'null' - has_more: - type: boolean required: - - object - - data - - has_more - ProjectRateLimitUpdateRequest: - type: object - properties: - max_requests_per_1_minute: - type: integer - description: The maximum requests per minute. - max_tokens_per_1_minute: - type: integer - description: The maximum tokens per minute. - max_images_per_1_minute: - type: integer - description: The maximum images per minute. Only relevant for certain models. - max_audio_megabytes_per_1_minute: - type: integer - description: >- - The maximum audio megabytes per minute. Only relevant for certain - models. - max_requests_per_1_day: - type: integer - description: The maximum requests per day. Only relevant for certain models. - batch_1_day_max_input_tokens: - type: integer - description: >- - The maximum batch input tokens per day. Only relevant for certain - models. - ProjectServiceAccount: + - event_id + - type + - response_id + - item_id + - output_index + - delta + x-oaiMeta: + name: response.mcp_call_arguments.delta + group: realtime + example: | + { + "event_id": "event_6201", + "type": "response.mcp_call_arguments.delta", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "delta": "{\"partial\":true}" + } + RealtimeServerEventResponseMCPCallArgumentsDone: type: object - description: Represents an individual service account in a project. + description: >- + Returned when MCP tool call arguments are finalized during response + generation. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - organization.project.service_account - description: >- - The object type, which is always - `organization.project.service_account` + - response.mcp_call_arguments.done + description: The event type, must be `response.mcp_call_arguments.done`. x-stainless-const: true - id: - type: string - description: The identifier, which can be referenced in API endpoints - name: + response_id: type: string - description: The name of the service account - role: + description: The ID of the response. + item_id: type: string - enum: - - owner - - member - description: '`owner` or `member`' - created_at: + description: The ID of the MCP tool call item. + output_index: type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) of when the service account was - created + description: The index of the output item in the response. + arguments: + type: string + description: The final JSON-encoded arguments string. required: - - object - - id - - name - - role - - created_at + - event_id + - type + - response_id + - item_id + - output_index + - arguments x-oaiMeta: - name: The project service account object + name: response.mcp_call_arguments.done + group: realtime example: | { - "object": "organization.project.service_account", - "id": "svc_acct_abc", - "name": "Service Account", - "role": "owner", - "created_at": 1711471533 + "event_id": "event_6202", + "type": "response.mcp_call_arguments.done", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "arguments": "{\"q\":\"docs\"}" } - ProjectServiceAccountApiKey: + RealtimeServerEventResponseMCPCallCompleted: type: object + description: Returned when an MCP tool call has completed successfully. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - organization.project.service_account.api_key - description: >- - The object type, which is always - `organization.project.service_account.api_key` + - response.mcp_call.completed + description: The event type, must be `response.mcp_call.completed`. x-stainless-const: true - value: - type: string - name: - type: string - created_at: + output_index: type: integer - format: unixtime - id: + description: The index of the output item in the response. + item_id: type: string + description: The ID of the MCP tool call item. required: - - object - - value - - name - - created_at - - id - ProjectServiceAccountCreateRequest: + - event_id + - type + - output_index + - item_id + x-oaiMeta: + name: response.mcp_call.completed + group: realtime + example: | + { + "event_id": "event_6302", + "type": "response.mcp_call.completed", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeServerEventResponseMCPCallFailed: type: object + description: Returned when an MCP tool call has failed. properties: - name: + event_id: type: string - description: The name of the service account being created. - required: - - name - ProjectServiceAccountCreateResponse: - type: object - properties: - object: + description: The unique ID of the server event. + type: type: string enum: - - organization.project.service_account + - response.mcp_call.failed + description: The event type, must be `response.mcp_call.failed`. x-stainless-const: true - id: + output_index: + type: integer + description: The index of the output item in the response. + item_id: type: string - name: + description: The ID of the MCP tool call item. + required: + - event_id + - type + - output_index + - item_id + x-oaiMeta: + name: response.mcp_call.failed + group: realtime + example: | + { + "event_id": "event_6303", + "type": "response.mcp_call.failed", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeServerEventResponseMCPCallInProgress: + type: object + description: Returned when an MCP tool call has started and is in progress. + properties: + event_id: type: string - role: + description: The unique ID of the server event. + type: type: string enum: - - member - description: Service accounts can only have one role of type `member` + - response.mcp_call.in_progress + description: The event type, must be `response.mcp_call.in_progress`. x-stainless-const: true - created_at: + output_index: type: integer - format: unixtime - api_key: - anyOf: - - $ref: '#/components/schemas/ProjectServiceAccountApiKey' - - type: 'null' + description: The index of the output item in the response. + item_id: + type: string + description: The ID of the MCP tool call item. required: - - object - - id - - name - - role - - created_at - - api_key - ProjectServiceAccountDeleteResponse: + - event_id + - type + - output_index + - item_id + x-oaiMeta: + name: response.mcp_call.in_progress + group: realtime + example: | + { + "event_id": "event_6301", + "type": "response.mcp_call.in_progress", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeServerEventResponseOutputItemAdded: type: object + description: Returned when a new Item is created during Response generation. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - organization.project.service_account.deleted + - response.output_item.added + description: The event type, must be `response.output_item.added`. x-stainless-const: true - id: + response_id: type: string - deleted: - type: boolean + description: The ID of the Response to which the item belongs. + output_index: + type: integer + description: The index of the output item in the Response. + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - - object - - id - - deleted - ProjectServiceAccountListResponse: + - event_id + - type + - response_id + - output_index + - item + x-oaiMeta: + name: response.output_item.added + group: realtime + example: | + { + "event_id": "event_3334", + "type": "response.output_item.added", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "in_progress", + "role": "assistant", + "content": [] + } + } + RealtimeServerEventResponseOutputItemDone: type: object + description: > + Returned when an Item is done streaming. Also emitted when a Response + is + + interrupted, incomplete, or cancelled. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list + - response.output_item.done + description: The event type, must be `response.output_item.done`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/ProjectServiceAccount' - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean + response_id: + type: string + description: The ID of the Response to which the item belongs. + output_index: + type: integer + description: The index of the output item in the Response. + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - - object - - data - - has_more - ProjectSpendAlert: + - event_id + - type + - response_id + - output_index + - item + x-oaiMeta: + name: response.output_item.done + group: realtime + example: | + { + "event_id": "event_3536", + "type": "response.output_item.done", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, I can help with that." + } + ] + } + } + RealtimeServerEventResponseTextDelta: type: object - description: Represents a spend alert configured at the project level. + description: >- + Returned when the text value of an "output_text" content part is + updated. properties: - id: + event_id: type: string - description: The identifier, which can be referenced in API endpoints. - object: + description: The unique ID of the server event. + type: type: string enum: - - project.spend_alert - description: The object type, which is always `project.spend_alert`. + - response.output_text.delta + description: The event type, must be `response.output_text.delta`. x-stainless-const: true - threshold_amount: - type: integer - description: The alert threshold amount, in cents. - currency: + response_id: type: string - enum: - - USD - description: The currency for the threshold amount. - interval: + description: The ID of the response. + item_id: type: string - enum: - - month - description: The time interval for evaluating spend against the threshold. - notification_channel: - $ref: '#/components/schemas/SpendAlertNotificationChannel' + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: The text delta. required: - - id - - object - - threshold_amount - - currency - - interval - - notification_channel + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - delta x-oaiMeta: - name: The project spend alert object + name: response.output_text.delta + group: realtime example: | { - "id": "alert_abc123", - "object": "project.spend_alert", - "threshold_amount": 100000, - "currency": "USD", - "interval": "month", - "notification_channel": { - "type": "email", - "recipients": ["finance@example.com"], - "subject_prefix": "OpenAI spend alert" - } + "event_id": "event_4142", + "type": "response.output_text.delta", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "delta": "Sure, I can h" } - ProjectSpendAlertDeletedResource: + RealtimeServerEventResponseTextDone: type: object - description: Confirmation payload returned after deleting a project spend alert. + description: > + Returned when the text value of an "output_text" content part is done + streaming. Also + + emitted when a Response is interrupted, incomplete, or cancelled. properties: - id: + event_id: type: string - description: The deleted spend alert ID. - object: + description: The unique ID of the server event. + type: type: string enum: - - project.spend_alert.deleted - description: Always `project.spend_alert.deleted`. + - response.output_text.done + description: The event type, must be `response.output_text.done`. x-stainless-const: true - deleted: - type: boolean - description: Whether the spend alert was deleted. + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + text: + type: string + description: The final text content. required: - - id - - object - - deleted - ProjectSpendAlertListResource: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - text + x-oaiMeta: + name: response.output_text.done + group: realtime + example: | + { + "event_id": "event_4344", + "type": "response.output_text.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "text": "Sure, I can help with that." + } + RealtimeServerEventSessionCreated: type: object - description: Paginated list of project spend alerts. + description: > + Returned when a Session is created. Emitted automatically when a new + + connection is established as the first server event. This event will + contain + + the default Session configuration. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - list - description: Always `list`. + - session.created + description: The event type, must be `session.created`. x-stainless-const: true - data: - type: array - description: Spend alerts returned in the current page. - items: - $ref: '#/components/schemas/ProjectSpendAlert' - first_id: - anyOf: - - type: string - - type: 'null' - description: The ID of the first spend alert in this page. - last_id: - anyOf: - - type: string - - type: 'null' - description: The ID of the last spend alert in this page. - has_more: - type: boolean - description: Whether more spend alerts are available when paginating. + session: + description: The session configuration. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' + - $ref: >- + #/components/schemas/RealtimeTranscriptionSessionCreateResponseGA required: - - object - - data - - first_id - - last_id - - has_more - ProjectUpdateRequest: - type: object - properties: - name: - anyOf: - - type: string - - type: 'null' - description: The updated name of the project, this name appears in reports. - external_key_id: - anyOf: - - type: string - - type: 'null' - description: External key ID to associate with the project. - geography: - anyOf: - - type: string - - type: 'null' - description: Geography for the project. - ProjectUser: + - event_id + - type + - session + x-oaiMeta: + name: session.created + group: realtime + example: | + { + "type": "session.created", + "event_id": "event_C9G5RJeJ2gF77mV7f2B1j", + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9G5QPteg4UIbotdKLoYQ", + "model": "gpt-realtime-2025-08-28", + "output_modalities": [ + "audio" + ], + "instructions": "Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.", + "tools": [], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "prompt": null, + "expires_at": 1756324625, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin", + "speed": 1 + } + }, + "include": null + }, + } + RealtimeServerEventSessionUpdated: type: object - description: Represents an individual user in a project. + description: | + Returned when a session is updated with a `session.update` event, unless + there is an error. properties: - object: + event_id: + type: string + description: The unique ID of the server event. + type: type: string enum: - - organization.project.user - description: The object type, which is always `organization.project.user` + - session.updated + description: The event type, must be `session.updated`. x-stainless-const: true - id: - type: string - description: The identifier, which can be referenced in API endpoints - name: - anyOf: - - type: string - - type: 'null' - description: The name of the user - email: - anyOf: - - type: string - - type: 'null' - description: The email address of the user - role: - type: string - description: '`owner` or `member`' - added_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the project was added. + session: + description: The session configuration. + oneOf: + - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' + - $ref: >- + #/components/schemas/RealtimeTranscriptionSessionCreateResponseGA required: - - object - - id - - role - - added_at + - event_id + - type + - session x-oaiMeta: - name: The project user object + name: session.updated + group: realtime example: | { - "object": "organization.project.user", - "id": "user_abc", - "name": "First Last", - "email": "user@example.com", - "role": "owner", - "added_at": 1711471533 + "type": "session.updated", + "event_id": "event_C9G8mqI3IucaojlVKE8Cs", + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9G8l3zp50uFv4qgxfJ8o", + "model": "gpt-realtime-2025-08-28", + "output_modalities": [ + "audio" + ], + "instructions": "Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.", + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "\nCall this function when a user asks for a color palette.\n", + "parameters": { + "type": "object", + "strict": true, + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "prompt": null, + "expires_at": 1756324832, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin", + "speed": 1 + } + }, + "include": null + }, } - ProjectUserCreateRequest: + RealtimeServerEventTranscriptionSessionUpdated: type: object + description: > + Returned when a transcription session is updated with a + `transcription_session.update` event, unless + + there is an error. properties: - user_id: - anyOf: - - type: string - - type: 'null' - description: The ID of the user. - email: - anyOf: - - type: string - - type: 'null' - description: Email of the user to add. - role: + event_id: type: string - description: '`owner` or `member`' - required: - - role - ProjectUserDeleteResponse: - type: object - properties: - object: + description: The unique ID of the server event. + type: type: string enum: - - organization.project.user.deleted + - transcription_session.updated + description: The event type, must be `transcription_session.updated`. x-stainless-const: true - id: - type: string - deleted: - type: boolean - required: - - object - - id - - deleted - ProjectUserListResponse: - type: object - properties: - object: - type: string - data: - type: array - items: - $ref: '#/components/schemas/ProjectUser' - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean - required: - - object - - data - - has_more - ProjectUserUpdateRequest: - type: object - properties: - role: - anyOf: - - type: string - - type: 'null' - description: '`owner` or `member`' - Prompt: - anyOf: - - type: object - description: | - Reference to a prompt template and its variables. - [Learn more](/docs/guides/text?api-mode=responses#reusable-prompts). - required: - - id - properties: - id: - type: string - description: The unique identifier of the prompt template to use. - version: - anyOf: - - type: string - description: Optional version of the prompt template. - - type: 'null' - variables: - $ref: '#/components/schemas/ResponsePromptVariables' - - type: 'null' - PublicAssignOrganizationGroupRoleBody: - type: object - description: Request payload for assigning a role to a group or user. - properties: - role_id: - type: string - description: Identifier of the role to assign. + session: + $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' required: - - role_id + - event_id + - type + - session x-oaiMeta: + name: transcription_session.updated + group: realtime example: | { - "role_id": "role_01J1F8ROLE01" + "event_id": "event_5678", + "type": "transcription_session.updated", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + // "interrupt_response": false -- this will NOT be returned + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.avg_logprob", + ], + } } - PublicCreateOrganizationRoleBody: + RealtimeSession: type: object - description: Request payload for creating a custom role. + description: Realtime session object for the beta interface. properties: - role_name: + id: type: string - description: Unique name for the role. - permissions: - type: array - description: Permissions to grant to the role. + description: > + Unique identifier for the session that looks like + `sess_1234567890abcdef`. + object: + type: string + enum: + - realtime.session + description: The object type. Always `realtime.session`. + modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. items: type: string - description: - description: Optional description of the role. + default: + - text + - audio + enum: + - text + - audio + model: + description: | + The Realtime model used for this session. anyOf: - type: string - - type: 'null' - required: - - role_name - - permissions - x-oaiMeta: - example: | - { - "role_name": "API Group Manager", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "description": "Allows managing organization groups" - } - PublicRoleListResource: - type: object - description: Paginated list of roles available on an organization or project. - properties: - object: + - type: string + enum: + - gpt-realtime + - gpt-realtime-1.5 + - gpt-realtime-2025-08-28 + - gpt-4o-realtime-preview + - gpt-4o-realtime-preview-2024-10-01 + - gpt-4o-realtime-preview-2024-12-17 + - gpt-4o-realtime-preview-2025-06-03 + - gpt-4o-mini-realtime-preview + - gpt-4o-mini-realtime-preview-2024-12-17 + - gpt-realtime-mini + - gpt-realtime-mini-2025-10-06 + - gpt-realtime-mini-2025-12-15 + - gpt-audio-1.5 + - gpt-audio-mini + - gpt-audio-mini-2025-10-06 + - gpt-audio-mini-2025-12-15 + instructions: + type: string + description: > + 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. + + + + 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. + voice: + $ref: '#/components/schemas/VoiceIdsShared' + description: > + The voice the model uses to respond. Voice cannot be changed during + the + + session once the model has responded with audio at least once. + Current + + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + + `shimmer`, and `verse`. + input_audio_format: type: string + default: pcm16 enum: - - list - description: Always `list`. - x-stainless-const: true - data: + - pcm16 + - g711_ulaw + - g711_alaw + description: > + The format of input audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + + For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, + + single channel (mono), and little-endian byte order. + output_audio_format: + type: string + default: pcm16 + enum: + - pcm16 + - g711_ulaw + - g711_alaw + description: > + The format of output audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + + For `pcm16`, output audio is sampled at a rate of 24kHz. + input_audio_transcription: + anyOf: + - allOf: + - $ref: '#/components/schemas/AudioTranscriptionResponse' + description: > + 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://platform.openai.com/docs/api-reference/audio/createTranscription) + 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. + - type: 'null' + turn_detection: + $ref: '#/components/schemas/RealtimeTurnDetection' + input_audio_noise_reduction: + type: object + default: null + description: > + Configuration for input audio noise reduction. This can be set to + `null` to turn off. + + Noise reduction filters audio added to the input audio buffer before + it is sent to VAD and the model. + + Filtering the audio can improve VAD and turn detection accuracy + (reducing false positives) and model performance by improving + perception of the input audio. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + speed: + type: number + default: 1 + maximum: 1.5 + minimum: 0.25 + description: > + The speed of the model's spoken response. 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. + tracing: + anyOf: + - title: Tracing Configuration + description: > + Configuration options for tracing. Set to null to disable + tracing. Once + + tracing is enabled for a session, the configuration cannot be + modified. + + + `auto` will create a trace for the session with default values + for the + + workflow name, group id, and metadata. + oneOf: + - type: string + default: auto + description: | + Default tracing mode for the session. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: > + The name of the workflow to attach to this trace. This + is used to + + name the trace in the traces dashboard. + group_id: + type: string + description: > + The group id to attach to this trace to enable filtering + and + + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + - type: 'null' + tools: type: array - description: Roles returned in the current page. + description: Tools (functions) available to the model. items: - $ref: '#/components/schemas/Role' - has_more: - type: boolean - description: Whether more roles are available when paginating. - next: - description: >- - Cursor to fetch the next page of results, or `null` when there are - no additional roles. - anyOf: + $ref: '#/components/schemas/RealtimeFunctionTool' + tool_choice: + type: string + default: auto + description: > + How the model chooses tools. Options are `auto`, `none`, `required`, + or + + specify a function. + temperature: + type: number + default: 0.8 + description: > + Sampling temperature for the model, limited to [0.6, 1.2]. For audio + models a temperature of 0.8 is highly recommended for best + performance. + max_response_output_tokens: + oneOf: + - type: integer - type: string + enum: + - inf + x-stainless-const: true + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + prompt: + anyOf: + - $ref: '#/components/schemas/Prompt' - type: 'null' - required: - - object - - data - - has_more - - next - x-oaiMeta: - name: Role list - example: | - { - "object": "list", - "data": [ - { - "object": "role", - "id": "role_01J1F8ROLE01", - "name": "API Group Manager", - "description": "Allows managing organization groups", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "resource_type": "api.organization", - "predefined_role": false - } - ], - "has_more": false, - "next": null - } - PublicUpdateOrganizationRoleBody: - type: object - description: Request payload for updating an existing role. - properties: - permissions: - description: Updated set of permissions for the role. + include: anyOf: - type: array items: type: string + enum: + - item.input_audio_transcription.logprobs + description: > + Additional fields to include in server outputs. + + - `item.input_audio_transcription.logprobs`: Include logprobs + for input audio transcription. - type: 'null' - description: - description: New description for the role. - anyOf: - - type: string - - type: 'null' - role_name: - description: New name for the role. - anyOf: - - type: string - - type: 'null' - x-oaiMeta: - example: | - { - "role_name": "API Group Manager", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "description": "Allows managing organization groups" - } - RealtimeAudioFormats: - anyOf: - - type: object - title: PCM audio format - description: The PCM audio format. Only a 24kHz sample rate is supported. + RealtimeSessionCreateRequest: + type: object + description: | + A new Realtime session configuration, with an ephemeral key. Default TTL + for keys is one minute. + properties: + client_secret: + type: object + description: Ephemeral key returned by the API. properties: - type: + value: type: string - description: The audio format. Always `audio/pcm`. - enum: - - audio/pcm - rate: + description: > + Ephemeral key usable in client environments to authenticate + connections + + to the Realtime API. Use this in client-side environments rather + than + + a standard API token, which should only be used server-side. + expires_at: type: integer - description: The sample rate of the audio. Always `24000`. - enum: - - 24000 - - type: object - title: PCMU audio format - description: The G.711 μ-law format. + format: unixtime + description: > + Timestamp for when the token expires. Currently, all tokens + expire + + after one minute. + required: + - value + - expires_at + modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + items: + type: string + enum: + - text + - audio + instructions: + type: string + description: > + 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. + + 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. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + description: > + The voice the model uses to respond. Supported built-in voices are + + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, + `verse`, + + `marin`, and `cedar`. You may also provide a custom voice object + with an + + `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed + during + + the session once the model has responded with audio at least once. + input_audio_format: + type: string + description: > + The format of input audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + output_audio_format: + type: string + description: > + The format of output audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + input_audio_transcription: + type: object + description: > + 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 and should be treated as rough guidance + + rather than the representation understood by the model. properties: - type: + model: type: string - description: The audio format. Always `audio/pcmu`. + description: | + The model to use for transcription. + speed: + type: number + default: 1 + maximum: 1.5 + minimum: 0.25 + description: > + The speed of the model's spoken response. 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. + tracing: + title: Tracing Configuration + description: > + Configuration options for tracing. Set to null to disable tracing. + Once + + tracing is enabled for a session, the configuration cannot be + modified. + + + `auto` will create a trace for the session with default values for + the + + workflow name, group id, and metadata. + oneOf: + - type: string + default: auto + description: | + Default tracing mode for the session. enum: - - audio/pcmu - - type: object - title: PCMA audio format - description: The G.711 A-law format. + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: > + The name of the workflow to attach to this trace. This is + used to + + name the trace in the traces dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + turn_detection: + type: object + description: > + Configuration for turn detection. Can be set to `null` to turn off. + 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. properties: type: type: string - description: The audio format. Always `audio/pcma`. - enum: - - audio/pcma - RealtimeBetaClientEventConversationItemCreate: - type: object - description: > - Add a new Item to the Conversation's context, including messages, - function + description: > + Type of turn detection, only `server_vad` is currently + supported. + threshold: + type: number + description: > + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. + A - calls, and function call responses. This event can be used both to - populate a + higher threshold will require louder audio to activate the + model, and - "history" of the conversation and to add new items mid-stream, but has - the + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Duration of silence to detect speech stop (in milliseconds). + Defaults - current limitation that it cannot populate assistant audio messages. + to 500ms. With shorter values the model will respond more + quickly, + but may jump in on short pauses from the user. + tools: + type: array + description: Tools (functions) available to the model. + items: + type: object + properties: + type: + type: string + enum: + - function + description: The type of the tool, i.e. `function`. + x-stainless-const: true + name: + type: string + description: The name of the function. + description: + type: string + description: > + The description of the function, including guidance on when + and how - If successful, the server will respond with a - `conversation.item.created` + to call it, and guidance about what to tell the user when + calling - event, otherwise an `error` event will be sent. - properties: - event_id: + (if anything). + parameters: + type: object + description: Parameters of the function in JSON Schema. + tool_choice: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. + description: > + How the model chooses tools. Options are `auto`, `none`, `required`, + or + + specify a function. + temperature: + type: number + description: > + Sampling temperature for the model, limited to [0.6, 1.2]. Defaults + to 0.8. + max_response_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + prompt: + $ref: '#/components/schemas/Prompt' + required: + - client_secret + x-oaiMeta: + name: The session object + group: realtime + example: | + { + "id": "sess_001", + "object": "realtime.session", + "model": "gpt-realtime-2025-08-25", + "modalities": ["audio", "text"], + "instructions": "You are a friendly assistant.", + "voice": "alloy", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": { + "model": "whisper-1" + }, + "turn_detection": null, + "tools": [], + "tool_choice": "none", + "temperature": 0.7, + "speed": 1.1, + "tracing": "auto", + "max_response_output_tokens": 200, + "truncation": "auto", + "prompt": null, + "client_secret": { + "value": "ek_abc123", + "expires_at": 1234567890 + } + } + RealtimeSessionCreateRequestGA: + type: object + title: Realtime session configuration + description: Realtime session object configuration. + properties: type: type: string + description: > + The type of session to create. Always `realtime` for the Realtime + API. enum: - - conversation.item.create - description: The event type, must be `conversation.item.create`. + - realtime x-stainless-const: true - previous_item_id: + output_modalities: + type: array + description: > + The set of modalities the model can respond with. It defaults to + `["audio"]`, indicating + + that the model will respond with audio plus a transcript. `["text"]` + can be used to make + + the model respond with text only. It is not possible to request both + `text` and `audio` at the same time. + default: + - audio + items: + type: string + enum: + - text + - audio + model: + anyOf: + - type: string + - type: string + enum: + - gpt-realtime + - gpt-realtime-1.5 + - gpt-realtime-2 + - gpt-realtime-2.1 + - gpt-realtime-2.1-mini + - gpt-realtime-2025-08-28 + - gpt-4o-realtime-preview + - gpt-4o-realtime-preview-2024-10-01 + - gpt-4o-realtime-preview-2024-12-17 + - gpt-4o-realtime-preview-2025-06-03 + - gpt-4o-mini-realtime-preview + - gpt-4o-mini-realtime-preview-2024-12-17 + - gpt-realtime-mini + - gpt-realtime-mini-2025-10-06 + - gpt-realtime-mini-2025-12-15 + - gpt-audio-1.5 + - gpt-audio-mini + - gpt-audio-mini-2025-10-06 + - gpt-audio-mini-2025-12-15 + description: | + The Realtime model used for this session. + instructions: type: string description: > - The ID of the preceding item after which the new item will be - inserted. + 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. + + + 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. + audio: + type: object + description: | + Configuration for input and output audio. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the input audio. + transcription: + description: > + 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](/docs/api-reference/audio/createTranscription) 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. + $ref: '#/components/schemas/AudioTranscription' + noise_reduction: + type: object + default: null + description: > + Configuration for input audio noise reduction. This can be + set to `null` to turn off. - If not set, the new item will be appended to the end of the - conversation. + Noise reduction filters audio added to the input audio + buffer before it is sent to VAD and the model. - If set to `root`, the new item will be added to the beginning of the - conversation. + Filtering the audio can improve VAD and turn detection + accuracy (reducing false positives) and model performance by + improving perception of the input audio. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + turn_detection: + $ref: '#/components/schemas/RealtimeTurnDetection' + output: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the output audio. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + default: alloy + description: > + The voice the model uses to respond. Supported built-in + voices are - If set to an existing ID, it allows an item to be inserted - mid-conversation. If the + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, `verse`, - ID cannot be found, an error will be returned and the item will not - be added. - item: - $ref: '#/components/schemas/RealtimeConversationItem' - required: - - type - - item - x-oaiMeta: - name: conversation.item.create - group: realtime - example: | - { - "type": "conversation.item.create", - "item": { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "hi" - } - ] - }, - "event_id": "b904fba0-0ec4-40af-8bbb-f908a9b26793", - } - RealtimeBetaClientEventConversationItemDelete: - type: object - description: > - Send this event when you want to remove any item from the conversation + `marin`, and `cedar`. You may also provide a custom voice + object with - history. The server will respond with a `conversation.item.deleted` - event, + an `id`, for example `{ "id": "voice_1234" }`. Voice cannot + be changed - unless the item does not exist in the conversation history, in which - case the + during the session once the model has responded with audio + at least once. - server will respond with an error. - properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. - type: - type: string - enum: - - conversation.item.delete - description: The event type, must be `conversation.item.delete`. - x-stainless-const: true - item_id: - type: string - description: The ID of the item to delete. - required: - - type - - item_id - x-oaiMeta: - name: conversation.item.delete - group: realtime - example: | - { - "event_id": "event_901", - "type": "conversation.item.delete", - "item_id": "msg_003" - } - RealtimeBetaClientEventConversationItemRetrieve: - type: object - description: > - Send 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. + We recommend `marin` and `cedar` for best quality. + speed: + type: number + default: 1 + maximum: 1.5 + minimum: 0.25 + description: > + The speed of the model's spoken response as a multiple of + the original speed. - The server will respond with a `conversation.item.retrieved` event, + 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. - unless the item does not exist in the conversation history, in which - case the - server will respond with an error. - properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. - type: - type: string - enum: - - conversation.item.retrieve - description: The event type, must be `conversation.item.retrieve`. - x-stainless-const: true - item_id: - type: string - description: The ID of the item to retrieve. - required: - - type - - item_id - x-oaiMeta: - name: conversation.item.retrieve - group: realtime - example: | - { - "event_id": "event_901", - "type": "conversation.item.retrieve", - "item_id": "msg_003" - } - RealtimeBetaClientEventConversationItemTruncate: - type: object - description: > - Send this event to truncate a previous assistant message’s audio. The - server + This parameter is a post-processing adjustment to the audio + after it is generated, it's - will produce audio faster than realtime, so this event is useful when - the user + also possible to prompt the model to speak faster or slower. + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: > + Additional fields to include in server outputs. - interrupts to truncate audio that has already been sent to the client - but not - yet played. This will synchronize the server's understanding of the - audio with + `item.input_audio_transcription.logprobs`: Include logprobs for + input audio transcription. + tracing: + title: Tracing Configuration + default: null + description: > + Realtime API can write session traces to the [Traces + Dashboard](https://platform.openai.com/logs?api=traces). Set to null + to disable tracing. Once - the client's playback. + tracing is enabled for a session, the configuration cannot be + modified. - Truncating audio will delete the server-side text transcript to ensure - there + `auto` will create a trace for the session with default values for + the - is not text in the context that hasn't been heard by the user. + workflow name, group id, and metadata. + nullable: true + oneOf: + - type: string + title: auto + default: auto + description: > + Enables tracing and sets default values for tracing + configuration options. Always `auto`. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: > + The name of the workflow to attach to this trace. This is + used to + name the trace in the Traces Dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the Traces Dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the Traces Dashboard. + tools: + type: array + description: Tools available to the model. + items: + oneOf: + - $ref: '#/components/schemas/RealtimeFunctionTool' + - $ref: '#/components/schemas/MCPTool' + tool_choice: + description: > + How the model chooses tools. Provide one of the string modes or + force a specific - If successful, the server will respond with a - `conversation.item.truncated` + function/MCP tool. + oneOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + default: auto + parallel_tool_calls: + type: boolean + description: > + Whether the model may call multiple tools in parallel. Only + supported by - event. + reasoning Realtime models such as `gpt-realtime-2`. + reasoning: + $ref: '#/components/schemas/RealtimeReasoning' + max_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + prompt: + $ref: '#/components/schemas/Prompt' + required: + - type + RealtimeSessionCreateResponse: + type: object + title: Realtime session configuration object + description: | + A Realtime session configuration object. properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. - type: + id: type: string - enum: - - conversation.item.truncate - description: The event type, must be `conversation.item.truncate`. - x-stainless-const: true - item_id: + description: > + Unique identifier for the session that looks like + `sess_1234567890abcdef`. + object: type: string + description: The object type. Always `realtime.session`. + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs description: > - The ID of the assistant message item to truncate. Only assistant - message + Additional fields to include in server outputs. - items can be truncated. - content_index: - type: integer - description: The index of the content part to truncate. Set this to 0. - audio_end_ms: - type: integer + - `item.input_audio_transcription.logprobs`: Include logprobs for + input audio transcription. + model: + type: string + description: The Realtime model used for this session. + output_modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + items: + type: string + enum: + - text + - audio + instructions: + type: string description: > - Inclusive duration up to which audio is truncated, in milliseconds. - If + The default system instructions (i.e. system message) prepended to + model - the audio_end_ms is greater than the actual audio duration, the - server + calls. This field allows the client to guide the model on desired - will respond with an error. - required: - - type - - item_id - - content_index - - audio_end_ms - x-oaiMeta: - name: conversation.item.truncate - group: realtime - example: | - { - "event_id": "event_678", - "type": "conversation.item.truncate", - "item_id": "msg_002", - "content_index": 0, - "audio_end_ms": 1500 - } - RealtimeBetaClientEventInputAudioBufferAppend: - type: object - description: > - Send this event to append audio bytes to the input audio buffer. The - audio + responses. The model can be instructed on response content and + format, - buffer is temporary storage you can write to and later commit. In Server - VAD + (e.g. "be extremely succinct", "act friendly", "here are examples of + good - mode, the audio buffer is used to detect speech and the server will - decide + responses") and on audio behavior (e.g. "talk quickly", "inject + emotion - when to commit. When Server VAD is disabled, you must commit the audio - buffer + into your voice", "laugh frequently"). The instructions are not + guaranteed - manually. + to be followed by the model, but they provide guidance to the model + on the + desired behavior. - The client may choose how much audio to place in each event up to a - maximum - of 15 MiB, for example streaming smaller chunks from the client may - allow the + Note that the server sets default instructions which will be used if + this - VAD to be more responsive. Unlike made other client events, the server - will + field is not set and are visible in the `session.created` event at + the - not send a confirmation response to this event. - properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. - type: - type: string - enum: - - input_audio_buffer.append - description: The event type, must be `input_audio_buffer.append`. - x-stainless-const: true + start of the session. audio: - type: string + type: object + description: | + Configuration for input and output audio for the session. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + transcription: + description: | + Configuration for input audio transcription. + $ref: '#/components/schemas/AudioTranscriptionResponse' + noise_reduction: + type: object + description: | + Configuration for input audio noise reduction. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + turn_detection: + type: object + description: | + Configuration for turn detection. + properties: + type: + type: string + description: > + Type of turn detection, only `server_vad` is currently + supported. + threshold: + type: number + prefix_padding_ms: + type: integer + silence_duration_ms: + type: integer + output: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + voice: + $ref: '#/components/schemas/VoiceIdsShared' + speed: + type: number + tracing: + title: Tracing Configuration description: > - Base64-encoded audio bytes. This must be in the format specified by - the + Configuration options for tracing. Set to null to disable tracing. + Once - `input_audio_format` field in the session configuration. - required: - - type - - audio - x-oaiMeta: - name: input_audio_buffer.append - group: realtime - example: | - { - "event_id": "event_456", - "type": "input_audio_buffer.append", - "audio": "Base64EncodedAudioData" - } - RealtimeBetaClientEventInputAudioBufferClear: - type: object - description: | - Send this event to clear the audio bytes in the buffer. The server will - respond with an `input_audio_buffer.cleared` event. - properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. - type: - type: string - enum: - - input_audio_buffer.clear - description: The event type, must be `input_audio_buffer.clear`. - x-stainless-const: true - required: - - type - x-oaiMeta: - name: input_audio_buffer.clear - group: realtime - example: | - { - "event_id": "event_012", - "type": "input_audio_buffer.clear" - } - RealtimeBetaClientEventInputAudioBufferCommit: - type: object - description: > - Send this event to commit the user input audio buffer, which will create - a + tracing is enabled for a session, the configuration cannot be + modified. - 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 + `auto` will create a trace for the session with default values for + the + + workflow name, group id, and metadata. + oneOf: + - type: string + default: auto + description: | + Default tracing mode for the session. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: > + The name of the workflow to attach to this trace. This is + used to - not need to send this event, the server will commit the audio buffer + name the trace in the traces dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + turn_detection: + type: object + description: > + Configuration for turn detection. Can be set to `null` to turn off. + Server - automatically. + 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. + properties: + type: + type: string + description: > + Type of turn detection, only `server_vad` is currently + supported. + threshold: + type: number + description: > + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. + A - Committing the input audio buffer will trigger input audio - transcription + higher threshold will require louder audio to activate the + model, and - (if enabled in session configuration), but it will not create a - response + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Duration of silence to detect speech stop (in milliseconds). + Defaults - from the model. The server will respond with an - `input_audio_buffer.committed` + to 500ms. With shorter values the model will respond more + quickly, - event. - properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. - type: + but may jump in on short pauses from the user. + tools: + type: array + description: Tools (functions) available to the model. + items: + $ref: '#/components/schemas/RealtimeFunctionTool' + tool_choice: type: string - enum: - - input_audio_buffer.commit - description: The event type, must be `input_audio_buffer.commit`. - x-stainless-const: true - required: - - type + description: > + How the model chooses tools. Options are `auto`, `none`, `required`, + or + + specify a function. + max_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. x-oaiMeta: - name: input_audio_buffer.commit + name: The session object group: realtime example: | { - "event_id": "event_789", - "type": "input_audio_buffer.commit" + "id": "sess_001", + "object": "realtime.session", + "expires_at": 1742188264, + "model": "gpt-realtime", + "output_modalities": ["audio"], + "instructions": "You are a friendly assistant.", + "tools": [], + "tool_choice": "none", + "max_output_tokens": "inf", + "tracing": "auto", + "truncation": "auto", + "prompt": null, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": { "model": "whisper-1" }, + "noise_reduction": null, + "turn_detection": null + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy", + "speed": 1.0 + } + } } - RealtimeBetaClientEventOutputAudioBufferClear: + RealtimeSessionCreateResponseGA: type: object - description: > - **WebRTC/SIP Only:** Emit to cut off the current audio response. This - will trigger the server to - - stop generating audio and emit a `output_audio_buffer.cleared` event. - This - - event should be preceded by a `response.cancel` client event to stop the - - generation of the current response. - - [Learn - more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + title: Realtime session configuration object + description: | + A Realtime session configuration object. properties: - event_id: - type: string - description: The unique ID of the client event used for error handling. type: type: string + description: > + The type of session to create. Always `realtime` for the Realtime + API. enum: - - output_audio_buffer.clear - description: The event type, must be `output_audio_buffer.clear`. + - realtime x-stainless-const: true - required: - - type - x-oaiMeta: - name: output_audio_buffer.clear - group: realtime - example: | - { - "event_id": "optional_client_event_id", - "type": "output_audio_buffer.clear" - } - RealtimeBetaClientEventResponseCancel: - type: object - description: > - Send this event to cancel an in-progress response. The server will - respond - - with a `response.done` event with a status of - `response.status=cancelled`. If - - there is no response to cancel, the server will respond with an error. - properties: - event_id: + id: type: string - description: Optional client-generated ID used to identify this event. - type: + description: > + Unique identifier for the session that looks like + `sess_1234567890abcdef`. + object: type: string + description: The object type. Always `realtime.session`. enum: - - response.cancel - description: The event type, must be `response.cancel`. + - realtime.session x-stainless-const: true - response_id: - type: string - description: | - A specific response ID to cancel - if not provided, will cancel an - in-progress response in the default conversation. - required: - - type - x-oaiMeta: - name: response.cancel - group: realtime - example: | - { - "event_id": "event_567", - "type": "response.cancel" - } - RealtimeBetaClientEventResponseCreate: - type: object - description: > - This event instructs the server to create a Response, which means - triggering + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + output_modalities: + type: array + description: > + The set of modalities the model can respond with. It defaults to + `["audio"]`, indicating - model inference. When in Server VAD mode, the server will create - Responses + that the model will respond with audio plus a transcript. `["text"]` + can be used to make - automatically. + the model respond with text only. It is not possible to request both + `text` and `audio` at the same time. + default: + - audio + items: + type: string + enum: + - text + - audio + model: + anyOf: + - type: string + - type: string + enum: + - gpt-realtime + - gpt-realtime-1.5 + - gpt-realtime-2 + - gpt-realtime-2.1 + - gpt-realtime-2.1-mini + - gpt-realtime-2025-08-28 + - gpt-4o-realtime-preview + - gpt-4o-realtime-preview-2024-10-01 + - gpt-4o-realtime-preview-2024-12-17 + - gpt-4o-realtime-preview-2025-06-03 + - gpt-4o-mini-realtime-preview + - gpt-4o-mini-realtime-preview-2024-12-17 + - gpt-realtime-mini + - gpt-realtime-mini-2025-10-06 + - gpt-realtime-mini-2025-12-15 + - gpt-audio-1.5 + - gpt-audio-mini + - gpt-audio-mini-2025-10-06 + - gpt-audio-mini-2025-12-15 + description: | + The Realtime model used for this session. + instructions: + type: string + description: > + 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. - A Response will include at least one Item, and may have two, in which - case + 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. + audio: + type: object + description: | + Configuration for input and output audio. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the input audio. + transcription: + description: > + 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](/docs/api-reference/audio/createTranscription) 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. + $ref: '#/components/schemas/AudioTranscriptionResponse' + noise_reduction: + type: object + default: null + description: > + Configuration for input audio noise reduction. This can be + set to `null` to turn off. - the second will be a function call. These Items will be appended to the + Noise reduction filters audio added to the input audio + buffer before it is sent to VAD and the model. - conversation history. + Filtering the audio can improve VAD and turn detection + accuracy (reducing false positives) and model performance by + improving perception of the input audio. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + turn_detection: + $ref: '#/components/schemas/RealtimeTurnDetection' + output: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the output audio. + voice: + $ref: '#/components/schemas/VoiceIdsShared' + default: alloy + description: > + The voice the model uses to respond. Voice cannot be changed + during the + session once the model has responded with audio at least + once. Current - The server will respond with a `response.created` event, events for - Items + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, + `sage`, - and content created, and finally a `response.done` event to indicate - the + `shimmer`, `verse`, `marin`, and `cedar`. We recommend + `marin` and `cedar` for - Response is complete. + best quality. + speed: + type: number + default: 1 + maximum: 1.5 + minimum: 0.25 + description: > + The speed of the model's spoken response as a multiple of + the original speed. + 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. - The `response.create` event can optionally include inference - configuration like - `instructions`, and `temperature`. These fields will override the - Session's + This parameter is a post-processing adjustment to the audio + after it is generated, it's - configuration for this Response only. + also possible to prompt the model to speak faster or slower. + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: > + Additional fields to include in server outputs. - Responses can be created out-of-band of the default Conversation, - meaning that they can + `item.input_audio_transcription.logprobs`: Include logprobs for + input audio transcription. + tracing: + anyOf: + - title: Tracing Configuration + default: null + description: > + Realtime API can write session traces to the [Traces + Dashboard](https://platform.openai.com/logs?api=traces). Set to + null to disable tracing. Once - have arbitrary input, and it's possible to disable writing the output to - the Conversation. + tracing is enabled for a session, the configuration cannot be + modified. - Only one Response can write to the default Conversation at a time, but - otherwise multiple - Responses can be created in parallel. + `auto` will create a trace for the session with default values + for the + workflow name, group id, and metadata. + oneOf: + - type: string + title: auto + default: auto + description: > + Enables tracing and sets default values for tracing + configuration options. Always `auto`. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: > + The name of the workflow to attach to this trace. This + is used to - Clients can set `conversation` to `none` to create a Response that does - not write to the default + name the trace in the Traces Dashboard. + group_id: + type: string + description: > + The group id to attach to this trace to enable filtering + and - Conversation. Arbitrary input can be provided with the `input` field, - which is an array accepting + grouping in the Traces Dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the Traces Dashboard. + - type: 'null' + tools: + type: array + description: Tools available to the model. + items: + oneOf: + - $ref: '#/components/schemas/RealtimeFunctionTool' + - $ref: '#/components/schemas/MCPTool' + tool_choice: + description: > + How the model chooses tools. Provide one of the string modes or + force a specific - raw Items and references to existing Items. - properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. - type: - type: string - enum: - - response.create - description: The event type, must be `response.create`. - x-stainless-const: true - response: - $ref: '#/components/schemas/RealtimeBetaResponseCreateParams' + function/MCP tool. + oneOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + default: auto + reasoning: + $ref: '#/components/schemas/RealtimeReasoning' + max_output_tokens: + oneOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + prompt: + $ref: '#/components/schemas/Prompt' required: - type + - id + - object x-oaiMeta: - name: response.create - group: realtime - example: > - // Trigger a response with the default Conversation and no special - parameters - - { - "type": "response.create", - } - - - // Trigger an out-of-band response that does not write to the default - Conversation - - { - "type": "response.create", - "response": { - "instructions": "Provide a concise answer.", - "tools": [], // clear any session tools - "conversation": "none", - "output_modalities": ["text"], - "input": [ - { - "type": "item_reference", - "id": "item_12345", - }, - { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Summarize the above message in one sentence." - } - ] - } - ], - } - } - RealtimeBetaClientEventSessionUpdate: + name: The session object + group: realtime + RealtimeTranscriptionSessionCreateRequest: type: object - description: > - Send this event to update the session’s default configuration. + title: Realtime transcription session configuration + description: Realtime transcription session object configuration. + properties: + turn_detection: + type: object + description: > + Configuration for turn detection. Can be set to `null` to turn off. + 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. + properties: + type: + type: string + description: > + Type of turn detection. Only `server_vad` is currently supported + for transcription sessions. + enum: + - server_vad + threshold: + type: number + description: > + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. + A - The client may send this event at any time to update any field, + higher threshold will require louder audio to activate the + model, and - except for `voice`. However, note that once a session has been + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Duration of silence to detect speech stop (in milliseconds). + Defaults - initialized with a particular `model`, it can’t be changed to + to 500ms. With shorter values the model will respond more + quickly, - another model using `session.update`. + but may jump in on short pauses from the user. + input_audio_noise_reduction: + type: object + default: null + description: > + Configuration for input audio noise reduction. This can be set to + `null` to turn off. + Noise reduction filters audio added to the input audio buffer before + it is sent to VAD and the model. - When the server receives a `session.update`, it will respond + Filtering the audio can improve VAD and turn detection accuracy + (reducing false positives) and model performance by improving + perception of the input audio. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + input_audio_format: + type: string + default: pcm16 + enum: + - pcm16 + - g711_ulaw + - g711_alaw + description: > + The format of input audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. - with a `session.updated` event showing the full, effective - configuration. + For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, - Only the fields that are present are updated. To clear a field like + single channel (mono), and little-endian byte order. + input_audio_transcription: + description: > + Configuration for input audio transcription. The client can + optionally set the language and prompt for transcription, these + offer additional guidance to the transcription service. + $ref: '#/components/schemas/AudioTranscription' + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: > + The set of items to include in the transcription. Current available + items are: - `instructions`, pass an empty string. - properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. - type: - type: string - enum: - - session.update - description: The event type, must be `session.update`. - x-stainless-const: true - session: - $ref: '#/components/schemas/RealtimeSessionCreateRequest' - required: - - type - - session - x-oaiMeta: - name: session.update - group: realtime - example: | - { - "type": "session.update", - "session": { - "tools": [ - { - "type": "function", - "name": "display_color_palette", - "description": "Call this function when a user asks for a color palette.", - "parameters": { - "type": "object", - "properties": { - "theme": { - "type": "string", - "description": "Description of the theme for the color scheme." - }, - "colors": { - "type": "array", - "description": "Array of five hex color codes based on the theme.", - "items": { - "type": "string", - "description": "Hex color code" - } - } - }, - "required": [ - "theme", - "colors" - ] - } - } - ], - "tool_choice": "auto" - } - } - RealtimeBetaClientEventTranscriptionSessionUpdate: + `item.input_audio_transcription.logprobs` + RealtimeTranscriptionSessionCreateRequestGA: type: object - description: | - Send this event to update a transcription session. + title: Realtime transcription session configuration + description: Realtime transcription session object configuration. properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. type: type: string + description: > + The type of session to create. Always `transcription` for + transcription sessions. enum: - - transcription_session.update - description: The event type, must be `transcription_session.update`. + - transcription x-stainless-const: true - session: - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequest' + audio: + type: object + description: | + Configuration for input and output audio. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + transcription: + description: > + 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](/docs/api-reference/audio/createTranscription) 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. + $ref: '#/components/schemas/AudioTranscription' + noise_reduction: + type: object + default: null + description: > + Configuration for input audio noise reduction. This can be + set to `null` to turn off. + + Noise reduction filters audio added to the input audio + buffer before it is sent to VAD and the model. + + Filtering the audio can improve VAD and turn detection + accuracy (reducing false positives) and model performance by + improving perception of the input audio. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + turn_detection: + $ref: '#/components/schemas/RealtimeTurnDetection' + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: > + Additional fields to include in server outputs. + + + `item.input_audio_transcription.logprobs`: Include logprobs for + input audio transcription. required: - type - - session - x-oaiMeta: - name: transcription_session.update - group: realtime - example: | - { - "type": "transcription_session.update", - "session": { - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "prompt": "", - "language": "" - }, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 500, - "create_response": true, - }, - "input_audio_noise_reduction": { - "type": "near_field" - }, - "include": [ - "item.input_audio_transcription.logprobs", - ] - } - } - RealtimeBetaResponse: + RealtimeTranscriptionSessionCreateResponse: type: object - description: The response resource. - properties: - id: - type: string - description: The unique ID of the response. - object: - type: string - enum: - - realtime.response - description: The object type, must be `realtime.response`. - x-stainless-const: true - status: - type: string - enum: - - completed - - cancelled - - failed - - incomplete - - in_progress - description: > - The final status of the response (`completed`, `cancelled`, - `failed`, or + description: | + A new Realtime transcription session configuration. - `incomplete`, `in_progress`). - status_details: + When a session is created on the server via REST API, the session object + also contains an ephemeral key. Default TTL for keys is 10 minutes. This + property is not present when a session is updated via the WebSocket API. + properties: + client_secret: type: object - description: Additional details about the status. + description: | + Ephemeral key returned by the API. Only present when the session is + created on the server via REST API. properties: - type: + value: type: string - enum: - - completed - - cancelled - - failed - - incomplete description: > - The type of error that caused the response to fail, - corresponding + Ephemeral key usable in client environments to authenticate + connections - with the `status` field (`completed`, `cancelled`, - `incomplete`, + to the Realtime API. Use this in client-side environments rather + than - `failed`). - reason: - type: string - enum: - - turn_detected - - client_cancelled - - max_output_tokens - - content_filter + a standard API token, which should only be used server-side. + expires_at: + type: integer + format: unixtime description: > - The reason the Response did not complete. For a `cancelled` - Response, - - one of `turn_detected` (the server VAD detected a new start of - speech) - - or `client_cancelled` (the client sent a cancel event). For an - - `incomplete` Response, one of `max_output_tokens` or - `content_filter` + Timestamp for when the token expires. Currently, all tokens + expire - (the server-side safety filter activated and cut off the - response). - error: - type: object - description: | - A description of the error that caused the response to fail, - populated when the `status` is `failed`. - properties: - type: - type: string - description: The type of error. - code: - type: string - description: Error code, if any. - output: - type: array - description: The list of output items generated by the response. + after one minute. + required: + - value + - expires_at + modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. items: - $ref: '#/components/schemas/RealtimeConversationItem' - metadata: - $ref: '#/components/schemas/Metadata' - usage: + type: string + enum: + - text + - audio + input_audio_format: + type: string + description: > + The format of input audio. Options are `pcm16`, `g711_ulaw`, or + `g711_alaw`. + input_audio_transcription: + description: | + Configuration of the transcription model. + $ref: '#/components/schemas/AudioTranscriptionResponse' + turn_detection: type: object description: > - Usage statistics for the Response, this will correspond to billing. - A - - Realtime API session will maintain a conversation context and append - new + Configuration for turn detection. Can be set to `null` to turn off. + Server - Items to the Conversation, thus output from previous turns (text - and + VAD means that the model will detect the start and end of speech + based on - audio tokens) will become the input for later turns. + audio volume and respond at the end of user speech. properties: - total_tokens: - type: integer + type: + type: string description: > - The total number of tokens in the Response including input and - output - - text and audio tokens. - input_tokens: - type: integer + Type of turn detection, only `server_vad` is currently + supported. + threshold: + type: number description: > - The number of input tokens used in the Response, including text - and + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. + A - audio tokens. - output_tokens: + higher threshold will require louder audio to activate the + model, and + + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: type: integer description: > - The number of output tokens sent in the Response, including text - and + Duration of silence to detect speech stop (in milliseconds). + Defaults - audio tokens. - input_token_details: - type: object - description: Details about the input tokens used in the Response. - properties: - cached_tokens: - type: integer - description: The number of cached tokens used as input for the Response. - text_tokens: - type: integer - description: The number of text tokens used as input for the Response. - image_tokens: - type: integer - description: The number of image tokens used as input for the Response. - audio_tokens: - type: integer - description: The number of audio tokens used as input for the Response. - cached_tokens_details: - type: object - description: >- - Details about the cached tokens used as input for the - Response. - properties: - text_tokens: - type: integer - description: >- - The number of cached text tokens used as input for the - Response. - image_tokens: - type: integer - description: >- - The number of cached image tokens used as input for the - Response. - audio_tokens: - type: integer - description: >- - The number of cached audio tokens used as input for the - Response. - output_token_details: - type: object - description: Details about the output tokens used in the Response. - properties: - text_tokens: - type: integer - description: The number of text tokens used in the Response. - audio_tokens: - type: integer - description: The number of audio tokens used in the Response. - conversation_id: + to 500ms. With shorter values the model will respond more + quickly, + + but may jump in on short pauses from the user. + required: + - client_secret + x-oaiMeta: + name: The transcription session object + group: realtime + example: | + { + "id": "sess_BBwZc7cFV3XizEyKGDCGL", + "object": "realtime.transcription_session", + "expires_at": 1742188264, + "modalities": ["audio", "text"], + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200 + }, + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "language": null, + "prompt": "" + }, + "client_secret": null + } + RealtimeTranscriptionSessionCreateResponseGA: + type: object + title: Realtime transcription session configuration object + description: | + A Realtime transcription session configuration object. + properties: + type: + type: string + description: > + The type of session. Always `transcription` for transcription + sessions. + enum: + - transcription + x-stainless-const: true + id: + type: string + description: > + Unique identifier for the session that looks like + `sess_1234567890abcdef`. + object: + type: string + description: The object type. Always `realtime.transcription_session`. + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs description: > - Which conversation the response is added to, determined by the - `conversation` - - field in the `response.create` event. If `auto`, the response will - be added to - - the default conversation and the value of `conversation_id` will be - an id like + Additional fields to include in server outputs. - `conv_1234`. If `none`, the response will not be added to any - conversation and + - `item.input_audio_transcription.logprobs`: Include logprobs for + input audio transcription. + audio: + type: object + description: | + Configuration for input audio for the session. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + transcription: + description: | + Configuration of the transcription model. + $ref: '#/components/schemas/AudioTranscriptionResponse' + noise_reduction: + type: object + description: | + Configuration for input audio noise reduction. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + turn_detection: + description: > + Configuration for turn detection. For + `gpt-realtime-whisper`, this must be `null`; VAD is not + supported. + anyOf: + - type: object + description: > + Configuration for turn detection. Can be set to `null` + to turn off. Server - the value of `conversation_id` will be `null`. If responses are - being triggered + VAD means that the model will detect the start and end + of speech based on - by server VAD, the response will be added to the default - conversation, thus + audio volume and respond at the end of user speech. For + `gpt-realtime-whisper`, this must be `null`; VAD is not + supported. + properties: + type: + type: string + description: > + Type of turn detection, only `server_vad` is + currently supported. + threshold: + type: number + description: > + Activation threshold for VAD (0.0 to 1.0), this + defaults to 0.5. A - the `conversation_id` will be an id like `conv_1234`. - type: string - voice: - $ref: '#/components/schemas/VoiceIdsShared' - description: > - The voice the model used to respond. + higher threshold will require louder audio to + activate the model, and - Current voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, - `sage`, + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: > + Amount of audio to include before the VAD detected + speech (in - `shimmer`, and `verse`. - modalities: - type: array - description: > - The set of modalities the model used to respond. If there are - multiple modalities, + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Duration of silence to detect speech stop (in + milliseconds). Defaults - the model will pick one, for example if `modalities` is `["text", - "audio"]`, the model + to 500ms. With shorter values the model will respond + more quickly, - could be responding in either text or audio. - items: - type: string - enum: - - text - - audio - output_audio_format: - type: string - enum: - - pcm16 - - g711_ulaw - - g711_alaw - description: > - The format of output audio. Options are `pcm16`, `g711_ulaw`, or - `g711_alaw`. - temperature: - type: number - description: > - Sampling temperature for the model, limited to [0.6, 1.2]. Defaults - to 0.8. - max_output_tokens: - oneOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true - description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls, that was used in this response. - RealtimeBetaResponseCreateParams: + but may jump in on short pauses from the user. + - type: 'null' + required: + - type + - id + - object + x-oaiMeta: + name: The transcription session object + group: realtime + example: | + { + "id": "sess_BBwZc7cFV3XizEyKGDCGL", + "type": "transcription", + "object": "realtime.transcription_session", + "expires_at": 1742188264, + "include": ["item.input_audio_transcription.logprobs"], + "audio": { + "input": { + "format": "pcm16", + "transcription": { + "model": "gpt-4o-transcribe", + "language": null, + "prompt": "" + }, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200 + } + } + } + } + RealtimeTranslationClientEvent: + discriminator: + propertyName: type + description: | + A Realtime translation client event. + anyOf: + - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionUpdate' + - $ref: >- + #/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend + - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionClose' + RealtimeTranslationClientEventInputAudioBufferAppend: type: object - description: Create a new Realtime response with these parameters - properties: - modalities: - type: array - description: | - The set of modalities the model can respond with. To disable audio, - set this to ["text"]. - items: - type: string - enum: - - text - - audio - instructions: - type: string - description: > - The default system instructions (i.e. system message) prepended to - model + description: > + Send this event to append audio bytes to the translation session input + audio buffer. - calls. This field allows the client to guide the model on desired - responses. The model can be instructed on response content and - format, + WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono - (e.g. "be extremely succinct", "act friendly", "here are examples of - good + little-endian raw audio bytes. Unsupported websocket audio formats + return a - responses") and on audio behavior (e.g. "talk quickly", "inject - emotion + validation error because lower-quality audio materially degrades + translation - into your voice", "laugh frequently"). The instructions are not - guaranteed + quality. - to be followed by the model, but they provide guidance to the model - on the - desired behavior. + Translation consumes 200 ms engine frames. For best realtime behavior, + append + audio in 200 ms chunks. If a chunk is shorter, the server buffers it + until it - Note that the server sets default instructions which will be used if - this + has enough audio for one frame. If a chunk is longer, the server splits + it into - field is not set and are visible in the `session.created` event at - the + 200 ms frames and enqueues them back-to-back. - start of the session. - voice: - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - description: > - The voice the model uses to respond. Supported built-in voices are - `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, - `verse`, + Keep appending silence while the session is active. If a client stops + sending - `marin`, and `cedar`. You may also provide a custom voice object - with an + audio and later resumes, model time treats the resumed audio as + contiguous with - `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed - during + the previous audio rather than as a real-world pause. + properties: + event_id: + type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: + type: string + enum: + - session.input_audio_buffer.append + description: The event type, must be `session.input_audio_buffer.append`. + x-stainless-const: true + audio: + type: string + description: Base64-encoded 24 kHz PCM16 mono audio bytes. + required: + - type + - audio + x-oaiMeta: + name: session.input_audio_buffer.append + group: realtime + example: | + { + "event_id": "event_456", + "type": "session.input_audio_buffer.append", + "audio": "Base64EncodedAudioData" + } + RealtimeTranslationClientEventSessionClose: + type: object + description: > + Gracefully close the realtime translation session. The server flushes + pending - the session once the model has responded with audio at least once. - output_audio_format: + input audio and emits any remaining translated output before closing the + + session. + properties: + event_id: + type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: type: string enum: - - pcm16 - - g711_ulaw - - g711_alaw - description: > - The format of output audio. Options are `pcm16`, `g711_ulaw`, or - `g711_alaw`. - tools: - type: array - description: Tools (functions) available to the model. - items: - type: object - properties: - type: - type: string - enum: - - function - description: The type of the tool, i.e. `function`. - x-stainless-const: true - name: - type: string - description: The name of the function. - description: - type: string - description: > - The description of the function, including guidance on when - and how + - session.close + description: The event type, must be `session.close`. + x-stainless-const: true + required: + - type + x-oaiMeta: + name: session.close + group: realtime + example: | + { + "event_id": "event_789", + "type": "session.close" + } + RealtimeTranslationClientEventSessionUpdate: + type: object + description: > + Send this event to update the translation session configuration. + Translation - to call it, and guidance about what to tell the user when - calling + sessions support updates to `audio.output.language`, + `audio.input.transcription`, - (if anything). - parameters: - type: object - description: Parameters of the function in JSON Schema. - tool_choice: + and `audio.input.noise_reduction`. + properties: + event_id: + type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: + type: string + enum: + - session.update + description: The event type, must be `session.update`. + x-stainless-const: true + session: + $ref: '#/components/schemas/RealtimeTranslationSessionUpdateRequest' description: > - How the model chooses tools. Provide one of the string modes or - force a specific + Translation session fields to update. The session `type` and `model` + are set - function/MCP tool. - oneOf: - - $ref: '#/components/schemas/ToolChoiceOptions' - - $ref: '#/components/schemas/ToolChoiceFunction' - - $ref: '#/components/schemas/ToolChoiceMCP' - default: auto - temperature: - type: number - description: > - Sampling temperature for the model, limited to [0.6, 1.2]. Defaults - to 0.8. - max_output_tokens: - oneOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true - description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - conversation: + at creation and cannot be changed with `session.update`. + required: + - type + - session + x-oaiMeta: + name: session.update + group: realtime + example: | + { + "type": "session.update", + "session": { + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper" + }, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + } + RealtimeTranslationClientSecretCreateRequest: + type: object + title: Realtime translation client secret creation request + description: | + Create a translation session and client secret for the Realtime API. + properties: + expires_after: + type: object + title: Client secret expiration description: > - Controls which conversation the response is added to. Currently - supports - - `auto` and `none`, with `auto` as the default value. The `auto` - value + Configuration for the client secret expiration. Expiration refers to + the time after which - means that the contents of the response will be added to the default + a client secret will no longer be valid for creating sessions. The + session itself may - conversation. Set this to `none` to create an out-of-band response - which + continue after that time once started. A secret can be used to + create multiple sessions - will not add items to default conversation. - oneOf: - - type: string - - type: string - default: auto + until it expires. + properties: + anchor: + type: string enum: - - auto - - none - metadata: - $ref: '#/components/schemas/Metadata' - prompt: - $ref: '#/components/schemas/Prompt' - input: - type: array - description: > - Input items to include in the prompt for the model. Using this field - - creates a new context for this Response instead of using the default - - conversation. An empty array `[]` will clear the context for this - Response. - - Note that this can include references to items from the default - conversation. - items: - $ref: '#/components/schemas/RealtimeConversationItem' - RealtimeBetaServerEventConversationItemCreated: + - created_at + description: > + The anchor point for the client secret expiration, meaning that + `seconds` will be added to the `created_at` time of the client + secret to produce an expiration timestamp. Only `created_at` is + currently supported. + default: created_at + x-stainless-const: true + seconds: + type: integer + format: int64 + description: > + The number of seconds from the anchor point to the expiration. + Select a value between `10` and `7200` (2 hours). This default + to 600 seconds (10 minutes) if not specified. + minimum: 10 + maximum: 7200 + default: 600 + session: + $ref: '#/components/schemas/RealtimeTranslationSessionCreateRequest' + required: + - session + RealtimeTranslationClientSecretCreateResponse: + type: object + title: Realtime translation session and client secret + description: > + Response from creating a translation session and client secret for the + Realtime API. + properties: + value: + type: string + description: The generated client secret value. + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the client secret, in seconds since epoch. + session: + $ref: '#/components/schemas/RealtimeTranslationSession' + required: + - value + - expires_at + - session + x-oaiMeta: + name: Translation session response object + group: realtime + example: | + { + "value": "ek_68af296e8e408191a1120ab6383263c2", + "expires_at": 1756310470, + "session": { + "id": "sess_C9CiUVUzUzYIssh3ELY1d", + "type": "translation", + "expires_at": 1756310470, + "model": "gpt-realtime-translate", + "audio": { + "input": { + "transcription": null, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + } + RealtimeTranslationServerEvent: + discriminator: + propertyName: type + description: | + A Realtime translation server event. + anyOf: + - $ref: '#/components/schemas/RealtimeServerEventError' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionCreated' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionUpdated' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionClosed' + - $ref: >- + #/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta + - $ref: >- + #/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta + - $ref: >- + #/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta + RealtimeTranslationServerEventSessionClosed: type: object - description: > - Returned when a conversation item is created. There are several - scenarios that produce this event: - - The server is generating a Response, which if successful will produce - either one or two Items, which will be of type `message` - (role `assistant`) or type `function_call`. - - The input audio buffer has been committed, either by the client or the - server (in `server_vad` mode). The server will take the content of the - input audio buffer and add it to a new user message Item. - - The client has sent a `conversation.item.create` event to add a new Item - to the Conversation. + description: | + Returned when a realtime translation session is closed. properties: event_id: type: string @@ -61314,54 +72985,30 @@ components: type: type: string enum: - - conversation.item.created - description: The event type, must be `conversation.item.created`. + - session.closed + description: The event type, must be `session.closed`. x-stainless-const: true - previous_item_id: - anyOf: - - type: string - description: > - The ID of the preceding item in the Conversation context, allows - the - - client to understand the order of the conversation. Can be - `null` if the - - item has no predecessor. - - type: 'null' - item: - $ref: '#/components/schemas/RealtimeConversationItem' required: - event_id - type - - item x-oaiMeta: - name: conversation.item.created + name: session.closed group: realtime example: | { - "event_id": "event_1920", - "type": "conversation.item.created", - "previous_item_id": "msg_002", - "item": { - "id": "msg_003", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "user", - "content": [] - } + "event_id": "event_987", + "type": "session.closed" } - RealtimeBetaServerEventConversationItemDeleted: + RealtimeTranslationServerEventSessionCreated: type: object description: > - Returned when an item in the conversation is deleted by the client with - a + Returned when a translation session is created. Emitted automatically + when a - `conversation.item.delete` event. This event is used to synchronize the + new connection is established as the first server event. This event + contains - server's understanding of the conversation history with the client's - view. + the default translation session configuration. properties: event_id: type: string @@ -61369,51 +73016,57 @@ components: type: type: string enum: - - conversation.item.deleted - description: The event type, must be `conversation.item.deleted`. + - session.created + description: The event type, must be `session.created`. x-stainless-const: true - item_id: - type: string - description: The ID of the item that was deleted. + session: + $ref: '#/components/schemas/RealtimeTranslationSession' + description: The translation session configuration. required: - event_id - type - - item_id + - session x-oaiMeta: - name: conversation.item.deleted + name: session.created group: realtime example: | { - "event_id": "event_2728", - "type": "conversation.item.deleted", - "item_id": "msg_005" + "type": "session.created", + "event_id": "event_123", + "session": { + "id": "sess_123", + "type": "translation", + "model": "gpt-realtime-translate", + "expires_at": 1714857600, + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper", + "language": "en" + }, + "noise_reduction": { + "type": "near_field" + } + }, + "output": { + "language": "fr" + } + } + } } - RealtimeBetaServerEventConversationItemInputAudioTranscriptionCompleted: + RealtimeTranslationServerEventSessionInputTranscriptDelta: type: object description: > - This event is the output of audio transcription for user audio written - to the - - user audio buffer. Transcription begins when the input audio buffer is - - committed by the client or server (in `server_vad` mode). Transcription - runs - - asynchronously with Response creation, so this event may come before or - after - - the Response events. - + Returned when optional source-language transcript text is available. + This event - Realtime API models accept audio natively, and thus input transcription - is a + is emitted only when `audio.input.transcription` is configured. - separate process run on a separate ASR (Automatic Speech Recognition) - model. - The transcript may diverge somewhat from the model's interpretation, and + Transcript deltas are append-only text fragments. Clients should not + insert - should be treated as a rough guide. + unconditional spaces between deltas. properties: event_id: type: string @@ -61421,68 +73074,48 @@ components: type: type: string enum: - - conversation.item.input_audio_transcription.completed - description: | - The event type, must be - `conversation.item.input_audio_transcription.completed`. + - session.input_transcript.delta + description: The event type, must be `session.input_transcript.delta`. x-stainless-const: true - item_id: - type: string - description: The ID of the user message item containing the audio. - content_index: - type: integer - description: The index of the content part containing the audio. - transcript: + delta: type: string - description: The transcribed text. - logprobs: + description: Append-only source-language transcript text. + elapsed_ms: anyOf: - - type: array - description: The log probabilities of the transcription. - items: - $ref: '#/components/schemas/LogProbProperties' + - type: integer + description: > + Timing metadata for stream alignment, derived from the + translation frame + + when available. It advances in 200 ms increments, but multiple + transcript + + deltas may share the same `elapsed_ms`. Treat it as alignment + metadata, + + not a unique transcript-delta identifier. - type: 'null' - usage: - type: object - description: Usage statistics for the transcription. - oneOf: - - $ref: '#/components/schemas/TranscriptTextUsageTokens' - title: Token Usage - - $ref: '#/components/schemas/TranscriptTextUsageDuration' - title: Duration Usage required: - event_id - type - - item_id - - content_index - - transcript - - usage + - delta x-oaiMeta: - name: conversation.item.input_audio_transcription.completed + name: session.input_transcript.delta group: realtime example: | { - "event_id": "event_2122", - "type": "conversation.item.input_audio_transcription.completed", - "item_id": "msg_003", - "content_index": 0, - "transcript": "Hello, how are you?", - "usage": { - "type": "tokens", - "total_tokens": 48, - "input_tokens": 38, - "input_token_details": { - "text_tokens": 10, - "audio_tokens": 28, - }, - "output_tokens": 10, - } + "event_id": "event_125", + "type": "session.input_transcript.delta", + "delta": " hear", + "elapsed_ms": 1200 } - RealtimeBetaServerEventConversationItemInputAudioTranscriptionDelta: + RealtimeTranslationServerEventSessionOutputAudioDelta: type: object description: > - Returned when the text value of an input audio transcription content - part is updated. + Returned when translated output audio is available. Output audio deltas + are + + 200 ms frames of PCM16 audio. properties: event_id: type: string @@ -61490,51 +73123,65 @@ components: type: type: string enum: - - conversation.item.input_audio_transcription.delta - description: >- - The event type, must be - `conversation.item.input_audio_transcription.delta`. + - session.output_audio.delta + description: The event type, must be `session.output_audio.delta`. x-stainless-const: true - item_id: + delta: type: string - description: The ID of the item. - content_index: + description: Base64-encoded translated audio data. + sample_rate: type: integer - description: The index of the content part in the item's content array. - delta: + description: Sample rate of the audio delta. + default: 24000 + channels: + type: integer + description: Number of audio channels. + default: 1 + format: type: string - description: The text delta. - logprobs: + enum: + - pcm16 + description: Audio encoding for `delta`. + x-stainless-const: true + elapsed_ms: anyOf: - - type: array - description: The log probabilities of the transcription. - items: - $ref: '#/components/schemas/LogProbProperties' + - type: integer + description: > + Timing metadata for stream alignment, derived from the + translation frame + + when available. Treat `elapsed_ms` as alignment metadata, not a + unique + + event identifier. - type: 'null' required: - event_id - type - - item_id + - delta x-oaiMeta: - name: conversation.item.input_audio_transcription.delta + name: session.output_audio.delta group: realtime example: | { - "type": "conversation.item.input_audio_transcription.delta", - "event_id": "event_001", - "item_id": "item_001", - "content_index": 0, - "delta": "Hello" + "event_id": "event_123", + "type": "session.output_audio.delta", + "delta": "Base64EncodedAudioDelta", + "sample_rate": 24000, + "channels": 1, + "format": "pcm16", + "elapsed_ms": 1200 } - RealtimeBetaServerEventConversationItemInputAudioTranscriptionFailed: + RealtimeTranslationServerEventSessionOutputTranscriptDelta: type: object description: > - Returned when input audio transcription is configured, and a - transcription + Returned when translated transcript text is available. - request for a user message failed. These events are separate from other - `error` events so that the client can identify the related Item. + Transcript deltas are append-only text fragments. Clients should not + insert + + unconditional spaces between deltas. properties: event_id: type: string @@ -61542,60 +73189,48 @@ components: type: type: string enum: - - conversation.item.input_audio_transcription.failed - description: | - The event type, must be - `conversation.item.input_audio_transcription.failed`. + - session.output_transcript.delta + description: The event type, must be `session.output_transcript.delta`. x-stainless-const: true - item_id: + delta: type: string - description: The ID of the user message item. - content_index: - type: integer - description: The index of the content part containing the audio. - error: - type: object - description: Details of the transcription error. - properties: - type: - type: string - description: The type of error. - code: - type: string - description: Error code, if any. - message: - type: string - description: A human-readable error message. - param: - type: string - description: Parameter related to the error, if any. + description: Append-only transcript text for the translated output audio. + elapsed_ms: + anyOf: + - type: integer + description: > + Timing metadata for stream alignment, derived from the + translation frame + + when available. It advances in 200 ms increments, but multiple + transcript + + deltas may share the same `elapsed_ms`. Treat it as alignment + metadata, + + not a unique transcript-delta identifier. + - type: 'null' required: - event_id - type - - item_id - - content_index - - error + - delta x-oaiMeta: - name: conversation.item.input_audio_transcription.failed + name: session.output_transcript.delta group: realtime example: | { - "event_id": "event_2324", - "type": "conversation.item.input_audio_transcription.failed", - "item_id": "msg_003", - "content_index": 0, - "error": { - "type": "transcription_error", - "code": "audio_unintelligible", - "message": "The audio could not be transcribed.", - "param": null - } + "event_id": "event_124", + "type": "session.output_transcript.delta", + "delta": " escuch", + "elapsed_ms": 1200 } - RealtimeBetaServerEventConversationItemInputAudioTranscriptionSegment: + RealtimeTranslationServerEventSessionUpdated: type: object - description: >- - Returned when an input audio transcription segment is identified for an - item. + description: > + Returned when a translation session is updated with a `session.update` + event, + + unless there is an error. properties: event_id: type: string @@ -61603,17223 +73238,17509 @@ components: type: type: string enum: - - conversation.item.input_audio_transcription.segment - description: >- - The event type, must be - `conversation.item.input_audio_transcription.segment`. + - session.updated + description: The event type, must be `session.updated`. x-stainless-const: true - item_id: - type: string - description: The ID of the item containing the input audio content. - content_index: - type: integer - description: The index of the input audio content part within the item. - text: - type: string - description: The text for this segment. - id: - type: string - description: The segment identifier. - speaker: - type: string - description: The detected speaker label for this segment. - start: - type: number - format: double - description: Start time of the segment in seconds. - end: - type: number - format: double - description: End time of the segment in seconds. + session: + $ref: '#/components/schemas/RealtimeTranslationSession' + description: The translation session configuration. required: - event_id - type - - item_id - - content_index - - text - - id - - speaker - - start - - end + - session x-oaiMeta: - name: conversation.item.input_audio_transcription.segment + name: session.updated group: realtime example: | { - "event_id": "event_6501", - "type": "conversation.item.input_audio_transcription.segment", - "item_id": "msg_011", - "content_index": 0, - "text": "hello", - "id": "seg_0001", - "speaker": "spk_1", - "start": 0.0, - "end": 0.4 + "type": "session.updated", + "event_id": "event_124", + "session": { + "id": "sess_123", + "type": "translation", + "model": "gpt-realtime-translate", + "expires_at": 1714857600, + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper", + "language": "en" + }, + "noise_reduction": { + "type": "near_field" + } + }, + "output": { + "language": "es" + } + } + } } - RealtimeBetaServerEventConversationItemRetrieved: + RealtimeTranslationSession: type: object + title: Realtime translation session description: > - Returned when a conversation item is retrieved with - `conversation.item.retrieve`. + A Realtime translation session. Translation sessions continuously + translate input + + audio into the configured output language. properties: - event_id: + id: type: string - description: The unique ID of the server event. + description: > + Unique identifier for the session that looks like + `sess_1234567890abcdef`. type: type: string enum: - - conversation.item.retrieved - description: The event type, must be `conversation.item.retrieved`. + - translation + description: > + The session type. Always `translation` for Realtime translation + sessions. x-stainless-const: true - item: - $ref: '#/components/schemas/RealtimeConversationItem' + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + model: + type: string + description: > + The Realtime translation model used for this session. This field is + set at + + session creation and cannot be changed with `session.update`. + audio: + type: object + description: | + Configuration for translation input and output audio. + properties: + input: + type: object + properties: + transcription: + anyOf: + - type: object + description: > + Optional source-language transcription. When configured, + the server emits + + `session.input_transcript.delta` events. Translation + itself still runs from + + the input audio stream. + properties: + model: + type: string + description: >- + The transcription model used for source transcript + deltas. + required: + - model + - type: 'null' + noise_reduction: + anyOf: + - type: object + description: | + Optional input noise reduction. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + required: + - type + - type: 'null' + output: + type: object + properties: + language: + type: string + description: > + Target language for translated output audio and transcript + deltas. required: - - event_id + - id - type - - item + - expires_at + - model + - audio x-oaiMeta: - name: conversation.item.retrieved + name: The translation session object group: realtime example: | { - "event_id": "event_1920", - "type": "conversation.item.created", - "previous_item_id": "msg_002", - "item": { - "id": "msg_003", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "user", - "content": [ - { - "type": "input_audio", - "transcript": "hello how are you", - "audio": "base64encodedaudio==" - } - ] + "id": "sess_C9G5QPteg4UIbotdKLoYQ", + "type": "translation", + "expires_at": 1756324625, + "model": "gpt-realtime-translate", + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper" + }, + "noise_reduction": null + }, + "output": { + "language": "es" } + } } - RealtimeBetaServerEventConversationItemTruncated: + RealtimeTranslationSessionCreateRequest: type: object + title: Realtime translation session configuration description: > - Returned when an earlier assistant audio message item is truncated by - the - - client with a `conversation.item.truncate` event. This event is used to - - synchronize the server's understanding of the audio with the client's - playback. - - - This action will truncate the audio and remove the server-side text - transcript + Realtime translation session configuration. Translation sessions stream + source - to ensure there is no text in the context that hasn't been heard by the - user. + audio in and translated audio plus transcript deltas out continuously. properties: - event_id: - type: string - description: The unique ID of the server event. - type: - type: string - enum: - - conversation.item.truncated - description: The event type, must be `conversation.item.truncated`. - x-stainless-const: true - item_id: + model: type: string - description: The ID of the assistant message item that was truncated. - content_index: - type: integer - description: The index of the content part that was truncated. - audio_end_ms: - type: integer description: | - The duration up to which the audio was truncated, in milliseconds. + The Realtime translation model used for this session. + audio: + type: object + description: | + Configuration for translation input and output audio. + properties: + input: + type: object + properties: + transcription: + anyOf: + - type: object + description: > + Optional source-language transcription. When configured, + the server emits + + `session.input_transcript.delta` events. Translation + itself still runs from + + the input audio stream. + properties: + model: + type: string + description: >- + The transcription model to use for source transcript + deltas. + required: + - model + - type: 'null' + noise_reduction: + anyOf: + - type: object + description: > + Optional input noise reduction. Set to `null` to disable + it. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + required: + - type + - type: 'null' + output: + type: object + properties: + language: + type: string + description: > + Target language for translated output audio and transcript + deltas. required: - - event_id - - type - - item_id - - content_index - - audio_end_ms - x-oaiMeta: - name: conversation.item.truncated - group: realtime - example: | - { - "event_id": "event_2526", - "type": "conversation.item.truncated", - "item_id": "msg_004", - "content_index": 0, - "audio_end_ms": 1500 - } - RealtimeBetaServerEventError: + - model + RealtimeTranslationSessionUpdateRequest: type: object + title: Realtime translation session update description: > - Returned when an error occurs, which could be a client problem or a - server + Realtime translation session fields that can be updated with + `session.update`. + properties: + audio: + type: object + description: | + Configuration for translation input and output audio. + properties: + input: + type: object + properties: + transcription: + anyOf: + - type: object + description: > + Optional source-language transcription. When configured, + the server emits - problem. Most errors are recoverable and the session will stay open, we + `session.input_transcript.delta` events. Translation + itself still runs from - recommend to implementors to monitor and log error messages by default. - properties: - event_id: - type: string - description: The unique ID of the server event. - type: - type: string + the input audio stream. + properties: + model: + type: string + description: >- + The transcription model to use for source transcript + deltas. + required: + - model + - type: 'null' + noise_reduction: + anyOf: + - type: object + description: > + Optional input noise reduction. Set to `null` to disable + it. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + required: + - type + - type: 'null' + output: + type: object + properties: + language: + type: string + description: > + Target language for translated output audio and transcript + deltas. + RealtimeTruncation: + title: Realtime Truncation Controls + description: > + 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. + + + Clients can configure truncation behavior to truncate with a lower max + token limit, which is an effective way to control token usage and cost. + + + 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. + + + 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. + oneOf: + - type: string + description: >- + 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. enum: - - error - description: The event type, must be `error`. - x-stainless-const: true - error: - type: object - description: Details of the error. - required: - - type - - message + - auto + - disabled + - type: object + title: Retention ratio truncation + description: >- + 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. properties: type: type: string + enum: + - retention_ratio + description: Use retention ratio truncation. + x-stainless-const: true + retention_ratio: + type: number description: > - The type of error (e.g., "invalid_request_error", - "server_error"). - code: - anyOf: - - type: string - description: Error code, if any. - - type: 'null' - message: - type: string - description: A human-readable error message. - param: - anyOf: - - type: string - description: Parameter related to the error, if any. - - type: 'null' - event_id: - anyOf: - - type: string + 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. + minimum: 0 + maximum: 1 + token_limits: + type: object + description: >- + Optional custom token limits for this truncation strategy. If + not provided, the model's default token limits will be used. + properties: + post_instructions: + type: integer + description: >- + 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. + minimum: 0 + required: + - type + - retention_ratio + RealtimeTurnDetection: + anyOf: + - title: Realtime Turn Detection + description: > + 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. + + + 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. + + + 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. + + + For `gpt-realtime-whisper` transcription sessions, turn detection + must be + + set to `null`; VAD is not supported. + oneOf: + - type: object + title: Server VAD + description: >- + Server-side voice activity detection (VAD) which flips on when + user speech is detected and off after a period of silence. + required: + - type + properties: + type: + type: string + default: server_vad + const: server_vad description: > - The event_id of the client event that caused the error, if - applicable. - - type: 'null' - required: - - event_id - - type - - error - x-oaiMeta: - name: error - group: realtime - example: | - { - "event_id": "event_890", - "type": "error", - "error": { - "type": "invalid_request_error", - "code": "invalid_event", - "message": "The 'type' field is missing.", - "param": null, - "event_id": "event_567" - } - } - RealtimeBetaServerEventInputAudioBufferCleared: + Type of turn detection, `server_vad` to turn on simple + Server VAD. + threshold: + type: number + description: > + Used only for `server_vad` mode. Activation threshold for + VAD (0.0 to 1.0), this defaults to 0.5. A + + higher threshold will require louder audio to activate the + model, and + + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: > + Used only for `server_vad` mode. Amount of audio to include + before the VAD detected speech (in + + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: > + Used only for `server_vad` mode. Duration of silence to + detect speech stop (in milliseconds). Defaults + + to 500ms. With shorter values the model will respond more + quickly, + + but may jump in on short pauses from the user. + create_response: + type: boolean + default: true + description: > + 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. + + + If both `create_response` and `interrupt_response` are set + to `false`, the model will never respond automatically but + VAD events will still be emitted. + interrupt_response: + type: boolean + default: true + description: > + Whether or not to automatically interrupt (cancel) any + ongoing response with output to the default + + 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. + + + If both `create_response` and `interrupt_response` are set + to `false`, the model will never respond automatically but + VAD events will still be emitted. + idle_timeout_ms: + anyOf: + - type: integer + minimum: 5000 + maximum: 30000 + description: > + Optional timeout after which a model response will be + triggered automatically. This is + + useful for situations in which a long pause from the + user is unexpected, such as a phone + + call. The model will effectively prompt the user to + continue the conversation based + + on the current context. + + + The timeout value will be applied after the last model + response's audio has finished playing, + + i.e. it's set to the `response.done` time plus audio + playback duration. + + + An `input_audio_buffer.timeout_triggered` event (plus + events + + associated with the Response) will be emitted when the + timeout is reached. + + Idle timeout is currently only supported for + `server_vad` mode. + - type: 'null' + - type: object + title: Semantic VAD + description: >- + Server-side semantic turn detection which uses a model to + determine when the user has finished speaking. + required: + - type + properties: + type: + type: string + const: semantic_vad + description: > + Type of turn detection, `semantic_vad` to turn on Semantic + VAD. + eagerness: + type: string + default: auto + enum: + - low + - medium + - high + - auto + description: > + 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. + create_response: + type: boolean + default: true + description: > + Whether or not to automatically generate a response when a + VAD stop event occurs. + interrupt_response: + type: boolean + default: true + description: > + Whether or not to automatically interrupt any ongoing + response with output to the default + + conversation (i.e. `conversation` of `auto`) when a VAD + start event occurs. + discriminator: + propertyName: type + - type: 'null' + Reasoning: type: object description: | - Returned when the input audio buffer is cleared by the client with a - `input_audio_buffer.clear` event. + **gpt-5 and o-series models only** + + Configuration options for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + title: Reasoning properties: - event_id: - type: string - description: The unique ID of the server event. - type: - type: string + mode: + $ref: '#/components/schemas/ReasoningModeEnum' + description: | + Controls the reasoning execution mode for the request. + + When returned on a response, this is the effective execution mode. + effort: + $ref: '#/components/schemas/ReasoningEffort' + summary: + anyOf: + - type: string + description: > + A summary of the reasoning performed by the model. This can be + + useful for debugging and understanding the model's reasoning + process. + + One of `auto`, `concise`, or `detailed`. + + + `concise` is supported for `computer-use-preview` models and all + reasoning models after `gpt-5`. + enum: + - auto + - concise + - detailed + - type: 'null' + context: + anyOf: + - type: string + description: > + Controls which reasoning items are rendered back to the model on + later turns. + + When returned on a response, this is the effective reasoning + context mode + + used for the response. + enum: + - auto + - current_turn + - all_turns + - type: 'null' + generate_summary: + anyOf: + - type: string + deprecated: true + description: > + **Deprecated:** use `summary` instead. + + + A summary of the reasoning performed by the model. This can be + + useful for debugging and understanding the model's reasoning + process. + + One of `auto`, `concise`, or `detailed`. + enum: + - auto + - concise + - detailed + - type: 'null' + ReasoningEffort: + anyOf: + - type: string enum: - - input_audio_buffer.cleared - description: The event type, must be `input_audio_buffer.cleared`. - x-stainless-const: true - required: - - event_id - - type - x-oaiMeta: - name: input_audio_buffer.cleared - group: realtime - example: | - { - "event_id": "event_1314", - "type": "input_audio_buffer.cleared" - } - RealtimeBetaServerEventInputAudioBufferCommitted: + - none + - minimal + - low + - medium + - high + - xhigh + - max + default: medium + description: > + Constrains effort on reasoning for reasoning models. Currently + supported + + values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and + `max`. + + Reducing reasoning effort can result in faster responses and fewer + tokens + + used on reasoning in a response. Not all reasoning models support + every + + value. See the + + [reasoning guide](https://platform.openai.com/docs/guides/reasoning) + + for model-specific support. + - type: 'null' + ReasoningItem: type: object description: > - Returned when an input audio buffer is committed, either by the client - or + A description of the chain of thought used by a reasoning model while + generating - automatically in server VAD mode. The `item_id` property is the ID of - the user + a response. Be sure to include these items in your `input` to the + Responses API - message item that will be created, thus a `conversation.item.created` - event + for subsequent turns of a conversation if you are manually - will also be sent to the client. + [managing context](/docs/guides/conversation-state). + title: Reasoning properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the object. Always `reasoning`. enum: - - input_audio_buffer.committed - description: The event type, must be `input_audio_buffer.committed`. + - reasoning x-stainless-const: true - previous_item_id: + id: + type: string + description: | + The unique identifier of the reasoning content. + encrypted_content: anyOf: - type: string description: > - The ID of the preceding item after which the new item will be - inserted. + The encrypted content of the reasoning item - populated when a + response is - Can be `null` if the item has no predecessor. + generated with `reasoning.encrypted_content` in the `include` + parameter. - type: 'null' - item_id: + summary: + type: array + description: | + Reasoning summary content. + items: + $ref: '#/components/schemas/SummaryTextContent' + content: + type: array + description: | + Reasoning text content. + items: + $ref: '#/components/schemas/ReasoningTextContent' + status: type: string - description: The ID of the user message item that will be created. + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete required: - - event_id + - id + - summary - type - - item_id - x-oaiMeta: - name: input_audio_buffer.committed - group: realtime - example: | - { - "event_id": "event_1121", - "type": "input_audio_buffer.committed", - "previous_item_id": "msg_001", - "item_id": "msg_002" - } - RealtimeBetaServerEventInputAudioBufferSpeechStarted: - type: object - description: > - Sent by the server when in `server_vad` mode to indicate that speech has - been + Response: + title: The response object + allOf: + - $ref: '#/components/schemas/ModelResponseProperties' + - $ref: '#/components/schemas/ResponseProperties' + - type: object + properties: + truncation: + anyOf: + - type: string + description: > + The truncation strategy to use for the model response. + + - `auto`: If the input to this Response exceeds + the model's context window size, the model will truncate the + response to fit the context window by dropping items from the beginning of the conversation. + - `disabled` (default): If the input size will exceed the + context window + size for a model, the request will fail with a 400 error. + enum: + - auto + - disabled + default: disabled + - type: 'null' + id: + type: string + description: | + Unique identifier for this Response. + object: + type: string + description: | + The object type of this resource - always set to `response`. + enum: + - response + x-stainless-const: true + status: + type: string + description: > + The status of the response generation. One of `completed`, + `failed`, - detected in the audio buffer. This can happen any time audio is added to - the + `in_progress`, `cancelled`, `queued`, or `incomplete`. + enum: + - completed + - failed + - in_progress + - cancelled + - queued + - incomplete + created_at: + type: number + format: unixtime + description: | + Unix timestamp (in seconds) of when this Response was created. + completed_at: + anyOf: + - type: number + format: unixtime + description: > + Unix timestamp (in seconds) of when this Response was + completed. - buffer (unless speech is already detected). The client may want to use - this + Only present when the status is `completed`. + - type: 'null' + error: + $ref: '#/components/schemas/ResponseError' + incomplete_details: + anyOf: + - type: object + description: | + Details about why the response is incomplete. + properties: + reason: + type: string + description: The reason why the response is incomplete. + enum: + - max_output_tokens + - content_filter + - type: 'null' + output: + type: array + description: > + An array of content items generated by the model. - event to interrupt audio playback or provide visual feedback to the - user. + + - The length and order of items in the `output` array is + dependent + on the model's response. + - Rather than accessing the first item in the `output` array and + assuming it's an `assistant` message with the content generated by + the model, you might consider using the `output_text` property where + supported in SDKs. + items: + $ref: '#/components/schemas/OutputItem' + reasoning: + anyOf: + - $ref: '#/components/schemas/Reasoning' + - type: 'null' + instructions: + anyOf: + - description: > + A system (or developer) message inserted into the model's + context. - The client should expect to receive a - `input_audio_buffer.speech_stopped` event + When using along with `previous_response_id`, the + instructions from a previous - when speech stops. The `item_id` property is the ID of the user message - item + response will not be carried over to the next response. This + makes it simple - that will be created when speech stops and will also be included in the + to swap out system (or developer) messages in new responses. + oneOf: + - type: string + description: > + A text input to the model, equivalent to a text input + with the - `input_audio_buffer.speech_stopped` event (unless the client manually - commits + `developer` role. + - type: array + title: Input item list + description: > + A list of one or many input items to the model, + containing - the audio buffer during VAD activation). + different content types. + items: + $ref: '#/components/schemas/InputItem' + - type: 'null' + output_text: + anyOf: + - type: string + description: > + SDK-only convenience property that contains the aggregated + text output + + from all `output_text` items in the `output` array, if any + are present. + + Supported in the Python and JavaScript SDKs. + x-oaiSupportedSDKs: + - python + - javascript + - type: 'null' + usage: + $ref: '#/components/schemas/ResponseUsage' + prompt_cache_options: + $ref: '#/components/schemas/PromptCacheOptions' + moderation: + anyOf: + - $ref: '#/components/schemas/Moderation' + description: > + Moderation results for the response input and output, if + moderated completions were requested. + - type: 'null' + parallel_tool_calls: + type: boolean + description: | + Whether to allow the model to run tool calls in parallel. + default: true + conversation: + anyOf: + - default: null + $ref: '#/components/schemas/Conversation-2' + - type: 'null' + max_output_tokens: + anyOf: + - description: > + An upper bound for the number of tokens that can be + generated for a response, including visible output tokens + and [reasoning tokens](/docs/guides/reasoning). + type: integer + - type: 'null' + required: + - id + - object + - created_at + - error + - incomplete_details + - instructions + - model + - tools + - output + - parallel_tool_calls + - metadata + - tool_choice + - temperature + - top_p + example: + id: resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41 + object: response + created_at: 1741476777 + status: completed + completed_at: 1741476778 + error: null + incomplete_details: null + instructions: null + max_output_tokens: null + model: gpt-4o-2024-08-06 + output: + - type: message + id: msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41 + status: completed + role: assistant + content: + - type: output_text + text: >- + The image depicts a scenic landscape with a wooden boardwalk + or pathway leading through lush, green grass under a blue sky + with some clouds. The setting suggests a peaceful natural + area, possibly a park or nature reserve. There are trees and + shrubs in the background. + annotations: [] + parallel_tool_calls: true + previous_response_id: null + reasoning: + effort: null + summary: null + context: null + store: true + temperature: 1 + text: + format: + type: text + tool_choice: auto + tools: [] + top_p: 1 + truncation: disabled + usage: + input_tokens: 328 + input_tokens_details: + cached_tokens: 0 + output_tokens: 52 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 380 + user: null + metadata: {} + ResponseAudioDeltaEvent: + type: object + description: Emitted when there is a partial audio response. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.audio.delta`. enum: - - input_audio_buffer.speech_started - description: The event type, must be `input_audio_buffer.speech_started`. + - response.audio.delta x-stainless-const: true - audio_start_ms: + sequence_number: type: integer - description: > - Milliseconds from the start of all audio written to the buffer - during the - - session when speech was first detected. This will correspond to the - - beginning of audio sent to the model, and thus includes the - - `prefix_padding_ms` configured in the Session. - item_id: + description: | + A sequence number for this chunk of the stream response. + delta: type: string - description: > - The ID of the user message item that will be created when speech - stops. + description: | + A chunk of Base64 encoded response audio bytes. required: - - event_id - type - - audio_start_ms - - item_id + - delta + - sequence_number x-oaiMeta: - name: input_audio_buffer.speech_started - group: realtime + name: response.audio.delta + group: responses example: | { - "event_id": "event_1516", - "type": "input_audio_buffer.speech_started", - "audio_start_ms": 1000, - "item_id": "msg_003" + "type": "response.audio.delta", + "response_id": "resp_123", + "delta": "base64encoded...", + "sequence_number": 1 } - RealtimeBetaServerEventInputAudioBufferSpeechStopped: + ResponseAudioDoneEvent: type: object - description: > - Returned in `server_vad` mode when the server detects the end of speech - in - - the audio buffer. The server will also send an - `conversation.item.created` - - event with the user message item that is created from the audio buffer. + description: Emitted when the audio response is complete. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.audio.done`. enum: - - input_audio_buffer.speech_stopped - description: The event type, must be `input_audio_buffer.speech_stopped`. + - response.audio.done x-stainless-const: true - audio_end_ms: + sequence_number: type: integer - description: > - Milliseconds since the session started when speech stopped. This - will - - correspond to the end of audio sent to the model, and thus includes - the - - `min_silence_duration_ms` configured in the Session. - item_id: - type: string - description: The ID of the user message item that will be created. + description: | + The sequence number of the delta. required: - - event_id - type - - audio_end_ms - - item_id + - sequence_number + - response_id x-oaiMeta: - name: input_audio_buffer.speech_stopped - group: realtime + name: response.audio.done + group: responses example: | { - "event_id": "event_1718", - "type": "input_audio_buffer.speech_stopped", - "audio_end_ms": 2000, - "item_id": "msg_003" + "type": "response.audio.done", + "response_id": "resp-123", + "sequence_number": 1 } - RealtimeBetaServerEventMCPListToolsCompleted: + ResponseAudioTranscriptDeltaEvent: type: object - description: Returned when listing MCP tools has completed for an item. + description: Emitted when there is a partial transcript of audio. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.audio.transcript.delta`. enum: - - mcp_list_tools.completed - description: The event type, must be `mcp_list_tools.completed`. + - response.audio.transcript.delta x-stainless-const: true - item_id: + delta: type: string - description: The ID of the MCP list tools item. + description: | + The partial transcript of the audio response. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - item_id + - response_id + - delta + - sequence_number x-oaiMeta: - name: mcp_list_tools.completed - group: realtime + name: response.audio.transcript.delta + group: responses example: | { - "event_id": "event_6102", - "type": "mcp_list_tools.completed", - "item_id": "mcp_list_tools_001" + "type": "response.audio.transcript.delta", + "response_id": "resp_123", + "delta": " ... partial transcript ... ", + "sequence_number": 1 } - RealtimeBetaServerEventMCPListToolsFailed: + ResponseAudioTranscriptDoneEvent: type: object - description: Returned when listing MCP tools has failed for an item. + description: Emitted when the full audio transcript is completed. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.audio.transcript.done`. enum: - - mcp_list_tools.failed - description: The event type, must be `mcp_list_tools.failed`. + - response.audio.transcript.done x-stainless-const: true - item_id: - type: string - description: The ID of the MCP list tools item. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - item_id + - response_id + - sequence_number x-oaiMeta: - name: mcp_list_tools.failed - group: realtime + name: response.audio.transcript.done + group: responses example: | { - "event_id": "event_6103", - "type": "mcp_list_tools.failed", - "item_id": "mcp_list_tools_001" + "type": "response.audio.transcript.done", + "response_id": "resp_123", + "sequence_number": 1 } - RealtimeBetaServerEventMCPListToolsInProgress: + ResponseCodeInterpreterCallCodeDeltaEvent: type: object - description: Returned when listing MCP tools is in progress for an item. + description: Emitted when a partial code snippet is streamed by the code interpreter. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: >- + The type of the event. Always + `response.code_interpreter_call_code.delta`. enum: - - mcp_list_tools.in_progress - description: The event type, must be `mcp_list_tools.in_progress`. + - response.code_interpreter_call_code.delta x-stainless-const: true + output_index: + type: integer + description: >- + The index of the output item in the response for which the code is + being streamed. item_id: type: string - description: The ID of the MCP list tools item. + description: The unique identifier of the code interpreter tool call item. + delta: + type: string + description: The partial code snippet being streamed by the code interpreter. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. required: - - event_id - type + - output_index - item_id + - delta + - sequence_number x-oaiMeta: - name: mcp_list_tools.in_progress - group: realtime + name: response.code_interpreter_call_code.delta + group: responses example: | { - "event_id": "event_6101", - "type": "mcp_list_tools.in_progress", - "item_id": "mcp_list_tools_001" + "type": "response.code_interpreter_call_code.delta", + "output_index": 0, + "item_id": "ci_12345", + "delta": "print('Hello, world')", + "sequence_number": 1 } - RealtimeBetaServerEventRateLimitsUpdated: + ResponseCodeInterpreterCallCodeDoneEvent: type: object - description: > - Emitted at the beginning of a Response to indicate the updated rate - limits. - - When a Response is created some tokens will be "reserved" for the - output - - tokens, the rate limits shown here reflect that reservation, which is - then - - adjusted accordingly once the Response is completed. + description: Emitted when the code snippet is finalized by the code interpreter. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: >- + The type of the event. Always + `response.code_interpreter_call_code.done`. enum: - - rate_limits.updated - description: The event type, must be `rate_limits.updated`. + - response.code_interpreter_call_code.done x-stainless-const: true - rate_limits: - type: array - description: List of rate limit information. - items: - type: object - properties: - name: - type: string - enum: - - requests - - tokens - description: | - The name of the rate limit (`requests`, `tokens`). - limit: - type: integer - description: The maximum allowed value for the rate limit. - remaining: - type: integer - description: The remaining value before the limit is reached. - reset_seconds: - type: number - description: Seconds until the rate limit resets. + output_index: + type: integer + description: >- + The index of the output item in the response for which the code is + finalized. + item_id: + type: string + description: The unique identifier of the code interpreter tool call item. + code: + type: string + description: The final code snippet output by the code interpreter. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. required: - - event_id - type - - rate_limits + - output_index + - item_id + - code + - sequence_number x-oaiMeta: - name: rate_limits.updated - group: realtime + name: response.code_interpreter_call_code.done + group: responses example: | { - "event_id": "event_5758", - "type": "rate_limits.updated", - "rate_limits": [ - { - "name": "requests", - "limit": 1000, - "remaining": 999, - "reset_seconds": 60 - }, - { - "name": "tokens", - "limit": 50000, - "remaining": 49950, - "reset_seconds": 60 - } - ] + "type": "response.code_interpreter_call_code.done", + "output_index": 3, + "item_id": "ci_12345", + "code": "print('done')", + "sequence_number": 1 } - RealtimeBetaServerEventResponseAudioDelta: + ResponseCodeInterpreterCallCompletedEvent: type: object - description: Returned when the model-generated audio is updated. + description: Emitted when the code interpreter call is completed. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: >- + The type of the event. Always + `response.code_interpreter_call.completed`. enum: - - response.output_audio.delta - description: The event type, must be `response.output_audio.delta`. + - response.code_interpreter_call.completed x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item. output_index: type: integer - description: The index of the output item in the response. - content_index: - type: integer - description: The index of the content part in the item's content array. - delta: + description: >- + The index of the output item in the response for which the code + interpreter call is completed. + item_id: type: string - description: Base64-encoded audio data delta. + description: The unique identifier of the code interpreter tool call item. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. required: - - event_id - type - - response_id - - item_id - output_index - - content_index - - delta + - item_id + - sequence_number x-oaiMeta: - name: response.output_audio.delta - group: realtime + name: response.code_interpreter_call.completed + group: responses example: | { - "event_id": "event_4950", - "type": "response.output_audio.delta", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0, - "delta": "Base64EncodedAudioDelta" + "type": "response.code_interpreter_call.completed", + "output_index": 5, + "item_id": "ci_12345", + "sequence_number": 1 } - RealtimeBetaServerEventResponseAudioDone: + ResponseCodeInterpreterCallInProgressEvent: type: object - description: > - Returned when the model-generated audio is done. Also emitted when a - Response - - is interrupted, incomplete, or cancelled. + description: Emitted when a code interpreter call is in progress. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: >- + The type of the event. Always + `response.code_interpreter_call.in_progress`. enum: - - response.output_audio.done - description: The event type, must be `response.output_audio.done`. + - response.code_interpreter_call.in_progress x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item. output_index: type: integer - description: The index of the output item in the response. - content_index: + description: >- + The index of the output item in the response for which the code + interpreter call is in progress. + item_id: + type: string + description: The unique identifier of the code interpreter tool call item. + sequence_number: type: integer - description: The index of the content part in the item's content array. + description: The sequence number of this event, used to order streaming events. required: - - event_id - type - - response_id - - item_id - output_index - - content_index + - item_id + - sequence_number x-oaiMeta: - name: response.output_audio.done - group: realtime + name: response.code_interpreter_call.in_progress + group: responses example: | { - "event_id": "event_5152", - "type": "response.output_audio.done", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0 + "type": "response.code_interpreter_call.in_progress", + "output_index": 0, + "item_id": "ci_12345", + "sequence_number": 1 } - RealtimeBetaServerEventResponseAudioTranscriptDelta: + ResponseCodeInterpreterCallInterpretingEvent: type: object - description: > - Returned when the model-generated transcription of audio output is - updated. + description: >- + Emitted when the code interpreter is actively interpreting the code + snippet. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: >- + The type of the event. Always + `response.code_interpreter_call.interpreting`. enum: - - response.output_audio_transcript.delta - description: The event type, must be `response.output_audio_transcript.delta`. + - response.code_interpreter_call.interpreting x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item. output_index: type: integer - description: The index of the output item in the response. - content_index: - type: integer - description: The index of the content part in the item's content array. - delta: + description: >- + The index of the output item in the response for which the code + interpreter is interpreting code. + item_id: type: string - description: The transcript delta. + description: The unique identifier of the code interpreter tool call item. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. required: - - event_id - type - - response_id - - item_id - output_index - - content_index - - delta + - item_id + - sequence_number x-oaiMeta: - name: response.output_audio_transcript.delta - group: realtime + name: response.code_interpreter_call.interpreting + group: responses example: | { - "event_id": "event_4546", - "type": "response.output_audio_transcript.delta", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0, - "delta": "Hello, how can I a" + "type": "response.code_interpreter_call.interpreting", + "output_index": 4, + "item_id": "ci_12345", + "sequence_number": 1 } - RealtimeBetaServerEventResponseAudioTranscriptDone: + ResponseCompletedEvent: type: object - description: | - Returned when the model-generated transcription of audio output is done - streaming. Also emitted when a Response is interrupted, incomplete, or - cancelled. + description: Emitted when the model response is complete. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.completed`. enum: - - response.output_audio_transcript.done - description: The event type, must be `response.output_audio_transcript.done`. + - response.completed x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item. - output_index: - type: integer - description: The index of the output item in the response. - content_index: + response: + $ref: '#/components/schemas/Response' + description: | + Properties of the completed response. + sequence_number: type: integer - description: The index of the content part in the item's content array. - transcript: - type: string - description: The final transcript of the audio. + description: The sequence number for this event. required: - - event_id - type - - response_id - - item_id - - output_index - - content_index - - transcript + - response + - sequence_number x-oaiMeta: - name: response.output_audio_transcript.done - group: realtime + name: response.completed + group: responses example: | { - "event_id": "event_4748", - "type": "response.output_audio_transcript.done", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0, - "transcript": "Hello, how can I assist you today?" + "type": "response.completed", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "completed", + "completed_at": 1740855870, + "error": null, + "incomplete_details": null, + "input": [], + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_123", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "annotations": [] + } + ] + } + ], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": null, + "metadata": {} + }, + "sequence_number": 1 } - RealtimeBetaServerEventResponseContentPartAdded: + ResponseContentPartAddedEvent: type: object - description: > - Returned when a new content part is added to an assistant message item - during - - response generation. + description: Emitted when a new content part is added. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.content_part.added`. enum: - response.content_part.added - description: The event type, must be `response.content_part.added`. - x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item to which the content part was added. - output_index: - type: integer - description: The index of the output item in the response. - content_index: - type: integer - description: The index of the content part in the item's content array. - part: - type: object - description: The content part that was added. - properties: - type: - type: string - enum: - - audio - - text - description: The content type ("text", "audio"). - text: - type: string - description: The text content (if type is "text"). - audio: - type: string - description: Base64-encoded audio data (if type is "audio"). - transcript: - type: string - description: The transcript of the audio (if type is "audio"). + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the content part was added to. + output_index: + type: integer + description: | + The index of the output item that the content part was added to. + content_index: + type: integer + description: | + The index of the content part that was added. + part: + $ref: '#/components/schemas/OutputContent' + description: | + The content part that was added. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - response_id - item_id - output_index - content_index - part + - sequence_number x-oaiMeta: name: response.content_part.added - group: realtime + group: responses example: | { - "event_id": "event_3738", - "type": "response.content_part.added", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "part": { - "type": "text", - "text": "" - } + "type": "response.content_part.added", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "part": { + "type": "output_text", + "text": "", + "annotations": [] + }, + "sequence_number": 1 } - RealtimeBetaServerEventResponseContentPartDone: + ResponseContentPartDoneEvent: type: object - description: > - Returned when a content part is done streaming in an assistant message - item. - - Also emitted when a Response is interrupted, incomplete, or cancelled. + description: Emitted when a content part is done. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.content_part.done`. enum: - response.content_part.done - description: The event type, must be `response.content_part.done`. x-stainless-const: true - response_id: - type: string - description: The ID of the response. item_id: type: string - description: The ID of the item. + description: | + The ID of the output item that the content part was added to. output_index: type: integer - description: The index of the output item in the response. + description: | + The index of the output item that the content part was added to. content_index: type: integer - description: The index of the content part in the item's content array. + description: | + The index of the content part that is done. + sequence_number: + type: integer + description: The sequence number of this event. part: - type: object - description: The content part that is done. - properties: - type: - type: string - enum: - - audio - - text - description: The content type ("text", "audio"). - text: - type: string - description: The text content (if type is "text"). - audio: - type: string - description: Base64-encoded audio data (if type is "audio"). - transcript: - type: string - description: The transcript of the audio (if type is "audio"). + $ref: '#/components/schemas/OutputContent' + description: | + The content part that is done. required: - - event_id - type - - response_id - item_id - output_index - content_index - part + - sequence_number x-oaiMeta: name: response.content_part.done - group: realtime + group: responses example: | { - "event_id": "event_3940", - "type": "response.content_part.done", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "part": { - "type": "text", - "text": "Sure, I can help with that." - } + "type": "response.content_part.done", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "sequence_number": 1, + "part": { + "type": "output_text", + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "annotations": [] + } } - RealtimeBetaServerEventResponseCreated: + ResponseCreatedEvent: type: object - description: > - Returned when a new Response is created. The first event of response - creation, - - where the response is in an initial state of `in_progress`. + description: | + An event that is emitted when a response is created. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.created`. enum: - response.created - description: The event type, must be `response.created`. x-stainless-const: true response: - $ref: '#/components/schemas/RealtimeBetaResponse' + $ref: '#/components/schemas/Response' + description: | + The response that was created. + sequence_number: + type: integer + description: The sequence number for this event. required: - - event_id - type - response + - sequence_number x-oaiMeta: name: response.created - group: realtime + group: responses example: | { "type": "response.created", - "event_id": "event_C9G8pqbTEddBSIxbBN6Os", "response": { - "object": "realtime.response", - "id": "resp_C9G8p7IH2WxLbkgPNouYL", + "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", + "object": "response", + "created_at": 1741487325, "status": "in_progress", - "status_details": null, + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", "output": [], - "conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN", - "output_modalities": [ - "audio" - ], - "max_output_tokens": "inf", - "audio": { - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "marin" + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" } }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", "usage": null, - "metadata": null + "user": null, + "metadata": {} }, - "timestamp": "2:30:35 PM" + "sequence_number": 1 } - RealtimeBetaServerEventResponseDone: + ResponseCustomToolCallInputDeltaEvent: + title: ResponseCustomToolCallInputDelta type: object description: > - Returned when a Response is done streaming. Always emitted, no matter - the - - final state. The Response object included in the `response.done` event - will - - include all output Items in the Response but will omit the raw audio - data. + Event representing a delta (partial update) to the input of a custom + tool call. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - response.done - description: The event type, must be `response.done`. + - response.custom_tool_call_input.delta + description: The event type identifier. x-stainless-const: true - response: - $ref: '#/components/schemas/RealtimeBetaResponse' + sequence_number: + type: integer + description: The sequence number of this event. + output_index: + type: integer + description: The index of the output this delta applies to. + item_id: + type: string + description: Unique identifier for the API item associated with this event. + delta: + type: string + description: The incremental input data (delta) for the custom tool call. required: - - event_id - type - - response + - output_index + - item_id + - delta + - sequence_number x-oaiMeta: - name: response.done - group: realtime + name: response.custom_tool_call_input.delta + group: responses example: | { - "event_id": "event_3132", - "type": "response.done", - "response": { - "id": "resp_001", - "object": "realtime.response", - "status": "completed", - "status_details": null, - "output": [ - { - "id": "msg_006", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "text", - "text": "Sure, how can I assist you today?" - } - ] - } - ], - "usage": { - "total_tokens":275, - "input_tokens":127, - "output_tokens":148, - "input_token_details": { - "cached_tokens":384, - "text_tokens":119, - "audio_tokens":8, - "cached_tokens_details": { - "text_tokens": 128, - "audio_tokens": 256 - } - }, - "output_token_details": { - "text_tokens":36, - "audio_tokens":112 - } - } - } + "type": "response.custom_tool_call_input.delta", + "output_index": 0, + "item_id": "ctc_1234567890abcdef", + "delta": "partial input text" } - RealtimeBetaServerEventResponseFunctionCallArgumentsDelta: + ResponseCustomToolCallInputDoneEvent: + title: ResponseCustomToolCallInputDone type: object description: | - Returned when the model-generated function call arguments are updated. + Event indicating that input for a custom tool call is complete. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - response.function_call_arguments.delta - description: | - The event type, must be `response.function_call_arguments.delta`. + - response.custom_tool_call_input.done + description: The event type identifier. x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the function call item. + sequence_number: + type: integer + description: The sequence number of this event. output_index: type: integer - description: The index of the output item in the response. - call_id: + description: The index of the output this event applies to. + item_id: type: string - description: The ID of the function call. - delta: + description: Unique identifier for the API item associated with this event. + input: type: string - description: The arguments delta as a JSON string. + description: The complete input data for the custom tool call. required: - - event_id - type - - response_id - - item_id - output_index - - call_id - - delta + - item_id + - input + - sequence_number x-oaiMeta: - name: response.function_call_arguments.delta - group: realtime + name: response.custom_tool_call_input.done + group: responses example: | { - "event_id": "event_5354", - "type": "response.function_call_arguments.delta", - "response_id": "resp_002", - "item_id": "fc_001", - "output_index": 0, - "call_id": "call_001", - "delta": "{\"location\": \"San\"" + "type": "response.custom_tool_call_input.done", + "output_index": 0, + "item_id": "ctc_1234567890abcdef", + "input": "final complete input text" } - RealtimeBetaServerEventResponseFunctionCallArgumentsDone: + ResponseError: + anyOf: + - type: object + description: > + An error object returned when the model fails to generate a + Response. + properties: + code: + $ref: '#/components/schemas/ResponseErrorCode' + message: + type: string + description: | + A human-readable description of the error. + required: + - code + - message + - type: 'null' + ResponseErrorCode: + type: string + description: | + The error code for the response. + enum: + - server_error + - rate_limit_exceeded + - invalid_prompt + - bio_policy + - vector_store_timeout + - invalid_image + - invalid_image_format + - invalid_base64_image + - invalid_image_url + - image_too_large + - image_too_small + - image_parse_error + - image_content_policy_violation + - invalid_image_mode + - image_file_too_large + - unsupported_image_media_type + - empty_image_file + - failed_to_download_image + - image_file_not_found + ResponseErrorEvent: type: object - description: > - Returned when the model-generated function call arguments are done - streaming. - - Also emitted when a Response is interrupted, incomplete, or cancelled. + description: Emitted when an error occurs. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string - enum: - - response.function_call_arguments.done description: | - The event type, must be `response.function_call_arguments.done`. + The type of the event. Always `error`. + enum: + - error x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: + code: + anyOf: + - type: string + description: | + The error code. + - type: 'null' + message: type: string - description: The ID of the function call item. - output_index: + description: | + The error message. + param: + anyOf: + - type: string + description: | + The error parameter. + - type: 'null' + sequence_number: type: integer - description: The index of the output item in the response. - call_id: - type: string - description: The ID of the function call. - name: - type: string - description: The name of the function that was called. - arguments: + description: The sequence number of this event. + required: + - type + - code + - message + - param + - sequence_number + x-oaiMeta: + name: error + group: responses + example: | + { + "type": "error", + "code": "ERR_SOMETHING", + "message": "Something went wrong", + "param": null, + "sequence_number": 1 + } + ResponseFailedEvent: + type: object + description: | + An event that is emitted when a response fails. + properties: + type: type: string - description: The final arguments as a JSON string. + description: | + The type of the event. Always `response.failed`. + enum: + - response.failed + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number of this event. + response: + $ref: '#/components/schemas/Response' + description: | + The response that failed. required: - - event_id - type - - response_id - - item_id - - output_index - - call_id - - name - - arguments + - response + - sequence_number x-oaiMeta: - name: response.function_call_arguments.done - group: realtime + name: response.failed + group: responses example: | { - "event_id": "event_5556", - "type": "response.function_call_arguments.done", - "response_id": "resp_002", - "item_id": "fc_001", - "output_index": 0, - "call_id": "call_001", - "name": "get_weather", - "arguments": "{\"location\": \"San Francisco\"}" + "type": "response.failed", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "failed", + "completed_at": null, + "error": { + "code": "server_error", + "message": "The model failed to generate a response." + }, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + } } - RealtimeBetaServerEventResponseMCPCallArgumentsDelta: + ResponseFileSearchCallCompletedEvent: type: object - description: >- - Returned when MCP tool call arguments are updated during response - generation. + description: Emitted when a file search call is completed (results found). properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.file_search_call.completed`. enum: - - response.mcp_call_arguments.delta - description: The event type, must be `response.mcp_call_arguments.delta`. + - response.file_search_call.completed x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the MCP tool call item. output_index: type: integer - description: The index of the output item in the response. - delta: + description: | + The index of the output item that the file search call is initiated. + item_id: type: string - description: The JSON-encoded arguments delta. - obfuscation: - anyOf: - - type: string - description: If present, indicates the delta text was obfuscated. - - type: 'null' + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - response_id - - item_id - output_index - - delta + - item_id + - sequence_number x-oaiMeta: - name: response.mcp_call_arguments.delta - group: realtime + name: response.file_search_call.completed + group: responses example: | { - "event_id": "event_6201", - "type": "response.mcp_call_arguments.delta", - "response_id": "resp_001", - "item_id": "mcp_call_001", - "output_index": 0, - "delta": "{\"partial\":true}" + "type": "response.file_search_call.completed", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 } - RealtimeBetaServerEventResponseMCPCallArgumentsDone: + ResponseFileSearchCallInProgressEvent: type: object - description: >- - Returned when MCP tool call arguments are finalized during response - generation. + description: Emitted when a file search call is initiated. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: > + The type of the event. Always + `response.file_search_call.in_progress`. enum: - - response.mcp_call_arguments.done - description: The event type, must be `response.mcp_call_arguments.done`. + - response.file_search_call.in_progress x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the MCP tool call item. output_index: type: integer - description: The index of the output item in the response. - arguments: + description: | + The index of the output item that the file search call is initiated. + item_id: type: string - description: The final JSON-encoded arguments string. + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - response_id - - item_id - output_index - - arguments + - item_id + - sequence_number x-oaiMeta: - name: response.mcp_call_arguments.done - group: realtime + name: response.file_search_call.in_progress + group: responses example: | { - "event_id": "event_6202", - "type": "response.mcp_call_arguments.done", - "response_id": "resp_001", - "item_id": "mcp_call_001", - "output_index": 0, - "arguments": "{\"q\":\"docs\"}" + "type": "response.file_search_call.in_progress", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 } - RealtimeBetaServerEventResponseMCPCallCompleted: + ResponseFileSearchCallSearchingEvent: type: object - description: Returned when an MCP tool call has completed successfully. + description: Emitted when a file search is currently searching. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.file_search_call.searching`. enum: - - response.mcp_call.completed - description: The event type, must be `response.mcp_call.completed`. + - response.file_search_call.searching x-stainless-const: true output_index: type: integer - description: The index of the output item in the response. + description: | + The index of the output item that the file search call is searching. item_id: type: string - description: The ID of the MCP tool call item. + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - output_index - item_id + - sequence_number x-oaiMeta: - name: response.mcp_call.completed - group: realtime + name: response.file_search_call.searching + group: responses example: | { - "event_id": "event_6302", - "type": "response.mcp_call.completed", - "output_index": 0, - "item_id": "mcp_call_001" + "type": "response.file_search_call.searching", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 } - RealtimeBetaServerEventResponseMCPCallFailed: + ResponseFormatJsonObject: type: object - description: Returned when an MCP tool call has failed. + title: JSON object + description: > + JSON object response format. An older method of generating JSON + responses. + + Using `json_schema` is recommended for models that support it. Note that + the + + model will not generate JSON without a system or user message + instructing it + + to do so. properties: - event_id: + type: type: string - description: The unique ID of the server event. + description: The type of response format being defined. Always `json_object`. + enum: + - json_object + x-stainless-const: true + required: + - type + ResponseFormatJsonSchema: + type: object + title: JSON schema + description: | + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). + properties: type: type: string + description: The type of response format being defined. Always `json_schema`. enum: - - response.mcp_call.failed - description: The event type, must be `response.mcp_call.failed`. + - json_schema x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response. - item_id: + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: > + A description of what the response format is for, used by the + model to + + determine how to respond in the format. + name: + type: string + description: > + The name of the response format. Must be a-z, A-Z, 0-9, or + contain + + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: > + Whether to enable strict schema adherence when generating + the output. + + If set to true, the model will always follow the exact + schema defined + + in the `schema` field. Only a subset of JSON Schema is + supported when + + `strict` is `true`. To learn more, read the [Structured + Outputs + + guide](/docs/guides/structured-outputs). + - type: 'null' + required: + - name + required: + - type + - json_schema + ResponseFormatJsonSchemaSchema: + type: object + title: JSON schema + description: | + The schema for the response format, described as a JSON Schema object. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + ResponseFormatText: + type: object + title: Text + description: | + Default response format. Used to generate text responses. + properties: + type: type: string - description: The ID of the MCP tool call item. + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true required: - - event_id - type - - output_index - - item_id - x-oaiMeta: - name: response.mcp_call.failed - group: realtime - example: | - { - "event_id": "event_6303", - "type": "response.mcp_call.failed", - "output_index": 0, - "item_id": "mcp_call_001" - } - RealtimeBetaServerEventResponseMCPCallInProgress: + ResponseFormatTextGrammar: type: object - description: Returned when an MCP tool call has started and is in progress. + title: Text grammar + description: | + A custom grammar for the model to follow when generating text. + Learn more in the [custom grammars guide](/docs/guides/custom-grammars). properties: - event_id: + type: type: string - description: The unique ID of the server event. + description: The type of response format being defined. Always `grammar`. + enum: + - grammar + x-stainless-const: true + grammar: + type: string + description: The custom grammar for the model to follow. + required: + - type + - grammar + ResponseFormatTextPython: + type: object + title: Python grammar + description: | + Configure the model to generate valid Python code. See the + [custom grammars guide](/docs/guides/custom-grammars) for more details. + properties: type: type: string + description: The type of response format being defined. Always `python`. enum: - - response.mcp_call.in_progress - description: The event type, must be `response.mcp_call.in_progress`. + - python + x-stainless-const: true + required: + - type + ResponseFunctionCallArgumentsDeltaEvent: + type: object + description: Emitted when there is a partial function-call arguments delta. + properties: + type: + type: string + description: > + The type of the event. Always + `response.function_call_arguments.delta`. + enum: + - response.function_call_arguments.delta x-stainless-const: true + item_id: + type: string + description: > + The ID of the output item that the function-call arguments delta is + added to. output_index: type: integer - description: The index of the output item in the response. - item_id: + description: > + The index of the output item that the function-call arguments delta + is added to. + sequence_number: + type: integer + description: The sequence number of this event. + delta: type: string - description: The ID of the MCP tool call item. + description: | + The function-call arguments delta that is added. required: - - event_id - type - - output_index - item_id + - output_index + - delta + - sequence_number x-oaiMeta: - name: response.mcp_call.in_progress - group: realtime + name: response.function_call_arguments.delta + group: responses example: | { - "event_id": "event_6301", - "type": "response.mcp_call.in_progress", - "output_index": 0, - "item_id": "mcp_call_001" + "type": "response.function_call_arguments.delta", + "item_id": "item-abc", + "output_index": 0, + "delta": "{ \"arg\":" + "sequence_number": 1 } - RealtimeBetaServerEventResponseOutputItemAdded: + ResponseFunctionCallArgumentsDoneEvent: type: object - description: Returned when a new Item is created during Response generation. + description: Emitted when function-call arguments are finalized. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - response.output_item.added - description: The event type, must be `response.output_item.added`. + - response.function_call_arguments.done x-stainless-const: true - response_id: + item_id: type: string - description: The ID of the Response to which the item belongs. + description: The ID of the item. + name: + type: string + description: The name of the function that was called. output_index: type: integer - description: The index of the output item in the Response. - item: - $ref: '#/components/schemas/RealtimeConversationItem' + description: The index of the output item. + sequence_number: + type: integer + description: The sequence number of this event. + arguments: + type: string + description: The function-call arguments. required: - - event_id - type - - response_id + - item_id + - name - output_index - - item + - arguments + - sequence_number x-oaiMeta: - name: response.output_item.added - group: realtime + name: response.function_call_arguments.done + group: responses example: | { - "event_id": "event_3334", - "type": "response.output_item.added", - "response_id": "resp_001", - "output_index": 0, - "item": { - "id": "msg_007", - "object": "realtime.item", - "type": "message", - "status": "in_progress", - "role": "assistant", - "content": [] - } + "type": "response.function_call_arguments.done", + "item_id": "item-abc", + "name": "get_weather", + "output_index": 1, + "arguments": "{ \"arg\": 123 }", + "sequence_number": 1 } - RealtimeBetaServerEventResponseOutputItemDone: + ResponseImageGenCallCompletedEvent: type: object + title: ResponseImageGenCallCompletedEvent description: > - Returned when an Item is done streaming. Also emitted when a Response - is - - interrupted, incomplete, or cancelled. + Emitted when an image generation tool call has completed and the final + image is available. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - response.output_item.done - description: The event type, must be `response.output_item.done`. + - response.image_generation_call.completed + description: >- + The type of the event. Always + 'response.image_generation_call.completed'. x-stainless-const: true - response_id: - type: string - description: The ID of the Response to which the item belongs. output_index: type: integer - description: The index of the output item in the Response. - item: - $ref: '#/components/schemas/RealtimeConversationItem' + description: The index of the output item in the response's output array. + sequence_number: + type: integer + description: The sequence number of this event. + item_id: + type: string + description: The unique identifier of the image generation item being processed. required: - - event_id - type - - response_id - output_index - - item + - item_id + - sequence_number x-oaiMeta: - name: response.output_item.done - group: realtime + name: response.image_generation_call.completed + group: responses example: | { - "event_id": "event_3536", - "type": "response.output_item.done", - "response_id": "resp_001", - "output_index": 0, - "item": { - "id": "msg_007", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "text", - "text": "Sure, I can help with that." - } - ] - } + "type": "response.image_generation_call.completed", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 1 } - RealtimeBetaServerEventResponseTextDelta: + ResponseImageGenCallGeneratingEvent: type: object - description: >- - Returned when the text value of an "output_text" content part is - updated. + title: ResponseImageGenCallGeneratingEvent + description: > + Emitted when an image generation tool call is actively generating an + image (intermediate state). properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - response.output_text.delta - description: The event type, must be `response.output_text.delta`. + - response.image_generation_call.generating + description: >- + The type of the event. Always + 'response.image_generation_call.generating'. x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item. output_index: type: integer - description: The index of the output item in the response. - content_index: - type: integer - description: The index of the content part in the item's content array. - delta: + description: The index of the output item in the response's output array. + item_id: type: string - description: The text delta. + description: The unique identifier of the image generation item being processed. + sequence_number: + type: integer + description: The sequence number of the image generation item being processed. required: - - event_id - type - - response_id - - item_id - output_index - - content_index - - delta + - item_id + - sequence_number x-oaiMeta: - name: response.output_text.delta - group: realtime + name: response.image_generation_call.generating + group: responses example: | { - "event_id": "event_4142", - "type": "response.output_text.delta", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "delta": "Sure, I can h" + "type": "response.image_generation_call.generating", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0 } - RealtimeBetaServerEventResponseTextDone: + ResponseImageGenCallInProgressEvent: type: object - description: > - Returned when the text value of an "output_text" content part is done - streaming. Also - - emitted when a Response is interrupted, incomplete, or cancelled. + title: ResponseImageGenCallInProgressEvent + description: | + Emitted when an image generation tool call is in progress. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - response.output_text.done - description: The event type, must be `response.output_text.done`. + - response.image_generation_call.in_progress + description: >- + The type of the event. Always + 'response.image_generation_call.in_progress'. x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item. output_index: type: integer - description: The index of the output item in the response. - content_index: - type: integer - description: The index of the content part in the item's content array. - text: + description: The index of the output item in the response's output array. + item_id: type: string - description: The final text content. + description: The unique identifier of the image generation item being processed. + sequence_number: + type: integer + description: The sequence number of the image generation item being processed. required: - - event_id - type - - response_id - - item_id - output_index - - content_index - - text + - item_id + - sequence_number x-oaiMeta: - name: response.output_text.done - group: realtime + name: response.image_generation_call.in_progress + group: responses example: | { - "event_id": "event_4344", - "type": "response.output_text.done", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "text": "Sure, I can help with that." + "type": "response.image_generation_call.in_progress", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0 } - RealtimeBetaServerEventSessionCreated: + ResponseImageGenCallPartialImageEvent: type: object + title: ResponseImageGenCallPartialImageEvent description: > - Returned when a Session is created. Emitted automatically when a new - - connection is established as the first server event. This event will - contain - - the default Session configuration. + Emitted when a partial image is available during image generation + streaming. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - session.created - description: The event type, must be `session.created`. + - response.image_generation_call.partial_image + description: >- + The type of the event. Always + 'response.image_generation_call.partial_image'. x-stainless-const: true - session: - $ref: '#/components/schemas/RealtimeSession' + output_index: + type: integer + description: The index of the output item in the response's output array. + item_id: + type: string + description: The unique identifier of the image generation item being processed. + sequence_number: + type: integer + description: The sequence number of the image generation item being processed. + partial_image_index: + type: integer + description: >- + 0-based index for the partial image (backend is 1-based, but this is + 0-based for the user). + partial_image_b64: + type: string + description: >- + Base64-encoded partial image data, suitable for rendering as an + image. required: - - event_id - type - - session + - output_index + - item_id + - sequence_number + - partial_image_index + - partial_image_b64 x-oaiMeta: - name: session.created - group: realtime + name: response.image_generation_call.partial_image + group: responses example: | { - "type": "session.created", - "event_id": "event_C9G5RJeJ2gF77mV7f2B1j", - "session": { - "object": "realtime.session", - "id": "sess_C9G5QPteg4UIbotdKLoYQ", - "model": "gpt-realtime-2025-08-28", - "modalities": [ - "audio" - ], - "instructions": "Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.", - "tools": [], - "tool_choice": "auto", - "max_response_output_tokens": "inf", - "tracing": null, - "prompt": null, - "expires_at": 1756324625, - "input_audio_format": "pcm16", - "input_audio_transcription": null, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200, - "idle_timeout_ms": null, - "create_response": true, - "interrupt_response": true - }, - "output_audio_format": "pcm16", - "voice": "marin", - "include": null - } + "type": "response.image_generation_call.partial_image", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0, + "partial_image_index": 0, + "partial_image_b64": "..." } - RealtimeBetaServerEventSessionUpdated: + ResponseInProgressEvent: type: object - description: | - Returned when a session is updated with a `session.update` event, unless - there is an error. + description: Emitted when the response is in progress. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.in_progress`. enum: - - session.updated - description: The event type, must be `session.updated`. + - response.in_progress x-stainless-const: true - session: - $ref: '#/components/schemas/RealtimeSession' + response: + $ref: '#/components/schemas/Response' + description: | + The response that is in progress. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - session + - response + - sequence_number x-oaiMeta: - name: session.updated - group: realtime + name: response.in_progress + group: responses example: | { - "event_id": "event_5678", - "type": "session.updated", - "session": { - "id": "sess_001", - "object": "realtime.session", - "model": "gpt-realtime", - "modalities": ["text"], - "instructions": "New instructions", - "voice": "sage", - "input_audio_format": "pcm16", - "output_audio_format": "pcm16", - "input_audio_transcription": { - "model": "whisper-1" - }, - "turn_detection": null, - "tools": [], - "tool_choice": "none", - "temperature": 0.7, - "max_response_output_tokens": 200, - "speed": 1.1, - "tracing": "auto" - } + "type": "response.in_progress", + "response": { + "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", + "object": "response", + "created_at": 1741487325, + "status": "in_progress", + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", + "output": [], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 } - RealtimeBetaServerEventTranscriptionSessionCreated: + ResponseIncompleteEvent: type: object description: | - Returned when a transcription session is created. + An event that is emitted when a response finishes as incomplete. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `response.incomplete`. enum: - - transcription_session.created - description: The event type, must be `transcription_session.created`. + - response.incomplete x-stainless-const: true - session: - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' + response: + $ref: '#/components/schemas/Response' + description: | + The response that was incomplete. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - session + - response + - sequence_number x-oaiMeta: - name: transcription_session.created - group: realtime + name: response.incomplete + group: responses example: | { - "event_id": "event_5566", - "type": "transcription_session.created", - "session": { - "id": "sess_001", - "object": "realtime.transcription_session", - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "prompt": "", - "language": "" - }, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 500 + "type": "response.incomplete", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "incomplete", + "completed_at": null, + "error": null, + "incomplete_details": { + "reason": "max_tokens" }, - "input_audio_noise_reduction": { - "type": "near_field" + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } }, - "include": [] - } + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 } - RealtimeBetaServerEventTranscriptionSessionUpdated: + ResponseItemList: type: object - description: > - Returned when a transcription session is updated with a - `transcription_session.update` event, unless - - there is an error. + description: A list of Response items. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string + description: The type of object returned, must be `list`. enum: - - transcription_session.updated - description: The event type, must be `transcription_session.updated`. + - list x-stainless-const: true - session: - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' + data: + type: array + description: A list of items used to generate this response. + items: + $ref: '#/components/schemas/ItemResource' + has_more: + type: boolean + description: Whether there are more items available. + first_id: + type: string + description: The ID of the first item in the list. + last_id: + type: string + description: The ID of the last item in the list. required: - - event_id - - type - - session + - object + - data + - has_more + - first_id + - last_id x-oaiMeta: - name: transcription_session.updated - group: realtime + name: The input item list + group: responses example: | { - "event_id": "event_5678", - "type": "transcription_session.updated", - "session": { - "id": "sess_001", - "object": "realtime.transcription_session", - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "prompt": "", - "language": "" - }, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 500, - "create_response": true, - // "interrupt_response": false -- this will NOT be returned - }, - "input_audio_noise_reduction": { - "type": "near_field" - }, - "include": [ - "item.input_audio_transcription.avg_logprob", - ], - } + "object": "list", + "data": [ + { + "id": "msg_abc123", + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Tell me a three sentence bedtime story about a unicorn." + } + ] + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc123", + "has_more": false } - RealtimeCallCreateRequest: - title: Realtime call creation request - type: object - description: >- - Parameters required to initiate a realtime call and receive the SDP - answer - - needed to complete a WebRTC peer connection. Provide an SDP offer - generated - - by your client and optionally configure the session that will answer the - call. - required: - - sdp - properties: - sdp: - type: string - description: >- - WebRTC Session Description Protocol (SDP) offer generated by the - caller. - session: - title: Session configuration - allOf: - - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' - description: >- - Optional session configuration to apply before the realtime session - is - - created. Use the same parameters you would send in a [`create client - secret`](/docs/api-reference/realtime-sessions/create-realtime-client-secret) - - request. - additionalProperties: false - RealtimeCallReferRequest: - title: Realtime call refer request - type: object - description: >- - Parameters required to transfer a SIP call to a new destination using - the - - Realtime API. - required: - - target_uri - properties: - target_uri: - type: string - description: >- - URI that should appear in the SIP Refer-To header. Supports values - like - - `tel:+14155550123` or `sip:agent@example.com`. - example: tel:+14155550123 - additionalProperties: false - RealtimeCallRejectRequest: - title: Realtime call reject request - type: object - description: >- - Parameters used to decline an incoming SIP call handled by the Realtime - API. - properties: - status_code: - type: integer - description: >- - SIP response code to send back to the caller. Defaults to `603` - (Decline) - - when omitted. - example: 486 - additionalProperties: false - RealtimeClientEvent: - discriminator: - propertyName: type - description: | - A realtime client event. - anyOf: - - $ref: '#/components/schemas/RealtimeClientEventConversationItemCreate' - - $ref: '#/components/schemas/RealtimeClientEventConversationItemDelete' - - $ref: '#/components/schemas/RealtimeClientEventConversationItemRetrieve' - - $ref: '#/components/schemas/RealtimeClientEventConversationItemTruncate' - - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferAppend' - - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferClear' - - $ref: '#/components/schemas/RealtimeClientEventOutputAudioBufferClear' - - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferCommit' - - $ref: '#/components/schemas/RealtimeClientEventResponseCancel' - - $ref: '#/components/schemas/RealtimeClientEventResponseCreate' - - $ref: '#/components/schemas/RealtimeClientEventSessionUpdate' - RealtimeClientEventConversationItemCreate: + ResponseLogProb: type: object description: > - Add a new Item to the Conversation's context, including messages, - function - - calls, and function call responses. This event can be used both to - populate a - - "history" of the conversation and to add new items mid-stream, but has - the - - current limitation that it cannot populate assistant audio messages. - + A logprob is the logarithmic probability that the model assigns to + producing - If successful, the server will respond with a - `conversation.item.created` + a particular token at a given position in the sequence. Less-negative + (higher) - event, otherwise an `error` event will be sent. + logprob values indicate greater model confidence in that token choice. properties: - event_id: + token: + description: A possible text token. type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. + logprob: + description: | + The log probability of this token. + type: number + top_logprobs: + description: | + The log probabilities of up to 20 of the most likely tokens. + type: array + items: + type: object + properties: + token: + description: A possible text token. + type: string + logprob: + description: The log probability of this token. + type: number + required: + - token + - logprob + ResponseMCPCallArgumentsDeltaEvent: + type: object + title: ResponseMCPCallArgumentsDeltaEvent + description: > + Emitted when there is a delta (partial update) to the arguments of an + MCP tool call. + properties: type: type: string enum: - - conversation.item.create - description: The event type, must be `conversation.item.create`. + - response.mcp_call_arguments.delta + description: The type of the event. Always 'response.mcp_call_arguments.delta'. x-stainless-const: true - previous_item_id: + output_index: + type: integer + description: The index of the output item in the response's output array. + item_id: + type: string + description: The unique identifier of the MCP tool call item being processed. + delta: type: string description: > - 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. - - - If set to `root`, the new item will be added to the beginning of the - conversation. - - - 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. - item: - $ref: '#/components/schemas/RealtimeConversationItem' + A JSON string containing the partial update to the arguments for the + MCP tool call. + sequence_number: + type: integer + description: The sequence number of this event. required: - type - - item + - output_index + - item_id + - delta + - sequence_number x-oaiMeta: - name: conversation.item.create - group: realtime + name: response.mcp_call_arguments.delta + group: responses example: | { - "type": "conversation.item.create", - "item": { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "hi" - } - ] - } + "type": "response.mcp_call_arguments.delta", + "output_index": 0, + "item_id": "item-abc", + "delta": "{", + "sequence_number": 1 } - RealtimeClientEventConversationItemDelete: + ResponseMCPCallArgumentsDoneEvent: type: object - description: > - Send this event when you want to remove any item from the conversation - - history. The server will respond with a `conversation.item.deleted` - event, - - unless the item does not exist in the conversation history, in which - case the - - server will respond with an error. + title: ResponseMCPCallArgumentsDoneEvent + description: | + Emitted when the arguments for an MCP tool call are finalized. properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. type: type: string enum: - - conversation.item.delete - description: The event type, must be `conversation.item.delete`. + - response.mcp_call_arguments.done + description: The type of the event. Always 'response.mcp_call_arguments.done'. x-stainless-const: true + output_index: + type: integer + description: The index of the output item in the response's output array. item_id: type: string - description: The ID of the item to delete. + description: The unique identifier of the MCP tool call item being processed. + arguments: + type: string + description: > + A JSON string containing the finalized arguments for the MCP tool + call. + sequence_number: + type: integer + description: The sequence number of this event. required: - type + - output_index - item_id + - arguments + - sequence_number x-oaiMeta: - name: conversation.item.delete - group: realtime + name: response.mcp_call_arguments.done + group: responses example: | { - "event_id": "event_901", - "type": "conversation.item.delete", - "item_id": "item_003" + "type": "response.mcp_call_arguments.done", + "output_index": 0, + "item_id": "item-abc", + "arguments": "{\"arg1\": \"value1\", \"arg2\": \"value2\"}", + "sequence_number": 1 } - RealtimeClientEventConversationItemRetrieve: + ResponseMCPCallCompletedEvent: type: object - description: > - Send 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. - - The server will respond with a `conversation.item.retrieved` event, - - unless the item does not exist in the conversation history, in which - case the - - server will respond with an error. + title: ResponseMCPCallCompletedEvent + description: | + Emitted when an MCP tool call has completed successfully. properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. type: type: string enum: - - conversation.item.retrieve - description: The event type, must be `conversation.item.retrieve`. + - response.mcp_call.completed + description: The type of the event. Always 'response.mcp_call.completed'. x-stainless-const: true item_id: type: string - description: The ID of the item to retrieve. + description: The ID of the MCP tool call item that completed. + output_index: + type: integer + description: The index of the output item that completed. + sequence_number: + type: integer + description: The sequence number of this event. required: - type - item_id + - output_index + - sequence_number x-oaiMeta: - name: conversation.item.retrieve - group: realtime + name: response.mcp_call.completed + group: responses example: | { - "event_id": "event_901", - "type": "conversation.item.retrieve", - "item_id": "item_003" + "type": "response.mcp_call.completed", + "sequence_number": 1, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", + "output_index": 0 } - RealtimeClientEventConversationItemTruncate: + ResponseMCPCallFailedEvent: type: object - description: > - Send this event to truncate a previous assistant message’s audio. The - server - - will produce audio faster than realtime, so this event is useful when - the user - - interrupts to truncate audio that has already been sent to the client - but not - - yet played. This will synchronize the server's understanding of the - audio with - - the client's playback. - - - Truncating audio will delete the server-side text transcript to ensure - there - - is not text in the context that hasn't been heard by the user. - - - If successful, the server will respond with a - `conversation.item.truncated` - - event. + title: ResponseMCPCallFailedEvent + description: | + Emitted when an MCP tool call has failed. properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. type: type: string enum: - - conversation.item.truncate - description: The event type, must be `conversation.item.truncate`. + - response.mcp_call.failed + description: The type of the event. Always 'response.mcp_call.failed'. x-stainless-const: true item_id: type: string - description: > - The ID of the assistant message item to truncate. Only assistant - message - - items can be truncated. - content_index: + description: The ID of the MCP tool call item that failed. + output_index: type: integer - description: The index of the content part to truncate. Set this to `0`. - audio_end_ms: + description: The index of the output item that failed. + sequence_number: type: integer - description: > - Inclusive duration up to which audio is truncated, in milliseconds. - If - - the audio_end_ms is greater than the actual audio duration, the - server - - will respond with an error. + description: The sequence number of this event. required: - type - item_id - - content_index - - audio_end_ms + - output_index + - sequence_number x-oaiMeta: - name: conversation.item.truncate - group: realtime + name: response.mcp_call.failed + group: responses example: | { - "event_id": "event_678", - "type": "conversation.item.truncate", - "item_id": "item_002", - "content_index": 0, - "audio_end_ms": 1500 + "type": "response.mcp_call.failed", + "sequence_number": 1, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", + "output_index": 0 } - RealtimeClientEventInputAudioBufferAppend: + ResponseMCPCallInProgressEvent: type: object - description: > - Send this event to append audio bytes to the input audio buffer. The - audio - - buffer is temporary storage you can write to and later commit. A - "commit" will create a new - - user message item in the conversation history from the buffer content - and clear the buffer. - - Input audio transcription (if enabled) will be generated when the buffer - is committed. - - - If VAD is enabled the audio buffer is used to detect speech and the - server will decide - - when to commit. When Server VAD is disabled, you must commit the audio - buffer - - manually. Input audio noise reduction operates on writes to the audio - buffer. - - - The client may choose how much audio to place in each event up to a - maximum - - of 15 MiB, for example streaming smaller chunks from the client may - allow the - - VAD to be more responsive. Unlike most other client events, the server - will - - not send a confirmation response to this event. + title: ResponseMCPCallInProgressEvent + description: | + Emitted when an MCP tool call is in progress. properties: - event_id: + type: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. + enum: + - response.mcp_call.in_progress + description: The type of the event. Always 'response.mcp_call.in_progress'. + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number of this event. + output_index: + type: integer + description: The index of the output item in the response's output array. + item_id: + type: string + description: The unique identifier of the MCP tool call item being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.mcp_call.in_progress + group: responses + example: | + { + "type": "response.mcp_call.in_progress", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90" + } + ResponseMCPListToolsCompletedEvent: + type: object + title: ResponseMCPListToolsCompletedEvent + description: > + Emitted when the list of available MCP tools has been successfully + retrieved. + properties: type: type: string enum: - - input_audio_buffer.append - description: The event type, must be `input_audio_buffer.append`. + - response.mcp_list_tools.completed + description: The type of the event. Always 'response.mcp_list_tools.completed'. x-stainless-const: true - audio: + item_id: type: string - description: > - Base64-encoded audio bytes. This must be in the format specified by - the - - `input_audio_format` field in the session configuration. + description: The ID of the MCP tool call item that produced this output. + output_index: + type: integer + description: The index of the output item that was processed. + sequence_number: + type: integer + description: The sequence number of this event. required: - type - - audio + - item_id + - output_index + - sequence_number x-oaiMeta: - name: input_audio_buffer.append - group: realtime + name: response.mcp_list_tools.completed + group: responses example: | { - "event_id": "event_456", - "type": "input_audio_buffer.append", - "audio": "Base64EncodedAudioData" + "type": "response.mcp_list_tools.completed", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" } - RealtimeClientEventInputAudioBufferClear: + ResponseMCPListToolsFailedEvent: type: object + title: ResponseMCPListToolsFailedEvent description: | - Send this event to clear the audio bytes in the buffer. The server will - respond with an `input_audio_buffer.cleared` event. + Emitted when the attempt to list available MCP tools has failed. properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. type: type: string enum: - - input_audio_buffer.clear - description: The event type, must be `input_audio_buffer.clear`. + - response.mcp_list_tools.failed + description: The type of the event. Always 'response.mcp_list_tools.failed'. x-stainless-const: true + item_id: + type: string + description: The ID of the MCP tool call item that failed. + output_index: + type: integer + description: The index of the output item that failed. + sequence_number: + type: integer + description: The sequence number of this event. required: - type + - item_id + - output_index + - sequence_number x-oaiMeta: - name: input_audio_buffer.clear - group: realtime + name: response.mcp_list_tools.failed + group: responses example: | { - "event_id": "event_012", - "type": "input_audio_buffer.clear" + "type": "response.mcp_list_tools.failed", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" } - RealtimeClientEventInputAudioBufferCommit: + ResponseMCPListToolsInProgressEvent: type: object + title: ResponseMCPListToolsInProgressEvent description: > - Send 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. + Emitted when the system is in the process of retrieving the list of + available MCP tools. + properties: + type: + type: string + enum: + - response.mcp_list_tools.in_progress + description: The type of the event. Always 'response.mcp_list_tools.in_progress'. + x-stainless-const: true + item_id: + type: string + description: The ID of the MCP tool call item that is being processed. + output_index: + type: integer + description: The index of the output item that is being processed. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_list_tools.in_progress + group: responses + example: | + { + "type": "response.mcp_list_tools.in_progress", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" + } + ResponseModalities: + anyOf: + - type: array + description: > + Output types that you would like the model to generate. + Most models are capable of generating text, which is the default: - Committing 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. + + `["text"]` + + + The `gpt-4o-audio-preview` model can also be used to + + [generate audio](/docs/guides/audio). To request that this model + generate + + both text and audio responses, you can use: + + + `["text", "audio"]` + items: + type: string + enum: + - text + - audio + - type: 'null' + ResponseOutputItemAddedEvent: + type: object + description: Emitted when a new output item is added. properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. type: type: string + description: | + The type of the event. Always `response.output_item.added`. enum: - - input_audio_buffer.commit - description: The event type, must be `input_audio_buffer.commit`. + - response.output_item.added x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that was added. + sequence_number: + type: integer + description: | + The sequence number of this event. + item: + $ref: '#/components/schemas/OutputItem' + description: | + The output item that was added. required: - type + - output_index + - item + - sequence_number x-oaiMeta: - name: input_audio_buffer.commit - group: realtime + name: response.output_item.added + group: responses example: | { - "event_id": "event_789", - "type": "input_audio_buffer.commit" + "type": "response.output_item.added", + "output_index": 0, + "item": { + "id": "msg_123", + "status": "in_progress", + "type": "message", + "role": "assistant", + "content": [] + }, + "sequence_number": 1 } - RealtimeClientEventOutputAudioBufferClear: + ResponseOutputItemDoneEvent: type: object - description: > - **WebRTC/SIP Only:** Emit to cut off the current audio response. This - will trigger the server to - - stop generating audio and emit a `output_audio_buffer.cleared` event. - This - - event should be preceded by a `response.cancel` client event to stop the - - generation of the current response. - - [Learn - more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + description: Emitted when an output item is marked done. properties: - event_id: - type: string - description: The unique ID of the client event used for error handling. type: type: string + description: | + The type of the event. Always `response.output_item.done`. enum: - - output_audio_buffer.clear - description: The event type, must be `output_audio_buffer.clear`. + - response.output_item.done x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that was marked done. + sequence_number: + type: integer + description: | + The sequence number of this event. + item: + $ref: '#/components/schemas/OutputItem' + description: | + The output item that was marked done. required: - type + - output_index + - item + - sequence_number x-oaiMeta: - name: output_audio_buffer.clear - group: realtime + name: response.output_item.done + group: responses example: | { - "event_id": "optional_client_event_id", - "type": "output_audio_buffer.clear" + "type": "response.output_item.done", + "output_index": 0, + "item": { + "id": "msg_123", + "status": "completed", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "annotations": [] + } + ] + }, + "sequence_number": 1 } - RealtimeClientEventResponseCancel: + ResponseOutputTextAnnotationAddedEvent: type: object - description: > - Send this event to cancel an in-progress response. The server will - respond - - with a `response.done` event with a status of - `response.status=cancelled`. If - - there is no response to cancel, the server will respond with an error. - It's safe - - to call `response.cancel` even if no response is in progress, an error - will be - - returned the session will remain unaffected. + title: ResponseOutputTextAnnotationAddedEvent + description: | + Emitted when an annotation is added to output text content. properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. type: type: string enum: - - response.cancel - description: The event type, must be `response.cancel`. + - response.output_text.annotation.added + description: >- + The type of the event. Always + 'response.output_text.annotation.added'. x-stainless-const: true - response_id: + item_id: type: string - description: | - A specific response ID to cancel - if not provided, will cancel an - in-progress response in the default conversation. + description: >- + The unique identifier of the item to which the annotation is being + added. + output_index: + type: integer + description: The index of the output item in the response's output array. + content_index: + type: integer + description: The index of the content part within the output item. + annotation_index: + type: integer + description: The index of the annotation within the content part. + sequence_number: + type: integer + description: The sequence number of this event. + annotation: + type: object + description: >- + The annotation object being added. (See annotation schema for + details.) required: - type + - item_id + - output_index + - content_index + - annotation_index + - annotation + - sequence_number x-oaiMeta: - name: response.cancel - group: realtime + name: response.output_text.annotation.added + group: responses example: | { - "type": "response.cancel", - "response_id": "resp_12345" + "type": "response.output_text.annotation.added", + "item_id": "item-abc", + "output_index": 0, + "content_index": 0, + "annotation_index": 0, + "annotation": { + "type": "text_annotation", + "text": "This is a test annotation", + "start": 0, + "end": 10 + }, + "sequence_number": 1 } - RealtimeClientEventResponseCreate: + ResponsePromptVariables: + anyOf: + - type: object + title: Prompt Variables + description: | + Optional map of values to substitute in for variables in your + prompt. The substitution values can either be strings, or other + Response input types like images or files. + x-oaiExpandable: true + x-oaiTypeLabel: map + additionalProperties: + x-oaiExpandable: true + x-oaiTypeLabel: map + oneOf: + - type: string + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/InputImageContent' + - $ref: '#/components/schemas/InputFileContent' + - type: 'null' + ResponseProperties: type: object - description: > - This event instructs the server to create a Response, which means - triggering - - model inference. When in Server VAD mode, the server will create - Responses - - automatically. - - - A Response will include at least one Item, and may have two, in which - case - - the second will be a function call. These Items will be appended to the - - conversation history by default. - - - The server will respond with a `response.created` event, events for - Items - - and content created, and finally a `response.done` event to indicate - the - - Response is complete. - - - The `response.create` event includes inference configuration like - - `instructions` and `tools`. If these are set, they will override the - Session's - - configuration for this Response only. - - - Responses can be created out-of-band of the default Conversation, - meaning that they can - - have arbitrary input, and it's possible to disable writing the output to - the Conversation. - - Only one Response can write to the default Conversation at a time, but - otherwise multiple - - Responses can be created in parallel. The `metadata` field is a good way - to disambiguate + properties: + previous_response_id: + anyOf: + - type: string + description: > + The unique ID of the previous response to the model. Use this to - multiple simultaneous Responses. + create multi-turn conversations. Learn more about + [conversation state](/docs/guides/conversation-state). Cannot be + used in conjunction with `conversation`. + - type: 'null' + model: + description: > + Model ID used to generate the response, like `gpt-4o` or `o3`. + OpenAI - Clients can set `conversation` to `none` to create a Response that does - not write to the default + offers a wide range of models with different capabilities, + performance - Conversation. Arbitrary input can be provided with the `input` field, - which is an array accepting + characteristics, and price points. Refer to the [model + guide](/docs/models) - raw Items and references to existing Items. + to browse and compare available models. + $ref: '#/components/schemas/ModelIdsResponses' + background: + anyOf: + - type: boolean + description: | + Whether to run the model response in the background. + [Learn more](/docs/guides/background). + default: false + - type: 'null' + max_tool_calls: + anyOf: + - description: > + The maximum number of total calls to built-in tools that can be + processed in a response. This maximum number applies across all + built-in tool calls, not per individual tool. Any further + attempts to call a tool by the model will be ignored. + type: integer + - type: 'null' + text: + $ref: '#/components/schemas/ResponseTextParam' + tools: + $ref: '#/components/schemas/ToolsArray' + tool_choice: + $ref: '#/components/schemas/ToolChoiceParam' + prompt: + $ref: '#/components/schemas/Prompt' + ResponseQueuedEvent: + type: object + title: ResponseQueuedEvent + description: | + Emitted when a response is queued and waiting to be processed. properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. type: type: string enum: - - response.create - description: The event type, must be `response.create`. + - response.queued + description: The type of the event. Always 'response.queued'. x-stainless-const: true response: - $ref: '#/components/schemas/RealtimeResponseCreateParams' + $ref: '#/components/schemas/Response' + description: The full response object that is queued. + sequence_number: + type: integer + description: The sequence number for this event. required: - type + - response + - sequence_number x-oaiMeta: - name: response.create - group: realtime - example: > - // Trigger a response with the default Conversation and no special - parameters - - { - "type": "response.create", - } - - - // Trigger an out-of-band response that does not write to the default - Conversation - + name: response.queued + group: responses + example: | { - "type": "response.create", + "type": "response.queued", "response": { - "instructions": "Provide a concise answer.", - "tools": [], // clear any session tools - "conversation": "none", - "output_modalities": ["text"], - "metadata": { - "response_purpose": "summarization" - }, - "input": [ - { - "type": "item_reference", - "id": "item_12345" - }, - { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Summarize the above message in one sentence." - } - ] - } - ] - } + "id": "res_123", + "status": "queued", + "created_at": "2021-01-01T00:00:00Z", + "updated_at": "2021-01-01T00:00:00Z" + }, + "sequence_number": 1 } - RealtimeClientEventSessionUpdate: + ResponseReasoningSummaryPartAddedEvent: type: object - description: > - Send this event to update the session’s configuration. - - The client may send this event at any time to update any field - - except for `voice` and `model`. `voice` can be updated only if there - have been no other audio outputs yet. - - - When the server receives a `session.update`, it will respond - - with a `session.updated` event showing the full, effective - configuration. - - Only the fields that are present in the `session.update` are updated. To - clear a field like - - `instructions`, pass an empty string. To clear a field like `tools`, - pass an empty array. - - To clear a field like `turn_detection`, pass `null`. + description: Emitted when a new reasoning summary part is added. properties: - event_id: - type: string - maxLength: 512 - description: >- - 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. type: type: string + description: > + The type of the event. Always + `response.reasoning_summary_part.added`. enum: - - session.update - description: The event type, must be `session.update`. + - response.reasoning_summary_part.added x-stainless-const: true - session: + item_id: + type: string + description: | + The ID of the item this summary part is associated with. + output_index: + type: integer + description: | + The index of the output item this summary part is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + part: type: object description: | - Update the Realtime session. Choose either a realtime - session or a transcription session. - oneOf: - - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' - - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' + The summary part that was added. + properties: + type: + type: string + description: The type of the summary part. Always `summary_text`. + enum: + - summary_text + x-stainless-const: true + text: + type: string + description: The text of the summary part. + required: + - type + - text required: - type - - session + - item_id + - output_index + - summary_index + - part + - sequence_number x-oaiMeta: - name: session.update - group: realtime + name: response.reasoning_summary_part.added + group: responses example: | { - "type": "session.update", - "session": { - "type": "realtime", - "instructions": "You are a creative assistant that helps with design tasks.", - "tools": [ - { - "type": "function", - "name": "display_color_palette", - "description": "Call this function when a user asks for a color palette.", - "parameters": { - "type": "object", - "properties": { - "theme": { - "type": "string", - "description": "Description of the theme for the color scheme." - }, - "colors": { - "type": "array", - "description": "Array of five hex color codes based on the theme.", - "items": { - "type": "string", - "description": "Hex color code" - } - } - }, - "required": [ - "theme", - "colors" - ] - } - } - ], - "tool_choice": "auto" - } + "type": "response.reasoning_summary_part.added", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "part": { + "type": "summary_text", + "text": "" + }, + "sequence_number": 1 } - RealtimeClientEventTranscriptionSessionUpdate: + ResponseReasoningSummaryPartDoneEvent: type: object - description: | - Send this event to update a transcription session. + description: Emitted when a reasoning summary part is completed. properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. type: type: string + description: > + The type of the event. Always + `response.reasoning_summary_part.done`. enum: - - transcription_session.update - description: The event type, must be `transcription_session.update`. + - response.reasoning_summary_part.done x-stainless-const: true - session: - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequest' + item_id: + type: string + description: | + The ID of the item this summary part is associated with. + output_index: + type: integer + description: | + The index of the output item this summary part is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + status: + type: string + description: > + The completion status of the summary part. Omitted when the part + completed + + normally and set to `incomplete` when generation was interrupted. + enum: + - incomplete + sequence_number: + type: integer + description: | + The sequence number of this event. + part: + type: object + description: | + The completed summary part. + properties: + type: + type: string + description: The type of the summary part. Always `summary_text`. + enum: + - summary_text + x-stainless-const: true + text: + type: string + description: The text of the summary part. + required: + - type + - text required: - type - - session + - item_id + - output_index + - summary_index + - part + - sequence_number x-oaiMeta: - name: transcription_session.update - group: realtime + name: response.reasoning_summary_part.done + group: responses example: | { - "type": "transcription_session.update", - "session": { - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "prompt": "", - "language": "" - }, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 500, - "create_response": true, - }, - "input_audio_noise_reduction": { - "type": "near_field" - }, - "include": [ - "item.input_audio_transcription.logprobs", - ] - } + "type": "response.reasoning_summary_part.done", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "part": { + "type": "summary_text", + "text": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!" + }, + "sequence_number": 1 } - RealtimeConversationItem: - description: A single item within a Realtime conversation. - anyOf: - - $ref: '#/components/schemas/RealtimeConversationItemMessageSystem' - - $ref: '#/components/schemas/RealtimeConversationItemMessageUser' - - $ref: '#/components/schemas/RealtimeConversationItemMessageAssistant' - - $ref: '#/components/schemas/RealtimeConversationItemFunctionCall' - - $ref: '#/components/schemas/RealtimeConversationItemFunctionCallOutput' - - $ref: '#/components/schemas/RealtimeMCPApprovalResponse' - - $ref: '#/components/schemas/RealtimeMCPListTools' - - $ref: '#/components/schemas/RealtimeMCPToolCall' - - $ref: '#/components/schemas/RealtimeMCPApprovalRequest' - discriminator: - propertyName: type - RealtimeConversationItemFunctionCall: + ResponseReasoningSummaryTextDeltaEvent: type: object - title: Realtime function call item - description: A function call item in a Realtime conversation. + description: Emitted when a delta is added to a reasoning summary text. properties: - id: - type: string - description: >- - The unique ID of the item. This may be provided by the client or - generated by the server. - object: - type: string - enum: - - realtime.item - description: >- - Identifier for the API object being returned - always - `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string + description: > + The type of the event. Always + `response.reasoning_summary_text.delta`. enum: - - function_call - description: The type of the item. Always `function_call`. + - response.reasoning_summary_text.delta x-stainless-const: true - status: - type: string - enum: - - completed - - incomplete - - in_progress - description: The status of the item. Has no effect on the conversation. - call_id: - type: string - description: The ID of the function call. - name: + item_id: type: string - description: The name of the function being called. - arguments: + description: | + The ID of the item this summary text delta is associated with. + output_index: + type: integer + description: > + The index of the output item this summary text delta is associated + with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + delta: type: string - description: >- - 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}`. + description: | + The text delta that was added to the summary. + sequence_number: + type: integer + description: | + The sequence number of this event. required: - type - - name - - arguments - RealtimeConversationItemFunctionCallOutput: + - item_id + - output_index + - summary_index + - delta + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_text.delta + group: responses + example: | + { + "type": "response.reasoning_summary_text.delta", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "delta": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!", + "sequence_number": 1 + } + ResponseReasoningSummaryTextDoneEvent: type: object - title: Realtime function call output item - description: A function call output item in a Realtime conversation. + description: Emitted when a reasoning summary text is completed. properties: - id: - type: string - description: >- - The unique ID of the item. This may be provided by the client or - generated by the server. - object: - type: string - enum: - - realtime.item - description: >- - Identifier for the API object being returned - always - `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string + description: > + The type of the event. Always + `response.reasoning_summary_text.done`. enum: - - function_call_output - description: The type of the item. Always `function_call_output`. + - response.reasoning_summary_text.done x-stainless-const: true - status: - type: string - enum: - - completed - - incomplete - - in_progress - description: The status of the item. Has no effect on the conversation. - call_id: + item_id: type: string - description: The ID of the function call this output is for. - output: + description: | + The ID of the item this summary text is associated with. + output_index: + type: integer + description: | + The index of the output item this summary text is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + text: type: string - description: >- - The output of the function call, this is free text and can contain - any information or simply be empty. + description: | + The full text of the completed reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. required: - type - - call_id - - output - RealtimeConversationItemMessageAssistant: + - item_id + - output_index + - summary_index + - text + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_text.done + group: responses + example: | + { + "type": "response.reasoning_summary_text.done", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "text": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!", + "sequence_number": 1 + } + ResponseReasoningTextDeltaEvent: type: object - title: Realtime assistant message item - description: An assistant message item in a Realtime conversation. + description: Emitted when a delta is added to a reasoning text. properties: - id: - type: string - description: >- - The unique ID of the item. This may be provided by the client or - generated by the server. - object: - type: string - enum: - - realtime.item - description: >- - Identifier for the API object being returned - always - `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string + description: | + The type of the event. Always `response.reasoning_text.delta`. enum: - - message - description: The type of the item. Always `message`. + - response.reasoning_text.delta x-stainless-const: true - status: + item_id: type: string - enum: - - completed - - incomplete - - in_progress - description: The status of the item. Has no effect on the conversation. - role: + description: | + The ID of the item this reasoning text delta is associated with. + output_index: + type: integer + description: > + The index of the output item this reasoning text delta is associated + with. + content_index: + type: integer + description: > + The index of the reasoning content part this delta is associated + with. + delta: type: string - enum: - - assistant - description: The role of the message sender. Always `assistant`. - x-stainless-const: true - content: - type: array - description: The content of the message. - items: - type: object - properties: - type: - type: string - enum: - - output_text - - output_audio - description: >- - The content type, `output_text` or `output_audio` depending on - the session `output_modalities` configuration. - text: - type: string - description: The text content. - audio: - type: string - description: >- - 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. - transcript: - type: string - description: >- - The transcript of the audio content, this will always be - present if the output type is `audio`. + description: | + The text delta that was added to the reasoning content. + sequence_number: + type: integer + description: | + The sequence number of this event. required: - type - - role - - content - RealtimeConversationItemMessageSystem: + - item_id + - output_index + - content_index + - delta + - sequence_number + x-oaiMeta: + name: response.reasoning_text.delta + group: responses + example: | + { + "type": "response.reasoning_text.delta", + "item_id": "rs_123", + "output_index": 0, + "content_index": 0, + "delta": "The", + "sequence_number": 1 + } + ResponseReasoningTextDoneEvent: type: object - title: Realtime system message item - description: >- - 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. + description: Emitted when a reasoning text is completed. properties: - id: - type: string - description: >- - The unique ID of the item. This may be provided by the client or - generated by the server. - object: - type: string - enum: - - realtime.item - description: >- - Identifier for the API object being returned - always - `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string + description: | + The type of the event. Always `response.reasoning_text.done`. enum: - - message - description: The type of the item. Always `message`. + - response.reasoning_text.done x-stainless-const: true - status: + item_id: type: string - enum: - - completed - - incomplete - - in_progress - description: The status of the item. Has no effect on the conversation. - role: + description: | + The ID of the item this reasoning text is associated with. + output_index: + type: integer + description: | + The index of the output item this reasoning text is associated with. + content_index: + type: integer + description: | + The index of the reasoning content part. + text: type: string - enum: - - system - description: The role of the message sender. Always `system`. - x-stainless-const: true - content: - type: array - description: The content of the message. - items: - type: object - properties: - type: - type: string - enum: - - input_text - description: The content type. Always `input_text` for system messages. - x-stainless-const: true - text: - type: string - description: The text content. + description: | + The full text of the completed reasoning content. + sequence_number: + type: integer + description: | + The sequence number of this event. required: - type - - role - - content - RealtimeConversationItemMessageUser: + - item_id + - output_index + - content_index + - text + - sequence_number + x-oaiMeta: + name: response.reasoning_text.done + group: responses + example: | + { + "type": "response.reasoning_text.done", + "item_id": "rs_123", + "output_index": 0, + "content_index": 0, + "text": "The user is asking...", + "sequence_number": 4 + } + ResponseRefusalDeltaEvent: type: object - title: Realtime user message item - description: A user message item in a Realtime conversation. + description: Emitted when there is a partial refusal text. properties: - id: - type: string - description: >- - The unique ID of the item. This may be provided by the client or - generated by the server. - object: - type: string - enum: - - realtime.item - description: >- - Identifier for the API object being returned - always - `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string + description: | + The type of the event. Always `response.refusal.delta`. enum: - - message - description: The type of the item. Always `message`. + - response.refusal.delta x-stainless-const: true - status: + item_id: type: string - enum: - - completed - - incomplete - - in_progress - description: The status of the item. Has no effect on the conversation. - role: + description: | + The ID of the output item that the refusal text is added to. + output_index: + type: integer + description: | + The index of the output item that the refusal text is added to. + content_index: + type: integer + description: | + The index of the content part that the refusal text is added to. + delta: type: string - enum: - - user - description: The role of the message sender. Always `user`. - x-stainless-const: true - content: - type: array - description: The content of the message. - items: - type: object - properties: - type: - type: string - enum: - - input_text - - input_audio - - input_image - description: >- - The content type (`input_text`, `input_audio`, or - `input_image`). - text: - type: string - description: The text content (for `input_text`). - audio: - type: string - description: >- - 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. - image_url: - type: string - format: uri - description: >- - Base64-encoded image bytes (for `input_image`) as a data URI. - For example - `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...`. Supported - formats are PNG and JPEG. - detail: - type: string - description: >- - The detail level of the image (for `input_image`). `auto` will - default to `high`. - default: auto - enum: - - auto - - low - - high - transcript: - type: string - description: >- - Transcript of the audio (for `input_audio`). This is not sent - to the model, but will be attached to the message item for - reference. + description: | + The refusal text that is added. + sequence_number: + type: integer + description: | + The sequence number of this event. required: - type - - role - - content - RealtimeConversationItemWithReference: + - item_id + - output_index + - content_index + - delta + - sequence_number + x-oaiMeta: + name: response.refusal.delta + group: responses + example: | + { + "type": "response.refusal.delta", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "delta": "refusal text so far", + "sequence_number": 1 + } + ResponseRefusalDoneEvent: type: object - description: The item to add to the conversation. + description: Emitted when refusal text is finalized. properties: - id: - type: string - description: > - For an item of type (`message` | `function_call` | - `function_call_output`) - - this field allows the client to assign the unique ID of the item. It - is - - not required because the server will generate one if not provided. - - - For an item of type `item_reference`, this field is required and is - a - - reference to any item that has previously existed in the - conversation. type: type: string + description: | + The type of the event. Always `response.refusal.done`. enum: - - message - - function_call - - function_call_output - description: > - The type of the item (`message`, `function_call`, - `function_call_output`, `item_reference`). - object: - type: string - enum: - - realtime.item - description: > - Identifier for the API object being returned - always - `realtime.item`. + - response.refusal.done x-stainless-const: true - status: - type: string - enum: - - completed - - incomplete - - in_progress - description: > - The status of the item (`completed`, `incomplete`, `in_progress`). - These have no effect - - on the conversation, but are accepted for consistency with the - - `conversation.item.created` event. - role: - type: string - enum: - - user - - assistant - - system - description: > - The role of the message sender (`user`, `assistant`, `system`), - only - - applicable for `message` items. - content: - type: array - description: > - The content of the message, applicable for `message` items. - - - Message items of role `system` support only `input_text` content - - - Message items of role `user` support `input_text` and - `input_audio` - content - - Message items of role `assistant` support `text` content. - items: - type: object - properties: - type: - type: string - enum: - - input_audio - - input_text - - item_reference - - text - description: > - The content type (`input_text`, `input_audio`, - `item_reference`, `text`). - text: - type: string - description: > - The text content, used for `input_text` and `text` content - types. - id: - type: string - description: > - ID of a previous conversation item to reference (for - `item_reference` - - content types in `response.create` events). These can - reference both - - client and server created items. - audio: - type: string - description: > - Base64-encoded audio bytes, used for `input_audio` content - type. - transcript: - type: string - description: > - The transcript of the audio, used for `input_audio` content - type. - call_id: - type: string - description: > - The ID of the function call (for `function_call` and - - `function_call_output` items). If passed on a - `function_call_output` - - item, the server will check that a `function_call` item with the - same - - ID exists in the conversation history. - name: + item_id: type: string description: | - The name of the function being called (for `function_call` items). - arguments: - type: string + The ID of the output item that the refusal text is finalized. + output_index: + type: integer description: | - The arguments of the function call (for `function_call` items). - output: + The index of the output item that the refusal text is finalized. + content_index: + type: integer + description: | + The index of the content part that the refusal text is finalized. + refusal: type: string description: | - The output of the function call (for `function_call_output` items). - RealtimeCreateClientSecretRequest: - type: object - title: Realtime client secret creation request - description: > - Create a session and client secret for the Realtime API. The request can - specify + The refusal text that is finalized. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - refusal + - sequence_number + x-oaiMeta: + name: response.refusal.done + group: responses + example: | + { + "type": "response.refusal.done", + "item_id": "item-abc", + "output_index": 1, + "content_index": 2, + "refusal": "final refusal text", + "sequence_number": 1 + } + ResponseStreamEvent: + anyOf: + - $ref: '#/components/schemas/ResponseAudioDeltaEvent' + - $ref: '#/components/schemas/ResponseAudioDoneEvent' + - $ref: '#/components/schemas/ResponseAudioTranscriptDeltaEvent' + - $ref: '#/components/schemas/ResponseAudioTranscriptDoneEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCompletedEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallInProgressEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent' + - $ref: '#/components/schemas/ResponseCompletedEvent' + - $ref: '#/components/schemas/ResponseContentPartAddedEvent' + - $ref: '#/components/schemas/ResponseContentPartDoneEvent' + - $ref: '#/components/schemas/ResponseCreatedEvent' + - $ref: '#/components/schemas/ResponseErrorEvent' + - $ref: '#/components/schemas/ResponseFileSearchCallCompletedEvent' + - $ref: '#/components/schemas/ResponseFileSearchCallInProgressEvent' + - $ref: '#/components/schemas/ResponseFileSearchCallSearchingEvent' + - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent' + - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDoneEvent' + - $ref: '#/components/schemas/ResponseInProgressEvent' + - $ref: '#/components/schemas/ResponseFailedEvent' + - $ref: '#/components/schemas/ResponseIncompleteEvent' + - $ref: '#/components/schemas/ResponseOutputItemAddedEvent' + - $ref: '#/components/schemas/ResponseOutputItemDoneEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryPartAddedEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryPartDoneEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryTextDeltaEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryTextDoneEvent' + - $ref: '#/components/schemas/ResponseReasoningTextDeltaEvent' + - $ref: '#/components/schemas/ResponseReasoningTextDoneEvent' + - $ref: '#/components/schemas/ResponseRefusalDeltaEvent' + - $ref: '#/components/schemas/ResponseRefusalDoneEvent' + - $ref: '#/components/schemas/ResponseTextDeltaEvent' + - $ref: '#/components/schemas/ResponseTextDoneEvent' + - $ref: '#/components/schemas/ResponseWebSearchCallCompletedEvent' + - $ref: '#/components/schemas/ResponseWebSearchCallInProgressEvent' + - $ref: '#/components/schemas/ResponseWebSearchCallSearchingEvent' + - $ref: '#/components/schemas/ResponseImageGenCallCompletedEvent' + - $ref: '#/components/schemas/ResponseImageGenCallGeneratingEvent' + - $ref: '#/components/schemas/ResponseImageGenCallInProgressEvent' + - $ref: '#/components/schemas/ResponseImageGenCallPartialImageEvent' + - $ref: '#/components/schemas/ResponseMCPCallArgumentsDeltaEvent' + - $ref: '#/components/schemas/ResponseMCPCallArgumentsDoneEvent' + - $ref: '#/components/schemas/ResponseMCPCallCompletedEvent' + - $ref: '#/components/schemas/ResponseMCPCallFailedEvent' + - $ref: '#/components/schemas/ResponseMCPCallInProgressEvent' + - $ref: '#/components/schemas/ResponseMCPListToolsCompletedEvent' + - $ref: '#/components/schemas/ResponseMCPListToolsFailedEvent' + - $ref: '#/components/schemas/ResponseMCPListToolsInProgressEvent' + - $ref: '#/components/schemas/ResponseOutputTextAnnotationAddedEvent' + - $ref: '#/components/schemas/ResponseQueuedEvent' + - $ref: '#/components/schemas/ResponseCustomToolCallInputDeltaEvent' + - $ref: '#/components/schemas/ResponseCustomToolCallInputDoneEvent' + discriminator: + propertyName: type + ResponseStreamOptions: + anyOf: + - description: > + Options for streaming responses. Only set this when you set `stream: + true`. + type: object + default: null + properties: + include_obfuscation: + type: boolean + description: > + When true, stream obfuscation will be enabled. Stream + obfuscation adds - either a realtime or a transcription session configuration. + random characters to an `obfuscation` field on streaming delta + events to - [Learn more about the Realtime API](/docs/guides/realtime). - properties: - expires_after: - type: object - title: Client secret expiration - description: > - Configuration for the client secret expiration. Expiration refers to - the time after which + normalize payload sizes as a mitigation to certain side-channel + attacks. - a client secret will no longer be valid for creating sessions. The - session itself may + These obfuscation fields are included by default, but add a + small amount - continue after that time once started. A secret can be used to - create multiple sessions + of overhead to the data stream. You can set + `include_obfuscation` to - until it expires. - properties: - anchor: - type: string - enum: - - created_at - description: > - The anchor point for the client secret expiration, meaning that - `seconds` will be added to the `created_at` time of the client - secret to produce an expiration timestamp. Only `created_at` is - currently supported. - default: created_at - x-stainless-const: true - seconds: - type: integer - format: int64 - description: > - The number of seconds from the anchor point to the expiration. - Select a value between `10` and `7200` (2 hours). This default - to 600 seconds (10 minutes) if not specified. - minimum: 10 - maximum: 7200 - default: 600 - session: - title: Session configuration - description: > - Session configuration to use for the client secret. Choose either a - realtime + false to optimize for bandwidth if you trust the network links + between - session or a transcription session. - oneOf: - - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' - - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' - RealtimeCreateClientSecretResponse: + your application and the OpenAI API. + - type: 'null' + ResponseTextDeltaEvent: type: object - title: Realtime session and client secret - description: | - Response from creating a session and client secret for the Realtime API. + description: Emitted when there is an additional text delta. properties: - value: + type: type: string - description: The generated client secret value. - expires_at: + description: | + The type of the event. Always `response.output_text.delta`. + enum: + - response.output_text.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the text delta was added to. + output_index: type: integer - format: unixtime - description: Expiration timestamp for the client secret, in seconds since epoch. - session: - title: Session configuration - description: > - The session configuration for either a realtime or transcription - session. - oneOf: - - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' - - $ref: >- - #/components/schemas/RealtimeTranscriptionSessionCreateResponseGA - discriminator: - propertyName: type + description: | + The index of the output item that the text delta was added to. + content_index: + type: integer + description: | + The index of the content part that the text delta was added to. + delta: + type: string + description: | + The text delta that was added. + sequence_number: + type: integer + description: The sequence number for this event. + logprobs: + type: array + description: | + The log probabilities of the tokens in the delta. + items: + $ref: '#/components/schemas/ResponseLogProb' required: - - value - - expires_at - - session + - type + - item_id + - output_index + - content_index + - delta + - sequence_number + - logprobs x-oaiMeta: - name: Session response object - group: realtime + name: response.output_text.delta + group: responses example: | { - "value": "ek_68af296e8e408191a1120ab6383263c2", - "expires_at": 1756310470, - "session": { - "type": "realtime", - "object": "realtime.session", - "id": "sess_C9CiUVUzUzYIssh3ELY1d", - "model": "gpt-realtime-2025-08-25", - "output_modalities": [ - "audio" - ], - "instructions": "You are a friendly assistant.", - "tools": [], - "tool_choice": "auto", - "max_output_tokens": "inf", - "tracing": null, - "truncation": "auto", - "prompt": null, - "expires_at": 0, - "audio": { - "input": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "transcription": null, - "noise_reduction": null, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200, - "idle_timeout_ms": null, - "create_response": true, - "interrupt_response": true - } - }, - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "alloy", - "speed": 1.0 - } - }, - "include": null - } + "type": "response.output_text.delta", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "delta": "In", + "sequence_number": 1 } - RealtimeFunctionTool: + ResponseTextDoneEvent: type: object - title: Function tool + description: Emitted when text content is finalized. properties: type: type: string + description: | + The type of the event. Always `response.output_text.done`. enum: - - function - description: The type of the tool, i.e. `function`. + - response.output_text.done x-stainless-const: true - name: + item_id: type: string - description: The name of the function. - description: + description: | + The ID of the output item that the text content is finalized. + output_index: + type: integer + description: | + The index of the output item that the text content is finalized. + content_index: + type: integer + description: | + The index of the content part that the text content is finalized. + text: type: string description: | - The description of the function, including guidance on when and how - to call it, and guidance about what to tell the user when calling - (if anything). - parameters: + The text content that is finalized. + sequence_number: + type: integer + description: The sequence number for this event. + logprobs: + type: array + description: | + The log probabilities of the tokens in the delta. + items: + $ref: '#/components/schemas/ResponseLogProb' + required: + - type + - item_id + - output_index + - content_index + - text + - sequence_number + - logprobs + x-oaiMeta: + name: response.output_text.done + group: responses + example: | + { + "type": "response.output_text.done", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "sequence_number": 1 + } + ResponseTextParam: + type: object + description: | + Configuration options for a text response from the model. Can be plain + text or structured JSON data. Learn more: + - [Text inputs and outputs](/docs/guides/text) + - [Structured Outputs](/docs/guides/structured-outputs) + properties: + format: + $ref: '#/components/schemas/TextResponseFormatConfiguration' + verbosity: + $ref: '#/components/schemas/Verbosity' + ResponseUsage: + type: object + description: | + Represents token usage details including input tokens, output tokens, + a breakdown of output tokens, and the total tokens used. + properties: + input_tokens: + type: integer + description: The number of input tokens. + input_tokens_details: type: object - description: Parameters of the function in JSON Schema. - RealtimeMCPApprovalRequest: + description: A detailed breakdown of the input tokens. + properties: + cached_tokens: + type: integer + description: | + The number of tokens that were retrieved from the cache. + [More on prompt caching](/docs/guides/prompt-caching). + cache_write_tokens: + type: integer + description: The number of input tokens that were written to the cache. + required: + - cached_tokens + - cache_write_tokens + output_tokens: + type: integer + description: The number of output tokens. + output_tokens_details: + type: object + description: A detailed breakdown of the output tokens. + properties: + reasoning_tokens: + type: integer + description: The number of reasoning tokens. + required: + - reasoning_tokens + total_tokens: + type: integer + description: The total number of tokens used. + required: + - input_tokens + - input_tokens_details + - output_tokens + - output_tokens_details + - total_tokens + ResponseWebSearchCallCompletedEvent: type: object - title: Realtime MCP approval request - description: | - A Realtime item requesting human approval of a tool invocation. + description: Emitted when a web search call is completed. properties: type: type: string + description: | + The type of the event. Always `response.web_search_call.completed`. enum: - - mcp_approval_request - description: The type of the item. Always `mcp_approval_request`. + - response.web_search_call.completed x-stainless-const: true - id: - type: string - description: The unique ID of the approval request. - server_label: - type: string - description: The label of the MCP server making the request. - name: - type: string - description: The name of the tool to run. - arguments: + output_index: + type: integer + description: > + The index of the output item that the web search call is associated + with. + item_id: type: string - description: A JSON string of arguments for the tool. + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. required: - type - - id - - server_label - - name - - arguments - RealtimeMCPApprovalResponse: + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.completed + group: responses + example: | + { + "type": "response.web_search_call.completed", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + ResponseWebSearchCallInProgressEvent: type: object - title: Realtime MCP approval response - description: | - A Realtime item responding to an MCP approval request. + description: Emitted when a web search call is initiated. properties: type: type: string + description: > + The type of the event. Always + `response.web_search_call.in_progress`. enum: - - mcp_approval_response - description: The type of the item. Always `mcp_approval_response`. + - response.web_search_call.in_progress x-stainless-const: true - id: - type: string - description: The unique ID of the approval response. - approval_request_id: + output_index: + type: integer + description: > + The index of the output item that the web search call is associated + with. + item_id: type: string - description: The ID of the approval request being answered. - approve: - type: boolean - description: Whether the request was approved. - reason: - anyOf: - - type: string - description: Optional reason for the decision. - - type: 'null' + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. required: - type - - id - - approval_request_id - - approve - RealtimeMCPHTTPError: + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.in_progress + group: responses + example: | + { + "type": "response.web_search_call.in_progress", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + ResponseWebSearchCallSearchingEvent: type: object - title: Realtime MCP HTTP error + description: Emitted when a web search call is executing. properties: type: type: string + description: | + The type of the event. Always `response.web_search_call.searching`. enum: - - http_error + - response.web_search_call.searching x-stainless-const: true - code: + output_index: type: integer - message: + description: > + The index of the output item that the web search call is associated + with. + item_id: type: string + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. required: - type - - code - - message - RealtimeMCPListTools: - type: object - title: Realtime MCP list tools + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.searching + group: responses + example: | + { + "type": "response.web_search_call.searching", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + ResponsesClientEvent: + discriminator: + propertyName: type description: | - A Realtime item listing tools available on an MCP server. + Client events accepted by the Responses WebSocket server. + anyOf: + - $ref: '#/components/schemas/ResponsesClientEventResponseCreate' + ResponsesClientEventResponseCreate: + allOf: + - type: object + properties: + type: + type: string + enum: + - response.create + description: | + The type of the client event. Always `response.create`. + x-stainless-const: true + required: + - type + - $ref: '#/components/schemas/CreateResponse' + description: > + Client event for creating a response over a persistent WebSocket + connection. + + This payload uses the same top-level fields as `POST /v1/responses`. + + + Notes: + + - `stream` is implicit over WebSocket and should not be sent. + + - `background` is not supported over WebSocket. + x-oaiMeta: + example: | + { + "type": "response.create", + "model": "gpt-5.5", + "input": "Say hello." + } + ResponsesServerEvent: + discriminator: + propertyName: type + description: | + Server events emitted by the Responses WebSocket server. + anyOf: + - $ref: '#/components/schemas/ResponseStreamEvent' + Role: + type: object + description: Details about a role that can be assigned through the public Roles API. properties: - type: + object: type: string enum: - - mcp_list_tools - description: The type of the item. Always `mcp_list_tools`. + - role + description: Always `role`. x-stainless-const: true id: type: string - description: The unique ID of the list. - server_label: + description: Identifier for the role. + name: type: string - description: The label of the MCP server. - tools: + description: Unique name for the role. + description: + description: Optional description of the role. + anyOf: + - type: string + - type: 'null' + permissions: type: array + description: Permissions granted by the role. items: - $ref: '#/components/schemas/MCPListToolsTool' - description: The tools available on the server. + type: string + resource_type: + type: string + description: >- + Resource type the role is bound to (for example `api.organization` + or `api.project`). + predefined_role: + type: boolean + description: Whether the role is predefined and managed by OpenAI. required: - - type - - server_label - - tools - RealtimeMCPProtocolError: + - object + - id + - name + - description + - permissions + - resource_type + - predefined_role + x-oaiMeta: + name: The role object + example: | + { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + RoleDeletedResource: type: object - title: Realtime MCP protocol error + description: Confirmation payload returned after deleting a role. properties: - type: + object: type: string enum: - - protocol_error + - role.deleted + description: Always `role.deleted`. x-stainless-const: true - code: - type: integer - message: + id: type: string + description: Identifier of the deleted role. + deleted: + type: boolean + description: Whether the role was deleted. required: - - type - - code - - message - RealtimeMCPToolCall: + - object + - id + - deleted + x-oaiMeta: + name: Role deletion confirmation + example: | + { + "object": "role.deleted", + "id": "role_01J1F8ROLE01", + "deleted": true + } + RoleListResource: type: object - title: Realtime MCP tool call - description: | - A Realtime item representing an invocation of a tool on an MCP server. + description: Paginated list of roles assigned to a principal. properties: - type: + object: type: string enum: - - mcp_call - description: The type of the item. Always `mcp_call`. + - list + description: Always `list`. x-stainless-const: true - id: - type: string - description: The unique ID of the tool call. - server_label: - type: string - description: The label of the MCP server running the tool. - name: - type: string - description: The name of the tool that was run. - arguments: - type: string - description: A JSON string of the arguments passed to the tool. - approval_request_id: - anyOf: - - type: string - description: The ID of an associated approval request, if any. - - type: 'null' - output: + data: + type: array + description: Role assignments returned in the current page. + items: + $ref: '#/components/schemas/AssignedRoleDetails' + has_more: + type: boolean + description: Whether additional assignments are available when paginating. + next: + description: >- + Cursor to fetch the next page of results, or `null` when there are + no more assignments. anyOf: - type: string - description: The output from the tool call. - - type: 'null' - error: - anyOf: - - description: The error from the tool call, if any. - oneOf: - - $ref: '#/components/schemas/RealtimeMCPProtocolError' - - $ref: '#/components/schemas/RealtimeMCPToolExecutionError' - - $ref: '#/components/schemas/RealtimeMCPHTTPError' - type: 'null' required: - - type - - id - - server_label - - name - - arguments - RealtimeMCPToolExecutionError: + - object + - data + - has_more + - next + x-oaiMeta: + name: Assigned role list + example: | + { + "object": "list", + "data": [ + { + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false, + "description": "Allows managing organization groups", + "created_at": 1711471533, + "updated_at": 1711472599, + "created_by": "user_abc123", + "created_by_user_obj": { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + }, + "metadata": {}, + "assignment_sources": null + } + ], + "has_more": false, + "next": null + } + RunCompletionUsage: + anyOf: + - type: object + description: >- + Usage statistics related to the run. This value will be `null` if + the run is not in a terminal state (i.e. `in_progress`, `queued`, + etc.). + properties: + completion_tokens: + type: integer + description: Number of completion tokens used over the course of the run. + prompt_tokens: + type: integer + description: Number of prompt tokens used over the course of the run. + total_tokens: + type: integer + description: Total number of tokens used (prompt + completion). + required: + - prompt_tokens + - completion_tokens + - total_tokens + - type: 'null' + RunGraderRequest: type: object - title: Realtime MCP tool execution error + title: RunGraderRequest properties: - type: - type: string - enum: - - tool_execution_error - x-stainless-const: true - message: + grader: + type: object + description: The grader used for the fine-tuning job. + oneOf: + - $ref: '#/components/schemas/GraderStringCheck' + - $ref: '#/components/schemas/GraderTextSimilarity' + - $ref: '#/components/schemas/GraderPython' + - $ref: '#/components/schemas/GraderScoreModel' + - $ref: '#/components/schemas/GraderMulti' + item: + type: object + description: > + The dataset item provided to the grader. This will be used to + populate + + the `item` namespace. See [the guide](/docs/guides/graders) for more + details. + model_sample: type: string + description: > + The model sample to be evaluated. This value will be used to + populate + + the `sample` namespace. See [the guide](/docs/guides/graders) for + more details. + + The `output_json` variable will be populated if the model sample is + a + + valid JSON string. + + required: + - grader + - model_sample + RunGraderResponse: + type: object + properties: + reward: + type: number + metadata: + type: object + properties: + name: + type: string + type: + type: string + errors: + type: object + properties: + formula_parse_error: + type: boolean + sample_parse_error: + type: boolean + truncated_observation_error: + type: boolean + unresponsive_reward_error: + type: boolean + invalid_variable_error: + type: boolean + other_error: + type: boolean + python_grader_server_error: + type: boolean + python_grader_server_error_type: + anyOf: + - type: string + - type: 'null' + python_grader_runtime_error: + type: boolean + python_grader_runtime_error_details: + anyOf: + - type: string + - type: 'null' + model_grader_server_error: + type: boolean + model_grader_refusal_error: + type: boolean + model_grader_parse_error: + type: boolean + model_grader_server_error_details: + anyOf: + - type: string + - type: 'null' + required: + - formula_parse_error + - sample_parse_error + - truncated_observation_error + - unresponsive_reward_error + - invalid_variable_error + - other_error + - python_grader_server_error + - python_grader_server_error_type + - python_grader_runtime_error + - python_grader_runtime_error_details + - model_grader_server_error + - model_grader_refusal_error + - model_grader_parse_error + - model_grader_server_error_details + execution_time: + type: number + scores: + type: object + additionalProperties: {} + token_usage: + anyOf: + - type: integer + - type: 'null' + sampled_model_name: + anyOf: + - type: string + - type: 'null' + required: + - name + - type + - errors + - execution_time + - scores + - token_usage + - sampled_model_name + sub_rewards: + type: object + additionalProperties: {} + model_grader_token_usage_per_model: + type: object + additionalProperties: {} required: - - type - - message - RealtimeReasoning: - type: object - title: Realtime reasoning configuration - description: > - Configuration for reasoning-capable Realtime models such as - `gpt-realtime-2`. - properties: - effort: - $ref: '#/components/schemas/RealtimeReasoningEffort' - RealtimeReasoningEffort: - type: string - description: > - Constrains effort on reasoning for reasoning-capable Realtime models - such as - - `gpt-realtime-2`. - enum: - - minimal - - low - - medium - - high - - xhigh - default: low - RealtimeResponse: + - reward + - metadata + - sub_rewards + - model_grader_token_usage_per_model + RunObject: type: object - description: The response resource. + title: A run on a thread + description: Represents an execution run on a [thread](/docs/api-reference/threads). properties: id: + description: The identifier, which can be referenced in API endpoints. type: string - description: The unique ID of the response, will look like `resp_1234`. object: + description: The object type, which is always `thread.run`. type: string enum: - - realtime.response - description: The object type, must be `realtime.response`. + - thread.run x-stainless-const: true + created_at: + description: The Unix timestamp (in seconds) for when the run was created. + type: integer + format: unixtime + thread_id: + description: >- + The ID of the [thread](/docs/api-reference/threads) that was + executed on as a part of this run. + type: string + assistant_id: + description: >- + The ID of the [assistant](/docs/api-reference/assistants) used for + execution of this run. + type: string status: + description: >- + The status of the run, which can be either `queued`, `in_progress`, + `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, + `incomplete`, or `expired`. type: string enum: - - completed + - queued + - in_progress + - requires_action + - cancelling - cancelled - failed + - completed - incomplete - - in_progress - description: > - The final status of the response (`completed`, `cancelled`, - `failed`, or - - `incomplete`, `in_progress`). - status_details: + - expired + required_action: type: object - description: Additional details about the status. + description: >- + Details on the action required to continue the run. Will be `null` + if no action is required. + nullable: true properties: type: + description: For now, this is always `submit_tool_outputs`. type: string enum: - - completed - - cancelled - - failed - - incomplete - description: > - The type of error that caused the response to fail, - corresponding - - with the `status` field (`completed`, `cancelled`, - `incomplete`, - - `failed`). - reason: - type: string - enum: - - turn_detected - - client_cancelled - - max_output_tokens - - content_filter - description: > - The reason the Response did not complete. For a `cancelled` - Response, one of `turn_detected` (the server VAD detected a new - start of speech) or `client_cancelled` (the client sent a - cancel event). For an `incomplete` Response, one of - `max_output_tokens` or `content_filter` (the server-side safety - filter activated and cut off the response). - error: - type: object - description: | - A description of the error that caused the response to fail, - populated when the `status` is `failed`. - properties: - type: - type: string - description: The type of error. - code: - type: string - description: Error code, if any. - output: - type: array - description: The list of output items generated by the response. - items: - $ref: '#/components/schemas/RealtimeConversationItem' - metadata: - $ref: '#/components/schemas/Metadata' - audio: - type: object - description: Configuration for audio output. - properties: - output: + - submit_tool_outputs + x-stainless-const: true + submit_tool_outputs: type: object + description: Details on the tool outputs needed for this run to continue. properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the output audio. - voice: - $ref: '#/components/schemas/VoiceIdsShared' - default: alloy - description: > - The voice the model uses to respond. Voice cannot be changed - during the - - session once the model has responded with audio at least - once. Current - - voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, - `sage`, - - `shimmer`, `verse`, `marin`, and `cedar`. We recommend - `marin` and `cedar` for - - best quality. - usage: + tool_calls: + type: array + description: A list of the relevant tool calls. + items: + $ref: '#/components/schemas/RunToolCallObject' + required: + - tool_calls + required: + - type + - submit_tool_outputs + last_error: type: object - description: > - Usage statistics for the Response, this will correspond to billing. - A - - Realtime API session will maintain a conversation context and append - new - - Items to the Conversation, thus output from previous turns (text - and - - audio tokens) will become the input for later turns. + description: >- + The last error associated with this run. Will be `null` if there are + no errors. + nullable: true properties: - total_tokens: - type: integer - description: > - The total number of tokens in the Response including input and - output - - text and audio tokens. - input_tokens: - type: integer - description: > - The number of input tokens used in the Response, including text - and - - audio tokens. - output_tokens: - type: integer - description: > - The number of output tokens sent in the Response, including text - and - - audio tokens. - input_token_details: - type: object + code: + type: string description: >- - Details about the input tokens used in the Response. Cached - tokens are tokens from previous turns in the conversation that - are included as context for the current response. Cached tokens - here are counted as a subset of input tokens, meaning input - tokens will include cached and uncached tokens. - properties: - cached_tokens: - type: integer - description: The number of cached tokens used as input for the Response. - text_tokens: - type: integer - description: The number of text tokens used as input for the Response. - image_tokens: - type: integer - description: The number of image tokens used as input for the Response. - audio_tokens: - type: integer - description: The number of audio tokens used as input for the Response. - cached_tokens_details: - type: object - description: >- - Details about the cached tokens used as input for the - Response. - properties: - text_tokens: - type: integer - description: >- - The number of cached text tokens used as input for the - Response. - image_tokens: - type: integer - description: >- - The number of cached image tokens used as input for the - Response. - audio_tokens: - type: integer - description: >- - The number of cached audio tokens used as input for the - Response. - output_token_details: - type: object - description: Details about the output tokens used in the Response. - properties: - text_tokens: - type: integer - description: The number of text tokens used in the Response. - audio_tokens: - type: integer - description: The number of audio tokens used in the Response. - conversation_id: - description: > - Which conversation the response is added to, determined by the - `conversation` - - field in the `response.create` event. If `auto`, the response will - be added to - - the default conversation and the value of `conversation_id` will be - an id like - - `conv_1234`. If `none`, the response will not be added to any - conversation and - - the value of `conversation_id` will be `null`. If responses are - being triggered - - automatically by VAD the response will be added to the default - conversation - type: string - output_modalities: - type: array - description: > - The set of modalities the model used to respond, currently the only - possible values are - - `[\"audio\"]`, `[\"text\"]`. Audio output always include a text - transcript. Setting the - - output to mode `text` will disable audio output from the model. - items: - type: string - enum: - - text - - audio - max_output_tokens: - oneOf: - - type: integer - - type: string + One of `server_error`, `rate_limit_exceeded`, or + `invalid_prompt`. enum: - - inf - x-stainless-const: true - description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls, that was used in this response. - RealtimeResponseCreateParams: - type: object - description: Create a new Realtime response with these parameters - properties: - output_modalities: - type: array - description: > - The set of modalities the model used to respond, currently the only - possible values are - - `[\"audio\"]`, `[\"text\"]`. Audio output always include a text - transcript. Setting the - - output to mode `text` will disable audio output from the model. - items: - type: string - enum: - - text - - audio - instructions: - type: string - description: > - 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. - - 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. - audio: + - server_error + - rate_limit_exceeded + - invalid_prompt + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + expires_at: + description: The Unix timestamp (in seconds) for when the run will expire. + type: integer + format: unixtime + nullable: true + started_at: + description: The Unix timestamp (in seconds) for when the run was started. + type: integer + format: unixtime + nullable: true + cancelled_at: + description: The Unix timestamp (in seconds) for when the run was cancelled. + type: integer + format: unixtime + nullable: true + failed_at: + description: The Unix timestamp (in seconds) for when the run failed. + type: integer + format: unixtime + nullable: true + completed_at: + description: The Unix timestamp (in seconds) for when the run was completed. + type: integer + format: unixtime + nullable: true + incomplete_details: + description: >- + Details on why the run is incomplete. Will be `null` if the run is + not incomplete. type: object - description: Configuration for audio input and output. + nullable: true properties: - output: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the output audio. - voice: - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - default: alloy - description: > - The voice the model uses to respond. Supported built-in - voices are - - `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, - `shimmer`, `verse`, - - `marin`, and `cedar`. You may also provide a custom voice - object with - - an `id`, for example `{ "id": "voice_1234" }`. Voice cannot - be changed - - during the session once the model has responded with audio - at least once. - - We recommend `marin` and `cedar` for best quality. - tools: - type: array - description: Tools available to the model. - items: - oneOf: - - $ref: '#/components/schemas/RealtimeFunctionTool' - - $ref: '#/components/schemas/MCPTool' - tool_choice: - description: > - How the model chooses tools. Provide one of the string modes or - force a specific - - function/MCP tool. - oneOf: - - $ref: '#/components/schemas/ToolChoiceOptions' - - $ref: '#/components/schemas/ToolChoiceFunction' - - $ref: '#/components/schemas/ToolChoiceMCP' - default: auto - parallel_tool_calls: - type: boolean - description: > - Whether the model may call multiple tools in parallel. Only - supported by - - reasoning Realtime models such as `gpt-realtime-2`. - reasoning: - $ref: '#/components/schemas/RealtimeReasoning' - max_output_tokens: - oneOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true - description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - conversation: - description: > - Controls which conversation the response is added to. Currently - supports - - `auto` and `none`, with `auto` as the default value. The `auto` - value - - means that the contents of the response will be added to the default - - conversation. Set this to `none` to create an out-of-band response - which - - will not add items to default conversation. - oneOf: - - type: string - - type: string - default: auto + reason: + description: >- + The reason why the run is incomplete. This will point to which + specific token limit was reached over the course of the run. + type: string enum: - - auto - - none + - max_completion_tokens + - max_prompt_tokens + model: + description: >- + The model that the [assistant](/docs/api-reference/assistants) used + for this run. + type: string + instructions: + description: >- + The instructions that the + [assistant](/docs/api-reference/assistants) used for this run. + type: string + tools: + description: >- + The list of tools that the + [assistant](/docs/api-reference/assistants) used for this run. + default: [] + type: array + maxItems: 20 + items: + oneOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearch' + - $ref: '#/components/schemas/AssistantToolsFunction' metadata: $ref: '#/components/schemas/Metadata' - prompt: - $ref: '#/components/schemas/Prompt' - input: - type: array + usage: + $ref: '#/components/schemas/RunCompletionUsage' + temperature: + description: >- + The sampling temperature used for this run. If not set, defaults to + 1. + type: number + nullable: true + top_p: + description: >- + The nucleus sampling value used for this run. If not set, defaults + to 1. + type: number + nullable: true + max_prompt_tokens: + type: integer + nullable: true description: > - Input items to include in the prompt for the model. Using this field - - creates a new context for this Response instead of using the default - - conversation. An empty array `[]` will clear the context for this - Response. - - Note that this can include references to items that previously - appeared in the session - - using their id. - items: - $ref: '#/components/schemas/RealtimeConversationItem' - RealtimeServerEvent: - discriminator: - propertyName: type - description: | - A realtime server event. + The maximum number of prompt tokens specified to have been used over + the course of the run. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: > + The maximum number of completion tokens specified to have been used + over the course of the run. + minimum: 256 + truncation_strategy: + allOf: + - $ref: '#/components/schemas/TruncationObject' + - nullable: true + tool_choice: + allOf: + - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' + - nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true + required: + - id + - object + - created_at + - thread_id + - assistant_id + - status + - required_action + - last_error + - expires_at + - started_at + - cancelled_at + - failed_at + - completed_at + - model + - instructions + - tools + - metadata + - usage + - incomplete_details + - max_prompt_tokens + - max_completion_tokens + - truncation_strategy + - tool_choice + - parallel_tool_calls + - response_format + x-oaiMeta: + name: The run object + beta: true + example: | + { + "id": "run_abc123", + "object": "thread.run", + "created_at": 1698107661, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699073476, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699073498, + "last_error": null, + "model": "gpt-4o", + "instructions": null, + "tools": [{"type": "file_search"}, {"type": "code_interpreter"}], + "metadata": {}, + "incomplete_details": null, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true + } + RunStepCompletionUsage: anyOf: - - $ref: '#/components/schemas/RealtimeServerEventConversationCreated' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemCreated' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemDeleted' - - $ref: >- - #/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionCompleted - - $ref: >- - #/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionDelta - - $ref: >- - #/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionFailed - - $ref: '#/components/schemas/RealtimeServerEventConversationItemRetrieved' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemTruncated' - - $ref: '#/components/schemas/RealtimeServerEventError' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCleared' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCommitted' - - $ref: >- - #/components/schemas/RealtimeServerEventInputAudioBufferDtmfEventReceived - - $ref: >- - #/components/schemas/RealtimeServerEventInputAudioBufferSpeechStarted - - $ref: >- - #/components/schemas/RealtimeServerEventInputAudioBufferSpeechStopped - - $ref: '#/components/schemas/RealtimeServerEventRateLimitsUpdated' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartAdded' - - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseCreated' - - $ref: '#/components/schemas/RealtimeServerEventResponseDone' - - $ref: >- - #/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDelta - - $ref: >- - #/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDone - - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemAdded' - - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseTextDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseTextDone' - - $ref: '#/components/schemas/RealtimeServerEventSessionCreated' - - $ref: '#/components/schemas/RealtimeServerEventSessionUpdated' - - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStarted' - - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStopped' - - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferCleared' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemAdded' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemDone' - - $ref: >- - #/components/schemas/RealtimeServerEventInputAudioBufferTimeoutTriggered - - $ref: >- - #/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionSegment - - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsInProgress' - - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsCompleted' - - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsFailed' - - $ref: >- - #/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDelta - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallInProgress' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallCompleted' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallFailed' - RealtimeServerEventConversationCreated: + - type: object + description: >- + Usage statistics related to the run step. This value will be `null` + while the run step's status is `in_progress`. + properties: + completion_tokens: + type: integer + description: >- + Number of completion tokens used over the course of the run + step. + prompt_tokens: + type: integer + description: Number of prompt tokens used over the course of the run step. + total_tokens: + type: integer + description: Total number of tokens used (prompt + completion). + required: + - prompt_tokens + - completion_tokens + - total_tokens + - type: 'null' + RunStepDeltaObject: type: object + title: Run step delta object description: > - Returned when a conversation is created. Emitted right after session - creation. + Represents a run step delta i.e. any changed fields on a run step during + streaming. properties: - event_id: + id: + description: >- + The identifier of the run step, which can be referenced in API + endpoints. type: string - description: The unique ID of the server event. - type: + object: + description: The object type, which is always `thread.run.step.delta`. type: string enum: - - conversation.created - description: The event type, must be `conversation.created`. + - thread.run.step.delta x-stainless-const: true - conversation: + delta: + description: The delta containing the fields that have changed on the run step. type: object - description: The conversation resource. properties: - id: - type: string - description: The unique ID of the conversation. - object: - type: string - description: The object type, must be `realtime.conversation`. + step_details: + type: object + description: The details of the run step. + oneOf: + - $ref: >- + #/components/schemas/RunStepDeltaStepDetailsMessageCreationObject + - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsObject' required: - - event_id - - type - - conversation + - id + - object + - delta x-oaiMeta: - name: conversation.created - group: realtime + name: The run step delta object + beta: true example: | { - "event_id": "event_9101", - "type": "conversation.created", - "conversation": { - "id": "conv_001", - "object": "realtime.conversation" + "id": "step_123", + "object": "thread.run.step.delta", + "delta": { + "step_details": { + "type": "tool_calls", + "tool_calls": [ + { + "index": 0, + "id": "call_123", + "type": "code_interpreter", + "code_interpreter": { "input": "", "outputs": [] } + } + ] } + } } - RealtimeServerEventConversationItemAdded: + RunStepDeltaStepDetailsMessageCreationObject: + title: Message creation type: object - description: > - Sent by the server when an Item is added to the default Conversation. - This can happen in several cases: - - - When the client sends a `conversation.item.create` event. - - - When the input audio buffer is committed. In this case the item will - be a user message containing the audio from the buffer. - - - When the model is generating a Response. In this case the - `conversation.item.added` event will be sent when the model starts - generating a specific Item, and thus it will not yet have any content - (and `status` will be `in_progress`). - - - The event will include the full content of the Item (except when model - is generating a Response) except for audio data, which can be retrieved - separately with a `conversation.item.retrieve` event if necessary. + description: Details of the message creation by the run step. properties: - event_id: + type: + description: Always `message_creation`. type: string - description: The unique ID of the server event. + enum: + - message_creation + x-stainless-const: true + message_creation: + type: object + properties: + message_id: + type: string + description: The ID of the message that was created by this run step. + required: + - type + RunStepDeltaStepDetailsToolCallsCodeObject: + title: Code interpreter tool call + type: object + description: Details of the Code Interpreter tool call the run step was involved in. + properties: + index: + type: integer + description: The index of the tool call in the tool calls array. + id: + type: string + description: The ID of the tool call. type: type: string + description: >- + The type of tool call. This is always going to be `code_interpreter` + for this type of tool call. enum: - - conversation.item.added - description: The event type, must be `conversation.item.added`. + - code_interpreter x-stainless-const: true - previous_item_id: - anyOf: - - type: string - description: > - The ID of the item that precedes this one, if any. This is used - to - - maintain ordering when items are inserted. - - type: 'null' - item: - $ref: '#/components/schemas/RealtimeConversationItem' + code_interpreter: + type: object + description: The Code Interpreter tool call definition. + properties: + input: + type: string + description: The input to the Code Interpreter tool call. + outputs: + type: array + description: >- + The outputs from the Code Interpreter tool call. Code + Interpreter can output one or more items, including text + (`logs`) or images (`image`). Each of these are represented by a + different object type. + items: + type: object + oneOf: + - $ref: >- + #/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject + - $ref: >- + #/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputImageObject + required: + - index + - type + RunStepDeltaStepDetailsToolCallsCodeOutputImageObject: + title: Code interpreter image output + type: object + properties: + index: + type: integer + description: The index of the output in the outputs array. + type: + description: Always `image`. + type: string + enum: + - image + x-stainless-const: true + image: + type: object + properties: + file_id: + description: The [file](/docs/api-reference/files) ID of the image. + type: string + required: + - index + - type + RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject: + title: Code interpreter log output + type: object + description: Text output from the Code Interpreter tool call as part of a run step. + properties: + index: + type: integer + description: The index of the output in the outputs array. + type: + description: Always `logs`. + type: string + enum: + - logs + x-stainless-const: true + logs: + type: string + description: The text output from the Code Interpreter tool call. + required: + - index + - type + RunStepDeltaStepDetailsToolCallsFileSearchObject: + title: File search tool call + type: object + properties: + index: + type: integer + description: The index of the tool call in the tool calls array. + id: + type: string + description: The ID of the tool call object. + type: + type: string + description: >- + The type of tool call. This is always going to be `file_search` for + this type of tool call. + enum: + - file_search + x-stainless-const: true + file_search: + type: object + description: For now, this is always going to be an empty object. + x-oaiTypeLabel: map + required: + - index + - type + - file_search + RunStepDeltaStepDetailsToolCallsFunctionObject: + type: object + title: Function tool call + properties: + index: + type: integer + description: The index of the tool call in the tool calls array. + id: + type: string + description: The ID of the tool call object. + type: + type: string + description: >- + The type of tool call. This is always going to be `function` for + this type of tool call. + enum: + - function + x-stainless-const: true + function: + type: object + description: The definition of the function that was called. + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments passed to the function. + output: + anyOf: + - type: string + description: >- + The output of the function. This will be `null` if the + outputs have not been + [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + - type: 'null' + required: + - index + - type + RunStepDeltaStepDetailsToolCallsObject: + title: Tool calls + type: object + description: Details of the tool call. + properties: + type: + description: Always `tool_calls`. + type: string + enum: + - tool_calls + x-stainless-const: true + tool_calls: + type: array + description: > + An array of tool calls the run step was involved in. These can be + associated with one of three types of tools: `code_interpreter`, + `file_search`, or `function`. + items: + oneOf: + - $ref: >- + #/components/schemas/RunStepDeltaStepDetailsToolCallsCodeObject + - $ref: >- + #/components/schemas/RunStepDeltaStepDetailsToolCallsFileSearchObject + - $ref: >- + #/components/schemas/RunStepDeltaStepDetailsToolCallsFunctionObject required: - - event_id - type - - item - x-oaiMeta: - name: conversation.item.added - group: realtime - example: | - { - "type": "conversation.item.added", - "event_id": "event_C9G8pjSJCfRNEhMEnYAVy", - "previous_item_id": null, - "item": { - "id": "item_C9G8pGVKYnaZu8PH5YQ9O", - "type": "message", - "status": "completed", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "hi" - } - ] - } - } - RealtimeServerEventConversationItemCreated: + RunStepDetailsMessageCreationObject: + title: Message creation type: object - description: > - Returned when a conversation item is created. There are several - scenarios that produce this event: - - The server is generating a Response, which if successful will produce - either one or two Items, which will be of type `message` - (role `assistant`) or type `function_call`. - - The input audio buffer has been committed, either by the client or the - server (in `server_vad` mode). The server will take the content of the - input audio buffer and add it to a new user message Item. - - The client has sent a `conversation.item.create` event to add a new Item - to the Conversation. + description: Details of the message creation by the run step. properties: - event_id: - type: string - description: The unique ID of the server event. type: + description: Always `message_creation`. type: string enum: - - conversation.item.created - description: The event type, must be `conversation.item.created`. + - message_creation x-stainless-const: true - previous_item_id: - anyOf: - - type: string - description: > - The ID of the preceding item in the Conversation context, allows - the - - client to understand the order of the conversation. Can be - `null` if the - - item has no predecessor. - - type: 'null' - item: - $ref: '#/components/schemas/RealtimeConversationItem' + message_creation: + type: object + properties: + message_id: + type: string + description: The ID of the message that was created by this run step. + required: + - message_id required: - - event_id - type - - item - x-oaiMeta: - name: conversation.item.created - group: realtime - example: | - { - "event_id": "event_1920", - "type": "conversation.item.created", - "previous_item_id": "msg_002", - "item": { - "id": "msg_003", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "user", - "content": [] - } - } - RealtimeServerEventConversationItemDeleted: + - message_creation + RunStepDetailsToolCallsCodeObject: + title: Code Interpreter tool call type: object - description: > - Returned when an item in the conversation is deleted by the client with - a - - `conversation.item.delete` event. This event is used to synchronize the - - server's understanding of the conversation history with the client's - view. + description: Details of the Code Interpreter tool call the run step was involved in. properties: - event_id: + id: type: string - description: The unique ID of the server event. + description: The ID of the tool call. type: type: string + description: >- + The type of tool call. This is always going to be `code_interpreter` + for this type of tool call. enum: - - conversation.item.deleted - description: The event type, must be `conversation.item.deleted`. + - code_interpreter x-stainless-const: true - item_id: - type: string - description: The ID of the item that was deleted. + code_interpreter: + type: object + description: The Code Interpreter tool call definition. + required: + - input + - outputs + properties: + input: + type: string + description: The input to the Code Interpreter tool call. + outputs: + type: array + description: >- + The outputs from the Code Interpreter tool call. Code + Interpreter can output one or more items, including text + (`logs`) or images (`image`). Each of these are represented by a + different object type. + items: + type: object + oneOf: + - $ref: >- + #/components/schemas/RunStepDetailsToolCallsCodeOutputLogsObject + - $ref: >- + #/components/schemas/RunStepDetailsToolCallsCodeOutputImageObject required: - - event_id + - id - type - - item_id - x-oaiMeta: - name: conversation.item.deleted - group: realtime - example: | - { - "event_id": "event_2728", - "type": "conversation.item.deleted", - "item_id": "msg_005" - } - RealtimeServerEventConversationItemDone: + - code_interpreter + RunStepDetailsToolCallsCodeOutputImageObject: + title: Code Interpreter image output type: object - description: > - Returned when a conversation item is finalized. - - - The event will include the full content of the Item except for audio - data, which can be retrieved separately with a - `conversation.item.retrieve` event if needed. properties: - event_id: - type: string - description: The unique ID of the server event. type: + description: Always `image`. type: string enum: - - conversation.item.done - description: The event type, must be `conversation.item.done`. + - image x-stainless-const: true - previous_item_id: - anyOf: - - type: string - description: > - The ID of the item that precedes this one, if any. This is used - to - - maintain ordering when items are inserted. - - type: 'null' - item: - $ref: '#/components/schemas/RealtimeConversationItem' + image: + type: object + properties: + file_id: + description: The [file](/docs/api-reference/files) ID of the image. + type: string + required: + - file_id required: - - event_id - type - - item - x-oaiMeta: - name: conversation.item.done - group: realtime - example: | - { - "type": "conversation.item.done", - "event_id": "event_CCXLgMZPo3qioWCeQa4WH", - "previous_item_id": "item_CCXLecNJVIVR2HUy3ABLj", - "item": { - "id": "item_CCXLfxmM5sXVJVz4mCa2S", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "output_audio", - "transcript": "Oh, I can hear you loud and clear! Sounds like we're connected just fine. What can I help you with today?" - } - ] - } - } - RealtimeServerEventConversationItemInputAudioTranscriptionCompleted: + - image + RunStepDetailsToolCallsCodeOutputLogsObject: + title: Code Interpreter log output type: object - description: > - This event is the output of audio transcription for user audio written - to the - - user audio buffer. Transcription begins when the input audio buffer is - - committed by the client or server (when VAD is enabled). Transcription - runs - - asynchronously with Response creation, so this event may come before or - after - - the Response events. - - - Realtime API models accept audio natively, and thus input transcription - is a - - separate process run on a separate ASR (Automatic Speech Recognition) - model. - - The transcript may diverge somewhat from the model's interpretation, and - - should be treated as a rough guide. + description: Text output from the Code Interpreter tool call as part of a run step. properties: - event_id: - type: string - description: The unique ID of the server event. type: + description: Always `logs`. type: string enum: - - conversation.item.input_audio_transcription.completed - description: | - The event type, must be - `conversation.item.input_audio_transcription.completed`. + - logs x-stainless-const: true - item_id: - type: string - description: The ID of the item containing the audio that is being transcribed. - content_index: - type: integer - description: The index of the content part containing the audio. - transcript: + logs: type: string - description: The transcribed text. - logprobs: - anyOf: - - type: array - description: The log probabilities of the transcription. - items: - $ref: '#/components/schemas/LogProbProperties' - - type: 'null' - usage: - type: object - description: >- - Usage statistics for the transcription, this is billed according to - the ASR model's pricing rather than the realtime model's pricing. - oneOf: - - $ref: '#/components/schemas/TranscriptTextUsageTokens' - title: Token Usage - - $ref: '#/components/schemas/TranscriptTextUsageDuration' - title: Duration Usage + description: The text output from the Code Interpreter tool call. required: - - event_id - type - - item_id - - content_index - - transcript - - usage - x-oaiMeta: - name: conversation.item.input_audio_transcription.completed - group: realtime - example: | - { - "type": "conversation.item.input_audio_transcription.completed", - "event_id": "event_CCXGRvtUVrax5SJAnNOWZ", - "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", - "content_index": 0, - "transcript": "Hey, can you hear me?", - "usage": { - "type": "tokens", - "total_tokens": 22, - "input_tokens": 13, - "input_token_details": { - "text_tokens": 0, - "audio_tokens": 13 - }, - "output_tokens": 9 - } - } - RealtimeServerEventConversationItemInputAudioTranscriptionDelta: + - logs + RunStepDetailsToolCallsFileSearchObject: + title: File search tool call type: object - description: > - Returned when the text value of an input audio transcription content - part is updated with incremental transcription results. properties: - event_id: + id: type: string - description: The unique ID of the server event. + description: The ID of the tool call object. type: type: string - enum: - - conversation.item.input_audio_transcription.delta description: >- - The event type, must be - `conversation.item.input_audio_transcription.delta`. + The type of tool call. This is always going to be `file_search` for + this type of tool call. + enum: + - file_search x-stainless-const: true - item_id: - type: string - description: The ID of the item containing the audio that is being transcribed. - content_index: - type: integer - description: The index of the content part in the item's content array. - delta: - type: string - description: The text delta. - logprobs: - anyOf: - - type: array - description: >- - The log probabilities of the transcription. These can be enabled - by configurating the session with `"include": - ["item.input_audio_transcription.logprobs"]`. Each entry in the - array corresponds a log probability of which token would be - selected for this chunk of transcription. This can help to - identify if it was possible there were multiple valid options - for a given chunk of transcription. + file_search: + type: object + description: For now, this is always going to be an empty object. + x-oaiTypeLabel: map + properties: + ranking_options: + $ref: >- + #/components/schemas/RunStepDetailsToolCallsFileSearchRankingOptionsObject + results: + type: array + description: The results of the file search. items: - $ref: '#/components/schemas/LogProbProperties' - - type: 'null' + $ref: >- + #/components/schemas/RunStepDetailsToolCallsFileSearchResultObject required: - - event_id + - id - type - - item_id - x-oaiMeta: - name: conversation.item.input_audio_transcription.delta - group: realtime - example: | - { - "type": "conversation.item.input_audio_transcription.delta", - "event_id": "event_CCXGRxsAimPAs8kS2Wc7Z", - "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", - "content_index": 0, - "delta": "Hey", - "obfuscation": "aLxx0jTEciOGe" - } - RealtimeServerEventConversationItemInputAudioTranscriptionFailed: + - file_search + RunStepDetailsToolCallsFileSearchRankingOptionsObject: + title: File search tool call ranking options type: object - description: > - Returned when input audio transcription is configured, and a - transcription - - request for a user message failed. These events are separate from other - - `error` events so that the client can identify the related Item. + description: The ranking options for the file search. properties: - event_id: + ranker: + $ref: '#/components/schemas/FileSearchRanker' + score_threshold: + type: number + description: >- + The score threshold for the file search. All values must be a + floating point number between 0 and 1. + minimum: 0 + maximum: 1 + required: + - ranker + - score_threshold + RunStepDetailsToolCallsFileSearchResultObject: + title: File search tool call result + type: object + description: A result instance of the file search. + x-oaiTypeLabel: map + properties: + file_id: type: string - description: The unique ID of the server event. + description: The ID of the file that result was found in. + file_name: + type: string + description: The name of the file that result was found in. + score: + type: number + description: >- + The score of the result. All values must be a floating point number + between 0 and 1. + minimum: 0 + maximum: 1 + content: + type: array + description: >- + The content of the result that was found. The content is only + included if requested via the include query parameter. + items: + type: object + properties: + type: + type: string + description: The type of the content. + enum: + - text + x-stainless-const: true + text: + type: string + description: The text content of the file. + required: + - file_id + - file_name + - score + RunStepDetailsToolCallsFunctionObject: + type: object + title: Function tool call + properties: + id: + type: string + description: The ID of the tool call object. type: type: string + description: >- + The type of tool call. This is always going to be `function` for + this type of tool call. enum: - - conversation.item.input_audio_transcription.failed - description: | - The event type, must be - `conversation.item.input_audio_transcription.failed`. + - function x-stainless-const: true - item_id: - type: string - description: The ID of the user message item. - content_index: - type: integer - description: The index of the content part containing the audio. - error: + function: type: object - description: Details of the transcription error. + description: The definition of the function that was called. properties: - type: - type: string - description: The type of error. - code: - type: string - description: Error code, if any. - message: + name: type: string - description: A human-readable error message. - param: + description: The name of the function. + arguments: type: string - description: Parameter related to the error, if any. + description: The arguments passed to the function. + output: + anyOf: + - type: string + description: >- + The output of the function. This will be `null` if the + outputs have not been + [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + - type: 'null' + required: + - name + - arguments + - output + required: + - id + - type + - function + RunStepDetailsToolCallsObject: + title: Tool calls + type: object + description: Details of the tool call. + properties: + type: + description: Always `tool_calls`. + type: string + enum: + - tool_calls + x-stainless-const: true + tool_calls: + type: array + description: > + An array of tool calls the run step was involved in. These can be + associated with one of three types of tools: `code_interpreter`, + `file_search`, or `function`. + items: + oneOf: + - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsFileSearchObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsFunctionObject' required: - - event_id - type - - item_id - - content_index - - error - x-oaiMeta: - name: conversation.item.input_audio_transcription.failed - group: realtime - example: | - { - "event_id": "event_2324", - "type": "conversation.item.input_audio_transcription.failed", - "item_id": "msg_003", - "content_index": 0, - "error": { - "type": "transcription_error", - "code": "audio_unintelligible", - "message": "The audio could not be transcribed.", - "param": null - } - } - RealtimeServerEventConversationItemInputAudioTranscriptionSegment: + - tool_calls + RunStepObject: type: object - description: >- - Returned when an input audio transcription segment is identified for an - item. + title: Run steps + description: | + Represents a step in execution of a run. properties: - event_id: + id: + description: >- + The identifier of the run step, which can be referenced in API + endpoints. type: string - description: The unique ID of the server event. - type: + object: + description: The object type, which is always `thread.run.step`. type: string enum: - - conversation.item.input_audio_transcription.segment - description: >- - The event type, must be - `conversation.item.input_audio_transcription.segment`. + - thread.run.step x-stainless-const: true - item_id: - type: string - description: The ID of the item containing the input audio content. - content_index: + created_at: + description: The Unix timestamp (in seconds) for when the run step was created. type: integer - description: The index of the input audio content part within the item. - text: + format: unixtime + assistant_id: + description: >- + The ID of the [assistant](/docs/api-reference/assistants) associated + with the run step. type: string - description: The text for this segment. - id: + thread_id: + description: The ID of the [thread](/docs/api-reference/threads) that was run. type: string - description: The segment identifier. - speaker: + run_id: + description: >- + The ID of the [run](/docs/api-reference/runs) that this run step is + a part of. type: string - description: The detected speaker label for this segment. - start: - type: number - format: double - description: Start time of the segment in seconds. - end: - type: number - format: double - description: End time of the segment in seconds. + type: + description: >- + The type of run step, which can be either `message_creation` or + `tool_calls`. + type: string + enum: + - message_creation + - tool_calls + status: + description: >- + The status of the run step, which can be either `in_progress`, + `cancelled`, `failed`, `completed`, or `expired`. + type: string + enum: + - in_progress + - cancelled + - failed + - completed + - expired + step_details: + type: object + description: The details of the run step. + oneOf: + - $ref: '#/components/schemas/RunStepDetailsMessageCreationObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsObject' + last_error: + anyOf: + - type: object + description: >- + The last error associated with this run step. Will be `null` if + there are no errors. + properties: + code: + type: string + description: One of `server_error` or `rate_limit_exceeded`. + enum: + - server_error + - rate_limit_exceeded + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + - type: 'null' + expired_at: + anyOf: + - description: >- + The Unix timestamp (in seconds) for when the run step expired. A + step is considered expired if the parent run is expired. + type: integer + format: unixtime + - type: 'null' + cancelled_at: + anyOf: + - description: >- + The Unix timestamp (in seconds) for when the run step was + cancelled. + type: integer + format: unixtime + - type: 'null' + failed_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the run step failed. + type: integer + format: unixtime + - type: 'null' + completed_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the run step completed. + type: integer + format: unixtime + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + usage: + $ref: '#/components/schemas/RunStepCompletionUsage' required: - - event_id - - type - - item_id - - content_index - - text - id - - speaker - - start - - end + - object + - created_at + - assistant_id + - thread_id + - run_id + - type + - status + - step_details + - last_error + - expired_at + - cancelled_at + - failed_at + - completed_at + - metadata + - usage x-oaiMeta: - name: conversation.item.input_audio_transcription.segment - group: realtime + name: The run step object + beta: true example: | { - "event_id": "event_6501", - "type": "conversation.item.input_audio_transcription.segment", - "item_id": "msg_011", - "content_index": 0, - "text": "hello", - "id": "seg_0001", - "speaker": "spk_1", - "start": 0.0, - "end": 0.4 + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + } } - RealtimeServerEventConversationItemRetrieved: + RunStepStreamEvent: + oneOf: + - type: object + properties: + event: + type: string + enum: + - thread.run.step.created + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: >- + Occurs when a [run step](/docs/api-reference/run-steps/step-object) + is created. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.in_progress + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: >- + Occurs when a [run step](/docs/api-reference/run-steps/step-object) + moves to an `in_progress` state. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.delta + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepDeltaObject' + required: + - event + - data + description: >- + Occurs when parts of a [run + step](/docs/api-reference/run-steps/step-object) are being streamed. + x-oaiMeta: + dataDescription: >- + `data` is a [run step + delta](/docs/api-reference/assistants-streaming/run-step-delta-object) + - type: object + properties: + event: + type: string + enum: + - thread.run.step.completed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: >- + Occurs when a [run step](/docs/api-reference/run-steps/step-object) + is completed. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.failed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: >- + Occurs when a [run step](/docs/api-reference/run-steps/step-object) + fails. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.cancelled + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: >- + Occurs when a [run step](/docs/api-reference/run-steps/step-object) + is cancelled. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.expired + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: >- + Occurs when a [run step](/docs/api-reference/run-steps/step-object) + expires. + x-oaiMeta: + dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' + RunStreamEvent: + oneOf: + - type: object + properties: + event: + type: string + enum: + - thread.run.created + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a new [run](/docs/api-reference/runs/object) is created. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.queued + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: >- + Occurs when a [run](/docs/api-reference/runs/object) moves to a + `queued` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.in_progress + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: >- + Occurs when a [run](/docs/api-reference/runs/object) moves to an + `in_progress` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.requires_action + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: >- + Occurs when a [run](/docs/api-reference/runs/object) moves to a + `requires_action` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.completed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) is completed. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.incomplete + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: >- + Occurs when a [run](/docs/api-reference/runs/object) ends with + status `incomplete`. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.failed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) fails. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.cancelling + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: >- + Occurs when a [run](/docs/api-reference/runs/object) moves to a + `cancelling` status. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.cancelled + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) is cancelled. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + - type: object + properties: + event: + type: string + enum: + - thread.run.expired + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](/docs/api-reference/runs/object) expires. + x-oaiMeta: + dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' + RunToolCallObject: type: object - description: > - Returned when a conversation item is retrieved with - `conversation.item.retrieve`. This is provided as a way to fetch the - server's representation of an item, for example to get access to the - post-processed audio data after noise cancellation and VAD. It includes - the full content of the Item, including audio data. + description: Tool call objects properties: - event_id: + id: type: string - description: The unique ID of the server event. + description: >- + The ID of the tool call. This ID must be referenced when you submit + the tool outputs in using the [Submit tool outputs to + run](/docs/api-reference/runs/submitToolOutputs) endpoint. type: type: string + description: >- + The type of tool call the output is required for. For now, this is + always `function`. enum: - - conversation.item.retrieved - description: The event type, must be `conversation.item.retrieved`. + - function x-stainless-const: true - item: - $ref: '#/components/schemas/RealtimeConversationItem' + function: + type: object + description: The function definition. + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: >- + The arguments that the model expects you to pass to the + function. + required: + - name + - arguments required: - - event_id + - id - type - - item - x-oaiMeta: - name: conversation.item.retrieved - group: realtime - example: | - { - "type": "conversation.item.retrieved", - "event_id": "event_CCXGSizgEppa2d4XbKA7K", - "item": { - "id": "item_CCXGRxbY0n6WE4EszhF5w", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "audio", - "transcript": "Yes, I can hear you loud and clear. How can I help you today?", - "audio": "8//2//v/9//q/+//+P/s...", - "format": "pcm16" - } - ] - } - } - RealtimeServerEventConversationItemTruncated: - type: object - description: > - Returned when an earlier assistant audio message item is truncated by - the - - client with a `conversation.item.truncate` event. This event is used to - - synchronize the server's understanding of the audio with the client's - playback. - - - This action will truncate the audio and remove the server-side text - transcript + - function + ServiceTier: + anyOf: + - type: string + description: | + Specifies the processing type used for serving the request. + - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. + - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. + - If set to '[flex](/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier. + - When not set, the default behavior is 'auto'. - to ensure there is no text in the context that hasn't been heard by the - user. + When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. + enum: + - auto + - default + - flex + - scale + - priority + default: auto + - type: 'null' + SpeechAudioDeltaEvent: + type: object + description: Emitted for each chunk of audio data generated during speech synthesis. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `speech.audio.delta`. enum: - - conversation.item.truncated - description: The event type, must be `conversation.item.truncated`. + - speech.audio.delta x-stainless-const: true - item_id: + audio: type: string - description: The ID of the assistant message item that was truncated. - content_index: - type: integer - description: The index of the content part that was truncated. - audio_end_ms: - type: integer description: | - The duration up to which the audio was truncated, in milliseconds. + A chunk of Base64-encoded audio data. required: - - event_id - type - - item_id - - content_index - - audio_end_ms + - audio x-oaiMeta: - name: conversation.item.truncated - group: realtime + name: Stream Event (speech.audio.delta) + group: speech example: | { - "event_id": "event_2526", - "type": "conversation.item.truncated", - "item_id": "msg_004", - "content_index": 0, - "audio_end_ms": 1500 + "type": "speech.audio.delta", + "audio": "base64-encoded-audio-data" } - RealtimeServerEventError: + SpeechAudioDoneEvent: type: object - description: > - Returned when an error occurs, which could be a client problem or a - server - - problem. Most errors are recoverable and the session will stay open, we - - recommend to implementors to monitor and log error messages by default. + description: >- + Emitted when the speech synthesis is complete and all audio has been + streamed. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `speech.audio.done`. enum: - - error - description: The event type, must be `error`. + - speech.audio.done x-stainless-const: true - error: + usage: type: object - description: Details of the error. - required: - - type - - message + description: | + Token usage statistics for the request. properties: - type: - type: string - description: > - The type of error (e.g., "invalid_request_error", - "server_error"). - code: - anyOf: - - type: string - description: Error code, if any. - - type: 'null' - message: - type: string - description: A human-readable error message. - param: - anyOf: - - type: string - description: Parameter related to the error, if any. - - type: 'null' - event_id: - anyOf: - - type: string - description: > - The event_id of the client event that caused the error, if - applicable. - - type: 'null' - required: - - event_id - - type - - error - x-oaiMeta: - name: error - group: realtime - example: | - { - "event_id": "event_890", - "type": "error", - "error": { - "type": "invalid_request_error", - "code": "invalid_event", - "message": "The 'type' field is missing.", - "param": null, - "event_id": "event_567" - } - } - RealtimeServerEventInputAudioBufferCleared: - type: object - description: | - Returned when the input audio buffer is cleared by the client with a - `input_audio_buffer.clear` event. - properties: - event_id: - type: string - description: The unique ID of the server event. - type: - type: string - enum: - - input_audio_buffer.cleared - description: The event type, must be `input_audio_buffer.cleared`. - x-stainless-const: true + input_tokens: + type: integer + description: Number of input tokens in the prompt. + output_tokens: + type: integer + description: Number of output tokens generated. + total_tokens: + type: integer + description: Total number of tokens used (input + output). + required: + - input_tokens + - output_tokens + - total_tokens required: - - event_id - type + - usage x-oaiMeta: - name: input_audio_buffer.cleared - group: realtime + name: Stream Event (speech.audio.done) + group: speech example: | { - "event_id": "event_1314", - "type": "input_audio_buffer.cleared" + "type": "speech.audio.done", + "usage": { + "input_tokens": 14, + "output_tokens": 101, + "total_tokens": 115 + } } - RealtimeServerEventInputAudioBufferCommitted: + SpendAlertNotificationChannel: type: object - description: > - Returned when an input audio buffer is committed, either by the client - or - - automatically in server VAD mode. The `item_id` property is the ID of - the user - - message item that will be created, thus a `conversation.item.created` - event - - will also be sent to the client. + description: Email notification settings for a spend alert. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - input_audio_buffer.committed - description: The event type, must be `input_audio_buffer.committed`. + - email + description: The notification channel type. Currently only `email` is supported. x-stainless-const: true - previous_item_id: + recipients: + type: array + description: Email addresses that receive the spend alert notification. + items: + type: string + subject_prefix: anyOf: - type: string - description: > - The ID of the preceding item after which the new item will be - inserted. - - Can be `null` if the item has no predecessor. - type: 'null' - item_id: - type: string - description: The ID of the user message item that will be created. + description: Optional subject prefix for alert emails. required: - - event_id - type - - item_id - x-oaiMeta: - name: input_audio_buffer.committed - group: realtime - example: | - { - "event_id": "event_1121", - "type": "input_audio_buffer.committed", - "previous_item_id": "msg_001", - "item_id": "msg_002" - } - RealtimeServerEventInputAudioBufferDtmfEventReceived: + - recipients + StaticChunkingStrategy: type: object - description: > - **SIP Only:** Returned when an DTMF event is received. A DTMF event is a - message that - - represents a telephone keypad press (0–9, *, #, A–D). The `event` - property + additionalProperties: false + properties: + max_chunk_size_tokens: + type: integer + minimum: 100 + maximum: 4096 + description: >- + The maximum number of tokens in each chunk. The default value is + `800`. The minimum value is `100` and the maximum value is `4096`. + chunk_overlap_tokens: + type: integer + description: > + The number of tokens that overlap between chunks. The default value + is `400`. - is the keypad that the user press. The `received_at` is the UTC Unix - Timestamp - that the server received the event. + Note that the overlap must not exceed half of + `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + StaticChunkingStrategyRequestParam: + type: object + title: Static Chunking Strategy + description: >- + Customize your own chunking strategy by setting chunk size and chunk + overlap. + additionalProperties: false properties: type: type: string + description: Always `static`. enum: - - input_audio_buffer.dtmf_event_received - description: The event type, must be `input_audio_buffer.dtmf_event_received`. + - static x-stainless-const: true - event: - type: string - description: The telephone keypad that was pressed by the user. - received_at: - type: integer - description: | - UTC Unix Timestamp when DTMF Event was received by server. + static: + $ref: '#/components/schemas/StaticChunkingStrategy' required: - type - - event - - received_at - x-oaiMeta: - name: input_audio_buffer.dtmf_event_received - group: realtime - example: | - { - "type":" input_audio_buffer.dtmf_event_received", - "event": "9", - "received_at": 1763605109, - } - RealtimeServerEventInputAudioBufferSpeechStarted: + - static + StaticChunkingStrategyResponseParam: type: object - description: > - Sent by the server when in `server_vad` mode to indicate that speech has - been - - detected in the audio buffer. This can happen any time audio is added to - the - - buffer (unless speech is already detected). The client may want to use - this - - event to interrupt audio playback or provide visual feedback to the - user. - - - The client should expect to receive a - `input_audio_buffer.speech_stopped` event - - when speech stops. The `item_id` property is the ID of the user message - item - - that will be created when speech stops and will also be included in the - - `input_audio_buffer.speech_stopped` event (unless the client manually - commits - - the audio buffer during VAD activation). + title: Static Chunking Strategy + additionalProperties: false properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: Always `static`. enum: - - input_audio_buffer.speech_started - description: The event type, must be `input_audio_buffer.speech_started`. + - static x-stainless-const: true - audio_start_ms: - type: integer - description: > - Milliseconds from the start of all audio written to the buffer - during the - - session when speech was first detected. This will correspond to the - - beginning of audio sent to the model, and thus includes the - - `prefix_padding_ms` configured in the Session. - item_id: - type: string - description: > - The ID of the user message item that will be created when speech - stops. + static: + $ref: '#/components/schemas/StaticChunkingStrategy' required: - - event_id - type - - audio_start_ms - - item_id - x-oaiMeta: - name: input_audio_buffer.speech_started - group: realtime - example: | - { - "event_id": "event_1516", - "type": "input_audio_buffer.speech_started", - "audio_start_ms": 1000, - "item_id": "msg_003" - } - RealtimeServerEventInputAudioBufferSpeechStopped: - type: object - description: > - Returned in `server_vad` mode when the server detects the end of speech - in + - static + StopConfiguration: + description: | + Not supported with latest reasoning models `o3` and `o4-mini`. - the audio buffer. The server will also send an - `conversation.item.created` + Up to 4 sequences where the API will stop generating further tokens. The + returned text will not contain the stop sequence. + default: null + nullable: true + oneOf: + - type: string + default: <|endoftext|> + example: |+ - event with the user message item that is created from the audio buffer. + nullable: true + - type: array + minItems: 1 + maxItems: 4 + items: + type: string + example: '["\n"]' + SubmitToolOutputsRunRequest: + type: object + additionalProperties: false properties: - event_id: - type: string - description: The unique ID of the server event. - type: - type: string - enum: - - input_audio_buffer.speech_stopped - description: The event type, must be `input_audio_buffer.speech_stopped`. - x-stainless-const: true - audio_end_ms: - type: integer - description: > - Milliseconds since the session started when speech stopped. This - will - - correspond to the end of audio sent to the model, and thus includes - the - - `min_silence_duration_ms` configured in the Session. - item_id: - type: string - description: The ID of the user message item that will be created. + tool_outputs: + description: A list of tools for which the outputs are being submitted. + type: array + items: + type: object + properties: + tool_call_id: + type: string + description: >- + The ID of the tool call in the `required_action` object within + the run object the output is being submitted for. + output: + type: string + description: >- + The output of the tool call to be submitted to continue the + run. + stream: + anyOf: + - type: boolean + description: > + If `true`, returns a stream of events that happen during the Run + as server-sent events, terminating when the Run enters a + terminal state with a `data: [DONE]` message. + - type: 'null' required: - - event_id - - type - - audio_end_ms - - item_id - x-oaiMeta: - name: input_audio_buffer.speech_stopped - group: realtime - example: | - { - "event_id": "event_1718", - "type": "input_audio_buffer.speech_stopped", - "audio_end_ms": 2000, - "item_id": "msg_003" - } - RealtimeServerEventInputAudioBufferTimeoutTriggered: - type: object + - tool_outputs + TextResponseFormatConfiguration: description: > - Returned when the Server VAD timeout is triggered for the input audio - buffer. This is configured + An object specifying the format that the model must output. - with `idle_timeout_ms` in the `turn_detection` settings of the session, - and it indicates that - there hasn't been any speech detected for the configured duration. + Configuring `{ "type": "json_schema" }` enables Structured Outputs, + which ensures the model will match your supplied JSON schema. Learn more + in the - The `audio_start_ms` and `audio_end_ms` fields indicate the segment of - audio after the last + [Structured Outputs guide](/docs/guides/structured-outputs). - model response up to the triggering time, as an offset from the - beginning of audio written - to the input audio buffer. This means it demarcates the segment of audio - that was silent and + The default format is `{ "type": "text" }` with no additional options. - the difference between the start and end values will roughly match the - configured timeout. + **Not recommended for gpt-4o and newer models:** - The empty audio will be committed to the conversation as an - `input_audio` item (there will be a - `input_audio_buffer.committed` event) and a model response will be - generated. There may be speech + Setting to `{ "type": "json_object" }` enables the older JSON mode, + which - that didn't trigger VAD but is still detected by the model, so the model - may respond with + ensures the message the model generates is valid JSON. Using + `json_schema` - something relevant to the conversation or a prompt to continue speaking. + is preferred for models that support it. + oneOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/TextResponseFormatJsonSchema' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + TextResponseFormatJsonSchema: + type: object + title: JSON schema + description: | + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: The type of response format being defined. Always `json_schema`. enum: - - input_audio_buffer.timeout_triggered - description: The event type, must be `input_audio_buffer.timeout_triggered`. + - json_schema x-stainless-const: true - audio_start_ms: - type: integer - description: >- - Millisecond offset of audio written to the input audio buffer that - was after the playback time of the last model response. - audio_end_ms: - type: integer - description: >- - Millisecond offset of audio written to the input audio buffer at the - time the timeout was triggered. - item_id: + description: type: string - description: The ID of the item associated with this segment. + description: > + A description of what the response format is for, used by the model + to + + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: > + Whether to enable strict schema adherence when generating the + output. + + If set to true, the model will always follow the exact schema + defined + + in the `schema` field. Only a subset of JSON Schema is supported + when + + `strict` is `true`. To learn more, read the [Structured Outputs + + guide](/docs/guides/structured-outputs). + - type: 'null' required: - - event_id - type - - audio_start_ms - - audio_end_ms - - item_id + - schema + - name + ThreadObject: + type: object + title: Thread + description: >- + Represents a thread that contains + [messages](/docs/api-reference/messages). + properties: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `thread`. + type: string + enum: + - thread + x-stainless-const: true + created_at: + description: The Unix timestamp (in seconds) for when the thread was created. + type: integer + format: unixtime + tool_resources: + anyOf: + - type: object + description: > + A set of resources that are made available to the assistant's + tools in this thread. The resources are specific to the type of + tool. For example, the `code_interpreter` tool requires a list + of file IDs, while the `file_search` tool requires a list of + vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: > + A list of [file](/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a + maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: > + The [vector + store](/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 + vector store attached to the thread. + maxItems: 1 + items: + type: string + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - id + - object + - created_at + - tool_resources + - metadata x-oaiMeta: - name: input_audio_buffer.timeout_triggered - group: realtime + name: The thread object + beta: true example: | { - "type":"input_audio_buffer.timeout_triggered", - "event_id":"event_CEKKrf1KTGvemCPyiJTJ2", - "audio_start_ms":13216, - "audio_end_ms":19232, - "item_id":"item_CEKKrWH0GiwN0ET97NUZc" + "id": "thread_abc123", + "object": "thread", + "created_at": 1698107661, + "metadata": {} } - RealtimeServerEventMCPListToolsCompleted: + ThreadStreamEvent: + oneOf: + - type: object + properties: + enabled: + type: boolean + description: Whether to enable input audio transcription. + event: + type: string + enum: + - thread.created + x-stainless-const: true + data: + $ref: '#/components/schemas/ThreadObject' + required: + - event + - data + description: >- + Occurs when a new [thread](/docs/api-reference/threads/object) is + created. + x-oaiMeta: + dataDescription: '`data` is a [thread](/docs/api-reference/threads/object)' + ToggleCertificatesRequest: type: object - description: Returned when listing MCP tools has completed for an item. properties: - event_id: - type: string - description: The unique ID of the server event. + certificate_ids: + type: array + items: + type: string + example: cert_abc + minItems: 1 + maxItems: 10 + required: + - certificate_ids + Tool: + description: | + A tool that can be used to generate a response. + discriminator: + propertyName: type + oneOf: + - $ref: '#/components/schemas/FunctionTool' + - $ref: '#/components/schemas/FileSearchTool' + - $ref: '#/components/schemas/ComputerTool' + - $ref: '#/components/schemas/ComputerUsePreviewTool' + - $ref: '#/components/schemas/WebSearchTool' + - $ref: '#/components/schemas/MCPTool' + - $ref: '#/components/schemas/CodeInterpreterTool' + - $ref: '#/components/schemas/ProgrammaticToolCallingParam' + - $ref: '#/components/schemas/ImageGenTool' + - $ref: '#/components/schemas/LocalShellToolParam' + - $ref: '#/components/schemas/FunctionShellToolParam' + - $ref: '#/components/schemas/CustomToolParam' + - $ref: '#/components/schemas/NamespaceToolParam' + - $ref: '#/components/schemas/ToolSearchToolParam' + - $ref: '#/components/schemas/WebSearchPreviewTool' + - $ref: '#/components/schemas/ApplyPatchToolParam' + ToolChoiceAllowed: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + properties: type: type: string enum: - - mcp_list_tools.completed - description: The event type, must be `mcp_list_tools.completed`. + - allowed_tools + description: Allowed tool configuration type. Always `allowed_tools`. x-stainless-const: true - item_id: + mode: type: string - description: The ID of the MCP list tools item. + enum: + - auto + - required + description: > + Constrains the tools available to the model to a pre-defined set. + + + `auto` allows the model to pick from among the allowed tools and + generate a + + message. + + + `required` requires the model to call one or more of the allowed + tools. + tools: + type: array + description: | + A list of tool definitions that the model should be allowed to call. + + For the Responses API, the list of tool definitions might look like: + ```json + [ + { "type": "function", "name": "get_weather" }, + { "type": "mcp", "server_label": "deepwiki" }, + { "type": "image_generation" } + ] + ``` + items: + type: object + description: | + A tool definition that the model should be allowed to call. + additionalProperties: true + x-oaiExpandable: false required: - - event_id - type - - item_id - x-oaiMeta: - name: mcp_list_tools.completed - group: realtime - example: | - { - "event_id": "event_6102", - "type": "mcp_list_tools.completed", - "item_id": "mcp_list_tools_001" - } - RealtimeServerEventMCPListToolsFailed: + - mode + - tools + ToolChoiceCustom: type: object - description: Returned when listing MCP tools has failed for an item. + title: Custom tool + description: | + Use this option to force the model to call a specific custom tool. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - mcp_list_tools.failed - description: The event type, must be `mcp_list_tools.failed`. + - custom + description: For custom tool calling, the type is always `custom`. x-stainless-const: true - item_id: + name: type: string - description: The ID of the MCP list tools item. + description: The name of the custom tool to call. required: - - event_id - type - - item_id - x-oaiMeta: - name: mcp_list_tools.failed - group: realtime - example: | - { - "event_id": "event_6103", - "type": "mcp_list_tools.failed", - "item_id": "mcp_list_tools_001" - } - RealtimeServerEventMCPListToolsInProgress: + - name + ToolChoiceFunction: type: object - description: Returned when listing MCP tools is in progress for an item. + title: Function tool + description: | + Use this option to force the model to call a specific function. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - mcp_list_tools.in_progress - description: The event type, must be `mcp_list_tools.in_progress`. + - function + description: For function calling, the type is always `function`. x-stainless-const: true - item_id: + name: type: string - description: The ID of the MCP list tools item. + description: The name of the function to call. required: - - event_id - type - - item_id - x-oaiMeta: - name: mcp_list_tools.in_progress - group: realtime - example: | - { - "event_id": "event_6101", - "type": "mcp_list_tools.in_progress", - "item_id": "mcp_list_tools_001" - } - RealtimeServerEventOutputAudioBufferCleared: + - name + ToolChoiceMCP: type: object + title: MCP tool description: > - **WebRTC/SIP Only:** Emitted when the output audio buffer is cleared. - This happens either in VAD - - mode when the user has interrupted - (`input_audio_buffer.speech_started`), - - or when the client has emitted the `output_audio_buffer.clear` event to - manually - - cut off the current audio response. - - [Learn - more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + Use this option to force the model to call a specific tool on a remote + MCP server. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - output_audio_buffer.cleared - description: The event type, must be `output_audio_buffer.cleared`. + - mcp + description: For MCP tools, the type is always `mcp`. x-stainless-const: true - response_id: + server_label: type: string - description: The unique ID of the response that produced the audio. + description: | + The label of the MCP server to use. + name: + anyOf: + - type: string + description: | + The name of the tool to call on the server. + - type: 'null' required: - - event_id - type - - response_id - x-oaiMeta: - name: output_audio_buffer.cleared - group: realtime - example: | - { - "event_id": "event_abc123", - "type": "output_audio_buffer.cleared", - "response_id": "resp_abc123" - } - RealtimeServerEventOutputAudioBufferStarted: - type: object + - server_label + ToolChoiceOptions: + type: string + title: Tool choice mode description: > - **WebRTC/SIP Only:** Emitted when the server begins streaming audio to - the client. This event is + Controls which (if any) tool is called by the model. - emitted after an audio content part has been added - (`response.content_part.added`) - to the response. + `none` means the model will not call any tool and instead generates a + message. - [Learn - more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + + `auto` means the model can pick between generating a message or calling + one or + + more tools. + + + `required` means the model must call one or more tools. + enum: + - none + - auto + - required + ToolChoiceParam: + description: | + How the model should select which tool (or tools) to use when generating + a response. See the `tools` parameter to see how to specify which tools + the model can call. + oneOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceAllowed' + - $ref: '#/components/schemas/ToolChoiceTypes' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + - $ref: '#/components/schemas/ToolChoiceCustom' + - $ref: '#/components/schemas/SpecificProgrammaticToolCallingParam' + - $ref: '#/components/schemas/SpecificApplyPatchParam' + - $ref: '#/components/schemas/SpecificFunctionShellParam' + ToolChoiceTypes: + type: object + title: Hosted tool + description: > + Indicates that the model should use a built-in tool to generate a + response. + + [Learn more about built-in tools](/docs/guides/tools). properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of hosted tool the model should to use. Learn more about + [built-in tools](/docs/guides/tools). + + Allowed values are: + - `file_search` + - `web_search_preview` + - `computer` + - `computer_use_preview` + - `computer_use` + - `code_interpreter` + - `image_generation` enum: - - output_audio_buffer.started - description: The event type, must be `output_audio_buffer.started`. - x-stainless-const: true - response_id: - type: string - description: The unique ID of the response that produced the audio. + - file_search + - web_search_preview + - computer + - computer_use_preview + - computer_use + - web_search_preview_2025_03_11 + - image_generation + - code_interpreter required: - - event_id - type - - response_id - x-oaiMeta: - name: output_audio_buffer.started - group: realtime - example: | - { - "event_id": "event_abc123", - "type": "output_audio_buffer.started", - "response_id": "resp_abc123" - } - RealtimeServerEventOutputAudioBufferStopped: - type: object + ToolsArray: + type: array description: > - **WebRTC/SIP Only:** Emitted when the output audio buffer has been - completely drained on the server, + An array of tools the model may call while generating a response. You - and no more audio is forthcoming. This event is emitted after the full - response + can specify which tool to use by setting the `tool_choice` parameter. - data has been sent to the client (`response.done`). - [Learn - more](/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + We support the following categories of tools: + + - **Built-in tools**: Tools that are provided by OpenAI that extend the + model's capabilities, like [web search](/docs/guides/tools-web-search) + or [file search](/docs/guides/tools-file-search). Learn more about + [built-in tools](/docs/guides/tools). + - **MCP Tools**: Integrations with third-party systems via custom MCP + servers + or predefined connectors such as Google Drive and SharePoint. Learn more about + [MCP Tools](/docs/guides/tools-connectors-mcp). + - **Function calls (custom tools)**: Functions that are defined by you, + enabling the model to call your own code with strongly typed arguments + and outputs. Learn more about + [function calling](/docs/guides/function-calling). You can also use + custom tools to call your own code. + items: + $ref: '#/components/schemas/Tool' + TranscriptTextDeltaEvent: + type: object + description: >- + Emitted when there is an additional text delta. This is also the first + event emitted when the transcription starts. Only emitted when you + [create a transcription](/docs/api-reference/audio/create-transcription) + with the `Stream` parameter set to `true`. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `transcript.text.delta`. enum: - - output_audio_buffer.stopped - description: The event type, must be `output_audio_buffer.stopped`. + - transcript.text.delta x-stainless-const: true - response_id: + delta: type: string - description: The unique ID of the response that produced the audio. + description: | + The text delta that was additionally transcribed. + logprobs: + type: array + description: > + The log probabilities of the delta. Only included if you [create a + transcription](/docs/api-reference/audio/create-transcription) with + the `include[]` parameter set to `logprobs`. + items: + type: object + properties: + token: + type: string + description: | + The token that was used to generate the log probability. + logprob: + type: number + description: | + The log probability of the token. + bytes: + type: array + items: + type: integer + description: | + The bytes that were used to generate the log probability. + segment_id: + type: string + description: > + Identifier of the diarized segment that this delta belongs to. Only + present when using `gpt-4o-transcribe-diarize`. required: - - event_id - type - - response_id + - delta x-oaiMeta: - name: output_audio_buffer.stopped - group: realtime + name: Stream Event (transcript.text.delta) + group: transcript example: | { - "event_id": "event_abc123", - "type": "output_audio_buffer.stopped", - "response_id": "resp_abc123" + "type": "transcript.text.delta", + "delta": " wonderful" } - RealtimeServerEventRateLimitsUpdated: + TranscriptTextDoneEvent: type: object - description: > - Emitted at the beginning of a Response to indicate the updated rate - limits. - - When a Response is created some tokens will be "reserved" for the - output - - tokens, the rate limits shown here reflect that reservation, which is - then - - adjusted accordingly once the Response is completed. + description: >- + Emitted when the transcription is complete. Contains the complete + transcription text. Only emitted when you [create a + transcription](/docs/api-reference/audio/create-transcription) with the + `Stream` parameter set to `true`. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the event. Always `transcript.text.done`. enum: - - rate_limits.updated - description: The event type, must be `rate_limits.updated`. + - transcript.text.done x-stainless-const: true - rate_limits: + text: + type: string + description: | + The text that was transcribed. + logprobs: type: array - description: List of rate limit information. + description: > + The log probabilities of the individual tokens in the transcription. + Only included if you [create a + transcription](/docs/api-reference/audio/create-transcription) with + the `include[]` parameter set to `logprobs`. items: type: object properties: - name: + token: type: string - enum: - - requests - - tokens description: | - The name of the rate limit (`requests`, `tokens`). - limit: - type: integer - description: The maximum allowed value for the rate limit. - remaining: - type: integer - description: The remaining value before the limit is reached. - reset_seconds: + The token that was used to generate the log probability. + logprob: type: number - description: Seconds until the rate limit resets. + description: | + The log probability of the token. + bytes: + type: array + items: + type: integer + description: | + The bytes that were used to generate the log probability. + usage: + $ref: '#/components/schemas/TranscriptTextUsageTokens' required: - - event_id - type - - rate_limits + - text x-oaiMeta: - name: rate_limits.updated - group: realtime + name: Stream Event (transcript.text.done) + group: transcript example: | { - "event_id": "event_5758", - "type": "rate_limits.updated", - "rate_limits": [ - { - "name": "requests", - "limit": 1000, - "remaining": 999, - "reset_seconds": 60 - }, - { - "name": "tokens", - "limit": 50000, - "remaining": 49950, - "reset_seconds": 60 - } - ] + "type": "transcript.text.done", + "text": "I see skies of blue and clouds of white, the bright blessed days, the dark sacred nights, and I think to myself, what a wonderful world.", + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 4 + }, + "output_tokens": 31, + "total_tokens": 45 + } } - RealtimeServerEventResponseAudioDelta: + TranscriptTextSegmentEvent: type: object - description: Returned when the model-generated audio is updated. + description: > + Emitted when a diarized transcription returns a completed segment with + speaker information. Only emitted when you [create a + transcription](/docs/api-reference/audio/create-transcription) with + `stream` set to `true` and `response_format` set to `diarized_json`. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: The type of the event. Always `transcript.text.segment`. enum: - - response.output_audio.delta - description: The event type, must be `response.output_audio.delta`. + - transcript.text.segment x-stainless-const: true - response_id: + id: type: string - description: The ID of the response. - item_id: + description: Unique identifier for the segment. + start: + type: number + format: double + description: Start timestamp of the segment in seconds. + end: + type: number + format: double + description: End timestamp of the segment in seconds. + text: type: string - description: The ID of the item. - output_index: - type: integer - description: The index of the output item in the response. - content_index: - type: integer - description: The index of the content part in the item's content array. - delta: + description: Transcript text for this segment. + speaker: type: string - description: Base64-encoded audio data delta. + description: Speaker label for this segment. required: - - event_id - type - - response_id - - item_id - - output_index - - content_index - - delta + - id + - start + - end + - text + - speaker x-oaiMeta: - name: response.output_audio.delta - group: realtime + name: Stream Event (transcript.text.segment) + group: transcript example: | { - "event_id": "event_4950", - "type": "response.output_audio.delta", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0, - "delta": "Base64EncodedAudioDelta" + "type": "transcript.text.segment", + "id": "seg_002", + "start": 5.2, + "end": 12.8, + "text": "Hi, I need help with diarization.", + "speaker": "A" } - RealtimeServerEventResponseAudioDone: + TranscriptTextUsageDuration: type: object - description: > - Returned when the model-generated audio is done. Also emitted when a - Response - - is interrupted, incomplete, or cancelled. + title: Duration Usage + description: Usage statistics for models billed by audio input duration. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - response.output_audio.done - description: The event type, must be `response.output_audio.done`. + - duration + description: The type of the usage object. Always `duration` for this variant. x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item. - output_index: - type: integer - description: The index of the output item in the response. - content_index: - type: integer - description: The index of the content part in the item's content array. + seconds: + type: number + format: double + description: Duration of the input audio in seconds. required: - - event_id - type - - response_id - - item_id - - output_index - - content_index - x-oaiMeta: - name: response.output_audio.done - group: realtime - example: | - { - "event_id": "event_5152", - "type": "response.output_audio.done", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0 - } - RealtimeServerEventResponseAudioTranscriptDelta: + - seconds + TranscriptTextUsageTokens: type: object - description: > - Returned when the model-generated transcription of audio output is - updated. + title: Token Usage + description: Usage statistics for models billed by token usage. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string enum: - - response.output_audio_transcript.delta - description: The event type, must be `response.output_audio_transcript.delta`. + - tokens + description: The type of the usage object. Always `tokens` for this variant. x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item. - output_index: + input_tokens: type: integer - description: The index of the output item in the response. - content_index: + description: Number of input tokens billed for this request. + input_token_details: + type: object + description: Details about the input tokens billed for this request. + properties: + text_tokens: + type: integer + description: Number of text tokens billed for this request. + audio_tokens: + type: integer + description: Number of audio tokens billed for this request. + output_tokens: type: integer - description: The index of the content part in the item's content array. - delta: - type: string - description: The transcript delta. + description: Number of output tokens generated. + total_tokens: + type: integer + description: Total number of tokens used (input + output). required: - - event_id - type - - response_id - - item_id - - output_index - - content_index - - delta - x-oaiMeta: - name: response.output_audio_transcript.delta - group: realtime - example: | - { - "event_id": "event_4546", - "type": "response.output_audio_transcript.delta", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0, - "delta": "Hello, how can I a" - } - RealtimeServerEventResponseAudioTranscriptDone: + - input_tokens + - output_tokens + - total_tokens + TranscriptionChunkingStrategy: type: object - description: | - Returned when the model-generated transcription of audio output is done - streaming. Also emitted when a Response is interrupted, incomplete, or - cancelled. + description: >- + Controls how the audio is cut into chunks. When set to `"auto"`, the + + server first normalizes loudness and then uses voice activity detection + (VAD) to + + choose boundaries. `server_vad` object can be provided to tweak VAD + detection + + parameters manually. If unset, the audio is transcribed as a single + block. + oneOf: + - type: string + enum: + - auto + default: + - auto + description: > + Automatically set chunking parameters based on the audio. Must be + set to `"auto"`. + x-stainless-const: true + - $ref: '#/components/schemas/VadConfig' + TranscriptionDiarizedSegment: + type: object + description: A segment of diarized transcript text with speaker metadata. properties: - event_id: - type: string - description: The unique ID of the server event. type: type: string + description: | + The type of the segment. Always `transcript.text.segment`. enum: - - response.output_audio_transcript.done - description: The event type, must be `response.output_audio_transcript.done`. + - transcript.text.segment x-stainless-const: true - response_id: + id: type: string - description: The ID of the response. - item_id: + description: Unique identifier for the segment. + start: + type: number + format: double + description: Start timestamp of the segment in seconds. + end: + type: number + format: double + description: End timestamp of the segment in seconds. + text: type: string - description: The ID of the item. - output_index: + description: Transcript text for this segment. + speaker: + type: string + description: > + Speaker label for this segment. When known speakers are provided, + the label matches `known_speaker_names[]`. Otherwise speakers are + labeled sequentially using capital letters (`A`, `B`, ...). + required: + - type + - id + - start + - end + - text + - speaker + TranscriptionInclude: + type: string + enum: + - logprobs + default: [] + TranscriptionSegment: + type: object + properties: + id: type: integer - description: The index of the output item in the response. - content_index: + description: Unique identifier of the segment. + seek: type: integer - description: The index of the content part in the item's content array. - transcript: + description: Seek offset of the segment. + start: + type: number + format: double + description: Start time of the segment in seconds. + end: + type: number + format: double + description: End time of the segment in seconds. + text: type: string - description: The final transcript of the audio. + description: Text content of the segment. + tokens: + type: array + items: + type: integer + description: Array of token IDs for the text content. + temperature: + type: number + format: float + description: Temperature parameter used for generating the segment. + avg_logprob: + type: number + format: float + description: >- + Average logprob of the segment. If the value is lower than -1, + consider the logprobs failed. + compression_ratio: + type: number + format: float + description: >- + Compression ratio of the segment. If the value is greater than 2.4, + consider the compression failed. + no_speech_prob: + type: number + format: float + description: >- + Probability of no speech in the segment. If the value is higher than + 1.0 and the `avg_logprob` is below -1, consider this segment silent. + required: + - id + - seek + - start + - end + - text + - tokens + - temperature + - avg_logprob + - compression_ratio + - no_speech_prob + TranscriptionWord: + type: object + properties: + word: + type: string + description: The text content of the word. + start: + type: number + format: double + description: Start time of the word in seconds. + end: + type: number + format: double + description: End time of the word in seconds. + required: + - word + - start + - end + TruncationObject: + type: object + title: Thread Truncation Controls + description: >- + Controls for how a thread will be truncated prior to the run. Use this + to control the initial context window of the run. + properties: + type: + type: string + description: >- + The truncation strategy to use for the thread. The default is + `auto`. If set to `last_messages`, the thread will be truncated to + the n most recent messages in the thread. When set to `auto`, + messages in the middle of the thread will be dropped to fit the + context length of the model, `max_prompt_tokens`. + enum: + - auto + - last_messages + last_messages: + anyOf: + - type: integer + description: >- + The number of most recent messages from the thread when + constructing the context for the run. + minimum: 1 + - type: 'null' required: - - event_id - type - - response_id - - item_id - - output_index - - content_index - - transcript + UpdateGroupBody: + type: object + description: Request payload for updating the details of an existing group. + properties: + name: + type: string + description: New display name for the group. + minLength: 1 + maxLength: 255 + required: + - name x-oaiMeta: - name: response.output_audio_transcript.done - group: realtime example: | { - "event_id": "event_4748", - "type": "response.output_audio_transcript.done", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0, - "transcript": "Hello, how can I assist you today?" + "name": "Escalations" } - RealtimeServerEventResponseContentPartAdded: + UpdateOrganizationDataRetentionBody: type: object - description: > - Returned when a new content part is added to an assistant message item - during - - response generation. + description: Parameters for updating organization data retention controls. properties: - event_id: + retention_type: type: string - description: The unique ID of the server event. - type: + enum: + - zero_data_retention + - modified_abuse_monitoring + - enhanced_zero_data_retention + - enhanced_modified_abuse_monitoring + description: The desired organization data retention type. + required: + - retention_type + UpdateProjectDataRetentionBody: + type: object + description: Parameters for updating project data retention controls. + properties: + retention_type: type: string enum: - - response.content_part.added - description: The event type, must be `response.content_part.added`. - x-stainless-const: true - response_id: + - organization_default + - none + - zero_data_retention + - modified_abuse_monitoring + - enhanced_zero_data_retention + - enhanced_modified_abuse_monitoring + description: The desired project data retention type. + required: + - retention_type + UpdateProjectServiceAccountBody: + type: object + description: Parameters for updating a project service account. + properties: + name: type: string - description: The ID of the response. - item_id: + description: The updated service account name. + role: type: string - description: The ID of the item to which the content part was added. - output_index: - type: integer - description: The index of the output item in the response. - content_index: - type: integer - description: The index of the content part in the item's content array. - part: - type: object - description: The content part that was added. - properties: - type: - type: string - enum: - - audio - - text - description: The content type ("text", "audio"). - text: - type: string - description: The text content (if type is "text"). - audio: - type: string - description: Base64-encoded audio data (if type is "audio"). - transcript: - type: string - description: The transcript of the audio (if type is "audio"). + enum: + - member + - owner + description: The updated service account role. + UpdateVectorStoreFileAttributesRequest: + type: object + additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' required: - - event_id - - type - - response_id - - item_id - - output_index - - content_index - - part + - attributes x-oaiMeta: - name: response.content_part.added - group: realtime - example: | - { - "event_id": "event_3738", - "type": "response.content_part.added", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "part": { - "type": "text", - "text": "" - } - } - RealtimeServerEventResponseContentPartDone: + name: Update vector store file attributes request + UpdateVectorStoreRequest: type: object - description: > - Returned when a content part is done streaming in an assistant message - item. - - Also emitted when a Response is interrupted, incomplete, or cancelled. + additionalProperties: false properties: - event_id: + name: + description: The name of the vector store. type: string - description: The unique ID of the server event. - type: + nullable: true + expires_after: + allOf: + - $ref: '#/components/schemas/VectorStoreExpirationAfter' + - nullable: true + metadata: + $ref: '#/components/schemas/Metadata' + UpdateVoiceConsentRequest: + type: object + additionalProperties: false + properties: + name: type: string - enum: - - response.content_part.done - description: The event type, must be `response.content_part.done`. - x-stainless-const: true - response_id: + description: The updated label for this consent recording. + required: + - name + Upload: + type: object + title: Upload + description: | + The Upload object can accept byte chunks in the form of Parts. + properties: + id: type: string - description: The ID of the response. - item_id: + description: >- + The Upload unique identifier, which can be referenced in API + endpoints. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the Upload was created. + filename: type: string - description: The ID of the item. - output_index: + description: The name of the file to be uploaded. + bytes: type: integer - description: The index of the output item in the response. - content_index: + description: The intended number of bytes to be uploaded. + purpose: + type: string + description: >- + The intended purpose of the file. [Please refer + here](/docs/api-reference/files/object#files/object-purpose) for + acceptable values. + status: + type: string + description: The status of the Upload. + enum: + - pending + - completed + - cancelled + - expired + expires_at: type: integer - description: The index of the content part in the item's content array. - part: - type: object - description: The content part that is done. - properties: - type: - type: string - enum: - - audio - - text - description: The content type ("text", "audio"). - text: - type: string - description: The text content (if type is "text"). - audio: - type: string - description: Base64-encoded audio data (if type is "audio"). - transcript: - type: string - description: The transcript of the audio (if type is "audio"). + format: unixtime + description: The Unix timestamp (in seconds) for when the Upload will expire. + object: + type: string + description: The object type, which is always "upload". + enum: + - upload + x-stainless-const: true + file: + allOf: + - $ref: '#/components/schemas/OpenAIFile' + - nullable: true + description: The ready File object after the Upload is completed. required: - - event_id - - type - - response_id - - item_id - - output_index - - content_index - - part + - bytes + - created_at + - expires_at + - filename + - id + - purpose + - status x-oaiMeta: - name: response.content_part.done - group: realtime + name: The upload object example: | { - "event_id": "event_3940", - "type": "response.content_part.done", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "part": { - "type": "text", - "text": "Sure, I can help with that." - } + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } } - RealtimeServerEventResponseCreated: + UploadCertificateRequest: + type: object + properties: + name: + type: string + description: An optional name for the certificate + certificate: + type: string + description: The certificate content in PEM format + required: + - certificate + UploadPart: type: object + title: UploadPart description: > - Returned when a new Response is created. The first event of response - creation, - - where the response is in an initial state of `in_progress`. + The upload Part represents a chunk of bytes we can add to an Upload + object. properties: - event_id: + id: type: string - description: The unique ID of the server event. - type: + description: >- + The upload Part unique identifier, which can be referenced in API + endpoints. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the Part was created. + upload_id: + type: string + description: The ID of the Upload object that this Part was added to. + object: type: string + description: The object type, which is always `upload.part`. enum: - - response.created - description: The event type, must be `response.created`. + - upload.part x-stainless-const: true - response: - $ref: '#/components/schemas/RealtimeResponse' required: - - event_id - - type - - response + - created_at + - id + - object + - upload_id x-oaiMeta: - name: response.created - group: realtime + name: The upload part object example: | { - "type": "response.created", - "event_id": "event_C9G8pqbTEddBSIxbBN6Os", - "response": { - "object": "realtime.response", - "id": "resp_C9G8p7IH2WxLbkgPNouYL", - "status": "in_progress", - "status_details": null, - "output": [], - "conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN", - "output_modalities": [ - "audio" - ], - "max_output_tokens": "inf", - "audio": { - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "marin" - } - }, - "usage": null, - "metadata": null - }, + "id": "part_def456", + "object": "upload.part", + "created_at": 1719186911, + "upload_id": "upload_abc123" } - RealtimeServerEventResponseDone: + UsageAudioSpeechesResult: type: object - description: > - Returned when a Response is done streaming. Always emitted, no matter - the - - final state. The Response object included in the `response.done` event - will - - include all output Items in the Response but will omit the raw audio - data. - - - Clients should check the `status` field of the Response to determine if - it was successful - - (`completed`) or if there was another outcome: `cancelled`, `failed`, or - `incomplete`. - - - A response will contain all output items that were generated during the - response, excluding - - any audio content. + description: The aggregated audio speeches usage details of the specific time bucket. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.done - description: The event type, must be `response.done`. + - organization.usage.audio_speeches.result x-stainless-const: true - response: - $ref: '#/components/schemas/RealtimeResponse' + characters: + type: integer + description: The number of characters processed. + num_model_requests: + type: integer + description: The count of requests made to the model. + project_id: + anyOf: + - type: string + description: >- + When `group_by=project_id`, this field provides the project ID + of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: >- + When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: >- + When `group_by=api_key_id`, this field provides the API key ID + of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: >- + When `group_by=model`, this field provides the model name of the + grouped usage result. + - type: 'null' required: - - event_id - - type - - response + - object + - characters + - num_model_requests x-oaiMeta: - name: response.done - group: realtime + name: Audio speeches usage object example: | { - "type": "response.done", - "event_id": "event_CCXHxcMy86rrKhBLDdqCh", - "response": { - "object": "realtime.response", - "id": "resp_CCXHw0UJld10EzIUXQCNh", - "status": "completed", - "status_details": null, - "output": [ - { - "id": "item_CCXHwGjjDUfOXbiySlK7i", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "output_audio", - "transcript": "Loud and clear! I can hear you perfectly. How can I help you today?" - } - ] - } - ], - "conversation_id": "conv_CCXHsurMKcaVxIZvaCI5m", - "output_modalities": [ - "audio" - ], - "max_output_tokens": "inf", - "audio": { - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "alloy" - } - }, - "usage": { - "total_tokens": 253, - "input_tokens": 132, - "output_tokens": 121, - "input_token_details": { - "text_tokens": 119, - "audio_tokens": 13, - "image_tokens": 0, - "cached_tokens": 64, - "cached_tokens_details": { - "text_tokens": 64, - "audio_tokens": 0, - "image_tokens": 0 - } - }, - "output_token_details": { - "text_tokens": 30, - "audio_tokens": 91 - } - }, - "metadata": null - } + "object": "organization.usage.audio_speeches.result", + "characters": 45, + "num_model_requests": 1, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "tts-1" } - RealtimeServerEventResponseFunctionCallArgumentsDelta: + UsageAudioTranscriptionsResult: type: object - description: | - Returned when the model-generated function call arguments are updated. + description: >- + The aggregated audio transcriptions usage details of the specific time + bucket. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.function_call_arguments.delta - description: | - The event type, must be `response.function_call_arguments.delta`. + - organization.usage.audio_transcriptions.result x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the function call item. - output_index: + seconds: type: integer - description: The index of the output item in the response. - call_id: - type: string - description: The ID of the function call. - delta: - type: string - description: The arguments delta as a JSON string. + format: int64 + description: The number of seconds processed. + num_model_requests: + type: integer + description: The count of requests made to the model. + project_id: + anyOf: + - type: string + description: >- + When `group_by=project_id`, this field provides the project ID + of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: >- + When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: >- + When `group_by=api_key_id`, this field provides the API key ID + of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: >- + When `group_by=model`, this field provides the model name of the + grouped usage result. + - type: 'null' required: - - event_id - - type - - response_id - - item_id - - output_index - - call_id - - delta + - object + - seconds + - num_model_requests x-oaiMeta: - name: response.function_call_arguments.delta - group: realtime + name: Audio transcriptions usage object example: | { - "event_id": "event_5354", - "type": "response.function_call_arguments.delta", - "response_id": "resp_002", - "item_id": "fc_001", - "output_index": 0, - "call_id": "call_001", - "delta": "{\"location\": \"San\"" + "object": "organization.usage.audio_transcriptions.result", + "seconds": 10, + "num_model_requests": 1, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "tts-1" } - RealtimeServerEventResponseFunctionCallArgumentsDone: + UsageCodeInterpreterSessionsResult: type: object - description: > - Returned when the model-generated function call arguments are done - streaming. - - Also emitted when a Response is interrupted, incomplete, or cancelled. + description: >- + The aggregated code interpreter sessions usage details of the specific + time bucket. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.function_call_arguments.done - description: | - The event type, must be `response.function_call_arguments.done`. + - organization.usage.code_interpreter_sessions.result x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the function call item. - output_index: + num_sessions: type: integer - description: The index of the output item in the response. - call_id: - type: string - description: The ID of the function call. - name: - type: string - description: The name of the function that was called. - arguments: - type: string - description: The final arguments as a JSON string. + description: The number of code interpreter sessions. + project_id: + anyOf: + - type: string + description: >- + When `group_by=project_id`, this field provides the project ID + of the grouped usage result. + - type: 'null' required: - - event_id - - type - - response_id - - item_id - - output_index - - call_id - - name - - arguments + - object + - num_sessions x-oaiMeta: - name: response.function_call_arguments.done - group: realtime + name: Code interpreter sessions usage object example: | { - "event_id": "event_5556", - "type": "response.function_call_arguments.done", - "response_id": "resp_002", - "item_id": "fc_001", - "output_index": 0, - "call_id": "call_001", - "name": "get_weather", - "arguments": "{\"location\": \"San Francisco\"}" + "object": "organization.usage.code_interpreter_sessions.result", + "num_sessions": 1, + "project_id": "proj_abc" } - RealtimeServerEventResponseMCPCallArgumentsDelta: + UsageCompletionsResult: type: object - description: >- - Returned when MCP tool call arguments are updated during response - generation. + description: The aggregated completions usage details of the specific time bucket. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.mcp_call_arguments.delta - description: The event type, must be `response.mcp_call_arguments.delta`. + - organization.usage.completions.result x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the MCP tool call item. - output_index: + input_tokens: type: integer - description: The index of the output item in the response. - delta: - type: string - description: The JSON-encoded arguments delta. - obfuscation: + description: >- + The aggregated number of text input tokens used, including cached + tokens. For customers subscribe to scale tier, this includes scale + tier tokens. + input_cached_tokens: + type: integer + description: >- + The aggregated number of text input tokens that has been cached from + previous requests. For customers subscribe to scale tier, this + includes scale tier tokens. + output_tokens: + type: integer + description: >- + The aggregated number of text output tokens used. For customers + subscribe to scale tier, this includes scale tier tokens. + input_audio_tokens: + type: integer + description: >- + The aggregated number of audio input tokens used, including cached + tokens. + output_audio_tokens: + type: integer + description: The aggregated number of audio output tokens used. + num_model_requests: + type: integer + description: The count of requests made to the model. + project_id: anyOf: - type: string - description: If present, indicates the delta text was obfuscated. + description: >- + When `group_by=project_id`, this field provides the project ID + of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: >- + When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: >- + When `group_by=api_key_id`, this field provides the API key ID + of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: >- + When `group_by=model`, this field provides the model name of the + grouped usage result. + - type: 'null' + batch: + anyOf: + - type: boolean + description: >- + When `group_by=batch`, this field tells whether the grouped + usage result is batch or not. + - type: 'null' + service_tier: + anyOf: + - type: string + description: >- + When `group_by=service_tier`, this field provides the service + tier of the grouped usage result. - type: 'null' required: - - event_id - - type - - response_id - - item_id - - output_index - - delta + - object + - input_tokens + - output_tokens + - num_model_requests x-oaiMeta: - name: response.mcp_call_arguments.delta - group: realtime + name: Completions usage object example: | { - "event_id": "event_6201", - "type": "response.mcp_call_arguments.delta", - "response_id": "resp_001", - "item_id": "mcp_call_001", - "output_index": 0, - "delta": "{\"partial\":true}" + "object": "organization.usage.completions.result", + "input_tokens": 5000, + "output_tokens": 1000, + "input_cached_tokens": 4000, + "input_audio_tokens": 300, + "output_audio_tokens": 200, + "num_model_requests": 5, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "gpt-4o-mini-2024-07-18", + "batch": false, + "service_tier": "default" } - RealtimeServerEventResponseMCPCallArgumentsDone: + UsageEmbeddingsResult: type: object - description: >- - Returned when MCP tool call arguments are finalized during response - generation. + description: The aggregated embeddings usage details of the specific time bucket. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.mcp_call_arguments.done - description: The event type, must be `response.mcp_call_arguments.done`. + - organization.usage.embeddings.result x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the MCP tool call item. - output_index: + input_tokens: type: integer - description: The index of the output item in the response. - arguments: - type: string - description: The final JSON-encoded arguments string. + description: The aggregated number of input tokens used. + num_model_requests: + type: integer + description: The count of requests made to the model. + project_id: + anyOf: + - type: string + description: >- + When `group_by=project_id`, this field provides the project ID + of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: >- + When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: >- + When `group_by=api_key_id`, this field provides the API key ID + of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: >- + When `group_by=model`, this field provides the model name of the + grouped usage result. + - type: 'null' required: - - event_id - - type - - response_id - - item_id - - output_index - - arguments + - object + - input_tokens + - num_model_requests x-oaiMeta: - name: response.mcp_call_arguments.done - group: realtime + name: Embeddings usage object example: | { - "event_id": "event_6202", - "type": "response.mcp_call_arguments.done", - "response_id": "resp_001", - "item_id": "mcp_call_001", - "output_index": 0, - "arguments": "{\"q\":\"docs\"}" + "object": "organization.usage.embeddings.result", + "input_tokens": 20, + "num_model_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "text-embedding-ada-002-v2" } - RealtimeServerEventResponseMCPCallCompleted: + UsageFileSearchCallsResult: type: object - description: Returned when an MCP tool call has completed successfully. + description: >- + The aggregated file search calls usage details of the specific time + bucket. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.mcp_call.completed - description: The event type, must be `response.mcp_call.completed`. + - organization.usage.file_searches.result x-stainless-const: true - output_index: + num_requests: type: integer - description: The index of the output item in the response. - item_id: - type: string - description: The ID of the MCP tool call item. + description: The count of file search calls. + project_id: + anyOf: + - type: string + description: >- + When `group_by=project_id`, this field provides the project ID + of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: >- + When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: >- + When `group_by=api_key_id`, this field provides the API key ID + of the grouped usage result. + - type: 'null' + vector_store_id: + anyOf: + - type: string + description: >- + When `group_by=vector_store_id`, this field provides the vector + store ID of the grouped usage result. + - type: 'null' required: - - event_id - - type - - output_index - - item_id + - object + - num_requests x-oaiMeta: - name: response.mcp_call.completed - group: realtime + name: File search calls usage object example: | { - "event_id": "event_6302", - "type": "response.mcp_call.completed", - "output_index": 0, - "item_id": "mcp_call_001" + "object": "organization.usage.file_searches.result", + "num_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "vector_store_id": "vs_abc" } - RealtimeServerEventResponseMCPCallFailed: + UsageImagesResult: type: object - description: Returned when an MCP tool call has failed. + description: The aggregated images usage details of the specific time bucket. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.mcp_call.failed - description: The event type, must be `response.mcp_call.failed`. + - organization.usage.images.result x-stainless-const: true - output_index: + images: type: integer - description: The index of the output item in the response. - item_id: - type: string - description: The ID of the MCP tool call item. + description: The number of images processed. + num_model_requests: + type: integer + description: The count of requests made to the model. + source: + anyOf: + - type: string + description: >- + When `group_by=source`, this field provides the source of the + grouped usage result, possible values are `image.generation`, + `image.edit`, `image.variation`. + - type: 'null' + size: + anyOf: + - type: string + description: >- + When `group_by=size`, this field provides the image size of the + grouped usage result. + - type: 'null' + project_id: + anyOf: + - type: string + description: >- + When `group_by=project_id`, this field provides the project ID + of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: >- + When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: >- + When `group_by=api_key_id`, this field provides the API key ID + of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: >- + When `group_by=model`, this field provides the model name of the + grouped usage result. + - type: 'null' required: - - event_id - - type - - output_index - - item_id + - object + - images + - num_model_requests x-oaiMeta: - name: response.mcp_call.failed - group: realtime + name: Images usage object example: | { - "event_id": "event_6303", - "type": "response.mcp_call.failed", - "output_index": 0, - "item_id": "mcp_call_001" + "object": "organization.usage.images.result", + "images": 2, + "num_model_requests": 2, + "size": "1024x1024", + "source": "image.generation", + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "dall-e-3" } - RealtimeServerEventResponseMCPCallInProgress: + UsageModerationsResult: type: object - description: Returned when an MCP tool call has started and is in progress. + description: The aggregated moderations usage details of the specific time bucket. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.mcp_call.in_progress - description: The event type, must be `response.mcp_call.in_progress`. + - organization.usage.moderations.result x-stainless-const: true - output_index: + input_tokens: type: integer - description: The index of the output item in the response. - item_id: - type: string - description: The ID of the MCP tool call item. + description: The aggregated number of input tokens used. + num_model_requests: + type: integer + description: The count of requests made to the model. + project_id: + anyOf: + - type: string + description: >- + When `group_by=project_id`, this field provides the project ID + of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: >- + When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: >- + When `group_by=api_key_id`, this field provides the API key ID + of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: >- + When `group_by=model`, this field provides the model name of the + grouped usage result. + - type: 'null' required: - - event_id - - type - - output_index - - item_id + - object + - input_tokens + - num_model_requests x-oaiMeta: - name: response.mcp_call.in_progress - group: realtime + name: Moderations usage object example: | { - "event_id": "event_6301", - "type": "response.mcp_call.in_progress", - "output_index": 0, - "item_id": "mcp_call_001" + "object": "organization.usage.moderations.result", + "input_tokens": 20, + "num_model_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "text-moderation" } - RealtimeServerEventResponseOutputItemAdded: + UsageResponse: type: object - description: Returned when a new Item is created during Response generation. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.output_item.added - description: The event type, must be `response.output_item.added`. + - page x-stainless-const: true - response_id: - type: string - description: The ID of the Response to which the item belongs. - output_index: - type: integer - description: The index of the output item in the Response. - item: - $ref: '#/components/schemas/RealtimeConversationItem' + data: + type: array + items: + $ref: '#/components/schemas/UsageTimeBucket' + has_more: + type: boolean + next_page: + anyOf: + - type: string + - type: 'null' required: - - event_id - - type - - response_id - - output_index - - item - x-oaiMeta: - name: response.output_item.added - group: realtime - example: | - { - "event_id": "event_3334", - "type": "response.output_item.added", - "response_id": "resp_001", - "output_index": 0, - "item": { - "id": "msg_007", - "object": "realtime.item", - "type": "message", - "status": "in_progress", - "role": "assistant", - "content": [] - } - } - RealtimeServerEventResponseOutputItemDone: + - object + - data + - has_more + - next_page + UsageTimeBucket: type: object - description: > - Returned when an Item is done streaming. Also emitted when a Response - is - - interrupted, incomplete, or cancelled. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.output_item.done - description: The event type, must be `response.output_item.done`. + - bucket x-stainless-const: true - response_id: - type: string - description: The ID of the Response to which the item belongs. - output_index: + start_time: type: integer - description: The index of the output item in the Response. - item: - $ref: '#/components/schemas/RealtimeConversationItem' + end_time: + type: integer + results: + type: array + items: + oneOf: + - $ref: '#/components/schemas/UsageCompletionsResult' + - $ref: '#/components/schemas/UsageEmbeddingsResult' + - $ref: '#/components/schemas/UsageModerationsResult' + - $ref: '#/components/schemas/UsageImagesResult' + - $ref: '#/components/schemas/UsageAudioSpeechesResult' + - $ref: '#/components/schemas/UsageAudioTranscriptionsResult' + - $ref: '#/components/schemas/UsageVectorStoresResult' + - $ref: '#/components/schemas/UsageCodeInterpreterSessionsResult' + - $ref: '#/components/schemas/UsageFileSearchCallsResult' + - $ref: '#/components/schemas/UsageWebSearchCallsResult' + - $ref: '#/components/schemas/CostsResult' + discriminator: + propertyName: object required: - - event_id - - type - - response_id - - output_index - - item - x-oaiMeta: - name: response.output_item.done - group: realtime - example: | - { - "event_id": "event_3536", - "type": "response.output_item.done", - "response_id": "resp_001", - "output_index": 0, - "item": { - "id": "msg_007", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "text", - "text": "Sure, I can help with that." - } - ] - } - } - RealtimeServerEventResponseTextDelta: + - object + - start_time + - end_time + - results + UsageVectorStoresResult: type: object - description: >- - Returned when the text value of an "output_text" content part is - updated. + description: The aggregated vector stores usage details of the specific time bucket. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.output_text.delta - description: The event type, must be `response.output_text.delta`. + - organization.usage.vector_stores.result x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item. - output_index: - type: integer - description: The index of the output item in the response. - content_index: + usage_bytes: type: integer - description: The index of the content part in the item's content array. - delta: - type: string - description: The text delta. + description: The vector stores usage in bytes. + project_id: + anyOf: + - type: string + description: >- + When `group_by=project_id`, this field provides the project ID + of the grouped usage result. + - type: 'null' required: - - event_id - - type - - response_id - - item_id - - output_index - - content_index - - delta + - object + - usage_bytes x-oaiMeta: - name: response.output_text.delta - group: realtime + name: Vector stores usage object example: | { - "event_id": "event_4142", - "type": "response.output_text.delta", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "delta": "Sure, I can h" + "object": "organization.usage.vector_stores.result", + "usage_bytes": 1024, + "project_id": "proj_abc" } - RealtimeServerEventResponseTextDone: + UsageWebSearchCallsResult: type: object - description: > - Returned when the text value of an "output_text" content part is done - streaming. Also - - emitted when a Response is interrupted, incomplete, or cancelled. + description: >- + The aggregated web search calls usage details of the specific time + bucket. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - response.output_text.done - description: The event type, must be `response.output_text.done`. + - organization.usage.web_searches.result x-stainless-const: true - response_id: - type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item. - output_index: + num_model_requests: type: integer - description: The index of the output item in the response. - content_index: + description: The count of model requests. + num_requests: type: integer - description: The index of the content part in the item's content array. - text: - type: string - description: The final text content. + description: The count of web search calls. + project_id: + anyOf: + - type: string + description: >- + When `group_by=project_id`, this field provides the project ID + of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: >- + When `group_by=user_id`, this field provides the user ID of the + grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: >- + When `group_by=api_key_id`, this field provides the API key ID + of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: >- + When `group_by=model`, this field provides the model name of the + grouped usage result. + - type: 'null' + context_level: + anyOf: + - type: string + description: >- + When `group_by=context_level`, this field provides the search + context size of the grouped usage result. + - type: 'null' required: - - event_id - - type - - response_id - - item_id - - output_index - - content_index - - text + - object + - num_model_requests + - num_requests x-oaiMeta: - name: response.output_text.done - group: realtime + name: Web search calls usage object example: | { - "event_id": "event_4344", - "type": "response.output_text.done", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "text": "Sure, I can help with that." + "object": "organization.usage.web_searches.result", + "num_model_requests": 2, + "num_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "gpt-4o-mini-2024-07-18", + "context_level": "medium" } - RealtimeServerEventSessionCreated: + User: type: object - description: > - Returned when a Session is created. Emitted automatically when a new - - connection is established as the first server event. This event will - contain - - the default Session configuration. + description: Represents an individual `user` within an organization. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - session.created - description: The event type, must be `session.created`. + - organization.user + description: The object type, which is always `organization.user` x-stainless-const: true - session: - description: The session configuration. - oneOf: - - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' - - $ref: >- - #/components/schemas/RealtimeTranscriptionSessionCreateResponseGA + id: + type: string + description: The identifier, which can be referenced in API endpoints + name: + anyOf: + - type: string + - type: 'null' + description: The name of the user + email: + anyOf: + - type: string + - type: 'null' + description: The email address of the user + role: + anyOf: + - type: string + - type: 'null' + description: '`owner` or `reader`' + added_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the user was added. + is_default: + type: boolean + description: Whether this is the organization's default user. + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the user was created. + user: + type: object + description: Nested user details. + properties: + object: + type: string + enum: + - user + x-stainless-const: true + id: + type: string + email: + anyOf: + - type: string + - type: 'null' + name: + anyOf: + - type: string + - type: 'null' + picture: + anyOf: + - type: string + - type: 'null' + enabled: + anyOf: + - type: boolean + - type: 'null' + banned: + anyOf: + - type: boolean + - type: 'null' + banned_at: + anyOf: + - type: integer + format: unixtime + - type: 'null' + required: + - object + - id + is_service_account: + type: boolean + description: Whether the user is a service account. + is_scale_tier_authorized_purchaser: + anyOf: + - type: boolean + - type: 'null' + description: Whether the user is an authorized purchaser for Scale Tier. + is_scim_managed: + type: boolean + description: Whether the user is managed through SCIM. + api_key_last_used_at: + anyOf: + - type: integer + format: unixtime + - type: 'null' + description: The Unix timestamp (in seconds) of the user's last API key usage. + technical_level: + anyOf: + - type: string + - type: 'null' + description: The technical level metadata for the user. + developer_persona: + anyOf: + - type: string + - type: 'null' + description: The developer persona metadata for the user. + projects: + anyOf: + - type: object + properties: + object: + type: string + enum: + - list + x-stainless-const: true + data: + type: array + items: + type: object + properties: + id: + anyOf: + - type: string + - type: 'null' + name: + anyOf: + - type: string + - type: 'null' + role: + anyOf: + - type: string + - type: 'null' + required: + - object + - data + - type: 'null' + description: Projects associated with the user, if included. required: - - event_id - - type - - session + - object + - id + - added_at x-oaiMeta: - name: session.created - group: realtime + name: The user object example: | { - "type": "session.created", - "event_id": "event_C9G5RJeJ2gF77mV7f2B1j", - "session": { - "type": "realtime", - "object": "realtime.session", - "id": "sess_C9G5QPteg4UIbotdKLoYQ", - "model": "gpt-realtime-2025-08-28", - "output_modalities": [ - "audio" - ], - "instructions": "Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.", - "tools": [], - "tool_choice": "auto", - "max_output_tokens": "inf", - "tracing": null, - "prompt": null, - "expires_at": 1756324625, - "audio": { - "input": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "transcription": null, - "noise_reduction": null, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200, - "idle_timeout_ms": null, - "create_response": true, - "interrupt_response": true - } - }, - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "marin", - "speed": 1 - } - }, - "include": null - }, + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 } - RealtimeServerEventSessionUpdated: + UserDeleteResponse: type: object - description: | - Returned when a session is updated with a `session.update` event, unless - there is an error. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - session.updated - description: The event type, must be `session.updated`. + - organization.user.deleted x-stainless-const: true - session: - description: The session configuration. - oneOf: - - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' - - $ref: >- - #/components/schemas/RealtimeTranscriptionSessionCreateResponseGA + id: + type: string + deleted: + type: boolean required: - - event_id - - type - - session - x-oaiMeta: - name: session.updated - group: realtime - example: | - { - "type": "session.updated", - "event_id": "event_C9G8mqI3IucaojlVKE8Cs", - "session": { - "type": "realtime", - "object": "realtime.session", - "id": "sess_C9G8l3zp50uFv4qgxfJ8o", - "model": "gpt-realtime-2025-08-28", - "output_modalities": [ - "audio" - ], - "instructions": "Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.", - "tools": [ - { - "type": "function", - "name": "display_color_palette", - "description": "\nCall this function when a user asks for a color palette.\n", - "parameters": { - "type": "object", - "strict": true, - "properties": { - "theme": { - "type": "string", - "description": "Description of the theme for the color scheme." - }, - "colors": { - "type": "array", - "description": "Array of five hex color codes based on the theme.", - "items": { - "type": "string", - "description": "Hex color code" - } - } - }, - "required": [ - "theme", - "colors" - ] - } - } - ], - "tool_choice": "auto", - "max_output_tokens": "inf", - "tracing": null, - "prompt": null, - "expires_at": 1756324832, - "audio": { - "input": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "transcription": null, - "noise_reduction": null, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200, - "idle_timeout_ms": null, - "create_response": true, - "interrupt_response": true - } - }, - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "marin", - "speed": 1 - } - }, - "include": null - }, - } - RealtimeServerEventTranscriptionSessionUpdated: + - object + - id + - deleted + UserListResource: type: object - description: > - Returned when a transcription session is updated with a - `transcription_session.update` event, unless - - there is an error. + description: >- + Paginated list of user objects returned when inspecting group + membership. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: type: string enum: - - transcription_session.updated - description: The event type, must be `transcription_session.updated`. + - list + description: Always `list`. x-stainless-const: true - session: - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' + data: + type: array + description: Users in the current page. + items: + $ref: '#/components/schemas/GroupUser' + has_more: + type: boolean + description: Whether more users are available when paginating. + next: + description: >- + Cursor to fetch the next page of results, or `null` when no further + users are available. + anyOf: + - type: string + - type: 'null' required: - - event_id - - type - - session + - object + - data + - has_more + - next x-oaiMeta: - name: transcription_session.updated - group: realtime + name: Group user list example: | { - "event_id": "event_5678", - "type": "transcription_session.updated", - "session": { - "id": "sess_001", - "object": "realtime.transcription_session", - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "prompt": "", - "language": "" - }, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 500, - "create_response": true, - // "interrupt_response": false -- this will NOT be returned - }, - "input_audio_noise_reduction": { - "type": "near_field" - }, - "include": [ - "item.input_audio_transcription.avg_logprob", + "object": "list", + "data": [ + { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + } ], - } + "has_more": false, + "next": null } - RealtimeSession: + UserListResponse: type: object - description: Realtime session object for the beta interface. properties: - id: - type: string - description: > - Unique identifier for the session that looks like - `sess_1234567890abcdef`. object: type: string enum: - - realtime.session - description: The object type. Always `realtime.session`. - modalities: - description: | - The set of modalities the model can respond with. To disable audio, - set this to ["text"]. + - list + x-stainless-const: true + data: + type: array items: - type: string - default: - - text - - audio - enum: - - text - - audio - model: - description: | - The Realtime model used for this session. + $ref: '#/components/schemas/User' + first_id: anyOf: - type: string + - type: 'null' + last_id: + anyOf: - type: string - enum: - - gpt-realtime - - gpt-realtime-1.5 - - gpt-realtime-2025-08-28 - - gpt-4o-realtime-preview - - gpt-4o-realtime-preview-2024-10-01 - - gpt-4o-realtime-preview-2024-12-17 - - gpt-4o-realtime-preview-2025-06-03 - - gpt-4o-mini-realtime-preview - - gpt-4o-mini-realtime-preview-2024-12-17 - - gpt-realtime-mini - - gpt-realtime-mini-2025-10-06 - - gpt-realtime-mini-2025-12-15 - - gpt-audio-1.5 - - gpt-audio-mini - - gpt-audio-mini-2025-10-06 - - gpt-audio-mini-2025-12-15 - instructions: - type: string - description: > - 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. - - - - 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. - voice: - $ref: '#/components/schemas/VoiceIdsShared' - description: > - The voice the model uses to respond. Voice cannot be changed during - the - - session once the model has responded with audio at least once. - Current - - voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, - - `shimmer`, and `verse`. - input_audio_format: - type: string - default: pcm16 - enum: - - pcm16 - - g711_ulaw - - g711_alaw - description: > - The format of input audio. Options are `pcm16`, `g711_ulaw`, or - `g711_alaw`. - - For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, - - single channel (mono), and little-endian byte order. - output_audio_format: + - type: 'null' + has_more: + type: boolean + required: + - object + - data + - has_more + UserRoleAssignment: + type: object + description: Role assignment linking a user to a role. + properties: + object: type: string - default: pcm16 enum: - - pcm16 - - g711_ulaw - - g711_alaw - description: > - The format of output audio. Options are `pcm16`, `g711_ulaw`, or - `g711_alaw`. - - For `pcm16`, output audio is sampled at a rate of 24kHz. - input_audio_transcription: - anyOf: - - allOf: - - $ref: '#/components/schemas/AudioTranscriptionResponse' - description: > - 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://platform.openai.com/docs/api-reference/audio/createTranscription) - 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. - - type: 'null' - turn_detection: - $ref: '#/components/schemas/RealtimeTurnDetection' - input_audio_noise_reduction: - type: object - default: null - description: > - Configuration for input audio noise reduction. This can be set to - `null` to turn off. - - Noise reduction filters audio added to the input audio buffer before - it is sent to VAD and the model. - - Filtering the audio can improve VAD and turn detection accuracy - (reducing false positives) and model performance by improving - perception of the input audio. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - speed: - type: number - default: 1 - maximum: 1.5 - minimum: 0.25 - description: > - The speed of the model's spoken response. 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. - tracing: - anyOf: - - title: Tracing Configuration - description: > - Configuration options for tracing. Set to null to disable - tracing. Once - - tracing is enabled for a session, the configuration cannot be - modified. - - - `auto` will create a trace for the session with default values - for the - - workflow name, group id, and metadata. - oneOf: - - type: string - default: auto - description: | - Default tracing mode for the session. - enum: - - auto - x-stainless-const: true - - type: object - title: Tracing Configuration - description: | - Granular configuration for tracing. - properties: - workflow_name: - type: string - description: > - The name of the workflow to attach to this trace. This - is used to - - name the trace in the traces dashboard. - group_id: - type: string - description: > - The group id to attach to this trace to enable filtering - and - - grouping in the traces dashboard. - metadata: - type: object - description: | - The arbitrary metadata to attach to this trace to enable - filtering in the traces dashboard. + - user.role + description: Always `user.role`. + x-stainless-const: true + user: + $ref: '#/components/schemas/User' + role: + $ref: '#/components/schemas/Role' + required: + - object + - user + - role + x-oaiMeta: + name: The user role object + example: | + { + "object": "user.role", + "user": { + "object": "organization.user", + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com", + "role": "owner", + "added_at": 1711470000 + }, + "role": { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + } + UserRoleUpdateRequest: + type: object + properties: + role: + anyOf: + - type: string - type: 'null' - tools: - type: array - description: Tools (functions) available to the model. - items: - $ref: '#/components/schemas/RealtimeFunctionTool' - tool_choice: - type: string - default: auto - description: > - How the model chooses tools. Options are `auto`, `none`, `required`, - or - - specify a function. - temperature: - type: number - default: 0.8 - description: > - Sampling temperature for the model, limited to [0.6, 1.2]. For audio - models a temperature of 0.8 is highly recommended for best - performance. - max_response_output_tokens: - oneOf: - - type: integer + description: '`owner` or `reader`' + role_id: + anyOf: - type: string - enum: - - inf - x-stainless-const: true - description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - expires_at: - type: integer - format: unixtime - description: Expiration timestamp for the session, in seconds since epoch. - prompt: + - type: 'null' + description: Role ID to assign to the user. + technical_level: anyOf: - - $ref: '#/components/schemas/Prompt' + - type: string - type: 'null' - include: + description: Technical level metadata. + developer_persona: anyOf: - - type: array - items: - type: string - enum: - - item.input_audio_transcription.logprobs - description: > - Additional fields to include in server outputs. - - - `item.input_audio_transcription.logprobs`: Include logprobs - for input audio transcription. + - type: string - type: 'null' - RealtimeSessionCreateRequest: + description: Developer persona metadata. + VadConfig: type: object - description: | - A new Realtime session configuration, with an ephemeral key. Default TTL - for keys is one minute. + additionalProperties: false + required: + - type properties: - client_secret: - type: object - description: Ephemeral key returned by the API. - properties: - value: - type: string - description: > - Ephemeral key usable in client environments to authenticate - connections - - to the Realtime API. Use this in client-side environments rather - than - - a standard API token, which should only be used server-side. - expires_at: - type: integer - format: unixtime - description: > - Timestamp for when the token expires. Currently, all tokens - expire - - after one minute. - required: - - value - - expires_at - modalities: - description: | - The set of modalities the model can respond with. To disable audio, - set this to ["text"]. - items: - type: string - enum: - - text - - audio - instructions: - type: string - description: > - 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. - - 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. - voice: - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - description: > - The voice the model uses to respond. Supported built-in voices are - - `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, - `verse`, - - `marin`, and `cedar`. You may also provide a custom voice object - with an - - `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed - during - - the session once the model has responded with audio at least once. - input_audio_format: - type: string - description: > - The format of input audio. Options are `pcm16`, `g711_ulaw`, or - `g711_alaw`. - output_audio_format: + type: type: string - description: > - The format of output audio. Options are `pcm16`, `g711_ulaw`, or - `g711_alaw`. - input_audio_transcription: - type: object - description: > - 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 and should be treated as rough guidance - - rather than the representation understood by the model. - properties: - model: - type: string - description: | - The model to use for transcription. - speed: + enum: + - server_vad + description: >- + Must be set to `server_vad` to enable manual chunking using server + side VAD. + prefix_padding_ms: + type: integer + default: 300 + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). + silence_duration_ms: + type: integer + default: 200 + description: | + Duration of silence to detect speech stop (in milliseconds). + With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + threshold: type: number - default: 1 - maximum: 1.5 - minimum: 0.25 - description: > - The speed of the model's spoken response. 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. - tracing: - title: Tracing Configuration + default: 0.5 description: > - Configuration options for tracing. Set to null to disable tracing. - Once - - tracing is enabled for a session, the configuration cannot be - modified. - + Sensitivity threshold (0.0 to 1.0) for voice activity detection. A - `auto` will create a trace for the session with default values for - the + higher threshold will require louder audio to activate the model, + and - workflow name, group id, and metadata. + thus might perform better in noisy environments. + ValidateGraderRequest: + type: object + title: ValidateGraderRequest + properties: + grader: + type: object + description: The grader used for the fine-tuning job. oneOf: - - type: string - default: auto - description: | - Default tracing mode for the session. - enum: - - auto - x-stainless-const: true - - type: object - title: Tracing Configuration - description: | - Granular configuration for tracing. - properties: - workflow_name: - type: string - description: > - The name of the workflow to attach to this trace. This is - used to - - name the trace in the traces dashboard. - group_id: - type: string - description: | - The group id to attach to this trace to enable filtering and - grouping in the traces dashboard. - metadata: - type: object - description: | - The arbitrary metadata to attach to this trace to enable - filtering in the traces dashboard. - turn_detection: + - $ref: '#/components/schemas/GraderStringCheck' + - $ref: '#/components/schemas/GraderTextSimilarity' + - $ref: '#/components/schemas/GraderPython' + - $ref: '#/components/schemas/GraderScoreModel' + - $ref: '#/components/schemas/GraderMulti' + required: + - grader + ValidateGraderResponse: + type: object + title: ValidateGraderResponse + properties: + grader: type: object + description: The grader used for the fine-tuning job. + oneOf: + - $ref: '#/components/schemas/GraderStringCheck' + - $ref: '#/components/schemas/GraderTextSimilarity' + - $ref: '#/components/schemas/GraderPython' + - $ref: '#/components/schemas/GraderScoreModel' + - $ref: '#/components/schemas/GraderMulti' + VectorStoreExpirationAfter: + type: object + title: Vector store expiration policy + description: The expiration policy for a vector store. + properties: + anchor: + description: >- + Anchor timestamp after which the expiration policy applies. + Supported anchors: `last_active_at`. + type: string + enum: + - last_active_at + x-stainless-const: true + days: + description: >- + The number of days after the anchor time that the vector store will + expire. + type: integer + minimum: 1 + maximum: 365 + required: + - anchor + - days + VectorStoreFileAttributes: + anyOf: + - type: object description: > - Configuration for turn detection. Can be set to `null` to turn off. - Server + Set of 16 key-value pairs that can be attached to an object. This + can be - VAD means that the model will detect the start and end of speech - based on + useful for storing additional information about the object in a + structured - audio volume and respond at the end of user speech. - properties: - type: - type: string - description: > - Type of turn detection, only `server_vad` is currently - supported. - threshold: - type: number - description: > - Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. - A + format, and querying for objects via API or the dashboard. Keys are + strings - higher threshold will require louder audio to activate the - model, and + with a maximum length of 64 characters. Values are strings with a + maximum - thus might perform better in noisy environments. - prefix_padding_ms: + length of 512 characters, booleans, or numbers. + maxProperties: 16 + propertyNames: + type: string + maxLength: 64 + additionalProperties: + oneOf: + - type: string + maxLength: 512 + - type: number + - type: boolean + x-oaiTypeLabel: map + - type: 'null' + VectorStoreFileBatchObject: + type: object + title: Vector store file batch + description: A batch of files attached to a vector store. + properties: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `vector_store.file_batch`. + type: string + enum: + - vector_store.files_batch + x-stainless-const: true + created_at: + description: >- + The Unix timestamp (in seconds) for when the vector store files + batch was created. + type: integer + format: unixtime + vector_store_id: + description: >- + The ID of the [vector + store](/docs/api-reference/vector-stores/object) that the + [File](/docs/api-reference/files) is attached to. + type: string + status: + description: >- + The status of the vector store files batch, which can be either + `in_progress`, `completed`, `cancelled` or `failed`. + type: string + enum: + - in_progress + - completed + - cancelled + - failed + file_counts: + type: object + properties: + in_progress: + description: The number of files that are currently being processed. type: integer - description: | - Amount of audio to include before the VAD detected speech (in - milliseconds). Defaults to 300ms. - silence_duration_ms: + completed: + description: The number of files that have been processed. type: integer - description: > - Duration of silence to detect speech stop (in milliseconds). - Defaults - - to 500ms. With shorter values the model will respond more - quickly, - - but may jump in on short pauses from the user. - tools: + failed: + description: The number of files that have failed to process. + type: integer + cancelled: + description: The number of files that where cancelled. + type: integer + total: + description: The total number of files. + type: integer + required: + - in_progress + - completed + - cancelled + - failed + - total + required: + - id + - object + - created_at + - vector_store_id + - status + - file_counts + x-oaiMeta: + name: The vector store files batch object + beta: true + example: | + { + "id": "vsfb_123", + "object": "vector_store.files_batch", + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "failed": 0, + "cancelled": 0, + "total": 100 + } + } + VectorStoreFileContentResponse: + type: object + description: Represents the parsed content of a vector store file. + properties: + object: + type: string + enum: + - vector_store.file_content.page + description: The object type, which is always `vector_store.file_content.page` + x-stainless-const: true + data: type: array - description: Tools (functions) available to the model. + description: Parsed content of the file. items: type: object properties: type: type: string - enum: - - function - description: The type of the tool, i.e. `function`. - x-stainless-const: true - name: - type: string - description: The name of the function. - description: + description: The content type (currently only `"text"`) + text: type: string - description: > - The description of the function, including guidance on when - and how - - to call it, and guidance about what to tell the user when - calling - - (if anything). - parameters: - type: object - description: Parameters of the function in JSON Schema. - tool_choice: + description: The text content + has_more: + type: boolean + description: Indicates if there are more content pages to fetch. + next_page: + anyOf: + - type: string + description: The token for the next page, if any. + - type: 'null' + required: + - object + - data + - has_more + - next_page + VectorStoreFileObject: + type: object + title: Vector store files + description: A list of files attached to a vector store. + properties: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `vector_store.file`. + type: string + enum: + - vector_store.file + x-stainless-const: true + usage_bytes: + description: >- + The total vector store usage in bytes. Note that this may be + different from the original file size. + type: integer + created_at: + description: >- + The Unix timestamp (in seconds) for when the vector store file was + created. + type: integer + format: unixtime + vector_store_id: + description: >- + The ID of the [vector + store](/docs/api-reference/vector-stores/object) that the + [File](/docs/api-reference/files) is attached to. type: string - description: > - How the model chooses tools. Options are `auto`, `none`, `required`, - or - - specify a function. - temperature: - type: number - description: > - Sampling temperature for the model, limited to [0.6, 1.2]. Defaults - to 0.8. - max_response_output_tokens: + status: + description: >- + The status of the vector store file, which can be either + `in_progress`, `completed`, `cancelled`, or `failed`. The status + `completed` indicates that the vector store file is ready for use. + type: string + enum: + - in_progress + - completed + - cancelled + - failed + last_error: + anyOf: + - type: object + description: >- + The last error associated with this vector store file. Will be + `null` if there are no errors. + properties: + code: + type: string + description: >- + One of `server_error`, `unsupported_file`, or + `invalid_file`. + enum: + - server_error + - unsupported_file + - invalid_file + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + - type: 'null' + chunking_strategy: + type: object + description: The strategy used to chunk the file. oneOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true - description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - truncation: - $ref: '#/components/schemas/RealtimeTruncation' - prompt: - $ref: '#/components/schemas/Prompt' + - $ref: '#/components/schemas/StaticChunkingStrategyResponseParam' + - $ref: '#/components/schemas/OtherChunkingStrategyResponseParam' + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' required: - - client_secret + - id + - object + - usage_bytes + - created_at + - vector_store_id + - status + - last_error x-oaiMeta: - name: The session object - group: realtime + name: The vector store file object + beta: true example: | { - "id": "sess_001", - "object": "realtime.session", - "model": "gpt-realtime-2025-08-25", - "modalities": ["audio", "text"], - "instructions": "You are a friendly assistant.", - "voice": "alloy", - "input_audio_format": "pcm16", - "output_audio_format": "pcm16", - "input_audio_transcription": { - "model": "whisper-1" - }, - "turn_detection": null, - "tools": [], - "tool_choice": "none", - "temperature": 0.7, - "speed": 1.1, - "tracing": "auto", - "max_response_output_tokens": 200, - "truncation": "auto", - "prompt": null, - "client_secret": { - "value": "ek_abc123", - "expires_at": 1234567890 + "id": "file-abc123", + "object": "vector_store.file", + "usage_bytes": 1234, + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "last_error": null, + "chunking_strategy": { + "type": "static", + "static": { + "max_chunk_size_tokens": 800, + "chunk_overlap_tokens": 400 + } } } - RealtimeSessionCreateRequestGA: + VectorStoreObject: type: object - title: Realtime session configuration - description: Realtime session object configuration. + title: Vector store + description: >- + A vector store is a collection of processed files can be used by the + `file_search` tool. properties: - type: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `vector_store`. type: string - description: > - The type of session to create. Always `realtime` for the Realtime - API. enum: - - realtime + - vector_store x-stainless-const: true - output_modalities: - type: array - description: > - The set of modalities the model can respond with. It defaults to - `["audio"]`, indicating - - that the model will respond with audio plus a transcript. `["text"]` - can be used to make - - the model respond with text only. It is not possible to request both - `text` and `audio` at the same time. - default: - - audio - items: - type: string - enum: - - text - - audio - model: - anyOf: - - type: string - - type: string - enum: - - gpt-realtime - - gpt-realtime-1.5 - - gpt-realtime-2 - - gpt-realtime-2025-08-28 - - gpt-4o-realtime-preview - - gpt-4o-realtime-preview-2024-10-01 - - gpt-4o-realtime-preview-2024-12-17 - - gpt-4o-realtime-preview-2025-06-03 - - gpt-4o-mini-realtime-preview - - gpt-4o-mini-realtime-preview-2024-12-17 - - gpt-realtime-mini - - gpt-realtime-mini-2025-10-06 - - gpt-realtime-mini-2025-12-15 - - gpt-audio-1.5 - - gpt-audio-mini - - gpt-audio-mini-2025-10-06 - - gpt-audio-mini-2025-12-15 - description: | - The Realtime model used for this session. - instructions: + created_at: + description: >- + The Unix timestamp (in seconds) for when the vector store was + created. + type: integer + format: unixtime + name: + description: The name of the vector store. type: string - description: > - 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. - - - 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. - audio: + usage_bytes: + description: The total number of bytes used by the files in the vector store. + type: integer + file_counts: type: object - description: | - Configuration for input and output audio. properties: - input: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the input audio. - transcription: - description: > - 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](/docs/api-reference/audio/createTranscription) 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. - $ref: '#/components/schemas/AudioTranscription' - noise_reduction: - type: object - default: null - description: > - Configuration for input audio noise reduction. This can be - set to `null` to turn off. - - Noise reduction filters audio added to the input audio - buffer before it is sent to VAD and the model. - - Filtering the audio can improve VAD and turn detection - accuracy (reducing false positives) and model performance by - improving perception of the input audio. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - turn_detection: - $ref: '#/components/schemas/RealtimeTurnDetection' - output: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the output audio. - voice: - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - default: alloy - description: > - The voice the model uses to respond. Supported built-in - voices are - - `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, - `shimmer`, `verse`, - - `marin`, and `cedar`. You may also provide a custom voice - object with - - an `id`, for example `{ "id": "voice_1234" }`. Voice cannot - be changed - - during the session once the model has responded with audio - at least once. - - We recommend `marin` and `cedar` for best quality. - speed: - type: number - default: 1 - maximum: 1.5 - minimum: 0.25 - description: > - The speed of the model's spoken response as a multiple of - the original speed. - - 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. - - - This parameter is a post-processing adjustment to the audio - after it is generated, it's - - also possible to prompt the model to speak faster or slower. - include: - type: array - items: - type: string - enum: - - item.input_audio_transcription.logprobs - description: > - Additional fields to include in server outputs. - - - `item.input_audio_transcription.logprobs`: Include logprobs for - input audio transcription. - tracing: - title: Tracing Configuration - default: null - description: > - Realtime API can write session traces to the [Traces - Dashboard](https://platform.openai.com/logs?api=traces). Set to null - to disable tracing. Once - - tracing is enabled for a session, the configuration cannot be - modified. - - - `auto` will create a trace for the session with default values for - the - - workflow name, group id, and metadata. - nullable: true + in_progress: + description: The number of files that are currently being processed. + type: integer + completed: + description: The number of files that have been successfully processed. + type: integer + failed: + description: The number of files that have failed to process. + type: integer + cancelled: + description: The number of files that were cancelled. + type: integer + total: + description: The total number of files. + type: integer + required: + - in_progress + - completed + - failed + - cancelled + - total + status: + description: >- + The status of the vector store, which can be either `expired`, + `in_progress`, or `completed`. A status of `completed` indicates + that the vector store is ready for use. + type: string + enum: + - expired + - in_progress + - completed + expires_after: + $ref: '#/components/schemas/VectorStoreExpirationAfter' + expires_at: + anyOf: + - description: >- + The Unix timestamp (in seconds) for when the vector store will + expire. + type: integer + format: unixtime + - type: 'null' + last_active_at: + anyOf: + - description: >- + The Unix timestamp (in seconds) for when the vector store was + last active. + type: integer + format: unixtime + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - id + - object + - usage_bytes + - created_at + - status + - last_active_at + - name + - file_counts + - metadata + x-oaiMeta: + name: The vector store object + example: | + { + "id": "vs_123", + "object": "vector_store", + "created_at": 1698107661, + "usage_bytes": 123456, + "last_active_at": 1698107661, + "name": "my_vector_store", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "cancelled": 0, + "failed": 0, + "total": 100 + }, + "last_used_at": 1698107661 + } + VectorStoreSearchRequest: + type: object + additionalProperties: false + properties: + query: + description: A query string for a search oneOf: - type: string - title: auto - default: auto - description: > - Enables tracing and sets default values for tracing - configuration options. Always `auto`. - enum: - - auto - x-stainless-const: true - - type: object - title: Tracing Configuration - description: | - Granular configuration for tracing. - properties: - workflow_name: - type: string - description: > - The name of the workflow to attach to this trace. This is - used to - - name the trace in the Traces Dashboard. - group_id: - type: string - description: | - The group id to attach to this trace to enable filtering and - grouping in the Traces Dashboard. - metadata: - type: object - description: | - The arbitrary metadata to attach to this trace to enable - filtering in the Traces Dashboard. - tools: - type: array - description: Tools available to the model. - items: - oneOf: - - $ref: '#/components/schemas/RealtimeFunctionTool' - - $ref: '#/components/schemas/MCPTool' - tool_choice: - description: > - How the model chooses tools. Provide one of the string modes or - force a specific - - function/MCP tool. - oneOf: - - $ref: '#/components/schemas/ToolChoiceOptions' - - $ref: '#/components/schemas/ToolChoiceFunction' - - $ref: '#/components/schemas/ToolChoiceMCP' - default: auto - parallel_tool_calls: + - type: array + items: + type: string + description: A list of queries to search for. + minItems: 1 + rewrite_query: + description: Whether to rewrite the natural language query for vector search. type: boolean - description: > - Whether the model may call multiple tools in parallel. Only - supported by - - reasoning Realtime models such as `gpt-realtime-2`. - reasoning: - $ref: '#/components/schemas/RealtimeReasoning' - max_output_tokens: + default: false + max_num_results: + description: >- + The maximum number of results to return. This number should be + between 1 and 50 inclusive. + type: integer + default: 10 + minimum: 1 + maximum: 50 + filters: + description: A filter to apply based on file attributes. oneOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true - description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - truncation: - $ref: '#/components/schemas/RealtimeTruncation' - prompt: - $ref: '#/components/schemas/Prompt' + - $ref: '#/components/schemas/ComparisonFilter' + - $ref: '#/components/schemas/CompoundFilter' + ranking_options: + description: Ranking options for search. + type: object + additionalProperties: false + properties: + ranker: + description: >- + Enable re-ranking; set to `none` to disable, which can help + reduce latency. + type: string + enum: + - none + - auto + - default-2024-11-15 + default: auto + score_threshold: + type: number + minimum: 0 + maximum: 1 + default: 0 + required: + - query + x-oaiMeta: + name: Vector store search request + VectorStoreSearchResultContentObject: + type: object + additionalProperties: false + properties: + type: + description: The type of content. + type: string + enum: + - text + text: + description: The text content returned from search. + type: string required: - type - RealtimeSessionCreateResponse: + - text + x-oaiMeta: + name: Vector store search result content object + VectorStoreSearchResultItem: type: object - title: Realtime session configuration object - description: | - A Realtime session configuration object. + additionalProperties: false properties: - id: + file_id: type: string - description: > - Unique identifier for the session that looks like - `sess_1234567890abcdef`. - object: + description: The ID of the vector store file. + filename: type: string - description: The object type. Always `realtime.session`. - expires_at: - type: integer - format: unixtime - description: Expiration timestamp for the session, in seconds since epoch. - include: + description: The name of the vector store file. + score: + type: number + description: The similarity score for the result. + minimum: 0 + maximum: 1 + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + content: type: array + description: Content chunks from the file. items: - type: string - enum: - - item.input_audio_transcription.logprobs - description: > - Additional fields to include in server outputs. - - - `item.input_audio_transcription.logprobs`: Include logprobs for - input audio transcription. - model: + $ref: '#/components/schemas/VectorStoreSearchResultContentObject' + required: + - file_id + - filename + - score + - attributes + - content + x-oaiMeta: + name: Vector store search result item + VectorStoreSearchResultsPage: + type: object + additionalProperties: false + properties: + object: type: string - description: The Realtime model used for this session. - output_modalities: - description: | - The set of modalities the model can respond with. To disable audio, - set this to ["text"]. + enum: + - vector_store.search_results.page + description: The object type, which is always `vector_store.search_results.page` + x-stainless-const: true + search_query: + type: array items: type: string - enum: - - text - - audio - instructions: - type: string - description: > - 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. - - - 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. - audio: - type: object - description: | - Configuration for input and output audio for the session. - properties: - input: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - transcription: - description: | - Configuration for input audio transcription. - $ref: '#/components/schemas/AudioTranscriptionResponse' - noise_reduction: - type: object - description: | - Configuration for input audio noise reduction. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - turn_detection: - type: object - description: | - Configuration for turn detection. - properties: - type: - type: string - description: > - Type of turn detection, only `server_vad` is currently - supported. - threshold: - type: number - prefix_padding_ms: - type: integer - silence_duration_ms: - type: integer - output: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - voice: - $ref: '#/components/schemas/VoiceIdsShared' - speed: - type: number - tracing: - title: Tracing Configuration - description: > - Configuration options for tracing. Set to null to disable tracing. - Once - - tracing is enabled for a session, the configuration cannot be - modified. - - - `auto` will create a trace for the session with default values for - the - - workflow name, group id, and metadata. - oneOf: + description: The query used for this search. + minItems: 1 + data: + type: array + description: The list of search result items. + items: + $ref: '#/components/schemas/VectorStoreSearchResultItem' + has_more: + type: boolean + description: Indicates if there are more results to fetch. + next_page: + anyOf: - type: string - default: auto - description: | - Default tracing mode for the session. - enum: - - auto - x-stainless-const: true - - type: object - title: Tracing Configuration - description: | - Granular configuration for tracing. - properties: - workflow_name: - type: string - description: > - The name of the workflow to attach to this trace. This is - used to - - name the trace in the traces dashboard. - group_id: - type: string - description: | - The group id to attach to this trace to enable filtering and - grouping in the traces dashboard. - metadata: - type: object - description: | - The arbitrary metadata to attach to this trace to enable - filtering in the traces dashboard. - turn_detection: - type: object + description: The token for the next page, if any. + - type: 'null' + required: + - object + - search_query + - data + - has_more + - next_page + x-oaiMeta: + name: Vector store search results page + Verbosity: + anyOf: + - type: string + enum: + - low + - medium + - high + default: medium description: > - Configuration for turn detection. Can be set to `null` to turn off. - 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. - properties: - type: - type: string - description: > - Type of turn detection, only `server_vad` is currently - supported. - threshold: - type: number - description: > - Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. - A - - higher threshold will require louder audio to activate the - model, and - - thus might perform better in noisy environments. - prefix_padding_ms: - type: integer - description: | - Amount of audio to include before the VAD detected speech (in - milliseconds). Defaults to 300ms. - silence_duration_ms: - type: integer - description: > - Duration of silence to detect speech stop (in milliseconds). - Defaults + Constrains the verbosity of the model's response. Lower values will + result in - to 500ms. With shorter values the model will respond more - quickly, + more concise responses, while higher values will result in more + verbose responses. - but may jump in on short pauses from the user. - tools: + Currently supported values are `low`, `medium`, and `high`. + - type: 'null' + VoiceConsentDeletedResource: + type: object + additionalProperties: false + properties: + id: + type: string + description: The consent recording identifier. + example: cons_1234 + object: + type: string + enum: + - audio.voice_consent + x-stainless-const: true + deleted: + type: boolean + required: + - id + - object + - deleted + x-oaiMeta: + name: The voice consent deletion object + example: | + { + "object": "audio.voice_consent", + "id": "cons_1234", + "deleted": true + } + VoiceConsentListResource: + type: object + additionalProperties: false + properties: + object: + type: string + enum: + - list + x-stainless-const: true + data: type: array - description: Tools (functions) available to the model. items: - $ref: '#/components/schemas/RealtimeFunctionTool' - tool_choice: - type: string - description: > - How the model chooses tools. Options are `auto`, `none`, `required`, - or - - specify a function. - max_output_tokens: - oneOf: - - type: integer + $ref: '#/components/schemas/VoiceConsentResource' + first_id: + anyOf: - type: string - enum: - - inf - x-stainless-const: true - description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean + required: + - object + - data + - has_more x-oaiMeta: - name: The session object - group: realtime + name: The voice consent list object example: | { - "id": "sess_001", - "object": "realtime.session", - "expires_at": 1742188264, - "model": "gpt-realtime", - "output_modalities": ["audio"], - "instructions": "You are a friendly assistant.", - "tools": [], - "tool_choice": "none", - "max_output_tokens": "inf", - "tracing": "auto", - "truncation": "auto", - "prompt": null, - "audio": { - "input": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "transcription": { "model": "whisper-1" }, - "noise_reduction": null, - "turn_detection": null - }, - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "alloy", - "speed": 1.0 + "object": "list", + "data": [ + { + "object": "audio.voice_consent", + "id": "cons_1234", + "name": "John Doe", + "language": "en-US", + "created_at": 1734220800 } - } + ], + "first_id": "cons_1234", + "last_id": "cons_1234", + "has_more": false + } + VoiceConsentResource: + type: object + title: Voice consent + description: A consent recording used to authorize creation of a custom voice. + additionalProperties: false + properties: + object: + type: string + description: The object type, which is always `audio.voice_consent`. + enum: + - audio.voice_consent + x-stainless-const: true + id: + type: string + description: The consent recording identifier. + example: cons_1234 + name: + type: string + description: The label provided when the consent recording was uploaded. + language: + type: string + description: >- + The BCP 47 language tag for the consent phrase (for example, + `en-US`). + created_at: + type: integer + format: unixtime + description: >- + The Unix timestamp (in seconds) for when the consent recording was + created. + required: + - object + - id + - name + - language + - created_at + x-oaiMeta: + name: The voice consent object + example: | + { + "object": "audio.voice_consent", + "id": "cons_1234", + "name": "John Doe", + "language": "en-US", + "created_at": 1734220800 + } + VoiceIdsOrCustomVoice: + title: Voice + description: | + A built-in voice name or a custom voice reference. + anyOf: + - $ref: '#/components/schemas/VoiceIdsShared' + - type: object + description: Custom voice reference. + additionalProperties: false + required: + - id + properties: + id: + type: string + description: The custom voice ID, e.g. `voice_1234`. + example: voice_1234 + VoiceIdsShared: + example: ash + anyOf: + - type: string + - type: string + enum: + - alloy + - ash + - ballad + - coral + - echo + - sage + - shimmer + - verse + - marin + - cedar + VoiceResource: + type: object + title: Voice + description: A custom voice that can be used for audio output. + additionalProperties: false + properties: + object: + type: string + description: The object type, which is always `audio.voice`. + enum: + - audio.voice + x-stainless-const: true + id: + type: string + description: The voice identifier, which can be referenced in API endpoints. + name: + type: string + description: The name of the voice. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the voice was created. + required: + - object + - id + - name + - created_at + x-oaiMeta: + name: The voice object + example: | + { + "object": "audio.voice", + "id": "voice_123abc", + "name": "My new voice", + "created_at": 1734220800 } - RealtimeSessionCreateResponseGA: + WebSearchActionFind: type: object - title: Realtime session configuration object + title: Find action description: | - A Realtime session configuration object. + Action type "find_in_page": Searches for a pattern within a loaded page. properties: type: type: string - description: > - The type of session to create. Always `realtime` for the Realtime - API. enum: - - realtime + - find_in_page + description: | + The action type. x-stainless-const: true - id: + url: type: string - description: > - Unique identifier for the session that looks like - `sess_1234567890abcdef`. - object: + format: uri + description: | + The URL of the page searched for the pattern. + pattern: + type: string + description: | + The pattern or text to search for within the page. + required: + - type + - url + - pattern + WebSearchActionOpenPage: + type: object + title: Open page action + description: | + Action type "open_page" - Opens a specific URL from search results. + properties: + type: type: string - description: The object type. Always `realtime.session`. enum: - - realtime.session + - open_page + description: | + The action type. x-stainless-const: true - expires_at: - type: integer - format: unixtime - description: Expiration timestamp for the session, in seconds since epoch. - output_modalities: - type: array - description: > - The set of modalities the model can respond with. It defaults to - `["audio"]`, indicating - - that the model will respond with audio plus a transcript. `["text"]` - can be used to make - - the model respond with text only. It is not possible to request both - `text` and `audio` at the same time. - default: - - audio - items: - type: string - enum: - - text - - audio - model: + url: + description: | + The URL opened by the model. anyOf: - type: string - - type: string - enum: - - gpt-realtime - - gpt-realtime-1.5 - - gpt-realtime-2 - - gpt-realtime-2025-08-28 - - gpt-4o-realtime-preview - - gpt-4o-realtime-preview-2024-10-01 - - gpt-4o-realtime-preview-2024-12-17 - - gpt-4o-realtime-preview-2025-06-03 - - gpt-4o-mini-realtime-preview - - gpt-4o-mini-realtime-preview-2024-12-17 - - gpt-realtime-mini - - gpt-realtime-mini-2025-10-06 - - gpt-realtime-mini-2025-12-15 - - gpt-audio-1.5 - - gpt-audio-mini - - gpt-audio-mini-2025-10-06 - - gpt-audio-mini-2025-12-15 + format: uri + - type: 'null' + required: + - type + WebSearchActionSearch: + type: object + title: Search action + description: | + Action type "search" - Performs a web search query. + properties: + type: + type: string + enum: + - search description: | - The Realtime model used for this session. - instructions: + The action type. + x-stainless-const: true + query: type: string - description: > - 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. - - - 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. - audio: - type: object + deprecated: true description: | - Configuration for input and output audio. - properties: - input: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the input audio. - transcription: - description: > - 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](/docs/api-reference/audio/createTranscription) 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. - $ref: '#/components/schemas/AudioTranscriptionResponse' - noise_reduction: - type: object - default: null - description: > - Configuration for input audio noise reduction. This can be - set to `null` to turn off. - - Noise reduction filters audio added to the input audio - buffer before it is sent to VAD and the model. - - Filtering the audio can improve VAD and turn detection - accuracy (reducing false positives) and model performance by - improving perception of the input audio. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - turn_detection: - $ref: '#/components/schemas/RealtimeTurnDetection' - output: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the output audio. - voice: - $ref: '#/components/schemas/VoiceIdsShared' - default: alloy - description: > - The voice the model uses to respond. Voice cannot be changed - during the - - session once the model has responded with audio at least - once. Current - - voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, - `sage`, - - `shimmer`, `verse`, `marin`, and `cedar`. We recommend - `marin` and `cedar` for - - best quality. - speed: - type: number - default: 1 - maximum: 1.5 - minimum: 0.25 - description: > - The speed of the model's spoken response as a multiple of - the original speed. - - 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. - - - This parameter is a post-processing adjustment to the audio - after it is generated, it's - - also possible to prompt the model to speak faster or slower. - include: + The search query. + queries: type: array + title: Search queries + description: | + The search queries. items: type: string - enum: - - item.input_audio_transcription.logprobs - description: > - Additional fields to include in server outputs. - - - `item.input_audio_transcription.logprobs`: Include logprobs for - input audio transcription. - tracing: - anyOf: - - title: Tracing Configuration - default: null - description: > - Realtime API can write session traces to the [Traces - Dashboard](https://platform.openai.com/logs?api=traces). Set to - null to disable tracing. Once - - tracing is enabled for a session, the configuration cannot be - modified. - - - `auto` will create a trace for the session with default values - for the - - workflow name, group id, and metadata. - oneOf: - - type: string - title: auto - default: auto - description: > - Enables tracing and sets default values for tracing - configuration options. Always `auto`. - enum: - - auto - x-stainless-const: true - - type: object - title: Tracing Configuration - description: | - Granular configuration for tracing. - properties: - workflow_name: - type: string - description: > - The name of the workflow to attach to this trace. This - is used to - - name the trace in the Traces Dashboard. - group_id: - type: string - description: > - The group id to attach to this trace to enable filtering - and - - grouping in the Traces Dashboard. - metadata: - type: object - description: | - The arbitrary metadata to attach to this trace to enable - filtering in the Traces Dashboard. - - type: 'null' - tools: + description: | + A search query. + sources: type: array - description: Tools available to the model. - items: - oneOf: - - $ref: '#/components/schemas/RealtimeFunctionTool' - - $ref: '#/components/schemas/MCPTool' - tool_choice: - description: > - How the model chooses tools. Provide one of the string modes or - force a specific - - function/MCP tool. - oneOf: - - $ref: '#/components/schemas/ToolChoiceOptions' - - $ref: '#/components/schemas/ToolChoiceFunction' - - $ref: '#/components/schemas/ToolChoiceMCP' - default: auto - reasoning: - $ref: '#/components/schemas/RealtimeReasoning' - max_output_tokens: - oneOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true + title: Web search sources description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - truncation: - $ref: '#/components/schemas/RealtimeTruncation' - prompt: - $ref: '#/components/schemas/Prompt' + The sources used in the search. + items: + type: object + title: Web search source + description: | + A source used in the search. + properties: + type: + type: string + enum: + - url + description: | + The type of source. Always `url`. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the source. + required: + - type + - url required: - type - - id - - object - x-oaiMeta: - name: The session object - group: realtime - RealtimeTranscriptionSessionCreateRequest: - type: object - title: Realtime transcription session configuration - description: Realtime transcription session object configuration. - properties: - turn_detection: - type: object - description: > - Configuration for turn detection. Can be set to `null` to turn off. - 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. + WebSearchApproximateLocation: + anyOf: + - type: object + title: Web search approximate location + description: | + The approximate location of the user. properties: type: type: string - description: > - Type of turn detection. Only `server_vad` is currently supported - for transcription sessions. enum: - - server_vad - threshold: - type: number - description: > - Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. - A - - higher threshold will require louder audio to activate the - model, and + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: + anyOf: + - type: string + description: >- + The two-letter [ISO country + code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, + e.g. `US`. + - type: 'null' + region: + anyOf: + - type: string + description: >- + Free text input for the region of the user, e.g. + `California`. + - type: 'null' + city: + anyOf: + - type: string + description: >- + Free text input for the city of the user, e.g. `San + Francisco`. + - type: 'null' + timezone: + anyOf: + - type: string + description: >- + The [IANA + timezone](https://timeapi.io/documentation/iana-timezones) + of the user, e.g. `America/Los_Angeles`. + - type: 'null' + - type: 'null' + WebSearchContextSize: + type: string + description: > + High level guidance for the amount of context window space to use for + the - thus might perform better in noisy environments. - prefix_padding_ms: - type: integer - description: | - Amount of audio to include before the VAD detected speech (in - milliseconds). Defaults to 300ms. - silence_duration_ms: - type: integer - description: > - Duration of silence to detect speech stop (in milliseconds). - Defaults + search. One of `low`, `medium`, or `high`. `medium` is the default. + enum: + - low + - medium + - high + default: medium + WebSearchLocation: + type: object + title: Web search location + description: Approximate location parameters for the search. + properties: + country: + type: string + description: > + The two-letter - to 500ms. With shorter values the model will respond more - quickly, + [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the + user, - but may jump in on short pauses from the user. - input_audio_noise_reduction: - type: object - default: null + e.g. `US`. + region: + type: string + description: | + Free text input for the region of the user, e.g. `California`. + city: + type: string + description: | + Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string description: > - Configuration for input audio noise reduction. This can be set to - `null` to turn off. + The [IANA + timezone](https://timeapi.io/documentation/iana-timezones) - Noise reduction filters audio added to the input audio buffer before - it is sent to VAD and the model. + of the user, e.g. `America/Los_Angeles`. + WebSearchTool: + type: object + title: Web search + description: > + Search the Internet for sources related to the prompt. Learn more about + the - Filtering the audio can improve VAD and turn detection accuracy - (reducing false positives) and model performance by improving - perception of the input audio. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - input_audio_format: + [web search tool](/docs/guides/tools-web-search). + properties: + type: type: string - default: pcm16 enum: - - pcm16 - - g711_ulaw - - g711_alaw - description: > - The format of input audio. Options are `pcm16`, `g711_ulaw`, or - `g711_alaw`. + - web_search + - web_search_2025_08_26 + description: >- + The type of the web search tool. One of `web_search` or + `web_search_2025_08_26`. + default: web_search + filters: + anyOf: + - type: object + description: | + Filters for the search. + properties: + allowed_domains: + anyOf: + - type: array + title: Allowed domains for the search. + description: > + Allowed domains for the search. If not provided, all + domains are allowed. - For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, + Subdomains of the provided domains are allowed as well. - single channel (mono), and little-endian byte order. - input_audio_transcription: - description: > - Configuration for input audio transcription. The client can - optionally set the language and prompt for transcription, these - offer additional guidance to the transcription service. - $ref: '#/components/schemas/AudioTranscription' - include: - type: array - items: - type: string - enum: - - item.input_audio_transcription.logprobs - description: > - The set of items to include in the transcription. Current available - items are: - `item.input_audio_transcription.logprobs` - RealtimeTranscriptionSessionCreateRequestGA: + Example: `["pubmed.ncbi.nlm.nih.gov"]` + items: + type: string + description: Allowed domain for the search. + default: [] + - type: 'null' + - type: 'null' + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + type: string + enum: + - low + - medium + - high + default: medium + description: >- + High level guidance for the amount of context window space to use + for the search. One of `low`, `medium`, or `high`. `medium` is the + default. + required: + - type + WebSearchToolCall: type: object - title: Realtime transcription session configuration - description: Realtime transcription session object configuration. + title: Web search tool call + description: | + The results of a web search tool call. See the + [web search guide](/docs/guides/tools-web-search) for more information. properties: + id: + type: string + description: | + The unique ID of the web search tool call. type: type: string - description: > - The type of session to create. Always `transcription` for - transcription sessions. enum: - - transcription + - web_search_call + description: | + The type of the web search tool call. Always `web_search_call`. x-stainless-const: true - audio: - type: object + status: + type: string description: | - Configuration for input and output audio. - properties: - input: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - transcription: - description: > - 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](/docs/api-reference/audio/createTranscription) 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. - $ref: '#/components/schemas/AudioTranscription' - noise_reduction: - type: object - default: null - description: > - Configuration for input audio noise reduction. This can be - set to `null` to turn off. - - Noise reduction filters audio added to the input audio - buffer before it is sent to VAD and the model. - - Filtering the audio can improve VAD and turn detection - accuracy (reducing false positives) and model performance by - improving perception of the input audio. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - turn_detection: - $ref: '#/components/schemas/RealtimeTurnDetection' - include: - type: array - items: - type: string - enum: - - item.input_audio_transcription.logprobs + The status of the web search tool call. + enum: + - in_progress + - searching + - completed + - failed + action: + type: object description: > - Additional fields to include in server outputs. - + An object describing the specific action taken in this web search + call. - `item.input_audio_transcription.logprobs`: Include logprobs for - input audio transcription. + Includes details on how the model used the web (search, open_page, + find_in_page). + oneOf: + - $ref: '#/components/schemas/WebSearchActionSearch' + - $ref: '#/components/schemas/WebSearchActionOpenPage' + - $ref: '#/components/schemas/WebSearchActionFind' + discriminator: + propertyName: type required: + - id - type - RealtimeTranscriptionSessionCreateResponse: + - status + - action + WebhookBatchCancelled: type: object + title: batch.cancelled description: | - A new Realtime transcription session configuration. - - When a session is created on the server via REST API, the session object - also contains an ephemeral key. Default TTL for keys is 10 minutes. This - property is not present when a session is updated via the WebSocket API. + Sent when a batch API request has been cancelled. + required: + - created_at + - id + - data + - type properties: - client_secret: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the batch API request was + cancelled. + id: + type: string + description: | + The unique ID of the event. + data: type: object description: | - Ephemeral key returned by the API. Only present when the session is - created on the server via REST API. + Event data payload. + required: + - id properties: - value: + id: type: string - description: > - Ephemeral key usable in client environments to authenticate - connections - - to the Realtime API. Use this in client-side environments rather - than - - a standard API token, which should only be used server-side. - expires_at: - type: integer - format: unixtime - description: > - Timestamp for when the token expires. Currently, all tokens - expire - - after one minute. - required: - - value - - expires_at - modalities: + description: | + The unique ID of the batch API request. + object: + type: string description: | - The set of modalities the model can respond with. To disable audio, - set this to ["text"]. - items: - type: string - enum: - - text - - audio - input_audio_format: + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: type: string - description: > - The format of input audio. Options are `pcm16`, `g711_ulaw`, or - `g711_alaw`. - input_audio_transcription: description: | - Configuration of the transcription model. - $ref: '#/components/schemas/AudioTranscriptionResponse' - turn_detection: - type: object - description: > - Configuration for turn detection. Can be set to `null` to turn off. - 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. - properties: - type: - type: string - description: > - Type of turn detection, only `server_vad` is currently - supported. - threshold: - type: number - description: > - Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. - A - - higher threshold will require louder audio to activate the - model, and - - thus might perform better in noisy environments. - prefix_padding_ms: - type: integer - description: | - Amount of audio to include before the VAD detected speech (in - milliseconds). Defaults to 300ms. - silence_duration_ms: - type: integer - description: > - Duration of silence to detect speech stop (in milliseconds). - Defaults - - to 500ms. With shorter values the model will respond more - quickly, - - but may jump in on short pauses from the user. - required: - - client_secret + The type of the event. Always `batch.cancelled`. + enum: + - batch.cancelled + x-stainless-const: true x-oaiMeta: - name: The transcription session object - group: realtime + name: batch.cancelled + group: webhook-events example: | { - "id": "sess_BBwZc7cFV3XizEyKGDCGL", - "object": "realtime.transcription_session", - "expires_at": 1742188264, - "modalities": ["audio", "text"], - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200 - }, - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "language": null, - "prompt": "" - }, - "client_secret": null + "id": "evt_abc123", + "type": "batch.cancelled", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } } - RealtimeTranscriptionSessionCreateResponseGA: + WebhookBatchCompleted: type: object - title: Realtime transcription session configuration object + title: batch.completed description: | - A Realtime transcription session configuration object. + Sent when a batch API request has been completed. + required: + - created_at + - id + - data + - type properties: - type: - type: string - description: > - The type of session. Always `transcription` for transcription - sessions. - enum: - - transcription - x-stainless-const: true - id: - type: string - description: > - Unique identifier for the session that looks like - `sess_1234567890abcdef`. - object: - type: string - description: The object type. Always `realtime.transcription_session`. - expires_at: + created_at: type: integer format: unixtime - description: Expiration timestamp for the session, in seconds since epoch. - include: - type: array - items: - type: string - enum: - - item.input_audio_transcription.logprobs description: > - Additional fields to include in server outputs. - - - `item.input_audio_transcription.logprobs`: Include logprobs for - input audio transcription. - audio: + The Unix timestamp (in seconds) of when the batch API request was + completed. + id: + type: string + description: | + The unique ID of the event. + data: type: object description: | - Configuration for input audio for the session. + Event data payload. + required: + - id properties: - input: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - transcription: - description: | - Configuration of the transcription model. - $ref: '#/components/schemas/AudioTranscriptionResponse' - noise_reduction: - type: object - description: | - Configuration for input audio noise reduction. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - turn_detection: - description: > - Configuration for turn detection. For - `gpt-realtime-whisper`, this must be `null`; VAD is not - supported. - anyOf: - - type: object - description: > - Configuration for turn detection. Can be set to `null` - to turn off. 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. For - `gpt-realtime-whisper`, this must be `null`; VAD is not - supported. - properties: - type: - type: string - description: > - Type of turn detection, only `server_vad` is - currently supported. - threshold: - type: number - description: > - Activation threshold for VAD (0.0 to 1.0), this - defaults to 0.5. A - - higher threshold will require louder audio to - activate the model, and - - thus might perform better in noisy environments. - prefix_padding_ms: - type: integer - description: > - Amount of audio to include before the VAD detected - speech (in - - milliseconds). Defaults to 300ms. - silence_duration_ms: - type: integer - description: > - Duration of silence to detect speech stop (in - milliseconds). Defaults - - to 500ms. With shorter values the model will respond - more quickly, - - but may jump in on short pauses from the user. - - type: 'null' - required: - - type - - id - - object + id: + type: string + description: | + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.completed`. + enum: + - batch.completed + x-stainless-const: true x-oaiMeta: - name: The transcription session object - group: realtime + name: batch.completed + group: webhook-events example: | { - "id": "sess_BBwZc7cFV3XizEyKGDCGL", - "type": "transcription", - "object": "realtime.transcription_session", - "expires_at": 1742188264, - "include": ["item.input_audio_transcription.logprobs"], - "audio": { - "input": { - "format": "pcm16", - "transcription": { - "model": "gpt-4o-transcribe", - "language": null, - "prompt": "" - }, - "noise_reduction": null, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200 - } - } + "id": "evt_abc123", + "type": "batch.completed", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" } } - RealtimeTranslationClientEvent: - discriminator: - propertyName: type - description: | - A Realtime translation client event. - anyOf: - - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionUpdate' - - $ref: >- - #/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend - - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionClose' - RealtimeTranslationClientEventInputAudioBufferAppend: + WebhookBatchExpired: type: object - description: > - Send this event to append audio bytes to the translation session input - audio buffer. - - - WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono - - little-endian raw audio bytes. Unsupported websocket audio formats - return a - - validation error because lower-quality audio materially degrades - translation - - quality. - - - Translation consumes 200 ms engine frames. For best realtime behavior, - append - - audio in 200 ms chunks. If a chunk is shorter, the server buffers it - until it - - has enough audio for one frame. If a chunk is longer, the server splits - it into - - 200 ms frames and enqueues them back-to-back. - - - Keep appending silence while the session is active. If a client stops - sending - - audio and later resumes, model time treats the resumed audio as - contiguous with - - the previous audio rather than as a real-world pause. + title: batch.expired + description: | + Sent when a batch API request has expired. + required: + - created_at + - id + - data + - type properties: - event_id: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the batch API request + expired. + id: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. - type: + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the batch API request. + object: type: string + description: | + The object of the event. Always `event`. enum: - - session.input_audio_buffer.append - description: The event type, must be `session.input_audio_buffer.append`. + - event x-stainless-const: true - audio: + type: type: string - description: Base64-encoded 24 kHz PCM16 mono audio bytes. - required: - - type - - audio + description: | + The type of the event. Always `batch.expired`. + enum: + - batch.expired + x-stainless-const: true x-oaiMeta: - name: session.input_audio_buffer.append - group: realtime + name: batch.expired + group: webhook-events example: | { - "event_id": "event_456", - "type": "session.input_audio_buffer.append", - "audio": "Base64EncodedAudioData" + "id": "evt_abc123", + "type": "batch.expired", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } } - RealtimeTranslationClientEventSessionClose: + WebhookBatchFailed: type: object - description: > - Gracefully close the realtime translation session. The server flushes - pending - - input audio and emits any remaining translated output before closing the - - session. + title: batch.failed + description: | + Sent when a batch API request has failed. + required: + - created_at + - id + - data + - type properties: - event_id: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the batch API request + failed. + id: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true type: type: string + description: | + The type of the event. Always `batch.failed`. enum: - - session.close - description: The event type, must be `session.close`. + - batch.failed x-stainless-const: true - required: - - type x-oaiMeta: - name: session.close - group: realtime + name: batch.failed + group: webhook-events example: | { - "event_id": "event_789", - "type": "session.close" + "id": "evt_abc123", + "type": "batch.failed", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } } - RealtimeTranslationClientEventSessionUpdate: + WebhookEvalRunCanceled: type: object - description: > - Send this event to update the translation session configuration. - Translation - - sessions support updates to `audio.output.language`, - `audio.input.transcription`, - - and `audio.input.noise_reduction`. + title: eval.run.canceled + description: | + Sent when an eval run has been canceled. + required: + - created_at + - id + - data + - type properties: - event_id: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the eval run was canceled. + id: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the eval run. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true type: type: string + description: | + The type of the event. Always `eval.run.canceled`. enum: - - session.update - description: The event type, must be `session.update`. + - eval.run.canceled x-stainless-const: true - session: - $ref: '#/components/schemas/RealtimeTranslationSessionUpdateRequest' - description: > - Translation session fields to update. The session `type` and `model` - are set - - at creation and cannot be changed with `session.update`. - required: - - type - - session x-oaiMeta: - name: session.update - group: realtime + name: eval.run.canceled + group: webhook-events example: | { - "type": "session.update", - "session": { - "audio": { - "input": { - "transcription": { - "model": "gpt-realtime-whisper" - }, - "noise_reduction": null - }, - "output": { - "language": "es" - } - } + "id": "evt_abc123", + "type": "eval.run.canceled", + "created_at": 1719168000, + "data": { + "id": "evalrun_abc123" } - } - RealtimeTranslationClientSecretCreateRequest: + } + WebhookEvalRunFailed: type: object - title: Realtime translation client secret creation request + title: eval.run.failed description: | - Create a translation session and client secret for the Realtime API. + Sent when an eval run has failed. + required: + - created_at + - id + - data + - type properties: - expires_after: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the eval run failed. + id: + type: string + description: | + The unique ID of the event. + data: type: object - title: Client secret expiration - description: > - Configuration for the client secret expiration. Expiration refers to - the time after which - - a client secret will no longer be valid for creating sessions. The - session itself may - - continue after that time once started. A secret can be used to - create multiple sessions - - until it expires. + description: | + Event data payload. + required: + - id properties: - anchor: + id: type: string - enum: - - created_at - description: > - The anchor point for the client secret expiration, meaning that - `seconds` will be added to the `created_at` time of the client - secret to produce an expiration timestamp. Only `created_at` is - currently supported. - default: created_at - x-stainless-const: true - seconds: - type: integer - format: int64 - description: > - The number of seconds from the anchor point to the expiration. - Select a value between `10` and `7200` (2 hours). This default - to 600 seconds (10 minutes) if not specified. - minimum: 10 - maximum: 7200 - default: 600 - session: - $ref: '#/components/schemas/RealtimeTranslationSessionCreateRequest' - required: - - session - RealtimeTranslationClientSecretCreateResponse: - type: object - title: Realtime translation session and client secret - description: > - Response from creating a translation session and client secret for the - Realtime API. - properties: - value: + description: | + The unique ID of the eval run. + object: type: string - description: The generated client secret value. - expires_at: - type: integer - format: unixtime - description: Expiration timestamp for the client secret, in seconds since epoch. - session: - $ref: '#/components/schemas/RealtimeTranslationSession' - required: - - value - - expires_at - - session + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `eval.run.failed`. + enum: + - eval.run.failed + x-stainless-const: true x-oaiMeta: - name: Translation session response object - group: realtime + name: eval.run.failed + group: webhook-events example: | { - "value": "ek_68af296e8e408191a1120ab6383263c2", - "expires_at": 1756310470, - "session": { - "id": "sess_C9CiUVUzUzYIssh3ELY1d", - "type": "translation", - "expires_at": 1756310470, - "model": "gpt-realtime-translate", - "audio": { - "input": { - "transcription": null, - "noise_reduction": null - }, - "output": { - "language": "es" - } - } + "id": "evt_abc123", + "type": "eval.run.failed", + "created_at": 1719168000, + "data": { + "id": "evalrun_abc123" } - } - RealtimeTranslationServerEvent: - discriminator: - propertyName: type - description: | - A Realtime translation server event. - anyOf: - - $ref: '#/components/schemas/RealtimeServerEventError' - - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionCreated' - - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionUpdated' - - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionClosed' - - $ref: >- - #/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta - - $ref: >- - #/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta - - $ref: >- - #/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta - RealtimeTranslationServerEventSessionClosed: + } + WebhookEvalRunSucceeded: type: object + title: eval.run.succeeded description: | - Returned when a realtime translation session is closed. + Sent when an eval run has succeeded. + required: + - created_at + - id + - data + - type properties: - event_id: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the eval run succeeded. + id: type: string - description: The unique ID of the server event. + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the eval run. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true type: type: string + description: | + The type of the event. Always `eval.run.succeeded`. enum: - - session.closed - description: The event type, must be `session.closed`. + - eval.run.succeeded x-stainless-const: true - required: - - event_id - - type x-oaiMeta: - name: session.closed - group: realtime + name: eval.run.succeeded + group: webhook-events example: | { - "event_id": "event_987", - "type": "session.closed" - } - RealtimeTranslationServerEventSessionCreated: + "id": "evt_abc123", + "type": "eval.run.succeeded", + "created_at": 1719168000, + "data": { + "id": "evalrun_abc123" + } + } + WebhookFineTuningJobCancelled: type: object - description: > - Returned when a translation session is created. Emitted automatically - when a - - new connection is established as the first server event. This event - contains - - the default translation session configuration. + title: fine_tuning.job.cancelled + description: | + Sent when a fine-tuning job has been cancelled. + required: + - created_at + - id + - data + - type properties: - event_id: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the fine-tuning job was + cancelled. + id: type: string - description: The unique ID of the server event. + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the fine-tuning job. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true type: type: string + description: | + The type of the event. Always `fine_tuning.job.cancelled`. enum: - - session.created - description: The event type, must be `session.created`. + - fine_tuning.job.cancelled x-stainless-const: true - session: - $ref: '#/components/schemas/RealtimeTranslationSession' - description: The translation session configuration. - required: - - event_id - - type - - session x-oaiMeta: - name: session.created - group: realtime + name: fine_tuning.job.cancelled + group: webhook-events example: | { - "type": "session.created", - "event_id": "event_123", - "session": { - "id": "sess_123", - "type": "translation", - "model": "gpt-realtime-translate", - "expires_at": 1714857600, - "audio": { - "input": { - "transcription": { - "model": "gpt-realtime-whisper", - "language": "en" - }, - "noise_reduction": { - "type": "near_field" - } - }, - "output": { - "language": "fr" - } - } - } - } - RealtimeTranslationServerEventSessionInputTranscriptDelta: - type: object - description: > - Returned when optional source-language transcript text is available. - This event - - is emitted only when `audio.input.transcription` is configured. - - - Transcript deltas are append-only text fragments. Clients should not - insert - - unconditional spaces between deltas. + "id": "evt_abc123", + "type": "fine_tuning.job.cancelled", + "created_at": 1719168000, + "data": { + "id": "ftjob_abc123" + } + } + WebhookFineTuningJobFailed: + type: object + title: fine_tuning.job.failed + description: | + Sent when a fine-tuning job has failed. + required: + - created_at + - id + - data + - type properties: - event_id: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the fine-tuning job failed. + id: type: string - description: The unique ID of the server event. - type: + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the fine-tuning job. + object: type: string + description: | + The object of the event. Always `event`. enum: - - session.input_transcript.delta - description: The event type, must be `session.input_transcript.delta`. + - event x-stainless-const: true - delta: + type: type: string - description: Append-only source-language transcript text. - elapsed_ms: - anyOf: - - type: integer - description: > - Timing metadata for stream alignment, derived from the - translation frame - - when available. It advances in 200 ms increments, but multiple - transcript - - deltas may share the same `elapsed_ms`. Treat it as alignment - metadata, - - not a unique transcript-delta identifier. - - type: 'null' - required: - - event_id - - type - - delta + description: | + The type of the event. Always `fine_tuning.job.failed`. + enum: + - fine_tuning.job.failed + x-stainless-const: true x-oaiMeta: - name: session.input_transcript.delta - group: realtime + name: fine_tuning.job.failed + group: webhook-events example: | { - "event_id": "event_125", - "type": "session.input_transcript.delta", - "delta": " hear", - "elapsed_ms": 1200 - } - RealtimeTranslationServerEventSessionOutputAudioDelta: + "id": "evt_abc123", + "type": "fine_tuning.job.failed", + "created_at": 1719168000, + "data": { + "id": "ftjob_abc123" + } + } + WebhookFineTuningJobSucceeded: type: object - description: > - Returned when translated output audio is available. Output audio deltas - are - - 200 ms frames of PCM16 audio. + title: fine_tuning.job.succeeded + description: | + Sent when a fine-tuning job has succeeded. + required: + - created_at + - id + - data + - type properties: - event_id: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the fine-tuning job + succeeded. + id: type: string - description: The unique ID of the server event. - type: + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the fine-tuning job. + object: type: string + description: | + The object of the event. Always `event`. enum: - - session.output_audio.delta - description: The event type, must be `session.output_audio.delta`. + - event x-stainless-const: true - delta: - type: string - description: Base64-encoded translated audio data. - sample_rate: - type: integer - description: Sample rate of the audio delta. - default: 24000 - channels: - type: integer - description: Number of audio channels. - default: 1 - format: + type: type: string + description: | + The type of the event. Always `fine_tuning.job.succeeded`. enum: - - pcm16 - description: Audio encoding for `delta`. + - fine_tuning.job.succeeded x-stainless-const: true - elapsed_ms: - anyOf: - - type: integer - description: > - Timing metadata for stream alignment, derived from the - translation frame - - when available. Treat `elapsed_ms` as alignment metadata, not a - unique - - event identifier. - - type: 'null' - required: - - event_id - - type - - delta x-oaiMeta: - name: session.output_audio.delta - group: realtime + name: fine_tuning.job.succeeded + group: webhook-events example: | { - "event_id": "event_123", - "type": "session.output_audio.delta", - "delta": "Base64EncodedAudioDelta", - "sample_rate": 24000, - "channels": 1, - "format": "pcm16", - "elapsed_ms": 1200 - } - RealtimeTranslationServerEventSessionOutputTranscriptDelta: + "id": "evt_abc123", + "type": "fine_tuning.job.succeeded", + "created_at": 1719168000, + "data": { + "id": "ftjob_abc123" + } + } + WebhookRealtimeCallIncoming: type: object - description: > - Returned when translated transcript text is available. - - - Transcript deltas are append-only text fragments. Clients should not - insert - - unconditional spaces between deltas. + title: realtime.call.incoming + description: | + Sent when Realtime API Receives a incoming SIP call. + required: + - created_at + - id + - data + - type properties: - event_id: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the model response was + completed. + id: type: string - description: The unique ID of the server event. - type: + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - call_id + - sip_headers + properties: + call_id: + type: string + description: | + The unique ID of this call. + sip_headers: + type: array + description: | + Headers from the SIP Invite. + items: + type: object + description: | + A header from the SIP Invite. + required: + - name + - value + properties: + name: + type: string + description: | + Name of the SIP Header. + value: + type: string + description: | + Value of the SIP Header. + object: type: string + description: | + The object of the event. Always `event`. enum: - - session.output_transcript.delta - description: The event type, must be `session.output_transcript.delta`. + - event x-stainless-const: true - delta: + type: type: string - description: Append-only transcript text for the translated output audio. - elapsed_ms: - anyOf: - - type: integer - description: > - Timing metadata for stream alignment, derived from the - translation frame - - when available. It advances in 200 ms increments, but multiple - transcript - - deltas may share the same `elapsed_ms`. Treat it as alignment - metadata, - - not a unique transcript-delta identifier. - - type: 'null' - required: - - event_id - - type - - delta + description: | + The type of the event. Always `realtime.call.incoming`. + enum: + - realtime.call.incoming + x-stainless-const: true x-oaiMeta: - name: session.output_transcript.delta - group: realtime + name: realtime.call.incoming + group: webhook-events example: | { - "event_id": "event_124", - "type": "session.output_transcript.delta", - "delta": " escuch", - "elapsed_ms": 1200 + "id": "evt_abc123", + "type": "realtime.call.incoming", + "created_at": 1719168000, + "data": { + "call_id": "rtc_479a275623b54bdb9b6fbae2f7cbd408", + "sip_headers": [ + {"name": "Max-Forwards", "value": "63"}, + {"name": "CSeq", "value": "851287 INVITE"}, + {"name": "Content-Type", "value": "application/sdp"}, + ] + } } - RealtimeTranslationServerEventSessionUpdated: + WebhookResponseCancelled: type: object - description: > - Returned when a translation session is updated with a `session.update` - event, - - unless there is an error. + title: response.cancelled + description: | + Sent when a background response has been cancelled. + required: + - created_at + - id + - data + - type properties: - event_id: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the model response was + cancelled. + id: type: string - description: The unique ID of the server event. + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true type: type: string + description: | + The type of the event. Always `response.cancelled`. enum: - - session.updated - description: The event type, must be `session.updated`. + - response.cancelled x-stainless-const: true - session: - $ref: '#/components/schemas/RealtimeTranslationSession' - description: The translation session configuration. - required: - - event_id - - type - - session x-oaiMeta: - name: session.updated - group: realtime + name: response.cancelled + group: webhook-events example: | { - "type": "session.updated", - "event_id": "event_124", - "session": { - "id": "sess_123", - "type": "translation", - "model": "gpt-realtime-translate", - "expires_at": 1714857600, - "audio": { - "input": { - "transcription": { - "model": "gpt-realtime-whisper", - "language": "en" - }, - "noise_reduction": { - "type": "near_field" - } - }, - "output": { - "language": "es" - } - } + "id": "evt_abc123", + "type": "response.cancelled", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" } } - RealtimeTranslationSession: + WebhookResponseCompleted: type: object - title: Realtime translation session - description: > - A Realtime translation session. Translation sessions continuously - translate input - - audio into the configured output language. + title: response.completed + description: | + Sent when a background response has been completed. + required: + - created_at + - id + - data + - type properties: + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the model response was + completed. id: type: string - description: > - Unique identifier for the session that looks like - `sess_1234567890abcdef`. - type: + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the model response. + object: type: string + description: | + The object of the event. Always `event`. enum: - - translation - description: > - The session type. Always `translation` for Realtime translation - sessions. + - event x-stainless-const: true - expires_at: - type: integer - format: unixtime - description: Expiration timestamp for the session, in seconds since epoch. - model: + type: type: string - description: > - The Realtime translation model used for this session. This field is - set at - - session creation and cannot be changed with `session.update`. - audio: - type: object description: | - Configuration for translation input and output audio. - properties: - input: - type: object - properties: - transcription: - anyOf: - - type: object - description: > - Optional source-language transcription. When configured, - the server emits - - `session.input_transcript.delta` events. Translation - itself still runs from - - the input audio stream. - properties: - model: - type: string - description: >- - The transcription model used for source transcript - deltas. - required: - - model - - type: 'null' - noise_reduction: - anyOf: - - type: object - description: | - Optional input noise reduction. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - required: - - type - - type: 'null' - output: - type: object - properties: - language: - type: string - description: > - Target language for translated output audio and transcript - deltas. - required: - - id - - type - - expires_at - - model - - audio - x-oaiMeta: - name: The translation session object - group: realtime - example: | - { - "id": "sess_C9G5QPteg4UIbotdKLoYQ", - "type": "translation", - "expires_at": 1756324625, - "model": "gpt-realtime-translate", - "audio": { - "input": { - "transcription": { - "model": "gpt-realtime-whisper" - }, - "noise_reduction": null - }, - "output": { - "language": "es" - } + The type of the event. Always `response.completed`. + enum: + - response.completed + x-stainless-const: true + x-oaiMeta: + name: response.completed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.completed", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" } } - RealtimeTranslationSessionCreateRequest: + WebhookResponseFailed: type: object - title: Realtime translation session configuration - description: > - Realtime translation session configuration. Translation sessions stream - source - - audio in and translated audio plus transcript deltas out continuously. + title: response.failed + description: | + Sent when a background response has failed. + required: + - created_at + - id + - data + - type properties: - model: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response failed. + id: type: string description: | - The Realtime translation model used for this session. - audio: + The unique ID of the event. + data: type: object description: | - Configuration for translation input and output audio. + Event data payload. + required: + - id properties: - input: - type: object - properties: - transcription: - anyOf: - - type: object - description: > - Optional source-language transcription. When configured, - the server emits - - `session.input_transcript.delta` events. Translation - itself still runs from - - the input audio stream. - properties: - model: - type: string - description: >- - The transcription model to use for source transcript - deltas. - required: - - model - - type: 'null' - noise_reduction: - anyOf: - - type: object - description: > - Optional input noise reduction. Set to `null` to disable - it. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - required: - - type - - type: 'null' - output: - type: object - properties: - language: - type: string - description: > - Target language for translated output audio and transcript - deltas. - required: - - model - RealtimeTranslationSessionUpdateRequest: - type: object - title: Realtime translation session update - description: > - Realtime translation session fields that can be updated with - `session.update`. - properties: - audio: - type: object + id: + type: string + description: | + The unique ID of the model response. + object: + type: string description: | - Configuration for translation input and output audio. - properties: - input: - type: object - properties: - transcription: - anyOf: - - type: object - description: > - Optional source-language transcription. When configured, - the server emits - - `session.input_transcript.delta` events. Translation - itself still runs from - - the input audio stream. - properties: - model: - type: string - description: >- - The transcription model to use for source transcript - deltas. - required: - - model - - type: 'null' - noise_reduction: - anyOf: - - type: object - description: > - Optional input noise reduction. Set to `null` to disable - it. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - required: - - type - - type: 'null' - output: - type: object - properties: - language: - type: string - description: > - Target language for translated output audio and transcript - deltas. - RealtimeTruncation: - title: Realtime Truncation Controls - description: > - 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. - - - Clients can configure truncation behavior to truncate with a lower max - token limit, which is an effective way to control token usage and cost. - - - 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. - - - 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. - oneOf: - - type: string - description: >- - 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. + The object of the event. Always `event`. enum: - - auto - - disabled - - type: object - title: Retention ratio truncation - description: >- - 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. - properties: - type: - type: string - enum: - - retention_ratio - description: Use retention ratio truncation. - x-stainless-const: true - retention_ratio: - type: number - description: > - 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. - minimum: 0 - maximum: 1 - token_limits: - type: object - description: >- - Optional custom token limits for this truncation strategy. If - not provided, the model's default token limits will be used. - properties: - post_instructions: - type: integer - description: >- - 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. - minimum: 0 - required: - - type - - retention_ratio - RealtimeTurnDetection: - anyOf: - - title: Realtime Turn Detection - description: > - 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. - - - 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. - - - 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. - - - For `gpt-realtime-whisper` transcription sessions, turn detection - must be - - set to `null`; VAD is not supported. - oneOf: - - type: object - title: Server VAD - description: >- - Server-side voice activity detection (VAD) which flips on when - user speech is detected and off after a period of silence. - required: - - type - properties: - type: - type: string - default: server_vad - const: server_vad - description: > - Type of turn detection, `server_vad` to turn on simple - Server VAD. - threshold: - type: number - description: > - Used only for `server_vad` mode. Activation threshold for - VAD (0.0 to 1.0), this defaults to 0.5. A - - higher threshold will require louder audio to activate the - model, and - - thus might perform better in noisy environments. - prefix_padding_ms: - type: integer - description: > - Used only for `server_vad` mode. Amount of audio to include - before the VAD detected speech (in - - milliseconds). Defaults to 300ms. - silence_duration_ms: - type: integer - description: > - Used only for `server_vad` mode. Duration of silence to - detect speech stop (in milliseconds). Defaults - - to 500ms. With shorter values the model will respond more - quickly, - - but may jump in on short pauses from the user. - create_response: - type: boolean - default: true - description: > - 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. - - - If both `create_response` and `interrupt_response` are set - to `false`, the model will never respond automatically but - VAD events will still be emitted. - interrupt_response: - type: boolean - default: true - description: > - Whether or not to automatically interrupt (cancel) any - ongoing response with output to the default - - 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. - - - If both `create_response` and `interrupt_response` are set - to `false`, the model will never respond automatically but - VAD events will still be emitted. - idle_timeout_ms: - anyOf: - - type: integer - minimum: 5000 - maximum: 30000 - description: > - Optional timeout after which a model response will be - triggered automatically. This is - - useful for situations in which a long pause from the - user is unexpected, such as a phone - - call. The model will effectively prompt the user to - continue the conversation based - - on the current context. - - - The timeout value will be applied after the last model - response's audio has finished playing, - - i.e. it's set to the `response.done` time plus audio - playback duration. - - - An `input_audio_buffer.timeout_triggered` event (plus - events - - associated with the Response) will be emitted when the - timeout is reached. - - Idle timeout is currently only supported for - `server_vad` mode. - - type: 'null' - - type: object - title: Semantic VAD - description: >- - Server-side semantic turn detection which uses a model to - determine when the user has finished speaking. - required: - - type - properties: - type: - type: string - const: semantic_vad - description: > - Type of turn detection, `semantic_vad` to turn on Semantic - VAD. - eagerness: - type: string - default: auto - enum: - - low - - medium - - high - - auto - description: > - 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. - create_response: - type: boolean - default: true - description: > - Whether or not to automatically generate a response when a - VAD stop event occurs. - interrupt_response: - type: boolean - default: true - description: > - Whether or not to automatically interrupt any ongoing - response with output to the default - - conversation (i.e. `conversation` of `auto`) when a VAD - start event occurs. - discriminator: - propertyName: type - - type: 'null' - Reasoning: - type: object - description: | - **gpt-5 and o-series models only** - - Configuration options for - [reasoning models](https://platform.openai.com/docs/guides/reasoning). - title: Reasoning - properties: - effort: - $ref: '#/components/schemas/ReasoningEffort' - summary: - anyOf: - - type: string - description: > - A summary of the reasoning performed by the model. This can be - - useful for debugging and understanding the model's reasoning - process. - - One of `auto`, `concise`, or `detailed`. - - - `concise` is supported for `computer-use-preview` models and all - reasoning models after `gpt-5`. - enum: - - auto - - concise - - detailed - - type: 'null' - generate_summary: - anyOf: - - type: string - deprecated: true - description: > - **Deprecated:** use `summary` instead. - - - A summary of the reasoning performed by the model. This can be - - useful for debugging and understanding the model's reasoning - process. - - One of `auto`, `concise`, or `detailed`. - enum: - - auto - - concise - - detailed - - type: 'null' - ReasoningEffort: - anyOf: - - type: string + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.failed`. enum: - - none - - minimal - - low - - medium - - high - - xhigh - default: medium - description: > - Constrains effort on reasoning for - - [reasoning - models](https://platform.openai.com/docs/guides/reasoning). - - Currently supported values are `none`, `minimal`, `low`, `medium`, - `high`, and `xhigh`. Reducing - - reasoning effort can result in faster responses and fewer tokens - used - - on reasoning in a response. - - - - `gpt-5.1` defaults to `none`, which does not perform reasoning. - The supported reasoning values for `gpt-5.1` are `none`, `low`, - `medium`, and `high`. Tool calls are supported for all reasoning - values in gpt-5.1. - - - All models before `gpt-5.1` default to `medium` reasoning effort, - and do not support `none`. - - - The `gpt-5-pro` model defaults to (and only supports) `high` - reasoning effort. - - - `xhigh` is supported for all models after `gpt-5.1-codex-max`. - - type: 'null' - ReasoningItem: + - response.failed + x-stainless-const: true + x-oaiMeta: + name: response.failed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.failed", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookResponseIncomplete: type: object - description: > - A description of the chain of thought used by a reasoning model while - generating - - a response. Be sure to include these items in your `input` to the - Responses API - - for subsequent turns of a conversation if you are manually - - [managing context](/docs/guides/conversation-state). - title: Reasoning + title: response.incomplete + description: | + Sent when a background response has been interrupted. + required: + - created_at + - id + - data + - type properties: - type: - type: string - description: | - The type of the object. Always `reasoning`. - enum: - - reasoning - x-stainless-const: true + created_at: + type: integer + format: unixtime + description: > + The Unix timestamp (in seconds) of when the model response was + interrupted. id: type: string description: | - The unique identifier of the reasoning content. - encrypted_content: - anyOf: - - type: string - description: > - The encrypted content of the reasoning item - populated when a - response is - - generated with `reasoning.encrypted_content` in the `include` - parameter. - - type: 'null' - summary: - type: array + The unique ID of the event. + data: + type: object description: | - Reasoning summary content. - items: - $ref: '#/components/schemas/SummaryTextContent' - content: - type: array + Event data payload. + required: + - id + properties: + id: + type: string + description: | + The unique ID of the model response. + object: + type: string description: | - Reasoning text content. - items: - $ref: '#/components/schemas/ReasoningTextContent' - status: + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: type: string description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. + The type of the event. Always `response.incomplete`. enum: - - in_progress - - completed - - incomplete + - response.incomplete + x-stainless-const: true + x-oaiMeta: + name: response.incomplete + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.incomplete", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookSafetyIdentifierBlocked: + type: object + title: safety_identifier.blocked + description: > + Sent when a request associated with a safety identifier has been + blocked. required: + - created_at - id - - summary + - data - type - Response: - title: The response object - allOf: - - $ref: '#/components/schemas/ModelResponseProperties' - - $ref: '#/components/schemas/ResponseProperties' - - type: object + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the request was blocked. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - safety_identifier + - safety_category properties: - id: + safety_identifier: type: string - description: | - Unique identifier for this Response. - object: + maxLength: 64 + description: > + The stable safety identifier associated with the blocked + request. + safety_category: + type: string + description: > + The safety category that triggered the block, such as `bio` or + `cyber`. + request_id: type: string description: | - The object type of this resource - always set to `response`. - enum: - - response - x-stainless-const: true - status: + The OpenAI request ID for the blocked request, if available. + project_id: type: string - description: > - The status of the response generation. One of `completed`, - `failed`, - - `in_progress`, `cancelled`, `queued`, or `incomplete`. - enum: - - completed - - failed - - in_progress - - cancelled - - queued - - incomplete - created_at: - type: number - format: unixtime description: | - Unix timestamp (in seconds) of when this Response was created. - completed_at: - anyOf: - - type: number - format: unixtime - description: > - Unix timestamp (in seconds) of when this Response was - completed. - - Only present when the status is `completed`. - - type: 'null' - error: - $ref: '#/components/schemas/ResponseError' - incomplete_details: - anyOf: - - type: object - description: | - Details about why the response is incomplete. - properties: - reason: - type: string - description: The reason why the response is incomplete. - enum: - - max_output_tokens - - content_filter - - type: 'null' - output: - type: array - description: > - An array of content items generated by the model. - - - - The length and order of items in the `output` array is - dependent - on the model's response. - - Rather than accessing the first item in the `output` array and - assuming it's an `assistant` message with the content generated by - the model, you might consider using the `output_text` property where - supported in SDKs. - items: - $ref: '#/components/schemas/OutputItem' - instructions: - anyOf: - - description: > - A system (or developer) message inserted into the model's - context. - - - When using along with `previous_response_id`, the - instructions from a previous - - response will not be carried over to the next response. This - makes it simple - - to swap out system (or developer) messages in new responses. - oneOf: - - type: string - description: > - A text input to the model, equivalent to a text input - with the - - `developer` role. - - type: array - title: Input item list - description: > - A list of one or many input items to the model, - containing - - different content types. - items: - $ref: '#/components/schemas/InputItem' - - type: 'null' - output_text: - anyOf: - - type: string - description: > - SDK-only convenience property that contains the aggregated - text output - - from all `output_text` items in the `output` array, if any - are present. - - Supported in the Python and JavaScript SDKs. - x-oaiSupportedSDKs: - - python - - javascript - - type: 'null' - usage: - $ref: '#/components/schemas/ResponseUsage' - moderation: - anyOf: - - $ref: '#/components/schemas/Moderation' - description: > - Moderation results for the response input and output, if - moderated completions were requested. - - type: 'null' - parallel_tool_calls: - type: boolean + The project associated with the blocked request, if available. + model: + type: string description: | - Whether to allow the model to run tool calls in parallel. - default: true - conversation: - anyOf: - - default: null - $ref: '#/components/schemas/Conversation-2' - - type: 'null' - max_output_tokens: - anyOf: - - description: > - An upper bound for the number of tokens that can be - generated for a response, including visible output tokens - and [reasoning tokens](/docs/guides/reasoning). - type: integer - - type: 'null' - required: - - id - - object - - created_at - - error - - incomplete_details - - instructions - - model - - tools - - output - - parallel_tool_calls - - metadata - - tool_choice - - temperature - - top_p - example: - id: resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41 - object: response - created_at: 1741476777 - status: completed - completed_at: 1741476778 - error: null - incomplete_details: null - instructions: null - max_output_tokens: null - model: gpt-4o-2024-08-06 + The model used for the blocked request, if available. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `safety_identifier.blocked`. + enum: + - safety_identifier.blocked + x-stainless-const: true + x-oaiMeta: + name: safety_identifier.blocked + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "safety_identifier.blocked", + "created_at": 1719168000, + "data": { + "safety_identifier": "safety-identifier-1234", + "safety_category": "cyber", + "request_id": "req_abc123", + "project_id": "proj_abc123", + "model": "gpt-4.1" + } + } + ModerationInputType: + type: string + enum: + - text + - image + ModerationResultBody: + properties: + type: + type: string + enum: + - moderation_result + description: >- + The object type, which was always `moderation_result` for successful + moderation results. + default: moderation_result + x-stainless-const: true + model: + type: string + description: The moderation model that produced this result. + flagged: + type: boolean + description: >- + A boolean indicating whether the content was flagged by any + category. + categories: + additionalProperties: + type: boolean + type: object + description: >- + A dictionary of moderation categories to booleans, True if the input + is flagged under this category. + x-oaiTypeLabel: map + category_scores: + additionalProperties: + type: number + type: object + description: A dictionary of moderation categories to scores. + x-oaiTypeLabel: map + category_applied_input_types: + additionalProperties: + items: + $ref: '#/components/schemas/ModerationInputType' + type: array + type: object + description: >- + Which modalities of input are reflected by the score for each + category. + x-oaiTypeLabel: map + type: object + required: + - type + - model + - flagged + - categories + - category_scores + - category_applied_input_types + title: Moderation result + description: A moderation result produced for the response input or output. + PromptCacheTTLEnum: + type: string + enum: + - 30m + PromptCacheModeEnum: + type: string + enum: + - implicit + - explicit + PromptCacheOptionsParam: + properties: + ttl: + $ref: '#/components/schemas/PromptCacheTTLEnum' + description: >- + The minimum lifetime applied to every implicit and explicit cache + breakpoint written by the request. Defaults to `30m`, which is + currently the only supported value. The backend may retain cache + entries for longer. + mode: + $ref: '#/components/schemas/PromptCacheModeEnum' + description: >- + Controls whether OpenAI automatically creates an implicit cache + breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates + one implicit breakpoint and writes up to the latest three explicit + breakpoints in the request. With `explicit`, OpenAI does not create + an implicit breakpoint and writes up to the latest four explicit + breakpoints. If there are no explicit breakpoints, the request does + not use prompt caching. + type: object + required: [] + title: Prompt cache options + description: >- + Options for prompt caching. Supported for `gpt-5.6` and later models. By + default, OpenAI automatically chooses one implicit cache breakpoint. You + can add explicit breakpoints to content blocks with + `prompt_cache_breakpoint`. Each request can write up to four + breakpoints. For cache matching, OpenAI considers up to the latest 80 + breakpoints in the conversation, without a content-block lookback limit. + Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` + defaults to `30m`, which is currently the only supported value. See the + [prompt caching guide](/docs/guides/prompt-caching) for current details. + PromptCacheBreakpointParam: + properties: + mode: + type: string + enum: + - explicit + description: The breakpoint mode. Always `explicit`. + default: explicit + x-stainless-const: true + type: object + required: + - mode + title: Prompt cache breakpoint + description: >- + 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. + ModerationMode: + type: string + enum: + - score + - block + ModerationConfigParam: + properties: + mode: + $ref: '#/components/schemas/ModerationMode' + type: object + required: + - mode + description: The moderation policy for the response input. + ModerationPolicyParam: + properties: + input: + anyOf: + - $ref: '#/components/schemas/ModerationConfigParam' + description: The moderation policy for the response input. + - type: 'null' output: - - type: message - id: msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41 - status: completed - role: assistant - content: - - type: output_text - text: >- - The image depicts a scenic landscape with a wooden boardwalk - or pathway leading through lush, green grass under a blue sky - with some clouds. The setting suggests a peaceful natural - area, possibly a park or nature reserve. There are trees and - shrubs in the background. - annotations: [] - parallel_tool_calls: true - previous_response_id: null - reasoning: - effort: null - summary: null - store: true - temperature: 1 - text: - format: - type: text - tool_choice: auto - tools: [] - top_p: 1 - truncation: disabled - usage: - input_tokens: 328 - input_tokens_details: - cached_tokens: 0 - output_tokens: 52 - output_tokens_details: - reasoning_tokens: 0 - total_tokens: 380 - user: null - metadata: {} - ResponseAudioDeltaEvent: + anyOf: + - $ref: '#/components/schemas/ModerationConfigParam' + description: The moderation policy for the response output. + - type: 'null' type: object - description: Emitted when there is a partial audio response. + required: [] + description: The policy to apply to moderated response input and output. + ModerationParam: + properties: + model: + type: string + description: >- + The moderation model to use for moderated completions, e.g. + 'omni-moderation-latest'. + policy: + anyOf: + - $ref: '#/components/schemas/ModerationPolicyParam' + description: The policy to apply to moderated response input and output. + - type: 'null' + type: object + required: + - model + description: >- + Configuration for running moderation on the input and output of this + response. + SkillReferenceParam: properties: type: type: string - description: | - The type of the event. Always `response.audio.delta`. enum: - - response.audio.delta + - skill_reference + description: References a skill created with the /v1/skills endpoint. + default: skill_reference x-stainless-const: true - sequence_number: - type: integer - description: | - A sequence number for this chunk of the stream response. - delta: + skill_id: type: string - description: | - A chunk of Base64 encoded response audio bytes. + maxLength: 64 + minLength: 1 + description: The ID of the referenced skill. + version: + type: string + description: >- + Optional skill version. Use a positive integer or 'latest'. Omit for + default. + type: object + required: + - type + - skill_id + InlineSkillSourceParam: + properties: + type: + type: string + enum: + - base64 + description: The type of the inline skill source. Must be `base64`. + default: base64 + x-stainless-const: true + media_type: + type: string + enum: + - application/zip + description: >- + The media type of the inline skill payload. Must be + `application/zip`. + default: application/zip + x-stainless-const: true + data: + type: string + maxLength: 70254592 + minLength: 1 + description: Base64-encoded skill zip bundle. + type: object + required: + - type + - media_type + - data + description: Inline skill payload + InlineSkillParam: + properties: + type: + type: string + enum: + - inline + description: Defines an inline skill for this request. + default: inline + x-stainless-const: true + name: + type: string + description: The name of the skill. + description: + type: string + description: The description of the skill. + source: + $ref: '#/components/schemas/InlineSkillSourceParam' + description: Inline skill payload + type: object required: - type - - delta - - sequence_number - x-oaiMeta: - name: response.audio.delta - group: responses - example: | - { - "type": "response.audio.delta", - "response_id": "resp_123", - "delta": "base64encoded...", - "sequence_number": 1 - } - ResponseAudioDoneEvent: - type: object - description: Emitted when the audio response is complete. + - name + - description + - source + ContainerNetworkPolicyDisabledParam: properties: type: type: string - description: | - The type of the event. Always `response.audio.done`. enum: - - response.audio.done + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled x-stainless-const: true - sequence_number: - type: integer - description: | - The sequence number of the delta. + type: object required: - type - - sequence_number - - response_id - x-oaiMeta: - name: response.audio.done - group: responses - example: | - { - "type": "response.audio.done", - "response_id": "resp-123", - "sequence_number": 1 - } - ResponseAudioTranscriptDeltaEvent: + ContainerNetworkPolicyDomainSecretParam: + properties: + domain: + type: string + minLength: 1 + description: The domain associated with the secret. + name: + type: string + minLength: 1 + description: The name of the secret to inject for the domain. + value: + type: string + maxLength: 10485760 + minLength: 1 + description: The secret value to inject for the domain. type: object - description: Emitted when there is a partial transcript of audio. + required: + - domain + - name + - value + ContainerNetworkPolicyAllowlistParam: properties: type: type: string - description: | - The type of the event. Always `response.audio.transcript.delta`. enum: - - response.audio.transcript.delta + - allowlist + description: >- + Allow outbound network access only to specified domains. Always + `allowlist`. + default: allowlist x-stainless-const: true - delta: - type: string - description: | - The partial transcript of the audio response. - sequence_number: - type: integer - description: The sequence number of this event. + allowed_domains: + items: + type: string + type: array + minItems: 1 + description: A list of allowed domains when type is `allowlist`. + domain_secrets: + items: + $ref: '#/components/schemas/ContainerNetworkPolicyDomainSecretParam' + type: array + minItems: 1 + description: Optional domain-scoped secrets for allowlisted domains. + type: object required: - type - - response_id - - delta - - sequence_number - x-oaiMeta: - name: response.audio.transcript.delta - group: responses - example: | - { - "type": "response.audio.transcript.delta", - "response_id": "resp_123", - "delta": " ... partial transcript ... ", - "sequence_number": 1 - } - ResponseAudioTranscriptDoneEvent: + - allowed_domains + IncludeEnum: + type: string + enum: + - file_search_call.results + - web_search_call.results + - web_search_call.action.sources + - message.input_image.image_url + - computer_call_output.output.image_url + - code_interpreter_call.outputs + - reasoning.encrypted_content + - message.output_text.logprobs + description: >- + Specify additional output data to include in the model response. + Currently supported values are: + + - `web_search_call.results`: Include the search results of the web + search tool call. + + - `web_search_call.action.sources`: Include the sources of the web + search tool call. + + - `code_interpreter_call.outputs`: Includes the outputs of python code + execution in code interpreter tool call items. + + - `computer_call_output.output.image_url`: Include image urls from the + computer call output. + + - `file_search_call.results`: Include the search results of the file + search tool call. + + - `message.input_image.image_url`: Include image urls from the input + message. + + - `message.output_text.logprobs`: Include logprobs with assistant + messages. + + - `reasoning.encrypted_content`: Includes an encrypted version of + reasoning tokens in reasoning item outputs. This enables reasoning items + to be used in multi-turn conversations when using the Responses API + statelessly (like when the `store` parameter is set to `false`, or when + an organization is enrolled in the zero data retention program). + MessageStatus: + type: string + enum: + - in_progress + - completed + - incomplete + MessageRole: + type: string + enum: + - unknown + - user + - assistant + - system + - critic + - discriminator + - developer + - tool + PromptCacheBreakpointConfig: + properties: + mode: + type: string + enum: + - explicit + description: The breakpoint mode. Always `explicit`. + default: explicit + x-stainless-const: true type: object - description: Emitted when the full audio transcript is completed. + required: + - mode + title: Prompt cache breakpoint + description: >- + 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. + InputTextContent: properties: type: type: string - description: | - The type of the event. Always `response.audio.transcript.done`. enum: - - response.audio.transcript.done + - input_text + description: The type of the input item. Always `input_text`. + default: input_text x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of this event. + text: + type: string + description: The text input to the model. + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointConfig' + type: object required: - type - - response_id - - sequence_number - x-oaiMeta: - name: response.audio.transcript.done - group: responses - example: | - { - "type": "response.audio.transcript.done", - "response_id": "resp_123", - "sequence_number": 1 - } - ResponseCodeInterpreterCallCodeDeltaEvent: - type: object - description: Emitted when a partial code snippet is streamed by the code interpreter. + - text + title: Input text + description: A text input to the model. + FileCitationBody: properties: type: type: string - description: >- - The type of the event. Always - `response.code_interpreter_call_code.delta`. enum: - - response.code_interpreter_call_code.delta + - file_citation + description: The type of the file citation. Always `file_citation`. + default: file_citation x-stainless-const: true - output_index: - type: integer - description: >- - The index of the output item in the response for which the code is - being streamed. - item_id: - type: string - description: The unique identifier of the code interpreter tool call item. - delta: + file_id: type: string - description: The partial code snippet being streamed by the code interpreter. - sequence_number: + description: The ID of the file. + index: type: integer - description: The sequence number of this event, used to order streaming events. + description: The index of the file in the list of files. + filename: + type: string + description: The filename of the file cited. + type: object required: - type - - output_index - - item_id - - delta - - sequence_number - x-oaiMeta: - name: response.code_interpreter_call_code.delta - group: responses - example: | - { - "type": "response.code_interpreter_call_code.delta", - "output_index": 0, - "item_id": "ci_12345", - "delta": "print('Hello, world')", - "sequence_number": 1 - } - ResponseCodeInterpreterCallCodeDoneEvent: - type: object - description: Emitted when the code snippet is finalized by the code interpreter. + - file_id + - index + - filename + title: File citation + description: A citation to a file. + UrlCitationBody: properties: type: type: string - description: >- - The type of the event. Always - `response.code_interpreter_call_code.done`. enum: - - response.code_interpreter_call_code.done + - url_citation + description: The type of the URL citation. Always `url_citation`. + default: url_citation x-stainless-const: true - output_index: - type: integer - description: >- - The index of the output item in the response for which the code is - finalized. - item_id: - type: string - description: The unique identifier of the code interpreter tool call item. - code: + url: type: string - description: The final code snippet output by the code interpreter. - sequence_number: + format: uri + description: The URL of the web resource. + start_index: type: integer - description: The sequence number of this event, used to order streaming events. + description: The index of the first character of the URL citation in the message. + end_index: + type: integer + description: The index of the last character of the URL citation in the message. + title: + type: string + description: The title of the web resource. + type: object required: - type - - output_index - - item_id - - code - - sequence_number - x-oaiMeta: - name: response.code_interpreter_call_code.done - group: responses - example: | - { - "type": "response.code_interpreter_call_code.done", - "output_index": 3, - "item_id": "ci_12345", - "code": "print('done')", - "sequence_number": 1 - } - ResponseCodeInterpreterCallCompletedEvent: - type: object - description: Emitted when the code interpreter call is completed. + - url + - start_index + - end_index + - title + title: URL citation + description: A citation for a web resource used to generate a model response. + ContainerFileCitationBody: properties: type: type: string - description: >- - The type of the event. Always - `response.code_interpreter_call.completed`. enum: - - response.code_interpreter_call.completed + - container_file_citation + description: >- + The type of the container file citation. Always + `container_file_citation`. + default: container_file_citation x-stainless-const: true - output_index: + container_id: + type: string + description: The ID of the container file. + file_id: + type: string + description: The ID of the file. + start_index: type: integer description: >- - The index of the output item in the response for which the code - interpreter call is completed. - item_id: - type: string - description: The unique identifier of the code interpreter tool call item. - sequence_number: + The index of the first character of the container file citation in + the message. + end_index: type: integer - description: The sequence number of this event, used to order streaming events. + description: >- + The index of the last character of the container file citation in + the message. + filename: + type: string + description: The filename of the container file cited. + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.code_interpreter_call.completed - group: responses - example: | - { - "type": "response.code_interpreter_call.completed", - "output_index": 5, - "item_id": "ci_12345", - "sequence_number": 1 - } - ResponseCodeInterpreterCallInProgressEvent: + - container_id + - file_id + - start_index + - end_index + - filename + title: Container file citation + description: A citation for a container file used to generate a model response. + Annotation: + oneOf: + - $ref: '#/components/schemas/FileCitationBody' + - $ref: '#/components/schemas/UrlCitationBody' + - $ref: '#/components/schemas/ContainerFileCitationBody' + - $ref: '#/components/schemas/FilePath' + description: An annotation that applies to a span of output text. + discriminator: + propertyName: type + TopLogProb: + properties: + token: + type: string + logprob: + type: number + bytes: + items: + type: integer + type: array type: object - description: Emitted when a code interpreter call is in progress. + required: + - token + - logprob + - bytes + title: Top log probability + description: The top log probability of a token. + LogProb: + properties: + token: + type: string + logprob: + type: number + bytes: + items: + type: integer + type: array + top_logprobs: + items: + $ref: '#/components/schemas/TopLogProb' + type: array + type: object + required: + - token + - logprob + - bytes + - top_logprobs + title: Log probability + description: The log probability of a token. + OutputTextContent: properties: type: type: string - description: >- - The type of the event. Always - `response.code_interpreter_call.in_progress`. enum: - - response.code_interpreter_call.in_progress + - output_text + description: The type of the output text. Always `output_text`. + default: output_text x-stainless-const: true - output_index: - type: integer - description: >- - The index of the output item in the response for which the code - interpreter call is in progress. - item_id: + text: type: string - description: The unique identifier of the code interpreter tool call item. - sequence_number: - type: integer - description: The sequence number of this event, used to order streaming events. + description: The text output from the model. + annotations: + items: + $ref: '#/components/schemas/Annotation' + type: array + description: The annotations of the text output. + logprobs: + items: + $ref: '#/components/schemas/LogProb' + type: array + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.code_interpreter_call.in_progress - group: responses - example: | - { - "type": "response.code_interpreter_call.in_progress", - "output_index": 0, - "item_id": "ci_12345", - "sequence_number": 1 - } - ResponseCodeInterpreterCallInterpretingEvent: - type: object - description: >- - Emitted when the code interpreter is actively interpreting the code - snippet. + - text + - annotations + - logprobs + title: Output text + description: A text output from the model. + TextContent: properties: type: type: string - description: >- - The type of the event. Always - `response.code_interpreter_call.interpreting`. enum: - - response.code_interpreter_call.interpreting + - text + default: text x-stainless-const: true - output_index: - type: integer - description: >- - The index of the output item in the response for which the code - interpreter is interpreting code. - item_id: + text: type: string - description: The unique identifier of the code interpreter tool call item. - sequence_number: - type: integer - description: The sequence number of this event, used to order streaming events. + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.code_interpreter_call.interpreting - group: responses - example: | - { - "type": "response.code_interpreter_call.interpreting", - "output_index": 4, - "item_id": "ci_12345", - "sequence_number": 1 - } - ResponseCompletedEvent: + - text + title: Text Content + description: A text content. + SummaryTextContent: + properties: + type: + type: string + enum: + - summary_text + description: The type of the object. Always `summary_text`. + default: summary_text + x-stainless-const: true + text: + type: string + description: A summary of the reasoning output from the model so far. type: object - description: Emitted when the model response is complete. + required: + - type + - text + title: Summary text + description: A summary text from the model. + ReasoningTextContent: properties: type: type: string - description: | - The type of the event. Always `response.completed`. enum: - - response.completed + - reasoning_text + description: The type of the reasoning text. Always `reasoning_text`. + default: reasoning_text x-stainless-const: true - response: - $ref: '#/components/schemas/Response' - description: | - Properties of the completed response. - sequence_number: - type: integer - description: The sequence number for this event. + text: + type: string + description: The reasoning text from the model. + type: object required: - type - - response - - sequence_number - x-oaiMeta: - name: response.completed - group: responses - example: | - { - "type": "response.completed", - "response": { - "id": "resp_123", - "object": "response", - "created_at": 1740855869, - "status": "completed", - "completed_at": 1740855870, - "error": null, - "incomplete_details": null, - "input": [], - "instructions": null, - "max_output_tokens": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_123", - "type": "message", - "role": "assistant", - "content": [ - { - "type": "output_text", - "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", - "annotations": [] - } - ] - } - ], - "previous_response_id": null, - "reasoning_effort": null, - "store": false, - "temperature": 1, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1, - "truncation": "disabled", - "usage": { - "input_tokens": 0, - "output_tokens": 0, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 0 - }, - "user": null, - "metadata": {} - }, - "sequence_number": 1 - } - ResponseContentPartAddedEvent: - type: object - description: Emitted when a new content part is added. + - text + title: Reasoning text + description: Reasoning text from the model. + RefusalContent: properties: type: type: string - description: | - The type of the event. Always `response.content_part.added`. enum: - - response.content_part.added + - refusal + description: The type of the refusal. Always `refusal`. + default: refusal x-stainless-const: true - item_id: + refusal: type: string - description: | - The ID of the output item that the content part was added to. - output_index: - type: integer - description: | - The index of the output item that the content part was added to. - content_index: - type: integer - description: | - The index of the content part that was added. - part: - $ref: '#/components/schemas/OutputContent' - description: | - The content part that was added. - sequence_number: - type: integer - description: The sequence number of this event. + description: The refusal explanation from the model. + type: object required: - type - - item_id - - output_index - - content_index - - part - - sequence_number - x-oaiMeta: - name: response.content_part.added - group: responses - example: | - { - "type": "response.content_part.added", - "item_id": "msg_123", - "output_index": 0, - "content_index": 0, - "part": { - "type": "output_text", - "text": "", - "annotations": [] - }, - "sequence_number": 1 - } - ResponseContentPartDoneEvent: - type: object - description: Emitted when a content part is done. + - refusal + title: Refusal + description: A refusal from the model. + ImageDetail: + type: string + enum: + - low + - high + - auto + - original + InputImageContent: properties: type: type: string - description: | - The type of the event. Always `response.content_part.done`. enum: - - response.content_part.done + - input_image + description: The type of the input item. Always `input_image`. + default: input_image x-stainless-const: true - item_id: - type: string - description: | - The ID of the output item that the content part was added to. - output_index: - type: integer - description: | - The index of the output item that the content part was added to. - content_index: - type: integer - description: | - The index of the content part that is done. - sequence_number: - type: integer - description: The sequence number of this event. - part: - $ref: '#/components/schemas/OutputContent' - description: | - The content part that is done. + image_url: + anyOf: + - type: string + format: uri + description: >- + The URL of the image to be sent to the model. A fully qualified + URL or base64 encoded image in a data URL. + - type: 'null' + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + - type: 'null' + detail: + $ref: '#/components/schemas/ImageDetail' + description: >- + The detail level of the image to be sent to the model. One of + `high`, `low`, `auto`, or `original`. Defaults to `auto`. + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointConfig' + type: object required: - type - - item_id - - output_index - - content_index - - part - - sequence_number - x-oaiMeta: - name: response.content_part.done - group: responses - example: | - { - "type": "response.content_part.done", - "item_id": "msg_123", - "output_index": 0, - "content_index": 0, - "sequence_number": 1, - "part": { - "type": "output_text", - "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", - "annotations": [] - } - } - ResponseCreatedEvent: - type: object - description: | - An event that is emitted when a response is created. + - detail + title: Input image + description: >- + An image input to the model. Learn about [image + inputs](/docs/guides/vision). + ComputerScreenshotContent: properties: type: type: string - description: | - The type of the event. Always `response.created`. enum: - - response.created + - computer_screenshot + description: >- + Specifies the event type. For a computer screenshot, this property + is always set to `computer_screenshot`. + default: computer_screenshot x-stainless-const: true - response: - $ref: '#/components/schemas/Response' - description: | - The response that was created. - sequence_number: - type: integer - description: The sequence number for this event. + image_url: + anyOf: + - type: string + format: uri + description: The URL of the screenshot image. + - type: 'null' + file_id: + anyOf: + - type: string + description: The identifier of an uploaded file that contains the screenshot. + - type: 'null' + detail: + $ref: '#/components/schemas/ImageDetail' + description: >- + The detail level of the screenshot image to be sent to the model. + One of `high`, `low`, `auto`, or `original`. Defaults to `auto`. + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointConfig' + type: object required: - type - - response - - sequence_number - x-oaiMeta: - name: response.created - group: responses - example: | - { - "type": "response.created", - "response": { - "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", - "object": "response", - "created_at": 1741487325, - "status": "in_progress", - "completed_at": null, - "error": null, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "model": "gpt-4o-2024-08-06", - "output": [], - "parallel_tool_calls": true, - "previous_response_id": null, - "reasoning": { - "effort": null, - "summary": null - }, - "store": true, - "temperature": 1, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1, - "truncation": "disabled", - "usage": null, - "user": null, - "metadata": {} - }, - "sequence_number": 1 - } - ResponseCustomToolCallInputDeltaEvent: - title: ResponseCustomToolCallInputDelta - type: object - description: > - Event representing a delta (partial update) to the input of a custom - tool call. + - image_url + - file_id + - detail + title: Computer screenshot + description: A screenshot of a computer. + FileInputDetail: + type: string + enum: + - auto + - low + - high + InputFileContent: properties: type: type: string enum: - - response.custom_tool_call_input.delta - description: The event type identifier. + - input_file + description: The type of the input item. Always `input_file`. + default: input_file x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of this event. - output_index: - type: integer - description: The index of the output this delta applies to. - item_id: + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + - type: 'null' + filename: type: string - description: Unique identifier for the API item associated with this event. - delta: + description: The name of the file to be sent to the model. + file_data: type: string - description: The incremental input data (delta) for the custom tool call. + description: | + The content of the file to be sent to the model. + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointConfig' + file_url: + type: string + format: uri + description: The URL of the file to be sent to the model. + detail: + $ref: '#/components/schemas/FileInputDetail' + description: >- + 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`. + type: object required: - type - - output_index - - item_id - - delta - - sequence_number - x-oaiMeta: - name: response.custom_tool_call_input.delta - group: responses - example: | - { - "type": "response.custom_tool_call_input.delta", - "output_index": 0, - "item_id": "ctc_1234567890abcdef", - "delta": "partial input text" - } - ResponseCustomToolCallInputDoneEvent: - title: ResponseCustomToolCallInputDone - type: object - description: | - Event indicating that input for a custom tool call is complete. + title: Input file + description: A file input to the model. + MessagePhase-2: + type: string + enum: + - commentary + - final_answer + Message: properties: type: type: string enum: - - response.custom_tool_call_input.done - description: The event type identifier. + - message + description: The type of the message. Always set to `message`. + default: message x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of this event. - output_index: - type: integer - description: The index of the output this event applies to. - item_id: - type: string - description: Unique identifier for the API item associated with this event. - input: + id: type: string - description: The complete input data for the custom tool call. + description: The unique ID of the message. + status: + $ref: '#/components/schemas/MessageStatus' + description: >- + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + role: + $ref: '#/components/schemas/MessageRole' + description: >- + The role of the message. One of `unknown`, `user`, `assistant`, + `system`, `critic`, `discriminator`, `developer`, or `tool`. + content: + items: + oneOf: + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/OutputTextContent' + - $ref: '#/components/schemas/TextContent' + - $ref: '#/components/schemas/SummaryTextContent' + - $ref: '#/components/schemas/ReasoningTextContent' + - $ref: '#/components/schemas/RefusalContent' + - $ref: '#/components/schemas/InputImageContent' + - $ref: '#/components/schemas/ComputerScreenshotContent' + - $ref: '#/components/schemas/InputFileContent' + description: A content part that makes up an input or output item. + discriminator: + propertyName: type + type: array + description: The content of the message + phase: + anyOf: + - $ref: '#/components/schemas/MessagePhase-2' + description: >- + Labels an `assistant` message as intermediate commentary + (`commentary`) or the final answer (`final_answer`). For models + like `gpt-5.3-codex` and beyond, when sending follow-up + requests, preserve and resend phase on all assistant messages — + dropping it can degrade performance. Not used for user messages. + - type: 'null' + type: object required: - type - - output_index - - item_id - - input - - sequence_number - x-oaiMeta: - name: response.custom_tool_call_input.done - group: responses - example: | - { - "type": "response.custom_tool_call_input.done", - "output_index": 0, - "item_id": "ctc_1234567890abcdef", - "input": "final complete input text" - } - ResponseError: - anyOf: - - type: object - description: > - An error object returned when the model fails to generate a - Response. - properties: - code: - $ref: '#/components/schemas/ResponseErrorCode' - message: - type: string - description: | - A human-readable description of the error. - required: - - code - - message - - type: 'null' - ResponseErrorCode: - type: string - description: | - The error code for the response. - enum: - - server_error - - rate_limit_exceeded - - invalid_prompt - - vector_store_timeout - - invalid_image - - invalid_image_format - - invalid_base64_image - - invalid_image_url - - image_too_large - - image_too_small - - image_parse_error - - image_content_policy_violation - - invalid_image_mode - - image_file_too_large - - unsupported_image_media_type - - empty_image_file - - failed_to_download_image - - image_file_not_found - ResponseErrorEvent: + - id + - status + - role + - content + title: Message + description: A message to or from the model. + DirectToolCallCaller: + properties: + type: + type: string + enum: + - direct + default: direct + x-stainless-const: true type: object - description: Emitted when an error occurs. + required: + - type + ProgramToolCallCaller: properties: type: type: string - description: | - The type of the event. Always `error`. enum: - - error + - program + default: program x-stainless-const: true - code: - anyOf: - - type: string - description: | - The error code. - - type: 'null' - message: + caller_id: type: string - description: | - The error message. - param: - anyOf: - - type: string - description: | - The error parameter. - - type: 'null' - sequence_number: - type: integer - description: The sequence number of this event. + description: The call ID of the program item that produced this tool call. + type: object required: - type - - code - - message - - param - - sequence_number - x-oaiMeta: - name: error - group: responses - example: | - { - "type": "error", - "code": "ERR_SOMETHING", - "message": "Something went wrong", - "param": null, - "sequence_number": 1 - } - ResponseFailedEvent: - type: object - description: | - An event that is emitted when a response fails. + - caller_id + ToolCallCaller: + oneOf: + - $ref: '#/components/schemas/DirectToolCallCaller' + - $ref: '#/components/schemas/ProgramToolCallCaller' + description: The execution context that produced this tool call. + discriminator: + propertyName: type + FunctionCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + DirectToolCallCallerParam: properties: type: type: string - description: | - The type of the event. Always `response.failed`. enum: - - response.failed + - direct + description: The caller type. Always `direct`. + default: direct x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of this event. - response: - $ref: '#/components/schemas/Response' - description: | - The response that failed. + type: object required: - type - - response - - sequence_number - x-oaiMeta: - name: response.failed - group: responses - example: | - { - "type": "response.failed", - "response": { - "id": "resp_123", - "object": "response", - "created_at": 1740855869, - "status": "failed", - "completed_at": null, - "error": { - "code": "server_error", - "message": "The model failed to generate a response." - }, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [], - "previous_response_id": null, - "reasoning_effort": null, - "store": false, - "temperature": 1, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1, - "truncation": "disabled", - "usage": null, - "user": null, - "metadata": {} - } - } - ResponseFileSearchCallCompletedEvent: - type: object - description: Emitted when a file search call is completed (results found). + ProgramToolCallCallerParam: properties: type: type: string - description: | - The type of the event. Always `response.file_search_call.completed`. enum: - - response.file_search_call.completed + - program + description: The caller type. Always `program`. + default: program x-stainless-const: true - output_index: - type: integer - description: | - The index of the output item that the file search call is initiated. - item_id: + caller_id: type: string - description: | - The ID of the output item that the file search call is initiated. - sequence_number: - type: integer - description: The sequence number of this event. + maxLength: 64 + minLength: 1 + description: The call ID of the program item that produced this tool call. + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.file_search_call.completed - group: responses - example: | - { - "type": "response.file_search_call.completed", - "output_index": 0, - "item_id": "fs_123", - "sequence_number": 1 - } - ResponseFileSearchCallInProgressEvent: - type: object - description: Emitted when a file search call is initiated. + - caller_id + ToolCallCallerParam: + oneOf: + - $ref: '#/components/schemas/DirectToolCallCallerParam' + - $ref: '#/components/schemas/ProgramToolCallCallerParam' + description: The execution context that produced this tool call. + discriminator: + propertyName: type + FunctionCallOutputStatusEnum: + type: string + enum: + - in_progress + - completed + - incomplete + ClickButtonType: + type: string + enum: + - left + - right + - wheel + - back + - forward + ClickParam: properties: type: type: string - description: > - The type of the event. Always - `response.file_search_call.in_progress`. enum: - - response.file_search_call.in_progress + - click + description: >- + Specifies the event type. For a click action, this property is + always `click`. + default: click x-stainless-const: true - output_index: + button: + $ref: '#/components/schemas/ClickButtonType' + description: >- + Indicates which mouse button was pressed during the click. One of + `left`, `right`, `wheel`, `back`, or `forward`. + x: type: integer - description: | - The index of the output item that the file search call is initiated. - item_id: - type: string - description: | - The ID of the output item that the file search call is initiated. - sequence_number: + description: The x-coordinate where the click occurred. + 'y': type: integer - description: The sequence number of this event. + description: The y-coordinate where the click occurred. + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while clicking. + - type: 'null' + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.file_search_call.in_progress - group: responses - example: | - { - "type": "response.file_search_call.in_progress", - "output_index": 0, - "item_id": "fs_123", - "sequence_number": 1 - } - ResponseFileSearchCallSearchingEvent: - type: object - description: Emitted when a file search is currently searching. + - button + - x + - 'y' + title: Click + description: A click action. + DoubleClickAction: properties: type: type: string - description: | - The type of the event. Always `response.file_search_call.searching`. enum: - - response.file_search_call.searching + - double_click + description: >- + Specifies the event type. For a double click action, this property + is always set to `double_click`. + default: double_click x-stainless-const: true - output_index: + x: type: integer - description: | - The index of the output item that the file search call is searching. - item_id: - type: string - description: | - The ID of the output item that the file search call is initiated. - sequence_number: + description: The x-coordinate where the double click occurred. + 'y': type: integer - description: The sequence number of this event. + description: The y-coordinate where the double click occurred. + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while double-clicking. + - type: 'null' + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.file_search_call.searching - group: responses - example: | - { - "type": "response.file_search_call.searching", - "output_index": 0, - "item_id": "fs_123", - "sequence_number": 1 - } - ResponseFormatJsonObject: + - x + - 'y' + - keys + title: DoubleClick + description: A double click action. + CoordParam: + properties: + x: + type: integer + description: The x-coordinate. + 'y': + type: integer + description: The y-coordinate. type: object - title: JSON object - description: > - JSON object response format. An older method of generating JSON - responses. + required: + - x + - 'y' + title: Coordinate + description: 'An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.' + DragParam: + properties: + type: + type: string + enum: + - drag + description: >- + Specifies the event type. For a drag action, this property is always + set to `drag`. + default: drag + x-stainless-const: true + path: + items: + $ref: '#/components/schemas/CoordParam' + type: array + description: >- + An array of coordinates representing the path of the drag action. + Coordinates will appear as an array of objects, eg - Using `json_schema` is recommended for models that support it. Note that - the + ``` - model will not generate JSON without a system or user message - instructing it + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] - to do so. + ``` + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while dragging the mouse. + - type: 'null' + type: object + required: + - type + - path + title: Drag + description: A drag action. + KeyPressAction: properties: type: type: string - description: The type of response format being defined. Always `json_object`. enum: - - json_object + - keypress + description: >- + Specifies the event type. For a keypress action, this property is + always set to `keypress`. + default: keypress x-stainless-const: true + keys: + items: + type: string + description: One of the keys the model is requesting to be pressed. + type: array + description: >- + The combination of keys the model is requesting to be pressed. This + is an array of strings, each representing a key. + type: object required: - type - ResponseFormatJsonSchema: - type: object - title: JSON schema - description: | - JSON Schema response format. Used to generate structured JSON responses. - Learn more about [Structured Outputs](/docs/guides/structured-outputs). + - keys + title: KeyPress + description: A collection of keypresses the model would like to perform. + MoveParam: properties: type: type: string - description: The type of response format being defined. Always `json_schema`. enum: - - json_schema + - move + description: >- + Specifies the event type. For a move action, this property is always + set to `move`. + default: move x-stainless-const: true - json_schema: - type: object - title: JSON schema - description: | - Structured Outputs configuration options, including a JSON Schema. - properties: - description: - type: string - description: > - A description of what the response format is for, used by the - model to - - determine how to respond in the format. - name: - type: string - description: > - The name of the response format. Must be a-z, A-Z, 0-9, or - contain - - underscores and dashes, with a maximum length of 64. - schema: - $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' - strict: - anyOf: - - type: boolean - default: false - description: > - Whether to enable strict schema adherence when generating - the output. - - If set to true, the model will always follow the exact - schema defined - - in the `schema` field. Only a subset of JSON Schema is - supported when - - `strict` is `true`. To learn more, read the [Structured - Outputs - - guide](/docs/guides/structured-outputs). - - type: 'null' - required: - - name + x: + type: integer + description: The x-coordinate to move to. + 'y': + type: integer + description: The y-coordinate to move to. + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while moving the mouse. + - type: 'null' + type: object required: - type - - json_schema - ResponseFormatJsonSchemaSchema: - type: object - title: JSON schema - description: | - The schema for the response format, described as a JSON Schema object. - Learn how to build JSON schemas [here](https://json-schema.org/). - additionalProperties: true - ResponseFormatText: - type: object - title: Text - description: | - Default response format. Used to generate text responses. + - x + - 'y' + title: Move + description: A mouse move action. + ScreenshotParam: properties: type: type: string - description: The type of response format being defined. Always `text`. enum: - - text + - screenshot + description: >- + Specifies the event type. For a screenshot action, this property is + always set to `screenshot`. + default: screenshot x-stainless-const: true + type: object required: - type - ResponseFormatTextGrammar: + title: Screenshot + description: A screenshot action. + ScrollParam: + properties: + type: + type: string + enum: + - scroll + description: >- + Specifies the event type. For a scroll action, this property is + always set to `scroll`. + default: scroll + x-stainless-const: true + x: + type: integer + description: The x-coordinate where the scroll occurred. + 'y': + type: integer + description: The y-coordinate where the scroll occurred. + scroll_x: + type: integer + description: The horizontal scroll distance. + scroll_y: + type: integer + description: The vertical scroll distance. + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while scrolling. + - type: 'null' type: object - title: Text grammar - description: | - A custom grammar for the model to follow when generating text. - Learn more in the [custom grammars guide](/docs/guides/custom-grammars). + required: + - type + - x + - 'y' + - scroll_x + - scroll_y + title: Scroll + description: A scroll action. + TypeParam: properties: type: type: string - description: The type of response format being defined. Always `grammar`. enum: - - grammar + - type + description: >- + Specifies the event type. For a type action, this property is always + set to `type`. + default: type x-stainless-const: true - grammar: + text: type: string - description: The custom grammar for the model to follow. + description: The text to type. + type: object required: - type - - grammar - ResponseFormatTextPython: - type: object - title: Python grammar - description: | - Configure the model to generate valid Python code. See the - [custom grammars guide](/docs/guides/custom-grammars) for more details. + - text + title: Type + description: An action to type in text. + WaitParam: properties: type: type: string - description: The type of response format being defined. Always `python`. enum: - - python + - wait + description: >- + Specifies the event type. For a wait action, this property is always + set to `wait`. + default: wait x-stainless-const: true + type: object required: - type - ResponseFunctionCallArgumentsDeltaEvent: + title: Wait + description: A wait action. + ComputerCallSafetyCheckParam: + properties: + id: + type: string + description: The ID of the pending safety check. + code: + anyOf: + - type: string + description: The type of the pending safety check. + - type: 'null' + message: + anyOf: + - type: string + description: Details about the pending safety check. + - type: 'null' type: object - description: Emitted when there is a partial function-call arguments delta. + required: + - id + description: A pending safety check for the computer call. + ComputerCallOutputStatus: + type: string + enum: + - completed + - incomplete + - failed + ToolSearchExecutionType: + type: string + enum: + - server + - client + ToolSearchCall: properties: type: type: string - description: > - The type of the event. Always - `response.function_call_arguments.delta`. enum: - - response.function_call_arguments.delta + - tool_search_call + description: The type of the item. Always `tool_search_call`. + default: tool_search_call x-stainless-const: true - item_id: + id: type: string - description: > - The ID of the output item that the function-call arguments delta is - added to. - output_index: - type: integer - description: > - The index of the output item that the function-call arguments delta - is added to. - sequence_number: - type: integer - description: The sequence number of this event. - delta: + description: The unique ID of the tool search call item. + call_id: + anyOf: + - type: string + description: The unique ID of the tool search call generated by the model. + - type: 'null' + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search was executed by the server or by the client. + arguments: + description: Arguments used for the tool search call. + status: + $ref: '#/components/schemas/FunctionCallStatus' + description: The status of the tool search call item that was recorded. + created_by: type: string - description: | - The function-call arguments delta that is added. + description: The identifier of the actor that created the item. + type: object required: - type - - item_id - - output_index - - delta - - sequence_number - x-oaiMeta: - name: response.function_call_arguments.delta - group: responses - example: | - { - "type": "response.function_call_arguments.delta", - "item_id": "item-abc", - "output_index": 0, - "delta": "{ \"arg\":" - "sequence_number": 1 - } - ResponseFunctionCallArgumentsDoneEvent: - type: object - description: Emitted when function-call arguments are finalized. + - id + - call_id + - execution + - arguments + - status + CallableToolAllowedCaller: + type: string + enum: + - direct + - programmatic + FunctionTool: properties: type: type: string enum: - - response.function_call_arguments.done + - function + description: The type of the function tool. Always `function`. + default: function x-stainless-const: true - item_id: - type: string - description: The ID of the item. name: type: string - description: The name of the function that was called. - output_index: - type: integer - description: The index of the output item. - sequence_number: - type: integer - description: The sequence number of this event. - arguments: - type: string - description: The function-call arguments. + description: The name of the function to call. + description: + anyOf: + - type: string + description: >- + A description of the function. Used by the model to determine + whether or not to call the function. + - type: 'null' + parameters: + anyOf: + - additionalProperties: {} + type: object + description: A JSON schema object describing the parameters of the function. + x-oaiTypeLabel: map + - type: 'null' + output_schema: + anyOf: + - additionalProperties: {} + type: object + description: >- + A JSON schema object describing the JSON value encoded in string + outputs for this function. + x-oaiTypeLabel: map + - type: 'null' + strict: + anyOf: + - type: boolean + description: >- + Whether strict parameter validation is enforced for this + function tool. + - type: 'null' + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + type: array + description: The tool invocation context(s). + - type: 'null' + type: object required: - type - - item_id - name - - output_index - - arguments - - sequence_number - x-oaiMeta: - name: response.function_call_arguments.done - group: responses - example: | - { - "type": "response.function_call_arguments.done", - "item_id": "item-abc", - "name": "get_weather", - "output_index": 1, - "arguments": "{ \"arg\": 123 }", - "sequence_number": 1 - } - ResponseImageGenCallCompletedEvent: + - strict + - parameters + title: Function + description: >- + Defines a function in your own code the model can choose to call. Learn + more about [function + calling](https://platform.openai.com/docs/guides/function-calling). + RankerVersionType: + type: string + enum: + - auto + - default-2024-11-15 + HybridSearchOptions: + properties: + embedding_weight: + type: number + description: The weight of the embedding in the reciprocal ranking fusion. + text_weight: + type: number + description: The weight of the text in the reciprocal ranking fusion. type: object - title: ResponseImageGenCallCompletedEvent - description: > - Emitted when an image generation tool call has completed and the final - image is available. + required: + - embedding_weight + - text_weight + RankingOptions: + properties: + ranker: + $ref: '#/components/schemas/RankerVersionType' + description: The ranker to use for the file search. + score_threshold: + type: number + description: >- + The score threshold for the file search, a number between 0 and 1. + Numbers closer to 1 will attempt to return only the most relevant + results, but may return fewer results. + hybrid_search: + $ref: '#/components/schemas/HybridSearchOptions' + description: >- + Weights that control how reciprocal rank fusion balances semantic + embedding matches versus sparse keyword matches when hybrid search + is enabled. + type: object + required: [] + Filters: + anyOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $ref: '#/components/schemas/CompoundFilter' + FileSearchTool: properties: type: type: string enum: - - response.image_generation_call.completed - description: >- - The type of the event. Always - 'response.image_generation_call.completed'. + - file_search + description: The type of the file search tool. Always `file_search`. + default: file_search x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response's output array. - sequence_number: + vector_store_ids: + items: + type: string + type: array + description: The IDs of the vector stores to search. + max_num_results: type: integer - description: The sequence number of this event. - item_id: - type: string - description: The unique identifier of the image generation item being processed. + description: >- + The maximum number of results to return. This number should be + between 1 and 50 inclusive. + ranking_options: + $ref: '#/components/schemas/RankingOptions' + description: Ranking options for search. + filters: + anyOf: + - $ref: '#/components/schemas/Filters' + description: A filter to apply. + - type: 'null' + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.image_generation_call.completed - group: responses - example: | - { - "type": "response.image_generation_call.completed", - "output_index": 0, - "item_id": "item-123", - "sequence_number": 1 - } - ResponseImageGenCallGeneratingEvent: - type: object - title: ResponseImageGenCallGeneratingEvent - description: > - Emitted when an image generation tool call is actively generating an - image (intermediate state). + - vector_store_ids + title: File search + description: >- + A tool that searches for relevant content from uploaded files. Learn + more about the [file search + tool](https://platform.openai.com/docs/guides/tools-file-search). + ComputerTool: properties: type: type: string enum: - - response.image_generation_call.generating - description: >- - The type of the event. Always - 'response.image_generation_call.generating'. + - computer + description: The type of the computer tool. Always `computer`. + default: computer x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response's output array. - item_id: - type: string - description: The unique identifier of the image generation item being processed. - sequence_number: - type: integer - description: The sequence number of the image generation item being processed. + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.image_generation_call.generating - group: responses - example: | - { - "type": "response.image_generation_call.generating", - "output_index": 0, - "item_id": "item-123", - "sequence_number": 0 - } - ResponseImageGenCallInProgressEvent: - type: object - title: ResponseImageGenCallInProgressEvent - description: | - Emitted when an image generation tool call is in progress. + title: Computer + description: >- + A tool that controls a virtual computer. Learn more about the [computer + tool](https://platform.openai.com/docs/guides/tools-computer-use). + ComputerEnvironment: + type: string + enum: + - windows + - mac + - linux + - ubuntu + - browser + ComputerUsePreviewTool: properties: type: type: string enum: - - response.image_generation_call.in_progress - description: >- - The type of the event. Always - 'response.image_generation_call.in_progress'. + - computer_use_preview + description: The type of the computer use tool. Always `computer_use_preview`. + default: computer_use_preview x-stainless-const: true - output_index: + environment: + $ref: '#/components/schemas/ComputerEnvironment' + description: The type of computer environment to control. + display_width: type: integer - description: The index of the output item in the response's output array. - item_id: - type: string - description: The unique identifier of the image generation item being processed. - sequence_number: + description: The width of the computer display. + display_height: type: integer - description: The sequence number of the image generation item being processed. + description: The height of the computer display. + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.image_generation_call.in_progress - group: responses - example: | - { - "type": "response.image_generation_call.in_progress", - "output_index": 0, - "item_id": "item-123", - "sequence_number": 0 - } - ResponseImageGenCallPartialImageEvent: - type: object - title: ResponseImageGenCallPartialImageEvent - description: > - Emitted when a partial image is available during image generation - streaming. + - environment + - display_width + - display_height + title: Computer use preview + description: >- + A tool that controls a virtual computer. Learn more about the [computer + tool](https://platform.openai.com/docs/guides/tools-computer-use). + ContainerMemoryLimit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + AutoCodeInterpreterToolParam: properties: type: type: string enum: - - response.image_generation_call.partial_image - description: >- - The type of the event. Always - 'response.image_generation_call.partial_image'. + - auto + description: Always `auto`. + default: auto x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response's output array. - item_id: - type: string - description: The unique identifier of the image generation item being processed. - sequence_number: - type: integer - description: The sequence number of the image generation item being processed. - partial_image_index: - type: integer - description: >- - 0-based index for the partial image (backend is 1-based, but this is - 0-based for the user). - partial_image_b64: - type: string - description: >- - Base64-encoded partial image data, suitable for rendering as an - image. + file_ids: + items: + type: string + example: file-123 + type: array + maxItems: 50 + description: An optional list of uploaded files to make available to your code. + memory_limit: + anyOf: + - $ref: '#/components/schemas/ContainerMemoryLimit' + description: The memory limit for the code interpreter container. + - type: 'null' + network_policy: + oneOf: + - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' + description: Network access policy for the container. + discriminator: + propertyName: type + type: object required: - type - - output_index - - item_id - - sequence_number - - partial_image_index - - partial_image_b64 - x-oaiMeta: - name: response.image_generation_call.partial_image - group: responses - example: | - { - "type": "response.image_generation_call.partial_image", - "output_index": 0, - "item_id": "item-123", - "sequence_number": 0, - "partial_image_index": 0, - "partial_image_b64": "..." - } - ResponseInProgressEvent: - type: object - description: Emitted when the response is in progress. + title: CodeInterpreterToolAuto + description: >- + Configuration for a code interpreter container. Optionally specify the + IDs of the files to run the code on. + ProgrammaticToolCallingParam: properties: type: type: string - description: | - The type of the event. Always `response.in_progress`. enum: - - response.in_progress + - programmatic_tool_calling + description: The type of the tool. Always `programmatic_tool_calling`. + default: programmatic_tool_calling x-stainless-const: true - response: - $ref: '#/components/schemas/Response' - description: | - The response that is in progress. - sequence_number: - type: integer - description: The sequence number of this event. - required: - - type - - response - - sequence_number - x-oaiMeta: - name: response.in_progress - group: responses - example: | - { - "type": "response.in_progress", - "response": { - "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", - "object": "response", - "created_at": 1741487325, - "status": "in_progress", - "completed_at": null, - "error": null, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "model": "gpt-4o-2024-08-06", - "output": [], - "parallel_tool_calls": true, - "previous_response_id": null, - "reasoning": { - "effort": null, - "summary": null - }, - "store": true, - "temperature": 1, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1, - "truncation": "disabled", - "usage": null, - "user": null, - "metadata": {} - }, - "sequence_number": 1 - } - ResponseIncompleteEvent: type: object - description: | - An event that is emitted when a response finishes as incomplete. + required: + - type + InputFidelity: + type: string + enum: + - high + - low + description: >- + Control how much effort the model will exert to match the style and + features, especially facial features, of input images. This parameter is + only supported for `gpt-image-1` and `gpt-image-1.5` and later models, + unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults + to `low`. + ImageGenActionEnum: + type: string + enum: + - generate + - edit + - auto + LocalShellToolParam: properties: type: type: string - description: | - The type of the event. Always `response.incomplete`. enum: - - response.incomplete + - local_shell + description: The type of the local shell tool. Always `local_shell`. + default: local_shell x-stainless-const: true - response: - $ref: '#/components/schemas/Response' - description: | - The response that was incomplete. - sequence_number: - type: integer - description: The sequence number of this event. + type: object required: - type - - response - - sequence_number - x-oaiMeta: - name: response.incomplete - group: responses - example: | - { - "type": "response.incomplete", - "response": { - "id": "resp_123", - "object": "response", - "created_at": 1740855869, - "status": "incomplete", - "completed_at": null, - "error": null, - "incomplete_details": { - "reason": "max_tokens" - }, - "instructions": null, - "max_output_tokens": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [], - "previous_response_id": null, - "reasoning_effort": null, - "store": false, - "temperature": 1, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1, - "truncation": "disabled", - "usage": null, - "user": null, - "metadata": {} - }, - "sequence_number": 1 - } - ResponseItemList: - type: object - description: A list of Response items. + title: Local shell tool + description: >- + A tool that allows the model to execute shell commands in a local + environment. + ContainerAutoParam: properties: - object: + type: type: string - description: The type of object returned, must be `list`. enum: - - list + - container_auto + description: Automatically creates a container for this request + default: container_auto x-stainless-const: true - data: + file_ids: + items: + type: string + example: file-123 type: array - description: A list of items used to generate this response. + maxItems: 50 + description: An optional list of uploaded files to make available to your code. + memory_limit: + anyOf: + - $ref: '#/components/schemas/ContainerMemoryLimit' + description: The memory limit for the container. + - type: 'null' + network_policy: + oneOf: + - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' + description: Network access policy for the container. + discriminator: + propertyName: type + skills: items: - $ref: '#/components/schemas/ItemResource' - has_more: - type: boolean - description: Whether there are more items available. - first_id: + oneOf: + - $ref: '#/components/schemas/SkillReferenceParam' + - $ref: '#/components/schemas/InlineSkillParam' + discriminator: + propertyName: type + type: array + maxItems: 200 + description: An optional list of skills referenced by id or inline data. + type: object + required: + - type + LocalSkillParam: + properties: + name: type: string - description: The ID of the first item in the list. - last_id: + description: The name of the skill. + description: type: string - description: The ID of the last item in the list. - required: - - object - - data - - has_more - - first_id - - last_id - x-oaiMeta: - name: The input item list - group: responses - example: | - { - "object": "list", - "data": [ - { - "id": "msg_abc123", - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Tell me a three sentence bedtime story about a unicorn." - } - ] - } - ], - "first_id": "msg_abc123", - "last_id": "msg_abc123", - "has_more": false - } - ResponseLogProb: + description: The description of the skill. + path: + type: string + description: The path to the directory containing the skill. type: object - description: > - A logprob is the logarithmic probability that the model assigns to - producing - - a particular token at a given position in the sequence. Less-negative - (higher) - - logprob values indicate greater model confidence in that token choice. + required: + - name + - description + - path + LocalEnvironmentParam: properties: - token: - description: A possible text token. + type: type: string - logprob: - description: | - The log probability of this token. - type: number - top_logprobs: - description: | - The log probabilities of up to 20 of the most likely tokens. - type: array + enum: + - local + description: Use a local computer environment. + default: local + x-stainless-const: true + skills: items: - type: object - properties: - token: - description: A possible text token. - type: string - logprob: - description: The log probability of this token. - type: number - required: - - token - - logprob - ResponseMCPCallArgumentsDeltaEvent: + $ref: '#/components/schemas/LocalSkillParam' + type: array + maxItems: 200 + description: An optional list of skills. type: object - title: ResponseMCPCallArgumentsDeltaEvent - description: > - Emitted when there is a delta (partial update) to the arguments of an - MCP tool call. + required: + - type + ContainerReferenceParam: properties: type: type: string enum: - - response.mcp_call_arguments.delta - description: The type of the event. Always 'response.mcp_call_arguments.delta'. + - container_reference + description: References a container created with the /v1/containers endpoint + default: container_reference x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response's output array. - item_id: - type: string - description: The unique identifier of the MCP tool call item being processed. - delta: + container_id: type: string - description: > - A JSON string containing the partial update to the arguments for the - MCP tool call. - sequence_number: - type: integer - description: The sequence number of this event. + description: The ID of the referenced container. + example: cntr_123 + type: object required: - type - - output_index - - item_id - - delta - - sequence_number - x-oaiMeta: - name: response.mcp_call_arguments.delta - group: responses - example: | - { - "type": "response.mcp_call_arguments.delta", - "output_index": 0, - "item_id": "item-abc", - "delta": "{", - "sequence_number": 1 - } - ResponseMCPCallArgumentsDoneEvent: - type: object - title: ResponseMCPCallArgumentsDoneEvent - description: | - Emitted when the arguments for an MCP tool call are finalized. + - container_id + FunctionShellToolParam: properties: type: type: string enum: - - response.mcp_call_arguments.done - description: The type of the event. Always 'response.mcp_call_arguments.done'. + - shell + description: The type of the shell tool. Always `shell`. + default: shell x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response's output array. - item_id: - type: string - description: The unique identifier of the MCP tool call item being processed. - arguments: - type: string - description: > - A JSON string containing the finalized arguments for the MCP tool - call. - sequence_number: - type: integer - description: The sequence number of this event. + environment: + anyOf: + - oneOf: + - $ref: '#/components/schemas/ContainerAutoParam' + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + discriminator: + propertyName: type + - type: 'null' + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). + - type: 'null' + type: object required: - type - - output_index - - item_id - - arguments - - sequence_number - x-oaiMeta: - name: response.mcp_call_arguments.done - group: responses - example: | - { - "type": "response.mcp_call_arguments.done", - "output_index": 0, - "item_id": "item-abc", - "arguments": "{\"arg1\": \"value1\", \"arg2\": \"value2\"}", - "sequence_number": 1 - } - ResponseMCPCallCompletedEvent: - type: object - title: ResponseMCPCallCompletedEvent - description: | - Emitted when an MCP tool call has completed successfully. + title: Shell tool + description: A tool that allows the model to execute shell commands. + CustomTextFormatParam: properties: type: type: string enum: - - response.mcp_call.completed - description: The type of the event. Always 'response.mcp_call.completed'. + - text + description: Unconstrained text format. Always `text`. + default: text x-stainless-const: true - item_id: - type: string - description: The ID of the MCP tool call item that completed. - output_index: - type: integer - description: The index of the output item that completed. - sequence_number: - type: integer - description: The sequence number of this event. + type: object required: - type - - item_id - - output_index - - sequence_number - x-oaiMeta: - name: response.mcp_call.completed - group: responses - example: | - { - "type": "response.mcp_call.completed", - "sequence_number": 1, - "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", - "output_index": 0 - } - ResponseMCPCallFailedEvent: - type: object - title: ResponseMCPCallFailedEvent - description: | - Emitted when an MCP tool call has failed. + title: Text format + description: Unconstrained free-form text. + GrammarSyntax1: + type: string + enum: + - lark + - regex + CustomGrammarFormatParam: properties: type: type: string enum: - - response.mcp_call.failed - description: The type of the event. Always 'response.mcp_call.failed'. + - grammar + description: Grammar format. Always `grammar`. + default: grammar x-stainless-const: true - item_id: + syntax: + $ref: '#/components/schemas/GrammarSyntax1' + description: The syntax of the grammar definition. One of `lark` or `regex`. + definition: type: string - description: The ID of the MCP tool call item that failed. - output_index: - type: integer - description: The index of the output item that failed. - sequence_number: - type: integer - description: The sequence number of this event. + description: The grammar definition. + type: object required: - type - - item_id - - output_index - - sequence_number - x-oaiMeta: - name: response.mcp_call.failed - group: responses - example: | - { - "type": "response.mcp_call.failed", - "sequence_number": 1, - "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", - "output_index": 0 - } - ResponseMCPCallInProgressEvent: - type: object - title: ResponseMCPCallInProgressEvent - description: | - Emitted when an MCP tool call is in progress. + - syntax + - definition + title: Grammar format + description: A grammar defined by the user. + CustomToolParam: properties: type: type: string enum: - - response.mcp_call.in_progress - description: The type of the event. Always 'response.mcp_call.in_progress'. + - custom + description: The type of the custom tool. Always `custom`. + default: custom x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of this event. - output_index: - type: integer - description: The index of the output item in the response's output array. - item_id: + name: type: string - description: The unique identifier of the MCP tool call item being processed. + description: The name of the custom tool, used to identify it in tool calls. + description: + type: string + description: >- + Optional description of the custom tool, used to provide more + context. + format: + oneOf: + - $ref: '#/components/schemas/CustomTextFormatParam' + - $ref: '#/components/schemas/CustomGrammarFormatParam' + description: The input format for the custom tool. Default is unconstrained text. + discriminator: + propertyName: type + defer_loading: + type: boolean + description: Whether this tool should be deferred and discovered via tool search. + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). + - type: 'null' + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.mcp_call.in_progress - group: responses - example: | - { - "type": "response.mcp_call.in_progress", - "sequence_number": 1, - "output_index": 0, - "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90" - } - ResponseMCPListToolsCompletedEvent: + - name + title: Custom tool + description: >- + A custom tool that processes input using a specified format. Learn more + about [custom tools](/docs/guides/function-calling#custom-tools) + EmptyModelParam: + properties: {} type: object - title: ResponseMCPListToolsCompletedEvent - description: > - Emitted when the list of available MCP tools has been successfully - retrieved. + required: [] + FunctionToolParam: + properties: + name: + type: string + maxLength: 128 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: + anyOf: + - type: string + - type: 'null' + parameters: + anyOf: + - $ref: '#/components/schemas/EmptyModelParam' + - type: 'null' + strict: + anyOf: + - type: boolean + description: >- + Whether to enforce strict parameter validation. If omitted, + Responses attempts to use strict validation when the schema is + compatible, and falls back to non-strict validation otherwise. + - type: 'null' + type: + type: string + enum: + - function + default: function + x-stainless-const: true + output_schema: + anyOf: + - additionalProperties: {} + type: object + description: >- + A JSON Schema describing the JSON value encoded in string + outputs for this function tool. This does not describe + content-array outputs. + x-oaiTypeLabel: map + - type: 'null' + defer_loading: + type: boolean + description: >- + Whether this function should be deferred and discovered via tool + search. + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). + - type: 'null' + type: object + required: + - name + - type + NamespaceToolParam: properties: type: type: string enum: - - response.mcp_list_tools.completed - description: The type of the event. Always 'response.mcp_list_tools.completed'. + - namespace + description: The type of the tool. Always `namespace`. + default: namespace x-stainless-const: true - item_id: + name: type: string - description: The ID of the MCP tool call item that produced this output. - output_index: - type: integer - description: The index of the output item that was processed. - sequence_number: - type: integer - description: The sequence number of this event. + minLength: 1 + description: The namespace name used in tool calls (for example, `crm`). + description: + type: string + minLength: 1 + description: A description of the namespace shown to the model. + tools: + items: + oneOf: + - $ref: '#/components/schemas/FunctionToolParam' + - $ref: '#/components/schemas/CustomToolParam' + description: A function or custom tool that belongs to a namespace. + discriminator: + propertyName: type + type: array + minItems: 1 + description: The function/custom tools available inside this namespace. + type: object required: - type - - item_id - - output_index - - sequence_number - x-oaiMeta: - name: response.mcp_list_tools.completed - group: responses - example: | - { - "type": "response.mcp_list_tools.completed", - "sequence_number": 1, - "output_index": 0, - "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" - } - ResponseMCPListToolsFailedEvent: - type: object - title: ResponseMCPListToolsFailedEvent - description: | - Emitted when the attempt to list available MCP tools has failed. + - name + - description + - tools + title: Namespace + description: Groups function/custom tools under a shared namespace. + ToolSearchToolParam: properties: type: type: string enum: - - response.mcp_list_tools.failed - description: The type of the event. Always 'response.mcp_list_tools.failed'. + - tool_search + description: The type of the tool. Always `tool_search`. + default: tool_search x-stainless-const: true - item_id: - type: string - description: The ID of the MCP tool call item that failed. - output_index: - type: integer - description: The index of the output item that failed. - sequence_number: - type: integer - description: The sequence number of this event. + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search is executed by the server or by the client. + description: + anyOf: + - type: string + description: >- + Description shown to the model for a client-executed tool search + tool. + - type: 'null' + parameters: + anyOf: + - $ref: '#/components/schemas/EmptyModelParam' + description: Parameter schema for a client-executed tool search tool. + - type: 'null' + type: object required: - type - - item_id - - output_index - - sequence_number - x-oaiMeta: - name: response.mcp_list_tools.failed - group: responses - example: | - { - "type": "response.mcp_list_tools.failed", - "sequence_number": 1, - "output_index": 0, - "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" - } - ResponseMCPListToolsInProgressEvent: - type: object - title: ResponseMCPListToolsInProgressEvent - description: > - Emitted when the system is in the process of retrieving the list of - available MCP tools. + title: Tool search tool + description: Hosted or BYOT tool search configuration for deferred tools. + ApproximateLocation: properties: type: type: string enum: - - response.mcp_list_tools.in_progress - description: The type of the event. Always 'response.mcp_list_tools.in_progress'. + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate x-stainless-const: true - item_id: - type: string - description: The ID of the MCP tool call item that is being processed. - output_index: - type: integer - description: The index of the output item that is being processed. - sequence_number: - type: integer - description: The sequence number of this event. + country: + anyOf: + - type: string + description: >- + The two-letter [ISO country + code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, + e.g. `US`. + - type: 'null' + region: + anyOf: + - type: string + description: Free text input for the region of the user, e.g. `California`. + - type: 'null' + city: + anyOf: + - type: string + description: Free text input for the city of the user, e.g. `San Francisco`. + - type: 'null' + timezone: + anyOf: + - type: string + description: >- + The [IANA + timezone](https://timeapi.io/documentation/iana-timezones) of + the user, e.g. `America/Los_Angeles`. + - type: 'null' + type: object required: - type - - item_id - - output_index - - sequence_number - x-oaiMeta: - name: response.mcp_list_tools.in_progress - group: responses - example: | - { - "type": "response.mcp_list_tools.in_progress", - "sequence_number": 1, - "output_index": 0, - "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" - } - ResponseModalities: - anyOf: - - type: array - description: > - Output types that you would like the model to generate. - - Most models are capable of generating text, which is the default: - - - `["text"]` - - - The `gpt-4o-audio-preview` model can also be used to - - [generate audio](/docs/guides/audio). To request that this model - generate - - both text and audio responses, you can use: - - - `["text", "audio"]` - items: - type: string - enum: - - text - - audio - - type: 'null' - ResponseOutputItemAddedEvent: - type: object - description: Emitted when a new output item is added. + SearchContextSize: + type: string + enum: + - low + - medium + - high + SearchContentType: + type: string + enum: + - text + - image + WebSearchPreviewTool: properties: type: type: string - description: | - The type of the event. Always `response.output_item.added`. enum: - - response.output_item.added + - web_search_preview + - web_search_preview_2025_03_11 + description: >- + The type of the web search tool. One of `web_search_preview` or + `web_search_preview_2025_03_11`. + default: web_search_preview x-stainless-const: true - output_index: - type: integer - description: | - The index of the output item that was added. - sequence_number: - type: integer - description: | - The sequence number of this event. - item: - $ref: '#/components/schemas/OutputItem' - description: | - The output item that was added. + user_location: + anyOf: + - $ref: '#/components/schemas/ApproximateLocation' + description: The user's location. + - type: 'null' + search_context_size: + $ref: '#/components/schemas/SearchContextSize' + description: >- + High level guidance for the amount of context window space to use + for the search. One of `low`, `medium`, or `high`. `medium` is the + default. + search_content_types: + items: + $ref: '#/components/schemas/SearchContentType' + type: array + type: object required: - type - - output_index - - item - - sequence_number - x-oaiMeta: - name: response.output_item.added - group: responses - example: | - { - "type": "response.output_item.added", - "output_index": 0, - "item": { - "id": "msg_123", - "status": "in_progress", - "type": "message", - "role": "assistant", - "content": [] - }, - "sequence_number": 1 - } - ResponseOutputItemDoneEvent: - type: object - description: Emitted when an output item is marked done. + title: Web search preview + description: >- + This tool searches the web for relevant results to use in a response. + Learn more about the [web search + tool](https://platform.openai.com/docs/guides/tools-web-search). + ApplyPatchToolParam: properties: type: type: string - description: | - The type of the event. Always `response.output_item.done`. enum: - - response.output_item.done + - apply_patch + description: The type of the tool. Always `apply_patch`. + default: apply_patch x-stainless-const: true - output_index: - type: integer - description: | - The index of the output item that was marked done. - sequence_number: - type: integer - description: | - The sequence number of this event. - item: - $ref: '#/components/schemas/OutputItem' - description: | - The output item that was marked done. + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). + - type: 'null' + type: object required: - type - - output_index - - item - - sequence_number - x-oaiMeta: - name: response.output_item.done - group: responses - example: | - { - "type": "response.output_item.done", - "output_index": 0, - "item": { - "id": "msg_123", - "status": "completed", - "type": "message", - "role": "assistant", - "content": [ - { - "type": "output_text", - "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", - "annotations": [] - } - ] - }, - "sequence_number": 1 - } - ResponseOutputTextAnnotationAddedEvent: - type: object - title: ResponseOutputTextAnnotationAddedEvent - description: | - Emitted when an annotation is added to output text content. + title: Apply patch tool + description: >- + Allows the assistant to create, delete, or update files using unified + diffs. + ToolSearchOutput: properties: type: type: string enum: - - response.output_text.annotation.added - description: >- - The type of the event. Always - 'response.output_text.annotation.added'. + - tool_search_output + description: The type of the item. Always `tool_search_output`. + default: tool_search_output x-stainless-const: true - item_id: + id: type: string - description: >- - The unique identifier of the item to which the annotation is being - added. - output_index: - type: integer - description: The index of the output item in the response's output array. - content_index: - type: integer - description: The index of the content part within the output item. - annotation_index: - type: integer - description: The index of the annotation within the content part. - sequence_number: - type: integer - description: The sequence number of this event. - annotation: - type: object - description: >- - The annotation object being added. (See annotation schema for - details.) - required: - - type - - item_id - - output_index - - content_index - - annotation_index - - annotation - - sequence_number - x-oaiMeta: - name: response.output_text.annotation.added - group: responses - example: | - { - "type": "response.output_text.annotation.added", - "item_id": "item-abc", - "output_index": 0, - "content_index": 0, - "annotation_index": 0, - "annotation": { - "type": "text_annotation", - "text": "This is a test annotation", - "start": 0, - "end": 10 - }, - "sequence_number": 1 - } - ResponsePromptVariables: - anyOf: - - type: object - title: Prompt Variables - description: | - Optional map of values to substitute in for variables in your - prompt. The substitution values can either be strings, or other - Response input types like images or files. - x-oaiExpandable: true - x-oaiTypeLabel: map - additionalProperties: - x-oaiExpandable: true - x-oaiTypeLabel: map - oneOf: - - type: string - - $ref: '#/components/schemas/InputTextContent' - - $ref: '#/components/schemas/InputImageContent' - - $ref: '#/components/schemas/InputFileContent' - - type: 'null' - ResponseProperties: - type: object - properties: - previous_response_id: + description: The unique ID of the tool search output item. + call_id: anyOf: - type: string - description: > - The unique ID of the previous response to the model. Use this to - - create multi-turn conversations. Learn more about - - [conversation state](/docs/guides/conversation-state). Cannot be - used in conjunction with `conversation`. - - type: 'null' - model: - description: > - Model ID used to generate the response, like `gpt-4o` or `o3`. - OpenAI - - offers a wide range of models with different capabilities, - performance - - characteristics, and price points. Refer to the [model - guide](/docs/models) - - to browse and compare available models. - $ref: '#/components/schemas/ModelIdsResponses' - reasoning: - anyOf: - - $ref: '#/components/schemas/Reasoning' - - type: 'null' - background: - anyOf: - - type: boolean - description: | - Whether to run the model response in the background. - [Learn more](/docs/guides/background). - default: false - - type: 'null' - max_tool_calls: - anyOf: - - description: > - The maximum number of total calls to built-in tools that can be - processed in a response. This maximum number applies across all - built-in tool calls, not per individual tool. Any further - attempts to call a tool by the model will be ignored. - type: integer + description: The unique ID of the tool search call generated by the model. - type: 'null' - text: - $ref: '#/components/schemas/ResponseTextParam' + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search was executed by the server or by the client. tools: - $ref: '#/components/schemas/ToolsArray' - tool_choice: - $ref: '#/components/schemas/ToolChoiceParam' - prompt: - $ref: '#/components/schemas/Prompt' - truncation: - anyOf: - - type: string - description: > - The truncation strategy to use for the model response. - - - `auto`: If the input to this Response exceeds - the model's context window size, the model will truncate the - response to fit the context window by dropping items from the beginning of the conversation. - - `disabled` (default): If the input size will exceed the - context window - size for a model, the request will fail with a 400 error. - enum: - - auto - - disabled - default: disabled - - type: 'null' - ResponseQueuedEvent: + items: + $ref: '#/components/schemas/Tool' + type: array + description: The loaded tool definitions returned by tool search. + status: + $ref: '#/components/schemas/FunctionCallOutputStatusEnum' + description: The status of the tool search output item that was recorded. + created_by: + type: string + description: The identifier of the actor that created the item. type: object - title: ResponseQueuedEvent - description: | - Emitted when a response is queued and waiting to be processed. + required: + - type + - id + - call_id + - execution + - tools + - status + AdditionalTools: + properties: + type: + type: string + enum: + - additional_tools + description: The type of the item. Always `additional_tools`. + default: additional_tools + x-stainless-const: true + id: + type: string + description: The unique ID of the additional tools item. + role: + $ref: '#/components/schemas/MessageRole' + description: The role that provided the additional tools. + tools: + items: + $ref: '#/components/schemas/Tool' + type: array + description: The additional tool definitions made available at this item. + type: object + required: + - type + - id + - role + - tools + Program: properties: type: type: string enum: - - response.queued - description: The type of the event. Always 'response.queued'. + - program + description: The type of the item. Always `program`. + default: program x-stainless-const: true - response: - $ref: '#/components/schemas/Response' - description: The full response object that is queued. - sequence_number: - type: integer - description: The sequence number for this event. + id: + type: string + description: The unique ID of the program item. + call_id: + type: string + description: The stable call ID of the program item. + code: + type: string + description: The JavaScript source executed by programmatic tool calling. + fingerprint: + type: string + description: Opaque program replay fingerprint that must be round-tripped. + type: object required: - type - - response - - sequence_number - x-oaiMeta: - name: response.queued - group: responses - example: | - { - "type": "response.queued", - "response": { - "id": "res_123", - "status": "queued", - "created_at": "2021-01-01T00:00:00Z", - "updated_at": "2021-01-01T00:00:00Z" - }, - "sequence_number": 1 - } - ResponseReasoningSummaryPartAddedEvent: - type: object - description: Emitted when a new reasoning summary part is added. + - id + - call_id + - code + - fingerprint + ProgramOutputStatus: + type: string + enum: + - completed + - incomplete + ProgramOutput: properties: type: type: string - description: > - The type of the event. Always - `response.reasoning_summary_part.added`. enum: - - response.reasoning_summary_part.added + - program_output + description: The type of the item. Always `program_output`. + default: program_output x-stainless-const: true - item_id: + id: type: string - description: | - The ID of the item this summary part is associated with. - output_index: - type: integer - description: | - The index of the output item this summary part is associated with. - summary_index: - type: integer - description: | - The index of the summary part within the reasoning summary. - sequence_number: - type: integer - description: | - The sequence number of this event. - part: - type: object - description: | - The summary part that was added. - properties: - type: - type: string - description: The type of the summary part. Always `summary_text`. - enum: - - summary_text - x-stainless-const: true - text: - type: string - description: The text of the summary part. - required: - - type - - text + description: The unique ID of the program output item. + call_id: + type: string + description: The call ID of the program item. + result: + type: string + description: The result produced by the program item. + status: + $ref: '#/components/schemas/ProgramOutputStatus' + description: The terminal status of the program output item. + type: object required: - type - - item_id - - output_index - - summary_index - - part - - sequence_number - x-oaiMeta: - name: response.reasoning_summary_part.added - group: responses - example: | - { - "type": "response.reasoning_summary_part.added", - "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", - "output_index": 0, - "summary_index": 0, - "part": { - "type": "summary_text", - "text": "" - }, - "sequence_number": 1 - } - ResponseReasoningSummaryPartDoneEvent: - type: object - description: Emitted when a reasoning summary part is completed. + - id + - call_id + - result + - status + CompactionBody: properties: type: type: string - description: > - The type of the event. Always - `response.reasoning_summary_part.done`. enum: - - response.reasoning_summary_part.done + - compaction + description: The type of the item. Always `compaction`. + default: compaction x-stainless-const: true - item_id: + id: type: string - description: | - The ID of the item this summary part is associated with. - output_index: - type: integer - description: | - The index of the output item this summary part is associated with. - summary_index: - type: integer - description: | - The index of the summary part within the reasoning summary. - sequence_number: - type: integer - description: | - The sequence number of this event. - part: - type: object - description: | - The completed summary part. - properties: - type: - type: string - description: The type of the summary part. Always `summary_text`. - enum: - - summary_text - x-stainless-const: true - text: - type: string - description: The text of the summary part. - required: - - type - - text + description: The unique ID of the compaction item. + encrypted_content: + type: string + description: The encrypted content that was produced by compaction. + created_by: + type: string + description: The identifier of the actor that created the item. + type: object required: - type - - item_id - - output_index - - summary_index - - part - - sequence_number - x-oaiMeta: - name: response.reasoning_summary_part.done - group: responses - example: | - { - "type": "response.reasoning_summary_part.done", - "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", - "output_index": 0, - "summary_index": 0, - "part": { - "type": "summary_text", - "text": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!" - }, - "sequence_number": 1 - } - ResponseReasoningSummaryTextDeltaEvent: - type: object - description: Emitted when a delta is added to a reasoning summary text. + - id + - encrypted_content + title: Compaction item + description: >- + A compaction item generated by the [`v1/responses/compact` + API](/docs/api-reference/responses/compact). + CodeInterpreterOutputLogs: properties: type: type: string - description: > - The type of the event. Always - `response.reasoning_summary_text.delta`. enum: - - response.reasoning_summary_text.delta + - logs + description: The type of the output. Always `logs`. + default: logs x-stainless-const: true - item_id: - type: string - description: | - The ID of the item this summary text delta is associated with. - output_index: - type: integer - description: > - The index of the output item this summary text delta is associated - with. - summary_index: - type: integer - description: | - The index of the summary part within the reasoning summary. - delta: + logs: type: string - description: | - The text delta that was added to the summary. - sequence_number: - type: integer - description: | - The sequence number of this event. + description: The logs output from the code interpreter. + type: object required: - type - - item_id - - output_index - - summary_index - - delta - - sequence_number - x-oaiMeta: - name: response.reasoning_summary_text.delta - group: responses - example: | - { - "type": "response.reasoning_summary_text.delta", - "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", - "output_index": 0, - "summary_index": 0, - "delta": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!", - "sequence_number": 1 - } - ResponseReasoningSummaryTextDoneEvent: - type: object - description: Emitted when a reasoning summary text is completed. + - logs + title: Code interpreter output logs + description: The logs output from the code interpreter. + CodeInterpreterOutputImage: properties: type: type: string - description: > - The type of the event. Always - `response.reasoning_summary_text.done`. enum: - - response.reasoning_summary_text.done + - image + description: The type of the output. Always `image`. + default: image x-stainless-const: true - item_id: + url: type: string - description: | - The ID of the item this summary text is associated with. - output_index: - type: integer - description: | - The index of the output item this summary text is associated with. - summary_index: - type: integer - description: | - The index of the summary part within the reasoning summary. - text: + format: uri + description: The URL of the image output from the code interpreter. + type: object + required: + - type + - url + title: Code interpreter output image + description: The image output from the code interpreter. + LocalShellExecAction: + properties: + type: type: string - description: | - The full text of the completed reasoning summary. - sequence_number: - type: integer - description: | - The sequence number of this event. + enum: + - exec + description: The type of the local shell action. Always `exec`. + default: exec + x-stainless-const: true + command: + items: + type: string + type: array + description: The command to run. + timeout_ms: + anyOf: + - type: integer + description: Optional timeout in milliseconds for the command. + - type: 'null' + working_directory: + anyOf: + - type: string + description: Optional working directory to run the command in. + - type: 'null' + env: + additionalProperties: + type: string + type: object + description: Environment variables to set for the command. + x-oaiTypeLabel: map + user: + anyOf: + - type: string + description: Optional user to run the command as. + - type: 'null' + type: object required: - type - - item_id - - output_index - - summary_index - - text - - sequence_number - x-oaiMeta: - name: response.reasoning_summary_text.done - group: responses - example: | - { - "type": "response.reasoning_summary_text.done", - "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", - "output_index": 0, - "summary_index": 0, - "text": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!", - "sequence_number": 1 - } - ResponseReasoningTextDeltaEvent: + - command + - env + title: Local shell exec action + description: Execute a shell command on the server. + FunctionShellAction: + properties: + commands: + items: + type: string + description: A list of commands to run. + type: array + timeout_ms: + anyOf: + - type: integer + description: Optional timeout in milliseconds for the commands. + - type: 'null' + max_output_length: + anyOf: + - type: integer + description: >- + Optional maximum number of characters to return from each + command. + - type: 'null' type: object - description: Emitted when a delta is added to a reasoning text. + required: + - commands + - timeout_ms + - max_output_length + title: Shell exec action + description: Execute a shell command. + FunctionShellCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + LocalEnvironmentResource: properties: type: type: string - description: | - The type of the event. Always `response.reasoning_text.delta`. enum: - - response.reasoning_text.delta + - local + description: The environment type. Always `local`. + default: local x-stainless-const: true - item_id: + type: object + required: + - type + title: Local Environment + description: Represents the use of a local environment to perform shell actions. + ContainerReferenceResource: + properties: + type: type: string - description: | - The ID of the item this reasoning text delta is associated with. - output_index: - type: integer - description: > - The index of the output item this reasoning text delta is associated - with. - content_index: - type: integer - description: > - The index of the reasoning content part this delta is associated - with. - delta: + enum: + - container_reference + description: The environment type. Always `container_reference`. + default: container_reference + x-stainless-const: true + container_id: type: string - description: | - The text delta that was added to the reasoning content. - sequence_number: - type: integer - description: | - The sequence number of this event. + type: object required: - type - - item_id - - output_index - - content_index - - delta - - sequence_number - x-oaiMeta: - name: response.reasoning_text.delta - group: responses - example: | - { - "type": "response.reasoning_text.delta", - "item_id": "rs_123", - "output_index": 0, - "content_index": 0, - "delta": "The", - "sequence_number": 1 - } - ResponseReasoningTextDoneEvent: - type: object - description: Emitted when a reasoning text is completed. + - container_id + title: Container Reference + description: Represents a container created with /v1/containers. + FunctionShellCall: properties: type: type: string - description: | - The type of the event. Always `response.reasoning_text.done`. enum: - - response.reasoning_text.done + - shell_call + description: The type of the item. Always `shell_call`. + default: shell_call x-stainless-const: true - item_id: + id: type: string - description: | - The ID of the item this reasoning text is associated with. - output_index: - type: integer - description: | - The index of the output item this reasoning text is associated with. - content_index: - type: integer - description: | - The index of the reasoning content part. - text: + description: >- + The unique ID of the shell tool call. Populated when this item is + returned via API. + call_id: type: string - description: | - The full text of the completed reasoning content. - sequence_number: - type: integer - description: | - The sequence number of this event. - required: - - type - - item_id - - output_index - - content_index - - text - - sequence_number - x-oaiMeta: - name: response.reasoning_text.done - group: responses - example: | - { - "type": "response.reasoning_text.done", - "item_id": "rs_123", - "output_index": 0, - "content_index": 0, - "text": "The user is asking...", - "sequence_number": 4 - } - ResponseRefusalDeltaEvent: + description: The unique ID of the shell tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCaller' + description: The execution context that produced this tool call. + - type: 'null' + action: + $ref: '#/components/schemas/FunctionShellAction' + description: >- + The shell commands and limits that describe how to run the tool + call. + status: + $ref: '#/components/schemas/FunctionShellCallStatus' + description: >- + The status of the shell call. One of `in_progress`, `completed`, or + `incomplete`. + environment: + anyOf: + - oneOf: + - $ref: '#/components/schemas/LocalEnvironmentResource' + - $ref: '#/components/schemas/ContainerReferenceResource' + discriminator: + propertyName: type + - type: 'null' + created_by: + type: string + description: The ID of the entity that created this tool call. type: object - description: Emitted when there is a partial refusal text. + required: + - type + - id + - call_id + - action + - status + - environment + title: Shell tool call + description: >- + A tool call that executes one or more shell commands in a managed + environment. + FunctionShellCallOutputStatusEnum: + type: string + enum: + - in_progress + - completed + - incomplete + FunctionShellCallOutputTimeoutOutcome: properties: type: type: string - description: | - The type of the event. Always `response.refusal.delta`. enum: - - response.refusal.delta + - timeout + description: The outcome type. Always `timeout`. + default: timeout x-stainless-const: true - item_id: - type: string - description: | - The ID of the output item that the refusal text is added to. - output_index: - type: integer - description: | - The index of the output item that the refusal text is added to. - content_index: - type: integer - description: | - The index of the content part that the refusal text is added to. - delta: - type: string - description: | - The refusal text that is added. - sequence_number: - type: integer - description: | - The sequence number of this event. + type: object required: - type - - item_id - - output_index - - content_index - - delta - - sequence_number - x-oaiMeta: - name: response.refusal.delta - group: responses - example: | - { - "type": "response.refusal.delta", - "item_id": "msg_123", - "output_index": 0, - "content_index": 0, - "delta": "refusal text so far", - "sequence_number": 1 - } - ResponseRefusalDoneEvent: - type: object - description: Emitted when refusal text is finalized. + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcome: properties: type: type: string - description: | - The type of the event. Always `response.refusal.done`. enum: - - response.refusal.done + - exit + description: The outcome type. Always `exit`. + default: exit x-stainless-const: true - item_id: - type: string - description: | - The ID of the output item that the refusal text is finalized. - output_index: - type: integer - description: | - The index of the output item that the refusal text is finalized. - content_index: - type: integer - description: | - The index of the content part that the refusal text is finalized. - refusal: - type: string - description: | - The refusal text that is finalized. - sequence_number: + exit_code: type: integer - description: | - The sequence number of this event. + description: Exit code from the shell process. + type: object required: - type - - item_id - - output_index - - content_index - - refusal - - sequence_number - x-oaiMeta: - name: response.refusal.done - group: responses - example: | - { - "type": "response.refusal.done", - "item_id": "item-abc", - "output_index": 1, - "content_index": 2, - "refusal": "final refusal text", - "sequence_number": 1 - } - ResponseStreamEvent: - anyOf: - - $ref: '#/components/schemas/ResponseAudioDeltaEvent' - - $ref: '#/components/schemas/ResponseAudioDoneEvent' - - $ref: '#/components/schemas/ResponseAudioTranscriptDeltaEvent' - - $ref: '#/components/schemas/ResponseAudioTranscriptDoneEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCompletedEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallInProgressEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent' - - $ref: '#/components/schemas/ResponseCompletedEvent' - - $ref: '#/components/schemas/ResponseContentPartAddedEvent' - - $ref: '#/components/schemas/ResponseContentPartDoneEvent' - - $ref: '#/components/schemas/ResponseCreatedEvent' - - $ref: '#/components/schemas/ResponseErrorEvent' - - $ref: '#/components/schemas/ResponseFileSearchCallCompletedEvent' - - $ref: '#/components/schemas/ResponseFileSearchCallInProgressEvent' - - $ref: '#/components/schemas/ResponseFileSearchCallSearchingEvent' - - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent' - - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDoneEvent' - - $ref: '#/components/schemas/ResponseInProgressEvent' - - $ref: '#/components/schemas/ResponseFailedEvent' - - $ref: '#/components/schemas/ResponseIncompleteEvent' - - $ref: '#/components/schemas/ResponseOutputItemAddedEvent' - - $ref: '#/components/schemas/ResponseOutputItemDoneEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryPartAddedEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryPartDoneEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryTextDeltaEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryTextDoneEvent' - - $ref: '#/components/schemas/ResponseReasoningTextDeltaEvent' - - $ref: '#/components/schemas/ResponseReasoningTextDoneEvent' - - $ref: '#/components/schemas/ResponseRefusalDeltaEvent' - - $ref: '#/components/schemas/ResponseRefusalDoneEvent' - - $ref: '#/components/schemas/ResponseTextDeltaEvent' - - $ref: '#/components/schemas/ResponseTextDoneEvent' - - $ref: '#/components/schemas/ResponseWebSearchCallCompletedEvent' - - $ref: '#/components/schemas/ResponseWebSearchCallInProgressEvent' - - $ref: '#/components/schemas/ResponseWebSearchCallSearchingEvent' - - $ref: '#/components/schemas/ResponseImageGenCallCompletedEvent' - - $ref: '#/components/schemas/ResponseImageGenCallGeneratingEvent' - - $ref: '#/components/schemas/ResponseImageGenCallInProgressEvent' - - $ref: '#/components/schemas/ResponseImageGenCallPartialImageEvent' - - $ref: '#/components/schemas/ResponseMCPCallArgumentsDeltaEvent' - - $ref: '#/components/schemas/ResponseMCPCallArgumentsDoneEvent' - - $ref: '#/components/schemas/ResponseMCPCallCompletedEvent' - - $ref: '#/components/schemas/ResponseMCPCallFailedEvent' - - $ref: '#/components/schemas/ResponseMCPCallInProgressEvent' - - $ref: '#/components/schemas/ResponseMCPListToolsCompletedEvent' - - $ref: '#/components/schemas/ResponseMCPListToolsFailedEvent' - - $ref: '#/components/schemas/ResponseMCPListToolsInProgressEvent' - - $ref: '#/components/schemas/ResponseOutputTextAnnotationAddedEvent' - - $ref: '#/components/schemas/ResponseQueuedEvent' - - $ref: '#/components/schemas/ResponseCustomToolCallInputDeltaEvent' - - $ref: '#/components/schemas/ResponseCustomToolCallInputDoneEvent' - discriminator: - propertyName: type - ResponseStreamOptions: - anyOf: - - description: > - Options for streaming responses. Only set this when you set `stream: - true`. - type: object - default: null - properties: - include_obfuscation: - type: boolean - description: > - When true, stream obfuscation will be enabled. Stream - obfuscation adds - - random characters to an `obfuscation` field on streaming delta - events to - - normalize payload sizes as a mitigation to certain side-channel - attacks. - - These obfuscation fields are included by default, but add a - small amount - - of overhead to the data stream. You can set - `include_obfuscation` to - - false to optimize for bandwidth if you trust the network links - between - - your application and the OpenAI API. - - type: 'null' - ResponseTextDeltaEvent: - type: object - description: Emitted when there is an additional text delta. + - exit_code + title: Shell call exit outcome + description: Indicates that the shell commands finished and returned an exit code. + FunctionShellCallOutputContent: properties: - type: + stdout: type: string - description: | - The type of the event. Always `response.output_text.delta`. - enum: - - response.output_text.delta - x-stainless-const: true - item_id: + description: The standard output that was captured. + stderr: type: string - description: | - The ID of the output item that the text delta was added to. - output_index: - type: integer - description: | - The index of the output item that the text delta was added to. - content_index: - type: integer - description: | - The index of the content part that the text delta was added to. - delta: + description: The standard error output that was captured. + outcome: + oneOf: + - $ref: '#/components/schemas/FunctionShellCallOutputTimeoutOutcome' + - $ref: '#/components/schemas/FunctionShellCallOutputExitOutcome' + title: Shell call outcome + description: >- + Represents either an exit outcome (with an exit code) or a timeout + outcome for a shell call output chunk. + discriminator: + propertyName: type + created_by: type: string - description: | - The text delta that was added. - sequence_number: - type: integer - description: The sequence number for this event. - logprobs: - type: array - description: | - The log probabilities of the tokens in the delta. - items: - $ref: '#/components/schemas/ResponseLogProb' - required: - - type - - item_id - - output_index - - content_index - - delta - - sequence_number - - logprobs - x-oaiMeta: - name: response.output_text.delta - group: responses - example: | - { - "type": "response.output_text.delta", - "item_id": "msg_123", - "output_index": 0, - "content_index": 0, - "delta": "In", - "sequence_number": 1 - } - ResponseTextDoneEvent: + description: The identifier of the actor that created the item. type: object - description: Emitted when text content is finalized. + required: + - stdout + - stderr + - outcome + title: Shell call output content + description: The content of a shell tool call output that was emitted. + FunctionShellCallOutput: properties: type: type: string - description: | - The type of the event. Always `response.output_text.done`. enum: - - response.output_text.done + - shell_call_output + description: The type of the shell call output. Always `shell_call_output`. + default: shell_call_output x-stainless-const: true - item_id: + id: type: string - description: | - The ID of the output item that the text content is finalized. - output_index: - type: integer - description: | - The index of the output item that the text content is finalized. - content_index: - type: integer - description: | - The index of the content part that the text content is finalized. - text: + description: >- + The unique ID of the shell call output. Populated when this item is + returned via API. + call_id: type: string - description: | - The text content that is finalized. - sequence_number: - type: integer - description: The sequence number for this event. - logprobs: - type: array - description: | - The log probabilities of the tokens in the delta. + description: The unique ID of the shell tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCaller' + description: The execution context that produced this tool call. + - type: 'null' + status: + $ref: '#/components/schemas/FunctionShellCallOutputStatusEnum' + description: >- + The status of the shell call output. One of `in_progress`, + `completed`, or `incomplete`. + output: items: - $ref: '#/components/schemas/ResponseLogProb' - required: - - type - - item_id - - output_index - - content_index - - text - - sequence_number - - logprobs - x-oaiMeta: - name: response.output_text.done - group: responses - example: | - { - "type": "response.output_text.done", - "item_id": "msg_123", - "output_index": 0, - "content_index": 0, - "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", - "sequence_number": 1 - } - ResponseTextParam: - type: object - description: | - Configuration options for a text response from the model. Can be plain - text or structured JSON data. Learn more: - - [Text inputs and outputs](/docs/guides/text) - - [Structured Outputs](/docs/guides/structured-outputs) - properties: - format: - $ref: '#/components/schemas/TextResponseFormatConfiguration' - verbosity: - $ref: '#/components/schemas/Verbosity' - ResponseUsage: + $ref: '#/components/schemas/FunctionShellCallOutputContent' + type: array + description: An array of shell call output contents + max_output_length: + anyOf: + - type: integer + description: >- + The maximum length of the shell command output. This is + generated by the model and should be passed back with the raw + output. + - type: 'null' + created_by: + type: string + description: The identifier of the actor that created the item. type: object - description: | - Represents token usage details including input tokens, output tokens, - a breakdown of output tokens, and the total tokens used. - properties: - input_tokens: - type: integer - description: The number of input tokens. - input_tokens_details: - type: object - description: A detailed breakdown of the input tokens. - properties: - cached_tokens: - type: integer - description: | - The number of tokens that were retrieved from the cache. - [More on prompt caching](/docs/guides/prompt-caching). - required: - - cached_tokens - output_tokens: - type: integer - description: The number of output tokens. - output_tokens_details: - type: object - description: A detailed breakdown of the output tokens. - properties: - reasoning_tokens: - type: integer - description: The number of reasoning tokens. - required: - - reasoning_tokens - total_tokens: - type: integer - description: The total number of tokens used. required: - - input_tokens - - input_tokens_details - - output_tokens - - output_tokens_details - - total_tokens - ResponseWebSearchCallCompletedEvent: - type: object - description: Emitted when a web search call is completed. + - type + - id + - call_id + - status + - output + - max_output_length + title: Shell call output + description: The output of a shell tool call that was emitted. + ApplyPatchCallStatus: + type: string + enum: + - in_progress + - completed + ApplyPatchCreateFileOperation: properties: type: type: string - description: | - The type of the event. Always `response.web_search_call.completed`. enum: - - response.web_search_call.completed + - create_file + description: Create a new file with the provided diff. + default: create_file x-stainless-const: true - output_index: - type: integer - description: > - The index of the output item that the web search call is associated - with. - item_id: + path: type: string - description: | - Unique ID for the output item associated with the web search call. - sequence_number: - type: integer - description: The sequence number of the web search call being processed. + description: Path of the file to create. + diff: + type: string + description: Diff to apply. + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.web_search_call.completed - group: responses - example: | - { - "type": "response.web_search_call.completed", - "output_index": 0, - "item_id": "ws_123", - "sequence_number": 0 - } - ResponseWebSearchCallInProgressEvent: - type: object - description: Emitted when a web search call is initiated. + - path + - diff + title: Apply patch create file operation + description: Instruction describing how to create a file via the apply_patch tool. + ApplyPatchDeleteFileOperation: properties: type: type: string - description: > - The type of the event. Always - `response.web_search_call.in_progress`. enum: - - response.web_search_call.in_progress + - delete_file + description: Delete the specified file. + default: delete_file x-stainless-const: true - output_index: - type: integer - description: > - The index of the output item that the web search call is associated - with. - item_id: + path: type: string - description: | - Unique ID for the output item associated with the web search call. - sequence_number: - type: integer - description: The sequence number of the web search call being processed. + description: Path of the file to delete. + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.web_search_call.in_progress - group: responses - example: | - { - "type": "response.web_search_call.in_progress", - "output_index": 0, - "item_id": "ws_123", - "sequence_number": 0 - } - ResponseWebSearchCallSearchingEvent: - type: object - description: Emitted when a web search call is executing. + - path + title: Apply patch delete file operation + description: Instruction describing how to delete a file via the apply_patch tool. + ApplyPatchUpdateFileOperation: properties: type: type: string - description: | - The type of the event. Always `response.web_search_call.searching`. enum: - - response.web_search_call.searching + - update_file + description: Update an existing file with the provided diff. + default: update_file x-stainless-const: true - output_index: - type: integer - description: > - The index of the output item that the web search call is associated - with. - item_id: + path: type: string - description: | - Unique ID for the output item associated with the web search call. - sequence_number: - type: integer - description: The sequence number of the web search call being processed. + description: Path of the file to update. + diff: + type: string + description: Diff to apply. + type: object required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.web_search_call.searching - group: responses - example: | - { - "type": "response.web_search_call.searching", - "output_index": 0, - "item_id": "ws_123", - "sequence_number": 0 - } - ResponsesClientEvent: - discriminator: - propertyName: type - description: | - Client events accepted by the Responses WebSocket server. - anyOf: - - $ref: '#/components/schemas/ResponsesClientEventResponseCreate' - ResponsesClientEventResponseCreate: - allOf: - - type: object - properties: - type: - type: string - enum: - - response.create - description: | - The type of the client event. Always `response.create`. - x-stainless-const: true - required: - - type - - $ref: '#/components/schemas/CreateResponse' - description: > - Client event for creating a response over a persistent WebSocket - connection. - - This payload uses the same top-level fields as `POST /v1/responses`. - - - Notes: - - - `stream` is implicit over WebSocket and should not be sent. - - - `background` is not supported over WebSocket. - ResponsesServerEvent: - discriminator: - propertyName: type - description: | - Server events emitted by the Responses WebSocket server. - anyOf: - - $ref: '#/components/schemas/ResponseStreamEvent' - Role: - type: object - description: Details about a role that can be assigned through the public Roles API. + - path + - diff + title: Apply patch update file operation + description: Instruction describing how to update a file via the apply_patch tool. + ApplyPatchToolCall: properties: - object: + type: type: string enum: - - role - description: Always `role`. + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call x-stainless-const: true id: type: string - description: Identifier for the role. - name: + description: >- + The unique ID of the apply patch tool call. Populated when this item + is returned via API. + call_id: type: string - description: Unique name for the role. - description: - description: Optional description of the role. + description: The unique ID of the apply patch tool call generated by the model. + caller: anyOf: - - type: string + - $ref: '#/components/schemas/ToolCallCaller' + description: The execution context that produced this tool call. - type: 'null' - permissions: - type: array - description: Permissions granted by the role. - items: - type: string - resource_type: - type: string + status: + $ref: '#/components/schemas/ApplyPatchCallStatus' description: >- - Resource type the role is bound to (for example `api.organization` - or `api.project`). - predefined_role: - type: boolean - description: Whether the role is predefined and managed by OpenAI. + The status of the apply patch tool call. One of `in_progress` or + `completed`. + operation: + oneOf: + - $ref: '#/components/schemas/ApplyPatchCreateFileOperation' + - $ref: '#/components/schemas/ApplyPatchDeleteFileOperation' + - $ref: '#/components/schemas/ApplyPatchUpdateFileOperation' + title: Apply patch operation + description: >- + One of the create_file, delete_file, or update_file operations + applied via apply_patch. + discriminator: + propertyName: type + created_by: + type: string + description: The ID of the entity that created this tool call. + type: object required: - - object + - type - id - - name - - description - - permissions - - resource_type - - predefined_role - x-oaiMeta: - name: The role object - example: | - { - "object": "role", - "id": "role_01J1F8ROLE01", - "name": "API Group Manager", - "description": "Allows managing organization groups", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "resource_type": "api.organization", - "predefined_role": false - } - RoleDeletedResource: - type: object - description: Confirmation payload returned after deleting a role. + - call_id + - status + - operation + title: Apply patch tool call + description: >- + A tool call that applies file diffs by creating, deleting, or updating + files. + ApplyPatchCallOutputStatus: + type: string + enum: + - completed + - failed + ApplyPatchToolCallOutput: properties: - object: + type: type: string enum: - - role.deleted - description: Always `role.deleted`. + - apply_patch_call_output + description: The type of the item. Always `apply_patch_call_output`. + default: apply_patch_call_output x-stainless-const: true id: type: string - description: Identifier of the deleted role. - deleted: - type: boolean - description: Whether the role was deleted. + description: >- + The unique ID of the apply patch tool call output. Populated when + this item is returned via API. + call_id: + type: string + description: The unique ID of the apply patch tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCaller' + description: The execution context that produced this tool call. + - type: 'null' + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatus' + description: >- + The status of the apply patch tool call output. One of `completed` + or `failed`. + output: + anyOf: + - type: string + description: Optional textual output returned by the apply patch tool. + - type: 'null' + created_by: + type: string + description: The ID of the entity that created this tool call output. + type: object required: - - object + - type - id - - deleted - x-oaiMeta: - name: Role deletion confirmation - example: | - { - "object": "role.deleted", - "id": "role_01J1F8ROLE01", - "deleted": true - } - RoleListResource: - type: object - description: Paginated list of roles assigned to a principal. + - call_id + - status + title: Apply patch tool call output + description: The output emitted by an apply patch tool call. + MCPToolCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + - calling + - failed + DetailEnum: + type: string + enum: + - low + - high + - auto + - original + FunctionCallItemStatus: + type: string + enum: + - in_progress + - completed + - incomplete + ComputerCallOutputItemParam: properties: - object: + id: + anyOf: + - type: string + description: The ID of the computer tool call output. + example: cuo_123 + - type: 'null' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The ID of the computer tool call that produced the output. + type: type: string enum: - - list - description: Always `list`. - x-stainless-const: true - data: - type: array - description: Role assignments returned in the current page. - items: - $ref: '#/components/schemas/AssignedRoleDetails' - has_more: - type: boolean - description: Whether additional assignments are available when paginating. - next: + - computer_call_output description: >- - Cursor to fetch the next page of results, or `null` when there are - no more assignments. + The type of the computer tool call output. Always + `computer_call_output`. + default: computer_call_output + x-stainless-const: true + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + acknowledged_safety_checks: anyOf: - - type: string + - items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + type: array + description: >- + The safety checks reported by the API that have been + acknowledged by the developer. + - type: 'null' + status: + anyOf: + - $ref: '#/components/schemas/FunctionCallItemStatus' + description: >- + The status of the message input. One of `in_progress`, + `completed`, or `incomplete`. Populated when input items are + returned via API. - type: 'null' - required: - - object - - data - - has_more - - next - x-oaiMeta: - name: Assigned role list - example: | - { - "object": "list", - "data": [ - { - "id": "role_01J1F8ROLE01", - "name": "API Group Manager", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "resource_type": "api.organization", - "predefined_role": false, - "description": "Allows managing organization groups", - "created_at": 1711471533, - "updated_at": 1711472599, - "created_by": "user_abc123", - "created_by_user_obj": { - "id": "user_abc123", - "name": "Ada Lovelace", - "email": "ada@example.com" - }, - "metadata": {}, - "assignment_sources": null - } - ], - "has_more": false, - "next": null - } - RunCompletionUsage: - anyOf: - - type: object - description: >- - Usage statistics related to the run. This value will be `null` if - the run is not in a terminal state (i.e. `in_progress`, `queued`, - etc.). - properties: - completion_tokens: - type: integer - description: Number of completion tokens used over the course of the run. - prompt_tokens: - type: integer - description: Number of prompt tokens used over the course of the run. - total_tokens: - type: integer - description: Total number of tokens used (prompt + completion). - required: - - prompt_tokens - - completion_tokens - - total_tokens - - type: 'null' - RunGraderRequest: type: object - title: RunGraderRequest + required: + - call_id + - type + - output + title: Computer tool call output + description: The output of a computer tool call. + InputTextContentParam: properties: - grader: - type: object - description: The grader used for the fine-tuning job. - oneOf: - - $ref: '#/components/schemas/GraderStringCheck' - - $ref: '#/components/schemas/GraderTextSimilarity' - - $ref: '#/components/schemas/GraderPython' - - $ref: '#/components/schemas/GraderScoreModel' - - $ref: '#/components/schemas/GraderMulti' - item: - type: object - description: > - The dataset item provided to the grader. This will be used to - populate - - the `item` namespace. See [the guide](/docs/guides/graders) for more - details. - model_sample: + type: type: string - description: > - The model sample to be evaluated. This value will be used to - populate - - the `sample` namespace. See [the guide](/docs/guides/graders) for - more details. - - The `output_json` variable will be populated if the model sample is - a - - valid JSON string. - - required: - - grader - - model_sample - RunGraderResponse: + enum: + - input_text + description: The type of the input item. Always `input_text`. + default: input_text + x-stainless-const: true + text: + type: string + maxLength: 10485760 + description: The text input to the model. + prompt_cache_breakpoint: + anyOf: + - $ref: '#/components/schemas/PromptCacheBreakpointParam' + - type: 'null' type: object + required: + - type + - text + title: Input text + description: A text input to the model. + InputImageContentParamAutoParam: properties: - reward: - type: number - metadata: - type: object - properties: - name: - type: string - type: - type: string - errors: - type: object - properties: - formula_parse_error: - type: boolean - sample_parse_error: - type: boolean - truncated_observation_error: - type: boolean - unresponsive_reward_error: - type: boolean - invalid_variable_error: - type: boolean - other_error: - type: boolean - python_grader_server_error: - type: boolean - python_grader_server_error_type: - anyOf: - - type: string - - type: 'null' - python_grader_runtime_error: - type: boolean - python_grader_runtime_error_details: - anyOf: - - type: string - - type: 'null' - model_grader_server_error: - type: boolean - model_grader_refusal_error: - type: boolean - model_grader_parse_error: - type: boolean - model_grader_server_error_details: - anyOf: - - type: string - - type: 'null' - required: - - formula_parse_error - - sample_parse_error - - truncated_observation_error - - unresponsive_reward_error - - invalid_variable_error - - other_error - - python_grader_server_error - - python_grader_server_error_type - - python_grader_runtime_error - - python_grader_runtime_error_details - - model_grader_server_error - - model_grader_refusal_error - - model_grader_parse_error - - model_grader_server_error_details - execution_time: - type: number - scores: - type: object - additionalProperties: {} - token_usage: - anyOf: - - type: integer - - type: 'null' - sampled_model_name: - anyOf: - - type: string - - type: 'null' - required: - - name - - type - - errors - - execution_time - - scores - - token_usage - - sampled_model_name - sub_rewards: - type: object - additionalProperties: {} - model_grader_token_usage_per_model: - type: object - additionalProperties: {} + type: + type: string + enum: + - input_image + description: The type of the input item. Always `input_image`. + default: input_image + x-stainless-const: true + image_url: + anyOf: + - type: string + maxLength: 20971520 + format: uri + description: >- + The URL of the image to be sent to the model. A fully qualified + URL or base64 encoded image in a data URL. + - type: 'null' + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + example: file-123 + - type: 'null' + detail: + anyOf: + - $ref: '#/components/schemas/DetailEnum' + description: >- + The detail level of the image to be sent to the model. One of + `high`, `low`, `auto`, or `original`. Defaults to `auto`. + - type: 'null' + prompt_cache_breakpoint: + anyOf: + - $ref: '#/components/schemas/PromptCacheBreakpointParam' + - type: 'null' + type: object required: - - reward - - metadata - - sub_rewards - - model_grader_token_usage_per_model - RunObject: + - type + title: Input image + description: >- + An image input to the model. Learn about [image + inputs](/docs/guides/vision) + FileDetailEnum: + type: string + enum: + - auto + - low + - high + InputFileContentParam: + properties: + type: + type: string + enum: + - input_file + description: The type of the input item. Always `input_file`. + default: input_file + x-stainless-const: true + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + example: file-123 + - type: 'null' + filename: + anyOf: + - type: string + description: The name of the file to be sent to the model. + - type: 'null' + file_data: + anyOf: + - type: string + maxLength: 73400320 + description: The base64-encoded data of the file to be sent to the model. + - type: 'null' + file_url: + anyOf: + - type: string + format: uri + description: The URL of the file to be sent to the model. + - type: 'null' + detail: + $ref: '#/components/schemas/FileDetailEnum' + description: >- + 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`. + prompt_cache_breakpoint: + anyOf: + - $ref: '#/components/schemas/PromptCacheBreakpointParam' + - type: 'null' type: object - title: A run on a thread - description: Represents an execution run on a [thread](/docs/api-reference/threads). + required: + - type + title: Input file + description: A file input to the model. + FunctionCallOutputItemParam: properties: id: - description: The identifier, which can be referenced in API endpoints. + anyOf: + - type: string + description: >- + The unique ID of the function tool call output. Populated when + this item is returned via API. + example: fc_123 + - type: 'null' + call_id: type: string - object: - description: The object type, which is always `thread.run`. + maxLength: 64 + minLength: 1 + description: The unique ID of the function tool call generated by the model. + type: type: string enum: - - thread.run + - function_call_output + description: >- + The type of the function tool call output. Always + `function_call_output`. + default: function_call_output x-stainless-const: true - created_at: - description: The Unix timestamp (in seconds) for when the run was created. + output: + oneOf: + - type: string + maxLength: 10485760 + description: A JSON string of the output of the function tool call. + - items: + oneOf: + - $ref: '#/components/schemas/InputTextContentParam' + - $ref: '#/components/schemas/InputImageContentParamAutoParam' + - $ref: '#/components/schemas/InputFileContentParam' + description: A piece of message content, such as text, an image, or a file. + discriminator: + propertyName: type + type: array + description: >- + An array of content outputs (text, image, file) for the function + tool call. + description: Text, image, or file output of the function tool call. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' + status: + anyOf: + - $ref: '#/components/schemas/FunctionCallItemStatus' + description: >- + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + - type: 'null' + type: object + required: + - call_id + - type + - output + title: Function tool call output + description: The output of a function tool call. + FileCitationParam: + properties: + type: + type: string + enum: + - file_citation + description: The citation type. Always `file_citation`. + default: file_citation + x-stainless-const: true + index: type: integer - format: unixtime - thread_id: - description: >- - The ID of the [thread](/docs/api-reference/threads) that was - executed on as a part of this run. + minimum: 0 + description: The index of the file in the list of files. + file_id: type: string - assistant_id: - description: >- - The ID of the [assistant](/docs/api-reference/assistants) used for - execution of this run. + description: The ID of the file. + example: file-123 + filename: type: string - status: - description: >- - The status of the run, which can be either `queued`, `in_progress`, - `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, - `incomplete`, or `expired`. + description: The filename of the file cited. + type: object + required: + - type + - index + - file_id + - filename + UrlCitationParam: + properties: + type: type: string enum: - - queued - - in_progress - - requires_action - - cancelling - - cancelled - - failed - - completed - - incomplete - - expired - required_action: - type: object - description: >- - Details on the action required to continue the run. Will be `null` - if no action is required. - nullable: true - properties: - type: - description: For now, this is always `submit_tool_outputs`. - type: string - enum: - - submit_tool_outputs - x-stainless-const: true - submit_tool_outputs: - type: object - description: Details on the tool outputs needed for this run to continue. - properties: - tool_calls: - type: array - description: A list of the relevant tool calls. - items: - $ref: '#/components/schemas/RunToolCallObject' - required: - - tool_calls - required: - - type - - submit_tool_outputs - last_error: - type: object - description: >- - The last error associated with this run. Will be `null` if there are - no errors. - nullable: true - properties: - code: - type: string - description: >- - One of `server_error`, `rate_limit_exceeded`, or - `invalid_prompt`. - enum: - - server_error - - rate_limit_exceeded - - invalid_prompt - message: - type: string - description: A human-readable description of the error. - required: - - code - - message - expires_at: - description: The Unix timestamp (in seconds) for when the run will expire. - type: integer - format: unixtime - nullable: true - started_at: - description: The Unix timestamp (in seconds) for when the run was started. + - url_citation + description: The citation type. Always `url_citation`. + default: url_citation + x-stainless-const: true + start_index: type: integer - format: unixtime - nullable: true - cancelled_at: - description: The Unix timestamp (in seconds) for when the run was cancelled. + minimum: 0 + description: The index of the first character of the citation in the message. + end_index: type: integer - format: unixtime - nullable: true - failed_at: - description: The Unix timestamp (in seconds) for when the run failed. + minimum: 0 + description: The index of the last character of the citation in the message. + url: + type: string + format: uri + description: The URL of the cited resource. + title: + type: string + description: The title of the cited resource. + type: object + required: + - type + - start_index + - end_index + - url + - title + ContainerFileCitationParam: + properties: + type: + type: string + enum: + - container_file_citation + description: The citation type. Always `container_file_citation`. + default: container_file_citation + x-stainless-const: true + start_index: type: integer - format: unixtime - nullable: true - completed_at: - description: The Unix timestamp (in seconds) for when the run was completed. + minimum: 0 + description: The index of the first character of the citation in the message. + end_index: type: integer - format: unixtime - nullable: true - incomplete_details: - description: >- - Details on why the run is incomplete. Will be `null` if the run is - not incomplete. - type: object - nullable: true - properties: - reason: - description: >- - The reason why the run is incomplete. This will point to which - specific token limit was reached over the course of the run. - type: string - enum: - - max_completion_tokens - - max_prompt_tokens - model: - description: >- - The model that the [assistant](/docs/api-reference/assistants) used - for this run. + minimum: 0 + description: The index of the last character of the citation in the message. + container_id: type: string - instructions: - description: >- - The instructions that the - [assistant](/docs/api-reference/assistants) used for this run. + description: The ID of the container. + example: cntr_123 + file_id: + type: string + description: The ID of the container file. + example: cfile_123 + filename: + type: string + description: The filename of the container file cited. + type: object + required: + - type + - start_index + - end_index + - container_id + - file_id + - filename + ToolSearchCallItemParam: + properties: + id: + anyOf: + - type: string + description: The unique ID of this tool search call. + example: tsc_123 + - type: 'null' + call_id: + anyOf: + - type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the tool search call generated by the model. + - type: 'null' + type: + type: string + enum: + - tool_search_call + description: The item type. Always `tool_search_call`. + default: tool_search_call + x-stainless-const: true + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search was executed by the server or by the client. + arguments: + $ref: '#/components/schemas/EmptyModelParam' + description: The arguments supplied to the tool search call. + status: + anyOf: + - $ref: '#/components/schemas/FunctionCallItemStatus' + description: The status of the tool search call. + - type: 'null' + type: object + required: + - type + - arguments + ToolSearchOutputItemParam: + properties: + id: + anyOf: + - type: string + description: The unique ID of this tool search output. + example: tso_123 + - type: 'null' + call_id: + anyOf: + - type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the tool search call generated by the model. + - type: 'null' + type: type: string + enum: + - tool_search_output + description: The item type. Always `tool_search_output`. + default: tool_search_output + x-stainless-const: true + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search was executed by the server or by the client. tools: - description: >- - The list of tools that the - [assistant](/docs/api-reference/assistants) used for this run. - default: [] - type: array - maxItems: 20 items: - oneOf: - - $ref: '#/components/schemas/AssistantToolsCode' - - $ref: '#/components/schemas/AssistantToolsFileSearch' - - $ref: '#/components/schemas/AssistantToolsFunction' - metadata: - $ref: '#/components/schemas/Metadata' - usage: - $ref: '#/components/schemas/RunCompletionUsage' - temperature: - description: >- - The sampling temperature used for this run. If not set, defaults to - 1. - type: number - nullable: true - top_p: - description: >- - The nucleus sampling value used for this run. If not set, defaults - to 1. - type: number - nullable: true - max_prompt_tokens: - type: integer - nullable: true - description: > - The maximum number of prompt tokens specified to have been used over - the course of the run. - minimum: 256 - max_completion_tokens: - type: integer - nullable: true - description: > - The maximum number of completion tokens specified to have been used - over the course of the run. - minimum: 256 - truncation_strategy: - allOf: - - $ref: '#/components/schemas/TruncationObject' - - nullable: true - tool_choice: - allOf: - - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' - - nullable: true - parallel_tool_calls: - $ref: '#/components/schemas/ParallelToolCalls' - response_format: - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' - nullable: true - required: - - id - - object - - created_at - - thread_id - - assistant_id - - status - - required_action - - last_error - - expires_at - - started_at - - cancelled_at - - failed_at - - completed_at - - model - - instructions - - tools - - metadata - - usage - - incomplete_details - - max_prompt_tokens - - max_completion_tokens - - truncation_strategy - - tool_choice - - parallel_tool_calls - - response_format - x-oaiMeta: - name: The run object - beta: true - example: | - { - "id": "run_abc123", - "object": "thread.run", - "created_at": 1698107661, - "assistant_id": "asst_abc123", - "thread_id": "thread_abc123", - "status": "completed", - "started_at": 1699073476, - "expires_at": null, - "cancelled_at": null, - "failed_at": null, - "completed_at": 1699073498, - "last_error": null, - "model": "gpt-4o", - "instructions": null, - "tools": [{"type": "file_search"}, {"type": "code_interpreter"}], - "metadata": {}, - "incomplete_details": null, - "usage": { - "prompt_tokens": 123, - "completion_tokens": 456, - "total_tokens": 579 - }, - "temperature": 1.0, - "top_p": 1.0, - "max_prompt_tokens": 1000, - "max_completion_tokens": 1000, - "truncation_strategy": { - "type": "auto", - "last_messages": null - }, - "response_format": "auto", - "tool_choice": "auto", - "parallel_tool_calls": true - } - RunStepCompletionUsage: - anyOf: - - type: object + $ref: '#/components/schemas/Tool' + type: array + description: The loaded tool definitions returned by the tool search output. + status: + anyOf: + - $ref: '#/components/schemas/FunctionCallItemStatus' + description: The status of the tool search output. + - type: 'null' + type: object + required: + - type + - tools + AdditionalToolsItemParam: + properties: + id: + anyOf: + - type: string + description: The unique ID of this additional tools item. + example: at_123 + - type: 'null' + type: + type: string + enum: + - additional_tools + description: The item type. Always `additional_tools`. + default: additional_tools + x-stainless-const: true + role: + type: string + enum: + - developer description: >- - Usage statistics related to the run step. This value will be `null` - while the run step's status is `in_progress`. - properties: - completion_tokens: - type: integer + The role that provided the additional tools. Only `developer` is + supported. + default: developer + x-stainless-const: true + tools: + items: + $ref: '#/components/schemas/Tool' + type: array + description: A list of additional tools made available at this item. + type: object + required: + - type + - role + - tools + CompactionSummaryItemParam: + properties: + id: + anyOf: + - type: string + description: The ID of the compaction item. + example: cmp_123 + - type: 'null' + type: + type: string + enum: + - compaction + description: The type of the item. Always `compaction`. + default: compaction + x-stainless-const: true + encrypted_content: + type: string + maxLength: 10485760 + description: The encrypted content of the compaction summary. + type: object + required: + - type + - encrypted_content + title: Compaction item + description: >- + A compaction item generated by the [`v1/responses/compact` + API](/docs/api-reference/responses/compact). + FunctionShellActionParam: + properties: + commands: + items: + type: string + type: array + description: Ordered shell commands for the execution environment to run. + timeout_ms: + anyOf: + - type: integer description: >- - Number of completion tokens used over the course of the run - step. - prompt_tokens: - type: integer - description: Number of prompt tokens used over the course of the run step. - total_tokens: - type: integer - description: Total number of tokens used (prompt + completion). - required: - - prompt_tokens - - completion_tokens - - total_tokens - - type: 'null' - RunStepDeltaObject: + Maximum wall-clock time in milliseconds to allow the shell + commands to run. + - type: 'null' + max_output_length: + anyOf: + - type: integer + description: >- + Maximum number of UTF-8 characters to capture from combined + stdout and stderr output. + - type: 'null' type: object - title: Run step delta object - description: > - Represents a run step delta i.e. any changed fields on a run step during - streaming. + required: + - commands + title: Shell action + description: Commands and limits describing how to run the shell tool call. + FunctionShellCallItemStatus: + type: string + enum: + - in_progress + - completed + - incomplete + title: Shell call status + description: Status values reported for shell tool calls. + FunctionShellCallItemParam: properties: id: - description: >- - The identifier of the run step, which can be referenced in API - endpoints. + anyOf: + - type: string + description: >- + The unique ID of the shell tool call. Populated when this item + is returned via API. + example: sh_123 + - type: 'null' + call_id: type: string - object: - description: The object type, which is always `thread.run.step.delta`. + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' + type: type: string enum: - - thread.run.step.delta + - shell_call + description: The type of the item. Always `shell_call`. + default: shell_call x-stainless-const: true - delta: - description: The delta containing the fields that have changed on the run step. - type: object - properties: - step_details: - type: object - description: The details of the run step. - oneOf: - - $ref: >- - #/components/schemas/RunStepDeltaStepDetailsMessageCreationObject - - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsObject' + action: + $ref: '#/components/schemas/FunctionShellActionParam' + description: >- + The shell commands and limits that describe how to run the tool + call. + status: + anyOf: + - $ref: '#/components/schemas/FunctionShellCallItemStatus' + description: >- + The status of the shell call. One of `in_progress`, `completed`, + or `incomplete`. + - type: 'null' + environment: + anyOf: + - oneOf: + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + description: The environment to execute the shell commands in. + discriminator: + propertyName: type + - type: 'null' + type: object required: - - id - - object - - delta - x-oaiMeta: - name: The run step delta object - beta: true - example: | - { - "id": "step_123", - "object": "thread.run.step.delta", - "delta": { - "step_details": { - "type": "tool_calls", - "tool_calls": [ - { - "index": 0, - "id": "call_123", - "type": "code_interpreter", - "code_interpreter": { "input": "", "outputs": [] } - } - ] - } - } - } - RunStepDeltaStepDetailsMessageCreationObject: - title: Message creation + - call_id + - type + - action + title: Shell tool call + description: A tool representing a request to execute one or more shell commands. + FunctionShellCallOutputTimeoutOutcomeParam: + properties: + type: + type: string + enum: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true type: object - description: Details of the message creation by the run step. + required: + - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcomeParam: properties: type: - description: Always `message_creation`. type: string enum: - - message_creation + - exit + description: The outcome type. Always `exit`. + default: exit x-stainless-const: true - message_creation: - type: object - properties: - message_id: - type: string - description: The ID of the message that was created by this run step. + exit_code: + type: integer + description: The exit code returned by the shell process. + type: object required: - type - RunStepDeltaStepDetailsToolCallsCodeObject: - title: Code interpreter tool call + - exit_code + title: Shell call exit outcome + description: Indicates that the shell commands finished and returned an exit code. + FunctionShellCallOutputOutcomeParam: + oneOf: + - $ref: '#/components/schemas/FunctionShellCallOutputTimeoutOutcomeParam' + - $ref: '#/components/schemas/FunctionShellCallOutputExitOutcomeParam' + title: Shell call outcome + description: The exit or timeout outcome associated with this shell call. + discriminator: + propertyName: type + FunctionShellCallOutputContentParam: + properties: + stdout: + type: string + maxLength: 10485760 + description: Captured stdout output for the shell call. + stderr: + type: string + maxLength: 10485760 + description: Captured stderr output for the shell call. + outcome: + $ref: '#/components/schemas/FunctionShellCallOutputOutcomeParam' + description: The exit or timeout outcome associated with this shell call. type: object - description: Details of the Code Interpreter tool call the run step was involved in. + required: + - stdout + - stderr + - outcome + title: Shell output content + description: Captured stdout and stderr for a portion of a shell tool call output. + FunctionShellCallOutputItemParam: properties: - index: - type: integer - description: The index of the tool call in the tool calls array. id: + anyOf: + - type: string + description: >- + The unique ID of the shell tool call output. Populated when this + item is returned via API. + example: sho_123 + - type: 'null' + call_id: type: string - description: The ID of the tool call. + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' type: type: string + enum: + - shell_call_output + description: The type of the item. Always `shell_call_output`. + default: shell_call_output + x-stainless-const: true + output: + items: + $ref: '#/components/schemas/FunctionShellCallOutputContentParam' + type: array description: >- - The type of tool call. This is always going to be `code_interpreter` - for this type of tool call. + Captured chunks of stdout and stderr output, along with their + associated outcomes. + status: + anyOf: + - $ref: '#/components/schemas/FunctionShellCallItemStatus' + description: The status of the shell call output. + - type: 'null' + max_output_length: + anyOf: + - type: integer + description: >- + The maximum number of UTF-8 characters captured for this shell + call's combined output. + - type: 'null' + type: object + required: + - call_id + - type + - output + title: Shell tool call output + description: The streamed output items emitted by a shell tool call. + ApplyPatchCallStatusParam: + type: string + enum: + - in_progress + - completed + title: Apply patch call status + description: Status values reported for apply_patch tool calls. + ApplyPatchCreateFileOperationParam: + properties: + type: + type: string enum: - - code_interpreter + - create_file + description: The operation type. Always `create_file`. + default: create_file x-stainless-const: true - code_interpreter: - type: object - description: The Code Interpreter tool call definition. - properties: - input: - type: string - description: The input to the Code Interpreter tool call. - outputs: - type: array + path: + type: string + minLength: 1 + description: Path of the file to create relative to the workspace root. + diff: + type: string + maxLength: 10485760 + description: Unified diff content to apply when creating the file. + type: object + required: + - type + - path + - diff + title: Apply patch create file operation + description: Instruction for creating a new file via the apply_patch tool. + ApplyPatchDeleteFileOperationParam: + properties: + type: + type: string + enum: + - delete_file + description: The operation type. Always `delete_file`. + default: delete_file + x-stainless-const: true + path: + type: string + minLength: 1 + description: Path of the file to delete relative to the workspace root. + type: object + required: + - type + - path + title: Apply patch delete file operation + description: Instruction for deleting an existing file via the apply_patch tool. + ApplyPatchUpdateFileOperationParam: + properties: + type: + type: string + enum: + - update_file + description: The operation type. Always `update_file`. + default: update_file + x-stainless-const: true + path: + type: string + minLength: 1 + description: Path of the file to update relative to the workspace root. + diff: + type: string + maxLength: 10485760 + description: Unified diff content to apply to the existing file. + type: object + required: + - type + - path + - diff + title: Apply patch update file operation + description: Instruction for updating an existing file via the apply_patch tool. + ApplyPatchOperationParam: + oneOf: + - $ref: '#/components/schemas/ApplyPatchCreateFileOperationParam' + - $ref: '#/components/schemas/ApplyPatchDeleteFileOperationParam' + - $ref: '#/components/schemas/ApplyPatchUpdateFileOperationParam' + title: Apply patch operation + description: >- + One of the create_file, delete_file, or update_file operations supplied + to the apply_patch tool. + discriminator: + propertyName: type + ApplyPatchToolCallItemParam: + properties: + type: + type: string + enum: + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call + x-stainless-const: true + id: + anyOf: + - type: string description: >- - The outputs from the Code Interpreter tool call. Code - Interpreter can output one or more items, including text - (`logs`) or images (`image`). Each of these are represented by a - different object type. - items: - type: object - oneOf: - - $ref: >- - #/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject - - $ref: >- - #/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputImageObject + The unique ID of the apply patch tool call. Populated when this + item is returned via API. + example: apc_123 + - type: 'null' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' + status: + $ref: '#/components/schemas/ApplyPatchCallStatusParam' + description: >- + The status of the apply patch tool call. One of `in_progress` or + `completed`. + operation: + $ref: '#/components/schemas/ApplyPatchOperationParam' + description: >- + The specific create, delete, or update instruction for the + apply_patch tool call. + type: object required: - - index - type - RunStepDeltaStepDetailsToolCallsCodeOutputImageObject: - title: Code interpreter image output + - call_id + - status + - operation + title: Apply patch tool call + description: >- + A tool call representing a request to create, delete, or update files + using diff patches. + ApplyPatchCallOutputStatusParam: + type: string + enum: + - completed + - failed + title: Apply patch call output status + description: Outcome values reported for apply_patch tool call outputs. + ApplyPatchToolCallOutputItemParam: + properties: + type: + type: string + enum: + - apply_patch_call_output + description: The type of the item. Always `apply_patch_call_output`. + default: apply_patch_call_output + x-stainless-const: true + id: + anyOf: + - type: string + description: >- + The unique ID of the apply patch tool call output. Populated + when this item is returned via API. + example: apco_123 + - type: 'null' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatusParam' + description: >- + The status of the apply patch tool call output. One of `completed` + or `failed`. + output: + anyOf: + - type: string + maxLength: 10485760 + description: >- + Optional human-readable log text from the apply patch tool + (e.g., patch results or errors). + - type: 'null' type: object + required: + - type + - call_id + - status + title: Apply patch tool call output + description: The streamed output emitted by an apply patch tool call. + CompactionTriggerItemParam: properties: - index: - type: integer - description: The index of the output in the outputs array. type: - description: Always `image`. type: string enum: - - image + - compaction_trigger + description: The type of the item. Always `compaction_trigger`. + default: compaction_trigger x-stainless-const: true - image: - type: object - properties: - file_id: - description: The [file](/docs/api-reference/files) ID of the image. - type: string + type: object required: - - index - type - RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject: - title: Code interpreter log output + title: Compaction trigger + description: Compacts the current context. Must be the final input item. + ItemReferenceParam: + properties: + type: + anyOf: + - type: string + enum: + - item_reference + description: The type of item to reference. Always `item_reference`. + default: item_reference + x-stainless-const: true + - type: 'null' + id: + type: string + description: The ID of the item to reference. type: object - description: Text output from the Code Interpreter tool call as part of a run step. + required: + - id + title: Item reference + description: An internal identifier for an item to reference. + ProgramItemParam: properties: - index: - type: integer - description: The index of the output in the outputs array. + id: + type: string + description: The unique ID of this program item. + example: cm_123 type: - description: Always `logs`. type: string enum: - - logs + - program + description: The item type. Always `program`. + default: program x-stainless-const: true - logs: + call_id: type: string - description: The text output from the Code Interpreter tool call. + maxLength: 64 + minLength: 1 + description: The stable call ID of the program item. + code: + type: string + maxLength: 10485760 + description: The JavaScript source executed by programmatic tool calling. + fingerprint: + type: string + maxLength: 10485760 + description: Opaque program replay fingerprint that must be round-tripped. + type: object required: - - index + - id - type - RunStepDeltaStepDetailsToolCallsFileSearchObject: - title: File search tool call - type: object + - call_id + - code + - fingerprint + ProgramOutputItemStatus: + type: string + enum: + - completed + - incomplete + ProgramOutputItemParam: properties: - index: - type: integer - description: The index of the tool call in the tool calls array. id: type: string - description: The ID of the tool call object. + description: The unique ID of this program output item. + example: cmo_123 type: type: string - description: >- - The type of tool call. This is always going to be `file_search` for - this type of tool call. enum: - - file_search + - program_output + description: The item type. Always `program_output`. + default: program_output x-stainless-const: true - file_search: - type: object - description: For now, this is always going to be an empty object. - x-oaiTypeLabel: map + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The call ID of the program item. + result: + type: string + maxLength: 10485760 + description: The result produced by the program item. + status: + $ref: '#/components/schemas/ProgramOutputItemStatus' + description: The terminal status of the program output. + type: object required: - - index + - id - type - - file_search - RunStepDeltaStepDetailsToolCallsFunctionObject: - type: object - title: Function tool call + - call_id + - result + - status + ConversationResource: properties: - index: - type: integer - description: The index of the tool call in the tool calls array. id: type: string - description: The ID of the tool call object. - type: + description: The unique ID of the conversation. + object: type: string - description: >- - The type of tool call. This is always going to be `function` for - this type of tool call. enum: - - function + - conversation + description: The object type, which is always `conversation`. + default: conversation x-stainless-const: true - function: - type: object - description: The definition of the function that was called. - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: The arguments passed to the function. - output: - anyOf: - - type: string - description: >- - The output of the function. This will be `null` if the - outputs have not been - [submitted](/docs/api-reference/runs/submitToolOutputs) yet. - - type: 'null' + metadata: + description: >- + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the + object in a structured format, and querying for objects via + API or the dashboard. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + created_at: + type: integer + format: unixtime + description: >- + The time at which the conversation was created, measured in seconds + since the Unix epoch. + type: object required: - - index - - type - RunStepDeltaStepDetailsToolCallsObject: - title: Tool calls + - id + - object + - metadata + - created_at + ImageGenOutputTokensDetails: + properties: + image_tokens: + type: integer + description: The number of image output tokens generated by the model. + text_tokens: + type: integer + description: The number of text output tokens generated by the model. type: object - description: Details of the tool call. + required: + - image_tokens + - text_tokens + title: Image generation output token details + description: The output token details for the image generation. + ImageGenInputUsageDetails: + properties: + text_tokens: + type: integer + description: The number of text tokens in the input prompt. + image_tokens: + type: integer + description: The number of image tokens in the input prompt. + type: object + required: + - text_tokens + - image_tokens + title: Input usage details + description: The input tokens detailed information for the image generation. + ImageGenUsage: + properties: + input_tokens: + type: integer + description: The number of tokens (images and text) in the input prompt. + total_tokens: + type: integer + description: >- + The total number of tokens (images and text) used for the image + generation. + output_tokens: + type: integer + description: The number of output tokens generated by the model. + output_tokens_details: + $ref: '#/components/schemas/ImageGenOutputTokensDetails' + input_tokens_details: + $ref: '#/components/schemas/ImageGenInputUsageDetails' + type: object + required: + - input_tokens + - total_tokens + - output_tokens + - input_tokens_details + title: Image generation usage + description: >- + For `gpt-image-1` only, the token usage information for the image + generation. + SpecificProgrammaticToolCallingParam: properties: type: - description: Always `tool_calls`. type: string enum: - - tool_calls + - programmatic_tool_calling + description: The tool to call. Always `programmatic_tool_calling`. + default: programmatic_tool_calling x-stainless-const: true - tool_calls: - type: array - description: > - An array of tool calls the run step was involved in. These can be - associated with one of three types of tools: `code_interpreter`, - `file_search`, or `function`. - items: - oneOf: - - $ref: >- - #/components/schemas/RunStepDeltaStepDetailsToolCallsCodeObject - - $ref: >- - #/components/schemas/RunStepDeltaStepDetailsToolCallsFileSearchObject - - $ref: >- - #/components/schemas/RunStepDeltaStepDetailsToolCallsFunctionObject + type: object required: - type - RunStepDetailsMessageCreationObject: - title: Message creation - type: object - description: Details of the message creation by the run step. + SpecificApplyPatchParam: properties: type: - description: Always `message_creation`. type: string enum: - - message_creation + - apply_patch + description: The tool to call. Always `apply_patch`. + default: apply_patch x-stainless-const: true - message_creation: - type: object - properties: - message_id: - type: string - description: The ID of the message that was created by this run step. - required: - - message_id + type: object required: - type - - message_creation - RunStepDetailsToolCallsCodeObject: - title: Code Interpreter tool call - type: object - description: Details of the Code Interpreter tool call the run step was involved in. + title: Specific apply patch tool choice + description: >- + Forces the model to call the apply_patch tool when executing a tool + call. + SpecificFunctionShellParam: properties: - id: - type: string - description: The ID of the tool call. type: type: string - description: >- - The type of tool call. This is always going to be `code_interpreter` - for this type of tool call. enum: - - code_interpreter + - shell + description: The tool to call. Always `shell`. + default: shell x-stainless-const: true - code_interpreter: - type: object - description: The Code Interpreter tool call definition. - required: - - input - - outputs - properties: - input: - type: string - description: The input to the Code Interpreter tool call. - outputs: - type: array - description: >- - The outputs from the Code Interpreter tool call. Code - Interpreter can output one or more items, including text - (`logs`) or images (`image`). Each of these are represented by a - different object type. - items: - type: object - oneOf: - - $ref: >- - #/components/schemas/RunStepDetailsToolCallsCodeOutputLogsObject - - $ref: >- - #/components/schemas/RunStepDetailsToolCallsCodeOutputImageObject + type: object required: - - id - type - - code_interpreter - RunStepDetailsToolCallsCodeOutputImageObject: - title: Code Interpreter image output + title: Specific shell tool choice + description: Forces the model to call the shell tool when a tool call is required. + ReasoningModeEnum: + anyOf: + - type: string + - type: string + enum: + - standard + - pro + ConversationParam-2: + properties: + id: + type: string + description: The unique ID of the conversation. + example: conv_123 type: object + required: + - id + title: Conversation object + description: The conversation that this response belongs to. + ContextManagementParam: properties: type: - description: Always `image`. type: string - enum: - - image - x-stainless-const: true - image: - type: object - properties: - file_id: - description: The [file](/docs/api-reference/files) ID of the image. - type: string - required: - - file_id + description: >- + The context management entry type. Currently only 'compaction' is + supported. + compact_threshold: + anyOf: + - type: integer + minimum: 1000 + description: >- + Token threshold at which compaction should be triggered for this + entry. + - type: 'null' + type: object required: - type - - image - RunStepDetailsToolCallsCodeOutputLogsObject: - title: Code Interpreter log output + PromptCacheOptions: + properties: + ttl: + $ref: '#/components/schemas/PromptCacheTTLEnum' + description: The minimum lifetime applied to each cache breakpoint. + mode: + $ref: '#/components/schemas/PromptCacheModeEnum' + description: Whether implicit prompt-cache breakpoints were enabled. type: object - description: Text output from the Code Interpreter tool call as part of a run step. + required: + - ttl + - mode + title: Prompt cache options + description: >- + The prompt-caching options that were applied to the response. Supported + for `gpt-5.6` and later models. + ModerationErrorBody: properties: type: - description: Always `logs`. type: string enum: - - logs + - error + description: The object type, which was always `error` for moderation failures. + default: error x-stainless-const: true - logs: + code: type: string - description: The text output from the Code Interpreter tool call. + description: The error code. + message: + type: string + description: The error message. + type: object required: - type - - logs - RunStepDetailsToolCallsFileSearchObject: - title: File search tool call + - code + - message + title: Moderation error + description: >- + An error produced while attempting moderation for the response input or + output. + Moderation: + properties: + input: + oneOf: + - $ref: '#/components/schemas/ModerationResultBody' + - $ref: '#/components/schemas/ModerationErrorBody' + description: Moderation for the response input. + discriminator: + propertyName: type + output: + oneOf: + - $ref: '#/components/schemas/ModerationResultBody' + - $ref: '#/components/schemas/ModerationErrorBody' + description: Moderation for the response output. + discriminator: + propertyName: type type: object + required: + - input + - output + title: Moderation + description: Moderation results or errors for the response input and output. + Conversation-2: properties: id: - type: string - description: The ID of the tool call object. - type: type: string description: >- - The type of tool call. This is always going to be `file_search` for - this type of tool call. - enum: - - file_search - x-stainless-const: true - file_search: - type: object - description: For now, this is always going to be an empty object. - x-oaiTypeLabel: map - properties: - ranking_options: - $ref: >- - #/components/schemas/RunStepDetailsToolCallsFileSearchRankingOptionsObject - results: - type: array - description: The results of the file search. - items: - $ref: >- - #/components/schemas/RunStepDetailsToolCallsFileSearchResultObject + The unique ID of the conversation that this response was associated + with. + type: object required: - id - - type - - file_search - RunStepDetailsToolCallsFileSearchRankingOptionsObject: - title: File search tool call ranking options - type: object - description: The ranking options for the file search. + title: Conversation + description: >- + The conversation that this response belonged to. Input items and output + items from this response were automatically added to this conversation. + CreateConversationBody: properties: - ranker: - $ref: '#/components/schemas/FileSearchRanker' - score_threshold: - type: number - description: >- - The score threshold for the file search. All values must be a - floating point number between 0 and 1. - minimum: 0 - maximum: 1 - required: - - ranker - - score_threshold - RunStepDetailsToolCallsFileSearchResultObject: - title: File search tool call result + metadata: + anyOf: + - $ref: '#/components/schemas/Metadata' + description: >- + Set of 16 key-value pairs that can be attached to an object. + This can be useful for storing additional information + about the object in a structured format, and querying + for objects via API or the dashboard. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + - type: 'null' + items: + anyOf: + - items: + $ref: '#/components/schemas/InputItem' + type: array + maxItems: 20 + description: >- + Initial items to include in the conversation context. You may + add up to 20 items at a time. + - type: 'null' type: object - description: A result instance of the file search. - x-oaiTypeLabel: map + required: [] + UpdateConversationBody: properties: - file_id: - type: string - description: The ID of the file that result was found in. - file_name: - type: string - description: The name of the file that result was found in. - score: - type: number - description: >- - The score of the result. All values must be a floating point number - between 0 and 1. - minimum: 0 - maximum: 1 - content: - type: array + metadata: + $ref: '#/components/schemas/Metadata' description: >- - The content of the result that was found. The content is only - included if requested via the include query parameter. - items: - type: object - properties: - type: - type: string - description: The type of the content. - enum: - - text - x-stainless-const: true - text: - type: string - description: The text content of the file. - required: - - file_id - - file_name - - score - RunStepDetailsToolCallsFunctionObject: + Set of 16 key-value pairs that can be attached to an object. This + can be useful for storing additional information about the + object in a structured format, and querying for objects via + API or the dashboard. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. type: object - title: Function tool call + required: + - metadata + DeletedConversationResource: properties: - id: - type: string - description: The ID of the tool call object. - type: + object: type: string - description: >- - The type of tool call. This is always going to be `function` for - this type of tool call. enum: - - function + - conversation.deleted + default: conversation.deleted x-stainless-const: true - function: - type: object - description: The definition of the function that was called. - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: The arguments passed to the function. - output: - anyOf: - - type: string - description: >- - The output of the function. This will be `null` if the - outputs have not been - [submitted](/docs/api-reference/runs/submitToolOutputs) yet. - - type: 'null' - required: - - name - - arguments - - output + deleted: + type: boolean + id: + type: string + type: object required: + - object + - deleted - id - - type - - function - RunStepDetailsToolCallsObject: - title: Tool calls - type: object - description: Details of the tool call. + OrderEnum: + type: string + enum: + - asc + - desc + VideoModel: + anyOf: + - type: string + - type: string + enum: + - sora-2 + - sora-2-pro + - sora-2-2025-10-06 + - sora-2-pro-2025-10-06 + - sora-2-2025-12-08 + VideoStatus: + type: string + enum: + - queued + - in_progress + - completed + - failed + VideoSize: + type: string + enum: + - 720x1280 + - 1280x720 + - 1024x1792 + - 1792x1024 + Error-2: properties: - type: - description: Always `tool_calls`. + code: type: string - enum: - - tool_calls - x-stainless-const: true - tool_calls: - type: array - description: > - An array of tool calls the run step was involved in. These can be - associated with one of three types of tools: `code_interpreter`, - `file_search`, or `function`. - items: - oneOf: - - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeObject' - - $ref: '#/components/schemas/RunStepDetailsToolCallsFileSearchObject' - - $ref: '#/components/schemas/RunStepDetailsToolCallsFunctionObject' - required: - - type - - tool_calls - RunStepObject: + description: A machine-readable error code that was returned. + message: + type: string + description: A human-readable description of the error that was returned. type: object - title: Run steps - description: | - Represents a step in execution of a run. + required: + - code + - message + title: Error + description: An error that occurred while generating the response. + VideoResource: properties: id: - description: >- - The identifier of the run step, which can be referenced in API - endpoints. type: string + description: Unique identifier for the video job. object: - description: The object type, which is always `thread.run.step`. type: string enum: - - thread.run.step + - video + description: The object type, which is always `video`. + default: video x-stainless-const: true + model: + $ref: '#/components/schemas/VideoModel' + description: The video generation model that produced the job. + status: + $ref: '#/components/schemas/VideoStatus' + description: Current lifecycle status of the video job. + progress: + type: integer + description: Approximate completion percentage for the generation task. created_at: - description: The Unix timestamp (in seconds) for when the run step was created. type: integer format: unixtime - assistant_id: - description: >- - The ID of the [assistant](/docs/api-reference/assistants) associated - with the run step. - type: string - thread_id: - description: The ID of the [thread](/docs/api-reference/threads) that was run. - type: string - run_id: - description: >- - The ID of the [run](/docs/api-reference/runs) that this run step is - a part of. - type: string - type: - description: >- - The type of run step, which can be either `message_creation` or - `tool_calls`. - type: string - enum: - - message_creation - - tool_calls - status: - description: >- - The status of the run step, which can be either `in_progress`, - `cancelled`, `failed`, `completed`, or `expired`. - type: string - enum: - - in_progress - - cancelled - - failed - - completed - - expired - step_details: - type: object - description: The details of the run step. - oneOf: - - $ref: '#/components/schemas/RunStepDetailsMessageCreationObject' - - $ref: '#/components/schemas/RunStepDetailsToolCallsObject' - last_error: + description: Unix timestamp (seconds) for when the job was created. + completed_at: anyOf: - - type: object + - type: integer + format: unixtime description: >- - The last error associated with this run step. Will be `null` if - there are no errors. - properties: - code: - type: string - description: One of `server_error` or `rate_limit_exceeded`. - enum: - - server_error - - rate_limit_exceeded - message: - type: string - description: A human-readable description of the error. - required: - - code - - message + Unix timestamp (seconds) for when the job completed, if + finished. - type: 'null' - expired_at: + expires_at: anyOf: - - description: >- - The Unix timestamp (in seconds) for when the run step expired. A - step is considered expired if the parent run is expired. - type: integer + - type: integer format: unixtime + description: >- + Unix timestamp (seconds) for when the downloadable assets + expire, if set. - type: 'null' - cancelled_at: + prompt: anyOf: - - description: >- - The Unix timestamp (in seconds) for when the run step was - cancelled. - type: integer - format: unixtime + - type: string + description: The prompt that was used to generate the video. - type: 'null' - failed_at: + size: + $ref: '#/components/schemas/VideoSize' + description: The resolution of the generated video. + seconds: + type: string + description: >- + Duration of the generated clip in seconds. For extensions, this is + the stitched total duration. + remixed_from_video_id: anyOf: - - description: The Unix timestamp (in seconds) for when the run step failed. - type: integer - format: unixtime + - type: string + description: Identifier of the source video if this video is a remix. - type: 'null' - completed_at: + error: anyOf: - - description: The Unix timestamp (in seconds) for when the run step completed. - type: integer - format: unixtime + - $ref: '#/components/schemas/Error-2' + description: >- + Error payload that explains why generation failed, if + applicable. - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - usage: - $ref: '#/components/schemas/RunStepCompletionUsage' + type: object required: - id - object - - created_at - - assistant_id - - thread_id - - run_id - - type + - model - status - - step_details - - last_error - - expired_at - - cancelled_at - - failed_at + - progress + - created_at - completed_at - - metadata - - usage - x-oaiMeta: - name: The run step object - beta: true - example: | - { - "id": "step_abc123", - "object": "thread.run.step", - "created_at": 1699063291, - "run_id": "run_abc123", - "assistant_id": "asst_abc123", - "thread_id": "thread_abc123", - "type": "message_creation", - "status": "completed", - "cancelled_at": null, - "completed_at": 1699063291, - "expired_at": null, - "failed_at": null, - "last_error": null, - "step_details": { - "type": "message_creation", - "message_creation": { - "message_id": "msg_abc123" - } - }, - "usage": { - "prompt_tokens": 123, - "completion_tokens": 456, - "total_tokens": 579 - } - } - RunStepStreamEvent: - oneOf: - - type: object - properties: - event: - type: string - enum: - - thread.run.step.created - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data - description: >- - Occurs when a [run step](/docs/api-reference/run-steps/step-object) - is created. - x-oaiMeta: - dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.step.in_progress - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data - description: >- - Occurs when a [run step](/docs/api-reference/run-steps/step-object) - moves to an `in_progress` state. - x-oaiMeta: - dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.step.delta - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepDeltaObject' - required: - - event - - data - description: >- - Occurs when parts of a [run - step](/docs/api-reference/run-steps/step-object) are being streamed. - x-oaiMeta: - dataDescription: >- - `data` is a [run step - delta](/docs/api-reference/assistants-streaming/run-step-delta-object) - - type: object - properties: - event: - type: string - enum: - - thread.run.step.completed - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data - description: >- - Occurs when a [run step](/docs/api-reference/run-steps/step-object) - is completed. - x-oaiMeta: - dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.step.failed - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data - description: >- - Occurs when a [run step](/docs/api-reference/run-steps/step-object) - fails. - x-oaiMeta: - dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.step.cancelled - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data - description: >- - Occurs when a [run step](/docs/api-reference/run-steps/step-object) - is cancelled. - x-oaiMeta: - dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.step.expired - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data + - expires_at + - prompt + - size + - seconds + - remixed_from_video_id + - error + title: Video job + description: Structured information describing a generated video job. + VideoListResource: + properties: + object: + type: string + enum: + - list + description: The type of object returned, must be `list`. + default: list + x-stainless-const: true + data: + items: + $ref: '#/components/schemas/VideoResource' + type: array + description: A list of items + first_id: + anyOf: + - type: string + description: The ID of the first item in the list. + - type: 'null' + last_id: + anyOf: + - type: string + description: The ID of the last item in the list. + - type: 'null' + has_more: + type: boolean + description: Whether there are more items available. + type: object + required: + - object + - data + - first_id + - last_id + - has_more + ImageRefParam-2: + properties: + image_url: + type: string + maxLength: 20971520 + format: uri + description: A fully qualified URL or base64-encoded data URL. + file_id: + type: string + example: file-123 + type: object + required: [] + VideoSeconds: + type: string + enum: + - '4' + - '8' + - '12' + CreateVideoMultipartBody: + properties: + model: + $ref: '#/components/schemas/VideoModel' description: >- - Occurs when a [run step](/docs/api-reference/run-steps/step-object) - expires. - x-oaiMeta: - dataDescription: '`data` is a [run step](/docs/api-reference/run-steps/step-object)' - RunStreamEvent: - oneOf: - - type: object - properties: - event: - type: string - enum: - - thread.run.created - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a new [run](/docs/api-reference/runs/object) is created. - x-oaiMeta: - dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.queued - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data + The video generation model to use (allowed values: sora-2, + sora-2-pro). Defaults to `sora-2`. + prompt: + type: string + maxLength: 32000 + minLength: 1 + description: Text prompt that describes the video to generate. + input_reference: + oneOf: + - type: string + format: binary + description: >- + Optional reference asset upload or reference object that guides + generation. + - $ref: '#/components/schemas/ImageRefParam-2' + description: >- + Optional reference asset upload or reference object that guides + generation. Provide exactly one of `image_url` or `file_id` when + using an object. + seconds: + $ref: '#/components/schemas/VideoSeconds' description: >- - Occurs when a [run](/docs/api-reference/runs/object) moves to a - `queued` status. - x-oaiMeta: - dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.in_progress - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data + Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 + seconds. + size: + $ref: '#/components/schemas/VideoSize' description: >- - Occurs when a [run](/docs/api-reference/runs/object) moves to an - `in_progress` status. - x-oaiMeta: - dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.requires_action - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data + Output resolution formatted as width x height (allowed values: + 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280. + type: object + required: + - prompt + title: Create video multipart request + description: Multipart parameters for creating a new video generation job. + CreateVideoJsonBody: + properties: + model: + $ref: '#/components/schemas/VideoModel' description: >- - Occurs when a [run](/docs/api-reference/runs/object) moves to a - `requires_action` status. - x-oaiMeta: - dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.completed - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](/docs/api-reference/runs/object) is completed. - x-oaiMeta: - dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.incomplete - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data + The video generation model to use (allowed values: sora-2, + sora-2-pro). Defaults to `sora-2`. + prompt: + type: string + maxLength: 32000 + minLength: 1 + description: Text prompt that describes the video to generate. + input_reference: + $ref: '#/components/schemas/ImageRefParam-2' description: >- - Occurs when a [run](/docs/api-reference/runs/object) ends with - status `incomplete`. - x-oaiMeta: - dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.failed - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](/docs/api-reference/runs/object) fails. - x-oaiMeta: - dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.cancelling - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data + Optional reference object that guides generation. Provide exactly + one of `image_url` or `file_id`. + seconds: + $ref: '#/components/schemas/VideoSeconds' description: >- - Occurs when a [run](/docs/api-reference/runs/object) moves to a - `cancelling` status. - x-oaiMeta: - dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.cancelled - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](/docs/api-reference/runs/object) is cancelled. - x-oaiMeta: - dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' - - type: object - properties: - event: - type: string - enum: - - thread.run.expired - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](/docs/api-reference/runs/object) expires. - x-oaiMeta: - dataDescription: '`data` is a [run](/docs/api-reference/runs/object)' - RunToolCallObject: + Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 + seconds. + size: + $ref: '#/components/schemas/VideoSize' + description: >- + Output resolution formatted as width x height (allowed values: + 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280. type: object - description: Tool call objects + required: + - prompt + title: Create video JSON request + description: JSON parameters for creating a new video generation job. + CreateVideoCharacterBody: properties: - id: + video: type: string - description: >- - The ID of the tool call. This ID must be referenced when you submit - the tool outputs in using the [Submit tool outputs to - run](/docs/api-reference/runs/submitToolOutputs) endpoint. - type: + format: binary + description: Video file used to create a character. + name: type: string - description: >- - The type of tool call the output is required for. For now, this is - always `function`. - enum: - - function - x-stainless-const: true - function: - type: object - description: The function definition. - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: >- - The arguments that the model expects you to pass to the - function. - required: - - name - - arguments + maxLength: 80 + minLength: 1 + description: Display name for this API character. + type: object + required: + - video + - name + title: Create character request + description: Parameters for creating a character from an uploaded video. + VideoCharacterResource: + properties: + id: + anyOf: + - type: string + description: Identifier for the character creation cameo. + - type: 'null' + name: + anyOf: + - type: string + description: Display name for the character. + - type: 'null' + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the character was created. + type: object required: - id - - type - - function - ServiceTier: - anyOf: - - type: string - description: | - Specifies the processing type used for serving the request. - - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. - - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. - - If set to '[flex](/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier. - - When not set, the default behavior is 'auto'. - - When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. - enum: - - auto - - default - - flex - - scale - - priority - default: auto - - type: 'null' - SpeechAudioDeltaEvent: + - name + - created_at + VideoReferenceInputParam: + properties: + id: + type: string + description: The identifier of the completed video. + example: video_123 type: object - description: Emitted for each chunk of audio data generated during speech synthesis. + required: + - id + description: Reference to the completed video. + CreateVideoEditMultipartBody: properties: - type: + video: + oneOf: + - type: string + format: binary + description: Reference to the completed video to edit. + - $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to edit. + prompt: type: string - description: | - The type of the event. Always `speech.audio.delta`. - enum: - - speech.audio.delta - x-stainless-const: true - audio: + maxLength: 32000 + minLength: 1 + description: Text prompt that describes how to edit the source video. + type: object + required: + - video + - prompt + title: Create video edit multipart request + description: Parameters for editing an existing generated video. + CreateVideoEditJsonBody: + properties: + video: + $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to edit. + prompt: type: string - description: | - A chunk of Base64-encoded audio data. + maxLength: 32000 + minLength: 1 + description: Text prompt that describes how to edit the source video. + type: object required: - - type - - audio - x-oaiMeta: - name: Stream Event (speech.audio.delta) - group: speech - example: | - { - "type": "speech.audio.delta", - "audio": "base64-encoded-audio-data" - } - SpeechAudioDoneEvent: + - video + - prompt + title: Create video edit JSON request + description: JSON parameters for editing an existing generated video. + CreateVideoExtendMultipartBody: + properties: + video: + oneOf: + - $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to extend. + - type: string + format: binary + description: Reference to the completed video to extend. + prompt: + type: string + maxLength: 32000 + minLength: 1 + description: Updated text prompt that directs the extension generation. + seconds: + $ref: '#/components/schemas/VideoSeconds' + description: >- + Length of the newly generated extension segment in seconds (allowed + values: 4, 8, 12, 16, 20). type: object - description: >- - Emitted when the speech synthesis is complete and all audio has been - streamed. + required: + - video + - prompt + - seconds + title: Create video extension multipart request + description: Multipart parameters for extending an existing generated video. + CreateVideoExtendJsonBody: properties: - type: + video: + $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to extend. + prompt: + type: string + maxLength: 32000 + minLength: 1 + description: Updated text prompt that directs the extension generation. + seconds: + $ref: '#/components/schemas/VideoSeconds' + description: >- + Length of the newly generated extension segment in seconds (allowed + values: 4, 8, 12, 16, 20). + type: object + required: + - video + - prompt + - seconds + title: Create video extension JSON request + description: JSON parameters for extending an existing generated video. + DeletedVideoResource: + properties: + object: type: string - description: | - The type of the event. Always `speech.audio.done`. enum: - - speech.audio.done + - video.deleted + description: The object type that signals the deletion response. + default: video.deleted x-stainless-const: true - usage: - type: object - description: | - Token usage statistics for the request. - properties: - input_tokens: - type: integer - description: Number of input tokens in the prompt. - output_tokens: - type: integer - description: Number of output tokens generated. - total_tokens: - type: integer - description: Total number of tokens used (input + output). - required: - - input_tokens - - output_tokens - - total_tokens - required: - - type - - usage - x-oaiMeta: - name: Stream Event (speech.audio.done) - group: speech - example: | - { - "type": "speech.audio.done", - "usage": { - "input_tokens": 14, - "output_tokens": 101, - "total_tokens": 115 - } - } - SpendAlertNotificationChannel: + deleted: + type: boolean + description: Indicates that the video resource was deleted. + id: + type: string + description: Identifier of the deleted video. type: object - description: Email notification settings for a spend alert. + required: + - object + - deleted + - id + title: Deleted video response + description: Confirmation payload returned after deleting a video. + VideoContentVariant: + type: string + enum: + - video + - thumbnail + - spritesheet + CreateVideoRemixBody: properties: - type: + prompt: type: string + maxLength: 32000 + minLength: 1 + description: Updated text prompt that directs the remix generation. + type: object + required: + - prompt + title: Create video remix request + description: Parameters for remixing an existing generated video. + TruncationEnum: + type: string + enum: + - auto + - disabled + PersonalityEnum: + anyOf: + - type: string + - type: string enum: - - email - description: The notification channel type. Currently only `email` is supported. - x-stainless-const: true - recipients: - type: array - description: Email addresses that receive the spend alert notification. - items: - type: string - subject_prefix: + - friendly + - pragmatic + TokenCountsBody: + properties: + model: + anyOf: + - type: string + description: >- + Model ID used to generate the response, like `gpt-4o` or `o3`. + OpenAI offers a wide range of models with different + capabilities, performance characteristics, and price points. + Refer to the [model guide](/docs/models) to browse and compare + available models. + - type: 'null' + input: + anyOf: + - oneOf: + - type: string + maxLength: 10485760 + description: >- + A text input to the model, equivalent to a text input with + the `user` role. + - items: + $ref: '#/components/schemas/InputItem' + type: array + description: >- + A list of one or many input items to the model, containing + different content types. + description: >- + Text, image, or file inputs to the model, used to generate a + response + - type: 'null' + previous_response_id: + anyOf: + - type: string + description: >- + The unique ID of the previous response to the model. Use this to + create multi-turn conversations. Learn more about [conversation + state](/docs/guides/conversation-state). Cannot be used in + conjunction with `conversation`. + example: resp_123 + - type: 'null' + tools: + anyOf: + - items: + $ref: '#/components/schemas/Tool' + type: array + description: >- + An array of tools the model may call while generating a + response. You can specify which tool to use by setting the + `tool_choice` parameter. + - type: 'null' + text: anyOf: - - type: string + - $ref: '#/components/schemas/ResponseTextParam' - type: 'null' - description: Optional subject prefix for alert emails. - required: - - type - - recipients - StaticChunkingStrategy: - type: object - additionalProperties: false - properties: - max_chunk_size_tokens: - type: integer - minimum: 100 - maximum: 4096 + reasoning: + anyOf: + - $ref: '#/components/schemas/Reasoning' + description: >- + **gpt-5 and o-series models only** Configuration options for + [reasoning + models](https://platform.openai.com/docs/guides/reasoning). + - type: 'null' + truncation: + $ref: '#/components/schemas/TruncationEnum' description: >- - The maximum number of tokens in each chunk. The default value is - `800`. The minimum value is `100` and the maximum value is `4096`. - chunk_overlap_tokens: - type: integer - description: > - The number of tokens that overlap between chunks. The default value - is `400`. - + The truncation strategy to use for the model response. - `auto`: If + the input to this Response exceeds the model's context window size, + the model will truncate the response to fit the context window by + dropping items from the beginning of the conversation. - `disabled` + (default): If the input size will exceed the context window size for + a model, the request will fail with a 400 error. + deprecated: true + instructions: + anyOf: + - type: string + description: >- + A system (or developer) message inserted into the model's + context. - Note that the overlap must not exceed half of - `max_chunk_size_tokens`. - required: - - max_chunk_size_tokens - - chunk_overlap_tokens - StaticChunkingStrategyRequestParam: + When used along with `previous_response_id`, the instructions + from a previous response will not be carried over to the next + response. This makes it simple to swap out system (or developer) + messages in new responses. + - type: 'null' + personality: + $ref: '#/components/schemas/PersonalityEnum' + description: >- + A model-owned style preset to apply to this request. Omit this + parameter to use the model's default style. Supported values may + expand over time. Values must be at most 64 characters. + conversation: + anyOf: + - $ref: '#/components/schemas/ConversationParam' + - type: 'null' + tool_choice: + anyOf: + - $ref: '#/components/schemas/ToolChoiceParam' + description: Controls which tool the model should use, if any. + - type: 'null' + parallel_tool_calls: + anyOf: + - type: boolean + description: Whether to allow the model to run tool calls in parallel. + - type: 'null' type: object - title: Static Chunking Strategy - description: >- - Customize your own chunking strategy by setting chunk size and chunk - overlap. - additionalProperties: false + required: [] + TokenCountsResource: properties: - type: + object: type: string - description: Always `static`. enum: - - static + - response.input_tokens + default: response.input_tokens x-stainless-const: true - static: - $ref: '#/components/schemas/StaticChunkingStrategy' - required: - - type - - static - StaticChunkingStrategyResponseParam: + input_tokens: + type: integer type: object - title: Static Chunking Strategy - additionalProperties: false - properties: - type: - type: string - description: Always `static`. - enum: - - static - x-stainless-const: true - static: - $ref: '#/components/schemas/StaticChunkingStrategy' required: - - type - - static - StopConfiguration: - description: | - Not supported with latest reasoning models `o3` and `o4-mini`. - - Up to 4 sequences where the API will stop generating further tokens. The - returned text will not contain the stop sequence. - default: null - nullable: true - oneOf: - - type: string - default: <|endoftext|> - example: |+ - - nullable: true - - type: array - minItems: 1 - maxItems: 4 - items: - type: string - example: '["\n"]' - SubmitToolOutputsRunRequest: - type: object - additionalProperties: false + - object + - input_tokens + title: Token counts + example: + object: response.input_tokens + input_tokens: 123 + PromptCacheRetentionEnum: + type: string + enum: + - in_memory + - 24h + ServiceTierEnum: + type: string + enum: + - auto + - default + - flex + - priority + CompactResponseMethodPublicBody: properties: - tool_outputs: - description: A list of tools for which the outputs are being submitted. - type: array - items: - type: object - properties: - tool_call_id: - type: string - description: >- - The ID of the tool call in the `required_action` object within - the run object the output is being submitted for. - output: - type: string - description: >- - The output of the tool call to be submitted to continue the - run. - stream: + model: + $ref: '#/components/schemas/ModelIdsCompaction' + input: anyOf: - - type: boolean - description: > - If `true`, returns a stream of events that happen during the Run - as server-sent events, terminating when the Run enters a - terminal state with a `data: [DONE]` message. + - oneOf: + - type: string + maxLength: 10485760 + description: >- + A text input to the model, equivalent to a text input with + the `user` role. + - items: + $ref: '#/components/schemas/InputItem' + type: array + description: >- + A list of one or many input items to the model, containing + different content types. + description: >- + Text, image, or file inputs to the model, used to generate a + response - type: 'null' - required: - - tool_outputs - TextResponseFormatConfiguration: - description: > - An object specifying the format that the model must output. - - - Configuring `{ "type": "json_schema" }` enables Structured Outputs, - - which ensures the model will match your supplied JSON schema. Learn more - in the - - [Structured Outputs guide](/docs/guides/structured-outputs). - - - The default format is `{ "type": "text" }` with no additional options. - - - **Not recommended for gpt-4o and newer models:** - - - Setting to `{ "type": "json_object" }` enables the older JSON mode, - which - - ensures the message the model generates is valid JSON. Using - `json_schema` - - is preferred for models that support it. - oneOf: - - $ref: '#/components/schemas/ResponseFormatText' - - $ref: '#/components/schemas/TextResponseFormatJsonSchema' - - $ref: '#/components/schemas/ResponseFormatJsonObject' - TextResponseFormatJsonSchema: - type: object - title: JSON schema - description: | - JSON Schema response format. Used to generate structured JSON responses. - Learn more about [Structured Outputs](/docs/guides/structured-outputs). - properties: - type: - type: string - description: The type of response format being defined. Always `json_schema`. - enum: - - json_schema - x-stainless-const: true - description: - type: string - description: > - A description of what the response format is for, used by the model - to - - determine how to respond in the format. - name: - type: string - description: | - The name of the response format. Must be a-z, A-Z, 0-9, or contain - underscores and dashes, with a maximum length of 64. - schema: - $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' - strict: + previous_response_id: anyOf: - - type: boolean - default: false - description: > - Whether to enable strict schema adherence when generating the - output. - - If set to true, the model will always follow the exact schema - defined - - in the `schema` field. Only a subset of JSON Schema is supported - when - - `strict` is `true`. To learn more, read the [Structured Outputs + - type: string + description: >- + The unique ID of the previous response to the model. Use this to + create multi-turn conversations. Learn more about [conversation + state](/docs/guides/conversation-state). Cannot be used in + conjunction with `conversation`. + example: resp_123 + - type: 'null' + instructions: + anyOf: + - type: string + description: >- + A system (or developer) message inserted into the model's + context. - guide](/docs/guides/structured-outputs). + When used along with `previous_response_id`, the instructions + from a previous response will not be carried over to the next + response. This makes it simple to swap out system (or developer) + messages in new responses. + - type: 'null' + prompt_cache_key: + anyOf: + - type: string + maxLength: 64 + description: A key to use when reading from or writing to the prompt cache. + - type: 'null' + prompt_cache_retention: + anyOf: + - $ref: '#/components/schemas/PromptCacheRetentionEnum' + description: How long to retain a prompt cache entry created by this request. + deprecated: true + - type: 'null' + prompt_cache_options: + anyOf: + - $ref: '#/components/schemas/PromptCacheOptionsParam' + - type: 'null' + service_tier: + anyOf: + - $ref: '#/components/schemas/ServiceTierEnum' + description: The service tier to use for this request. - type: 'null' - required: - - type - - schema - - name - ThreadObject: type: object - title: Thread + required: + - model + ItemField: + oneOf: + - $ref: '#/components/schemas/Message' + - $ref: '#/components/schemas/Program' + - $ref: '#/components/schemas/ProgramOutput' + - $ref: '#/components/schemas/FunctionToolCall' + - $ref: '#/components/schemas/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $ref: '#/components/schemas/AdditionalTools' + - $ref: '#/components/schemas/FunctionToolCallOutput' + - $ref: '#/components/schemas/FileSearchToolCall' + - $ref: '#/components/schemas/WebSearchToolCall' + - $ref: '#/components/schemas/ImageGenToolCall' + - $ref: '#/components/schemas/ComputerToolCall' + - $ref: '#/components/schemas/ComputerToolCallOutputResource' + - $ref: '#/components/schemas/ReasoningItem' + - $ref: '#/components/schemas/CompactionBody' + - $ref: '#/components/schemas/CodeInterpreterToolCall' + - $ref: '#/components/schemas/LocalShellToolCall' + deprecated: true + - $ref: '#/components/schemas/LocalShellToolCallOutput' + deprecated: true + - $ref: '#/components/schemas/FunctionShellCall' + - $ref: '#/components/schemas/FunctionShellCallOutput' + - $ref: '#/components/schemas/ApplyPatchToolCall' + - $ref: '#/components/schemas/ApplyPatchToolCallOutput' + - $ref: '#/components/schemas/MCPListTools' + - $ref: '#/components/schemas/MCPApprovalRequest' + - $ref: '#/components/schemas/MCPApprovalResponseResource' + - $ref: '#/components/schemas/MCPToolCall' + - $ref: '#/components/schemas/CustomToolCall' + - $ref: '#/components/schemas/CustomToolCallOutput' description: >- - Represents a thread that contains - [messages](/docs/api-reference/messages). + An item representing a message, tool call, tool output, reasoning, or + other response element. + discriminator: + propertyName: type + CompactResource: properties: id: - description: The identifier, which can be referenced in API endpoints. type: string + description: The unique identifier for the compacted response. object: - description: The object type, which is always `thread`. type: string enum: - - thread + - response.compaction + description: The object type. Always `response.compaction`. + default: response.compaction x-stainless-const: true + output: + items: + $ref: '#/components/schemas/ItemField' + type: array + description: The compacted list of output items. created_at: - description: The Unix timestamp (in seconds) for when the thread was created. type: integer format: unixtime - tool_resources: - anyOf: - - type: object - description: > - A set of resources that are made available to the assistant's - tools in this thread. The resources are specific to the type of - tool. For example, the `code_interpreter` tool requires a list - of file IDs, while the `file_search` tool requires a list of - vector store IDs. - properties: - code_interpreter: - type: object - properties: - file_ids: - type: array - description: > - A list of [file](/docs/api-reference/files) IDs made - available to the `code_interpreter` tool. There can be a - maximum of 20 files associated with the tool. - default: [] - maxItems: 20 - items: - type: string - file_search: - type: object - properties: - vector_store_ids: - type: array - description: > - The [vector - store](/docs/api-reference/vector-stores/object) - attached to this thread. There can be a maximum of 1 - vector store attached to the thread. - maxItems: 1 - items: - type: string - - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - required: - - id - - object - - created_at - - tool_resources - - metadata - x-oaiMeta: - name: The thread object - beta: true - example: | - { - "id": "thread_abc123", - "object": "thread", - "created_at": 1698107661, - "metadata": {} - } - ThreadStreamEvent: - oneOf: - - type: object - properties: - enabled: - type: boolean - description: Whether to enable input audio transcription. - event: - type: string - enum: - - thread.created - x-stainless-const: true - data: - $ref: '#/components/schemas/ThreadObject' - required: - - event - - data description: >- - Occurs when a new [thread](/docs/api-reference/threads/object) is + Unix timestamp (in seconds) when the compacted conversation was created. - x-oaiMeta: - dataDescription: '`data` is a [thread](/docs/api-reference/threads/object)' - ToggleCertificatesRequest: + usage: + $ref: '#/components/schemas/ResponseUsage' + description: >- + Token accounting for the compaction pass, including cached, + reasoning, and total tokens. type: object - properties: - certificate_ids: - type: array - items: - type: string - example: cert_abc - minItems: 1 - maxItems: 10 required: - - certificate_ids - Tool: - description: | - A tool that can be used to generate a response. - discriminator: - propertyName: type - oneOf: - - $ref: '#/components/schemas/FunctionTool' - - $ref: '#/components/schemas/FileSearchTool' - - $ref: '#/components/schemas/ComputerTool' - - $ref: '#/components/schemas/ComputerUsePreviewTool' - - $ref: '#/components/schemas/WebSearchTool' - - $ref: '#/components/schemas/MCPTool' - - $ref: '#/components/schemas/CodeInterpreterTool' - - $ref: '#/components/schemas/ImageGenTool' - - $ref: '#/components/schemas/LocalShellToolParam' - - $ref: '#/components/schemas/FunctionShellToolParam' - - $ref: '#/components/schemas/CustomToolParam' - - $ref: '#/components/schemas/NamespaceToolParam' - - $ref: '#/components/schemas/ToolSearchToolParam' - - $ref: '#/components/schemas/WebSearchPreviewTool' - - $ref: '#/components/schemas/ApplyPatchToolParam' - ToolChoiceAllowed: - type: object - title: Allowed tools - description: | - Constrains the tools available to the model to a pre-defined set. + - id + - object + - output + - created_at + - usage + title: The compacted response object + example: + id: resp_001 + object: response.compaction + output: + - type: message + role: user + content: + - type: input_text + text: Summarize our launch checklist from last week. + - type: message + role: user + content: + - type: input_text + text: You are performing a CONTEXT CHECKPOINT COMPACTION... + - type: compaction + id: cmp_001 + encrypted_content: encrypted-summary + created_at: 1731459200 + usage: + input_tokens: 42897 + output_tokens: 12000 + total_tokens: 54912 + SkillResource: properties: - type: + id: + type: string + description: Unique identifier for the skill. + object: type: string enum: - - allowed_tools - description: Allowed tool configuration type. Always `allowed_tools`. + - skill + description: The object type, which is `skill`. + default: skill x-stainless-const: true - mode: + name: + type: string + description: Name of the skill. + description: + type: string + description: Description of the skill. + created_at: + type: integer + format: unixtime + description: Unix timestamp (seconds) for when the skill was created. + default_version: + type: string + description: Default version for the skill. + latest_version: + type: string + description: Latest version for the skill. + type: object + required: + - id + - object + - name + - description + - created_at + - default_version + - latest_version + SkillListResource: + properties: + object: type: string enum: - - auto - - required - description: > - Constrains the tools available to the model to a pre-defined set. - - - `auto` allows the model to pick from among the allowed tools and - generate a - - message. - - - `required` requires the model to call one or more of the allowed - tools. - tools: - type: array - description: | - A list of tool definitions that the model should be allowed to call. - - For the Responses API, the list of tool definitions might look like: - ```json - [ - { "type": "function", "name": "get_weather" }, - { "type": "mcp", "server_label": "deepwiki" }, - { "type": "image_generation" } - ] - ``` + - list + description: The type of object returned, must be `list`. + default: list + x-stainless-const: true + data: items: - type: object - description: | - A tool definition that the model should be allowed to call. - additionalProperties: true - x-oaiExpandable: false + $ref: '#/components/schemas/SkillResource' + type: array + description: A list of items + first_id: + anyOf: + - type: string + description: The ID of the first item in the list. + - type: 'null' + last_id: + anyOf: + - type: string + description: The ID of the last item in the list. + - type: 'null' + has_more: + type: boolean + description: Whether there are more items available. + type: object required: - - type - - mode - - tools - ToolChoiceCustom: + - object + - data + - first_id + - last_id + - has_more + CreateSkillBody: + properties: + files: + oneOf: + - items: + type: string + format: binary + type: array + maxItems: 500 + description: Skill files to upload (directory upload) or a single zip file. + - type: string + format: binary + description: Skill zip file to upload. type: object - title: Custom tool - description: | - Use this option to force the model to call a specific custom tool. + required: + - files + title: Create skill request + description: >- + Uploads a skill either as a directory (multipart `files[]`) or as a + single zip file. + SetDefaultSkillVersionBody: properties: - type: + default_version: + type: string + description: The skill version number to set as default. + type: object + required: + - default_version + title: Update skill request + description: Updates the default version pointer for a skill. + DeletedSkillResource: + properties: + object: type: string enum: - - custom - description: For custom tool calling, the type is always `custom`. + - skill.deleted + default: skill.deleted x-stainless-const: true - name: + deleted: + type: boolean + id: type: string - description: The name of the custom tool to call. - required: - - type - - name - ToolChoiceFunction: type: object - title: Function tool - description: | - Use this option to force the model to call a specific function. + required: + - object + - deleted + - id + SkillVersionResource: properties: - type: + object: type: string enum: - - function - description: For function calling, the type is always `function`. + - skill.version + description: The object type, which is `skill.version`. + default: skill.version x-stainless-const: true + id: + type: string + description: Unique identifier for the skill version. + skill_id: + type: string + description: Identifier of the skill for this version. + version: + type: string + description: Version number for this skill. + created_at: + type: integer + format: unixtime + description: Unix timestamp (seconds) for when the version was created. name: type: string - description: The name of the function to call. + description: Name of the skill version. + description: + type: string + description: Description of the skill version. + type: object required: - - type + - object + - id + - skill_id + - version + - created_at - name - ToolChoiceMCP: - type: object - title: MCP tool - description: > - Use this option to force the model to call a specific tool on a remote - MCP server. + - description + SkillVersionListResource: properties: - type: + object: type: string enum: - - mcp - description: For MCP tools, the type is always `mcp`. + - list + description: The type of object returned, must be `list`. + default: list x-stainless-const: true - server_label: - type: string - description: | - The label of the MCP server to use. - name: + data: + items: + $ref: '#/components/schemas/SkillVersionResource' + type: array + description: A list of items + first_id: anyOf: - type: string - description: | - The name of the tool to call on the server. + description: The ID of the first item in the list. - type: 'null' - required: - - type - - server_label - ToolChoiceOptions: - type: string - title: Tool choice mode - description: > - Controls which (if any) tool is called by the model. - - - `none` means the model will not call any tool and instead generates a - message. - - - `auto` means the model can pick between generating a message or calling - one or - - more tools. - - - `required` means the model must call one or more tools. - enum: - - none - - auto - - required - ToolChoiceParam: - description: | - How the model should select which tool (or tools) to use when generating - a response. See the `tools` parameter to see how to specify which tools - the model can call. - oneOf: - - $ref: '#/components/schemas/ToolChoiceOptions' - - $ref: '#/components/schemas/ToolChoiceAllowed' - - $ref: '#/components/schemas/ToolChoiceTypes' - - $ref: '#/components/schemas/ToolChoiceFunction' - - $ref: '#/components/schemas/ToolChoiceMCP' - - $ref: '#/components/schemas/ToolChoiceCustom' - - $ref: '#/components/schemas/SpecificApplyPatchParam' - - $ref: '#/components/schemas/SpecificFunctionShellParam' - ToolChoiceTypes: + last_id: + anyOf: + - type: string + description: The ID of the last item in the list. + - type: 'null' + has_more: + type: boolean + description: Whether there are more items available. type: object - title: Hosted tool - description: > - Indicates that the model should use a built-in tool to generate a - response. - - [Learn more about built-in tools](/docs/guides/tools). - properties: - type: - type: string - description: | - The type of hosted tool the model should to use. Learn more about - [built-in tools](/docs/guides/tools). - - Allowed values are: - - `file_search` - - `web_search_preview` - - `computer` - - `computer_use_preview` - - `computer_use` - - `code_interpreter` - - `image_generation` - enum: - - file_search - - web_search_preview - - computer - - computer_use_preview - - computer_use - - web_search_preview_2025_03_11 - - image_generation - - code_interpreter required: - - type - ToolsArray: - type: array - description: > - An array of tools the model may call while generating a response. You - - can specify which tool to use by setting the `tool_choice` parameter. - - - We support the following categories of tools: - - - **Built-in tools**: Tools that are provided by OpenAI that extend the - model's capabilities, like [web search](/docs/guides/tools-web-search) - or [file search](/docs/guides/tools-file-search). Learn more about - [built-in tools](/docs/guides/tools). - - **MCP Tools**: Integrations with third-party systems via custom MCP - servers - or predefined connectors such as Google Drive and SharePoint. Learn more about - [MCP Tools](/docs/guides/tools-connectors-mcp). - - **Function calls (custom tools)**: Functions that are defined by you, - enabling the model to call your own code with strongly typed arguments - and outputs. Learn more about - [function calling](/docs/guides/function-calling). You can also use - custom tools to call your own code. - items: - $ref: '#/components/schemas/Tool' - TranscriptTextDeltaEvent: + - object + - data + - first_id + - last_id + - has_more + CreateSkillVersionBody: + properties: + files: + oneOf: + - items: + type: string + format: binary + type: array + maxItems: 500 + description: Skill files to upload (directory upload) or a single zip file. + - type: string + format: binary + description: Skill zip file to upload. + default: + type: boolean + description: Whether to set this version as the default. type: object - description: >- - Emitted when there is an additional text delta. This is also the first - event emitted when the transcription starts. Only emitted when you - [create a transcription](/docs/api-reference/audio/create-transcription) - with the `Stream` parameter set to `true`. + required: + - files + title: Create skill version request + description: Uploads a new immutable version of a skill. + DeletedSkillVersionResource: properties: - type: + object: type: string - description: | - The type of the event. Always `transcript.text.delta`. enum: - - transcript.text.delta + - skill.version.deleted + default: skill.version.deleted x-stainless-const: true - delta: + deleted: + type: boolean + id: type: string - description: | - The text delta that was additionally transcribed. - logprobs: - type: array - description: > - The log probabilities of the delta. Only included if you [create a - transcription](/docs/api-reference/audio/create-transcription) with - the `include[]` parameter set to `logprobs`. - items: - type: object - properties: - token: - type: string - description: | - The token that was used to generate the log probability. - logprob: - type: number - description: | - The log probability of the token. - bytes: - type: array - items: - type: integer - description: | - The bytes that were used to generate the log probability. - segment_id: + version: type: string - description: > - Identifier of the diarized segment that this delta belongs to. Only - present when using `gpt-4o-transcribe-diarize`. + description: The deleted skill version. + type: object required: - - type - - delta - x-oaiMeta: - name: Stream Event (transcript.text.delta) - group: transcript - example: | - { - "type": "transcript.text.delta", - "delta": " wonderful" - } - TranscriptTextDoneEvent: + - object + - deleted + - id + - version + ChatkitWorkflowTracing: + properties: + enabled: + type: boolean + description: Indicates whether tracing is enabled. + type: object + required: + - enabled + title: Tracing Configuration + description: Controls diagnostic tracing during the session. + ChatkitWorkflow: + properties: + id: + type: string + description: Identifier of the workflow backing the session. + version: + anyOf: + - type: string + description: >- + Specific workflow version used for the session. Defaults to null + when using the latest deployment. + - type: 'null' + state_variables: + anyOf: + - additionalProperties: + oneOf: + - type: string + - type: integer + - type: boolean + - type: number + type: object + description: >- + State variable key-value pairs applied when invoking the + workflow. Defaults to null when no overrides were provided. + x-oaiTypeLabel: map + - type: 'null' + tracing: + $ref: '#/components/schemas/ChatkitWorkflowTracing' + description: Tracing settings applied to the workflow. + type: object + required: + - id + - version + - state_variables + - tracing + title: Workflow + description: Workflow metadata and state returned for the session. + ChatSessionRateLimits: + properties: + max_requests_per_1_minute: + type: integer + description: Maximum allowed requests per one-minute window. + type: object + required: + - max_requests_per_1_minute + title: Rate limits + description: Active per-minute request limit for the session. + ChatSessionStatus: + type: string + enum: + - active + - expired + - cancelled + ChatSessionAutomaticThreadTitling: + properties: + enabled: + type: boolean + description: Whether automatic thread titling is enabled. + type: object + required: + - enabled + title: Automatic thread titling + description: Automatic thread title preferences for the session. + ChatSessionFileUpload: + properties: + enabled: + type: boolean + description: Indicates if uploads are enabled for the session. + max_file_size: + anyOf: + - type: integer + description: Maximum upload size in megabytes. + - type: 'null' + max_files: + anyOf: + - type: integer + description: Maximum number of uploads allowed during the session. + - type: 'null' + type: object + required: + - enabled + - max_file_size + - max_files + title: File upload settings + description: Upload permissions and limits applied to the session. + ChatSessionHistory: + properties: + enabled: + type: boolean + description: Indicates if chat history is persisted for the session. + recent_threads: + anyOf: + - type: integer + description: >- + Number of prior threads surfaced in history views. Defaults to + null when all history is retained. + - type: 'null' type: object - description: >- - Emitted when the transcription is complete. Contains the complete - transcription text. Only emitted when you [create a - transcription](/docs/api-reference/audio/create-transcription) with the - `Stream` parameter set to `true`. + required: + - enabled + - recent_threads + title: History settings + description: History retention preferences returned for the session. + ChatSessionChatkitConfiguration: properties: - type: + automatic_thread_titling: + $ref: '#/components/schemas/ChatSessionAutomaticThreadTitling' + description: Automatic thread titling preferences. + file_upload: + $ref: '#/components/schemas/ChatSessionFileUpload' + description: Upload settings for the session. + history: + $ref: '#/components/schemas/ChatSessionHistory' + description: History retention configuration. + type: object + required: + - automatic_thread_titling + - file_upload + - history + title: ChatKit configuration + description: ChatKit configuration for the session. + ChatSessionResource: + properties: + id: + type: string + description: Identifier for the ChatKit session. + object: type: string - description: | - The type of the event. Always `transcript.text.done`. enum: - - transcript.text.done + - chatkit.session + description: Type discriminator that is always `chatkit.session`. + default: chatkit.session x-stainless-const: true - text: + expires_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the session expires. + client_secret: type: string - description: | - The text that was transcribed. - logprobs: - type: array - description: > - The log probabilities of the individual tokens in the transcription. - Only included if you [create a - transcription](/docs/api-reference/audio/create-transcription) with - the `include[]` parameter set to `logprobs`. - items: - type: object - properties: - token: - type: string - description: | - The token that was used to generate the log probability. - logprob: - type: number - description: | - The log probability of the token. - bytes: - type: array - items: - type: integer - description: | - The bytes that were used to generate the log probability. - usage: - $ref: '#/components/schemas/TranscriptTextUsageTokens' + description: Ephemeral client secret that authenticates session requests. + workflow: + $ref: '#/components/schemas/ChatkitWorkflow' + description: Workflow metadata for the session. + user: + type: string + description: User identifier associated with the session. + rate_limits: + $ref: '#/components/schemas/ChatSessionRateLimits' + description: Resolved rate limit values. + max_requests_per_1_minute: + type: integer + description: Convenience copy of the per-minute request limit. + status: + $ref: '#/components/schemas/ChatSessionStatus' + description: Current lifecycle state of the session. + chatkit_configuration: + $ref: '#/components/schemas/ChatSessionChatkitConfiguration' + description: Resolved ChatKit feature configuration for the session. + type: object required: - - type - - text - x-oaiMeta: - name: Stream Event (transcript.text.done) - group: transcript - example: | - { - "type": "transcript.text.done", - "text": "I see skies of blue and clouds of white, the bright blessed days, the dark sacred nights, and I think to myself, what a wonderful world.", - "usage": { - "type": "tokens", - "input_tokens": 14, - "input_token_details": { - "text_tokens": 10, - "audio_tokens": 4 - }, - "output_tokens": 31, - "total_tokens": 45 - } - } - TranscriptTextSegmentEvent: + - id + - object + - expires_at + - client_secret + - workflow + - user + - rate_limits + - max_requests_per_1_minute + - status + - chatkit_configuration + title: The chat session object + description: Represents a ChatKit session and its resolved configuration. + example: + id: cksess_123 + object: chatkit.session + client_secret: ek_token_123 + expires_at: 1712349876 + workflow: + id: workflow_alpha + version: 2024-10-01T00:00:00.000Z + user: user_789 + rate_limits: + max_requests_per_1_minute: 60 + max_requests_per_1_minute: 60 + status: cancelled + chatkit_configuration: + automatic_thread_titling: + enabled: true + file_upload: + enabled: true + max_file_size: 16 + max_files: 20 + history: + enabled: true + recent_threads: 10 + WorkflowTracingParam: + properties: + enabled: + type: boolean + description: Whether tracing is enabled during the session. Defaults to true. type: object - description: > - Emitted when a diarized transcription returns a completed segment with - speaker information. Only emitted when you [create a - transcription](/docs/api-reference/audio/create-transcription) with - `stream` set to `true` and `response_format` set to `diarized_json`. + required: [] + title: Tracing Configuration + description: Controls diagnostic tracing during the session. + WorkflowParam: properties: - type: - type: string - description: The type of the event. Always `transcript.text.segment`. - enum: - - transcript.text.segment - x-stainless-const: true id: type: string - description: Unique identifier for the segment. - start: - type: number - format: double - description: Start timestamp of the segment in seconds. - end: - type: number - format: double - description: End timestamp of the segment in seconds. - text: - type: string - description: Transcript text for this segment. - speaker: + description: Identifier for the workflow invoked by the session. + version: type: string - description: Speaker label for this segment. + description: >- + Specific workflow version to run. Defaults to the latest deployed + version. + state_variables: + additionalProperties: + oneOf: + - type: string + maxLength: 10485760 + - type: integer + - type: boolean + - type: number + type: object + maxProperties: 64 + description: >- + State variables forwarded to the workflow. Keys may be up to 64 + characters, values must be primitive types, and the map defaults to + an empty object. + x-oaiTypeLabel: map + tracing: + $ref: '#/components/schemas/WorkflowTracingParam' + description: >- + Optional tracing overrides for the workflow invocation. When + omitted, tracing is enabled by default. + type: object required: - - type - id - - start - - end - - text - - speaker - x-oaiMeta: - name: Stream Event (transcript.text.segment) - group: transcript - example: | - { - "type": "transcript.text.segment", - "id": "seg_002", - "start": 5.2, - "end": 12.8, - "text": "Hi, I need help with diarization.", - "speaker": "A" - } - TranscriptTextUsageDuration: - type: object - title: Duration Usage - description: Usage statistics for models billed by audio input duration. + title: Workflow settings + description: Workflow reference and overrides applied to the chat session. + ExpiresAfterParam: properties: - type: + anchor: type: string enum: - - duration - description: The type of the usage object. Always `duration` for this variant. + - created_at + description: >- + Base timestamp used to calculate expiration. Currently fixed to + `created_at`. + default: created_at x-stainless-const: true seconds: - type: number - format: double - description: Duration of the input audio in seconds. + type: integer + maximum: 600 + minimum: 1 + format: int64 + description: Number of seconds after the anchor when the session expires. + type: object required: - - type + - anchor - seconds - TranscriptTextUsageTokens: + title: Expiration overrides + description: Controls when the session expires relative to an anchor timestamp. + RateLimitsParam: + properties: + max_requests_per_1_minute: + type: integer + minimum: 1 + description: >- + Maximum number of requests allowed per minute for the session. + Defaults to 10. type: object - title: Token Usage - description: Usage statistics for models billed by token usage. + required: [] + title: Rate limit overrides + description: Controls request rate limits for the session. + AutomaticThreadTitlingParam: properties: - type: - type: string - enum: - - tokens - description: The type of the usage object. Always `tokens` for this variant. - x-stainless-const: true - input_tokens: + enabled: + type: boolean + description: Enable automatic thread title generation. Defaults to true. + type: object + required: [] + title: Automatic thread titling configuration + description: Controls whether ChatKit automatically generates thread titles. + FileUploadParam: + properties: + enabled: + type: boolean + description: Enable uploads for this session. Defaults to false. + max_file_size: type: integer - description: Number of input tokens billed for this request. - input_token_details: - type: object - description: Details about the input tokens billed for this request. - properties: - text_tokens: - type: integer - description: Number of text tokens billed for this request. - audio_tokens: - type: integer - description: Number of audio tokens billed for this request. - output_tokens: + maximum: 512 + minimum: 1 + description: >- + Maximum size in megabytes for each uploaded file. Defaults to 512 + MB, which is the maximum allowable size. + max_files: type: integer - description: Number of output tokens generated. - total_tokens: + minimum: 1 + description: >- + Maximum number of files that can be uploaded to the session. + Defaults to 10. + type: object + required: [] + title: File upload configuration + description: Controls whether users can upload files. + HistoryParam: + properties: + enabled: + type: boolean + description: >- + Enables chat users to access previous ChatKit threads. Defaults to + true. + recent_threads: type: integer - description: Total number of tokens used (input + output). - required: - - type - - input_tokens - - output_tokens - - total_tokens - TranscriptionChunkingStrategy: + minimum: 1 + description: >- + Number of recent ChatKit threads users have access to. Defaults to + unlimited when unset. type: object - description: >- - Controls how the audio is cut into chunks. When set to `"auto"`, the - - server first normalizes loudness and then uses voice activity detection - (VAD) to - - choose boundaries. `server_vad` object can be provided to tweak VAD - detection - - parameters manually. If unset, the audio is transcribed as a single - block. - oneOf: - - type: string - enum: - - auto - default: - - auto - description: > - Automatically set chunking parameters based on the audio. Must be - set to `"auto"`. - x-stainless-const: true - - $ref: '#/components/schemas/VadConfig' - TranscriptionDiarizedSegment: + required: [] + title: Chat history configuration + description: Controls how much historical context is retained for the session. + ChatkitConfigurationParam: + properties: + automatic_thread_titling: + $ref: '#/components/schemas/AutomaticThreadTitlingParam' + description: >- + Configuration for automatic thread titling. When omitted, automatic + thread titling is enabled by default. + file_upload: + $ref: '#/components/schemas/FileUploadParam' + description: >- + Configuration for upload enablement and limits. When omitted, + uploads are disabled by default (max_files 10, max_file_size 512 + MB). + history: + $ref: '#/components/schemas/HistoryParam' + description: >- + Configuration for chat history retention. When omitted, history is + enabled by default with no limit on recent_threads (null). type: object - description: A segment of diarized transcript text with speaker metadata. + required: [] + title: ChatKit configuration overrides + description: Optional per-session configuration settings for ChatKit behavior. + CreateChatSessionBody: + properties: + workflow: + $ref: '#/components/schemas/WorkflowParam' + description: Workflow that powers the session. + user: + type: string + minLength: 1 + description: >- + A free-form string that identifies your end user; ensures this + Session can access other objects that have the same `user` scope. + expires_after: + $ref: '#/components/schemas/ExpiresAfterParam' + description: >- + Optional override for session expiration timing in seconds from + creation. Defaults to 10 minutes. + rate_limits: + $ref: '#/components/schemas/RateLimitsParam' + description: >- + Optional override for per-minute request limits. When omitted, + defaults to 10. + chatkit_configuration: + $ref: '#/components/schemas/ChatkitConfigurationParam' + description: Optional overrides for ChatKit runtime configuration features + type: object + required: + - workflow + - user + title: Create chat session request + description: Parameters for provisioning a new ChatKit session. + UserMessageInputText: properties: type: type: string - description: | - The type of the segment. Always `transcript.text.segment`. enum: - - transcript.text.segment + - input_text + description: Type discriminator that is always `input_text`. + default: input_text x-stainless-const: true - id: - type: string - description: Unique identifier for the segment. - start: - type: number - format: double - description: Start timestamp of the segment in seconds. - end: - type: number - format: double - description: End timestamp of the segment in seconds. text: type: string - description: Transcript text for this segment. - speaker: - type: string - description: > - Speaker label for this segment. When known speakers are provided, - the label matches `known_speaker_names[]`. Otherwise speakers are - labeled sequentially using capital letters (`A`, `B`, ...). + description: Plain-text content supplied by the user. + type: object required: - type - - id - - start - - end - text - - speaker - TranscriptionInclude: - type: string - enum: - - logprobs - default: [] - TranscriptionSegment: - type: object + title: User message input + description: Text block that a user contributed to the thread. + UserMessageQuotedText: properties: - id: - type: integer - description: Unique identifier of the segment. - seek: - type: integer - description: Seek offset of the segment. - start: - type: number - format: double - description: Start time of the segment in seconds. - end: - type: number - format: double - description: End time of the segment in seconds. - text: + type: type: string - description: Text content of the segment. - tokens: - type: array - items: - type: integer - description: Array of token IDs for the text content. - temperature: - type: number - format: float - description: Temperature parameter used for generating the segment. - avg_logprob: - type: number - format: float - description: >- - Average logprob of the segment. If the value is lower than -1, - consider the logprobs failed. - compression_ratio: - type: number - format: float - description: >- - Compression ratio of the segment. If the value is greater than 2.4, - consider the compression failed. - no_speech_prob: - type: number - format: float - description: >- - Probability of no speech in the segment. If the value is higher than - 1.0 and the `avg_logprob` is below -1, consider this segment silent. + enum: + - quoted_text + description: Type discriminator that is always `quoted_text`. + default: quoted_text + x-stainless-const: true + text: + type: string + description: Quoted text content. + type: object required: - - id - - seek - - start - - end + - type - text - - tokens - - temperature - - avg_logprob - - compression_ratio - - no_speech_prob - TranscriptionWord: + title: User message quoted text + description: Quoted snippet that the user referenced in their message. + AttachmentType: + type: string + enum: + - image + - file + Attachment: + properties: + type: + $ref: '#/components/schemas/AttachmentType' + description: Attachment discriminator. + id: + type: string + description: Identifier for the attachment. + name: + type: string + description: Original display name for the attachment. + mime_type: + type: string + description: MIME type of the attachment. + preview_url: + anyOf: + - type: string + format: uri + description: Preview URL for rendering the attachment inline. + - type: 'null' type: object + required: + - type + - id + - name + - mime_type + - preview_url + title: Attachment + description: Attachment metadata included on thread items. + ToolChoice: properties: - word: + id: type: string - description: The text content of the word. - start: - type: number - format: double - description: Start time of the word in seconds. - end: - type: number - format: double - description: End time of the word in seconds. + description: Identifier of the requested tool. + type: object required: - - word - - start - - end - TruncationObject: + - id + title: Tool choice + description: Tool selection that the assistant should honor when executing the item. + InferenceOptions: + properties: + tool_choice: + anyOf: + - $ref: '#/components/schemas/ToolChoice' + description: >- + Preferred tool to invoke. Defaults to null when ChatKit should + auto-select. + - type: 'null' + model: + anyOf: + - type: string + description: >- + Model name that generated the response. Defaults to null when + using the session default. + - type: 'null' type: object - title: Thread Truncation Controls - description: >- - Controls for how a thread will be truncated prior to the run. Use this - to control the initial context window of the run. + required: + - tool_choice + - model + title: Inference options + description: Model and tool overrides applied when generating the assistant response. + UserMessageItem: properties: + id: + type: string + description: Identifier of the thread item. + object: + type: string + enum: + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item + x-stainless-const: true + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. type: type: string - description: >- - The truncation strategy to use for the thread. The default is - `auto`. If set to `last_messages`, the thread will be truncated to - the n most recent messages in the thread. When set to `auto`, - messages in the middle of the thread will be dropped to fit the - context length of the model, `max_prompt_tokens`. enum: - - auto - - last_messages - last_messages: + - chatkit.user_message + default: chatkit.user_message + x-stainless-const: true + content: + items: + oneOf: + - $ref: '#/components/schemas/UserMessageInputText' + - $ref: '#/components/schemas/UserMessageQuotedText' + description: Content blocks that comprise a user message. + discriminator: + propertyName: type + type: array + description: Ordered content elements supplied by the user. + attachments: + items: + $ref: '#/components/schemas/Attachment' + type: array + description: >- + Attachments associated with the user message. Defaults to an empty + list. + inference_options: anyOf: - - type: integer + - $ref: '#/components/schemas/InferenceOptions' description: >- - The number of most recent messages from the thread when - constructing the context for the run. - minimum: 1 + Inference overrides applied to the message. Defaults to null + when unset. - type: 'null' + type: object required: + - id + - object + - created_at + - thread_id - type - UpdateGroupBody: - type: object - description: Request payload for updating the details of an existing group. + - content + - attachments + - inference_options + title: User Message Item + description: User-authored messages within a thread. + FileAnnotationSource: properties: - name: + type: type: string - description: New display name for the group. - minLength: 1 - maxLength: 255 - required: - - name - x-oaiMeta: - example: | - { - "name": "Escalations" - } - UpdateOrganizationDataRetentionBody: + enum: + - file + description: Type discriminator that is always `file`. + default: file + x-stainless-const: true + filename: + type: string + description: Filename referenced by the annotation. type: object - description: Parameters for updating organization data retention controls. + required: + - type + - filename + title: File annotation source + description: Attachment source referenced by an annotation. + FileAnnotation: properties: - retention_type: + type: type: string enum: - - zero_data_retention - - modified_abuse_monitoring - - enhanced_zero_data_retention - - enhanced_modified_abuse_monitoring - description: The desired organization data retention type. - required: - - retention_type - UpdateProjectDataRetentionBody: + - file + description: Type discriminator that is always `file` for this annotation. + default: file + x-stainless-const: true + source: + $ref: '#/components/schemas/FileAnnotationSource' + description: File attachment referenced by the annotation. type: object - description: Parameters for updating project data retention controls. + required: + - type + - source + title: File annotation + description: Annotation that references an uploaded file. + UrlAnnotationSource: properties: - retention_type: + type: type: string enum: - - organization_default - - none - - zero_data_retention - - modified_abuse_monitoring - - enhanced_zero_data_retention - - enhanced_modified_abuse_monitoring - description: The desired project data retention type. - required: - - retention_type - UpdateProjectServiceAccountBody: + - url + description: Type discriminator that is always `url`. + default: url + x-stainless-const: true + url: + type: string + format: uri + description: URL referenced by the annotation. type: object - description: Parameters for updating a project service account. + required: + - type + - url + title: URL annotation source + description: URL backing an annotation entry. + UrlAnnotation: properties: - name: - type: string - description: The updated service account name. - role: + type: type: string enum: - - member - - owner - description: The updated service account role. - UpdateVectorStoreFileAttributesRequest: + - url + description: Type discriminator that is always `url` for this annotation. + default: url + x-stainless-const: true + source: + $ref: '#/components/schemas/UrlAnnotationSource' + description: URL referenced by the annotation. type: object - additionalProperties: false - properties: - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' required: - - attributes - x-oaiMeta: - name: Update vector store file attributes request - UpdateVectorStoreRequest: - type: object - additionalProperties: false + - type + - source + title: URL annotation + description: Annotation that references a URL. + ResponseOutputText: properties: - name: - description: The name of the vector store. + type: type: string - nullable: true - expires_after: - allOf: - - $ref: '#/components/schemas/VectorStoreExpirationAfter' - - nullable: true - metadata: - $ref: '#/components/schemas/Metadata' - UpdateVoiceConsentRequest: - type: object - additionalProperties: false - properties: - name: + enum: + - output_text + description: Type discriminator that is always `output_text`. + default: output_text + x-stainless-const: true + text: type: string - description: The updated label for this consent recording. - required: - - name - Upload: + description: Assistant generated text. + annotations: + items: + oneOf: + - $ref: '#/components/schemas/FileAnnotation' + - $ref: '#/components/schemas/UrlAnnotation' + description: Annotation object describing a cited source. + discriminator: + propertyName: type + type: array + description: Ordered list of annotations attached to the response text. type: object - title: Upload - description: | - The Upload object can accept byte chunks in the form of Parts. + required: + - type + - text + - annotations + title: Assistant message content + description: Assistant response text accompanied by optional annotations. + AssistantMessageItem: properties: id: type: string - description: >- - The Upload unique identifier, which can be referenced in API - endpoints. + description: Identifier of the thread item. + object: + type: string + enum: + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item + x-stainless-const: true created_at: type: integer format: unixtime - description: The Unix timestamp (in seconds) for when the Upload was created. - filename: + description: Unix timestamp (in seconds) for when the item was created. + thread_id: type: string - description: The name of the file to be uploaded. - bytes: - type: integer - description: The intended number of bytes to be uploaded. - purpose: + description: Identifier of the parent thread. + type: type: string - description: >- - The intended purpose of the file. [Please refer - here](/docs/api-reference/files/object#files/object-purpose) for - acceptable values. - status: + enum: + - chatkit.assistant_message + description: Type discriminator that is always `chatkit.assistant_message`. + default: chatkit.assistant_message + x-stainless-const: true + content: + items: + $ref: '#/components/schemas/ResponseOutputText' + type: array + description: Ordered assistant response segments. + type: object + required: + - id + - object + - created_at + - thread_id + - type + - content + title: Assistant message + description: Assistant-authored message within a thread. + WidgetMessageItem: + properties: + id: + type: string + description: Identifier of the thread item. + object: type: string - description: The status of the Upload. enum: - - pending - - completed - - cancelled - - expired - expires_at: + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item + x-stainless-const: true + created_at: type: integer format: unixtime - description: The Unix timestamp (in seconds) for when the Upload will expire. - object: + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. + type: type: string - description: The object type, which is always "upload". enum: - - upload + - chatkit.widget + description: Type discriminator that is always `chatkit.widget`. + default: chatkit.widget x-stainless-const: true - file: - allOf: - - $ref: '#/components/schemas/OpenAIFile' - - nullable: true - description: The ready File object after the Upload is completed. + widget: + type: string + description: Serialized widget payload rendered in the UI. + type: object required: - - bytes - - created_at - - expires_at - - filename - id - - purpose - - status - x-oaiMeta: - name: The upload object - example: | - { - "id": "upload_abc123", - "object": "upload", - "bytes": 2147483648, - "created_at": 1719184911, - "filename": "training_examples.jsonl", - "purpose": "fine-tune", - "status": "completed", - "expires_at": 1719127296, - "file": { - "id": "file-xyz321", - "object": "file", - "bytes": 2147483648, - "created_at": 1719186911, - "filename": "training_examples.jsonl", - "purpose": "fine-tune", - } - } - UploadCertificateRequest: - type: object + - object + - created_at + - thread_id + - type + - widget + title: Widget message + description: Thread item that renders a widget payload. + ClientToolCallStatus: + type: string + enum: + - in_progress + - completed + ClientToolCallItem: properties: + id: + type: string + description: Identifier of the thread item. + object: + type: string + enum: + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item + x-stainless-const: true + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. + type: + type: string + enum: + - chatkit.client_tool_call + description: Type discriminator that is always `chatkit.client_tool_call`. + default: chatkit.client_tool_call + x-stainless-const: true + status: + $ref: '#/components/schemas/ClientToolCallStatus' + description: Execution status for the tool call. + call_id: + type: string + description: Identifier for the client tool call. name: type: string - description: An optional name for the certificate - certificate: + description: Tool name that was invoked. + arguments: type: string - description: The certificate content in PEM format - required: - - certificate - UploadPart: + description: JSON-encoded arguments that were sent to the tool. + output: + anyOf: + - type: string + description: >- + JSON-encoded output captured from the tool. Defaults to null + while execution is in progress. + - type: 'null' type: object - title: UploadPart - description: > - The upload Part represents a chunk of bytes we can add to an Upload - object. + required: + - id + - object + - created_at + - thread_id + - type + - status + - call_id + - name + - arguments + - output + title: Client tool call + description: Record of a client side tool invocation initiated by the assistant. + TaskType: + type: string + enum: + - custom + - thought + TaskItem: properties: id: type: string - description: >- - The upload Part unique identifier, which can be referenced in API - endpoints. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the Part was created. - upload_id: - type: string - description: The ID of the Upload object that this Part was added to. + description: Identifier of the thread item. object: type: string - description: The object type, which is always `upload.part`. enum: - - upload.part + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item x-stainless-const: true - required: - - created_at - - id - - object - - upload_id - x-oaiMeta: - name: The upload part object - example: | - { - "id": "part_def456", - "object": "upload.part", - "created_at": 1719186911, - "upload_id": "upload_abc123" - } - UsageAudioSpeechesResult: - type: object - description: The aggregated audio speeches usage details of the specific time bucket. - properties: - object: + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. + type: type: string enum: - - organization.usage.audio_speeches.result + - chatkit.task + description: Type discriminator that is always `chatkit.task`. + default: chatkit.task x-stainless-const: true - characters: - type: integer - description: The number of characters processed. - num_model_requests: - type: integer - description: The count of requests made to the model. - project_id: + task_type: + $ref: '#/components/schemas/TaskType' + description: Subtype for the task. + heading: anyOf: - type: string description: >- - When `group_by=project_id`, this field provides the project ID - of the grouped usage result. + Optional heading for the task. Defaults to null when not + provided. - type: 'null' - user_id: + summary: anyOf: - type: string description: >- - When `group_by=user_id`, this field provides the user ID of the - grouped usage result. + Optional summary that describes the task. Defaults to null when + omitted. - type: 'null' - api_key_id: + type: object + required: + - id + - object + - created_at + - thread_id + - type + - task_type + - heading + - summary + title: Task item + description: Task emitted by the workflow to show progress and status updates. + TaskGroupTask: + properties: + type: + $ref: '#/components/schemas/TaskType' + description: Subtype for the grouped task. + heading: anyOf: - type: string description: >- - When `group_by=api_key_id`, this field provides the API key ID - of the grouped usage result. + Optional heading for the grouped task. Defaults to null when not + provided. - type: 'null' - model: + summary: anyOf: - type: string description: >- - When `group_by=model`, this field provides the model name of the - grouped usage result. + Optional summary that describes the grouped task. Defaults to + null when omitted. - type: 'null' - required: - - object - - characters - - num_model_requests - x-oaiMeta: - name: Audio speeches usage object - example: | - { - "object": "organization.usage.audio_speeches.result", - "characters": 45, - "num_model_requests": 1, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "tts-1" - } - UsageAudioTranscriptionsResult: type: object - description: >- - The aggregated audio transcriptions usage details of the specific time - bucket. + required: + - type + - heading + - summary + title: Task group task + description: Task entry that appears within a TaskGroup. + TaskGroupItem: properties: + id: + type: string + description: Identifier of the thread item. object: type: string enum: - - organization.usage.audio_transcriptions.result + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item x-stainless-const: true - seconds: - type: integer - format: int64 - description: The number of seconds processed. - num_model_requests: + created_at: type: integer - description: The count of requests made to the model. - project_id: + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. + type: + type: string + enum: + - chatkit.task_group + description: Type discriminator that is always `chatkit.task_group`. + default: chatkit.task_group + x-stainless-const: true + tasks: + items: + $ref: '#/components/schemas/TaskGroupTask' + type: array + description: Tasks included in the group. + type: object + required: + - id + - object + - created_at + - thread_id + - type + - tasks + title: Task group + description: Collection of workflow tasks grouped together in the thread. + ThreadItem: + oneOf: + - $ref: '#/components/schemas/UserMessageItem' + - $ref: '#/components/schemas/AssistantMessageItem' + - $ref: '#/components/schemas/WidgetMessageItem' + - $ref: '#/components/schemas/ClientToolCallItem' + - $ref: '#/components/schemas/TaskItem' + - $ref: '#/components/schemas/TaskGroupItem' + title: The thread item + discriminator: + propertyName: type + ThreadItemListResource: + properties: + object: + type: string + enum: + - list + description: The type of object returned, must be `list`. + default: list + x-stainless-const: true + data: + items: + $ref: '#/components/schemas/ThreadItem' + type: array + description: A list of items + first_id: anyOf: - type: string - description: >- - When `group_by=project_id`, this field provides the project ID - of the grouped usage result. + description: The ID of the first item in the list. - type: 'null' - user_id: + last_id: anyOf: - type: string - description: >- - When `group_by=user_id`, this field provides the user ID of the - grouped usage result. + description: The ID of the last item in the list. - type: 'null' - api_key_id: + has_more: + type: boolean + description: Whether there are more items available. + type: object + required: + - object + - data + - first_id + - last_id + - has_more + title: Thread Items + description: A paginated list of thread items rendered for the ChatKit API. + ActiveStatus: + properties: + type: + type: string + enum: + - active + description: Status discriminator that is always `active`. + default: active + x-stainless-const: true + type: object + required: + - type + title: Active thread status + description: Indicates that a thread is active. + LockedStatus: + properties: + type: + type: string + enum: + - locked + description: Status discriminator that is always `locked`. + default: locked + x-stainless-const: true + reason: anyOf: - type: string description: >- - When `group_by=api_key_id`, this field provides the API key ID - of the grouped usage result. + Reason that the thread was locked. Defaults to null when no + reason is recorded. - type: 'null' - model: + type: object + required: + - type + - reason + title: Locked thread status + description: Indicates that a thread is locked and cannot accept new input. + ClosedStatus: + properties: + type: + type: string + enum: + - closed + description: Status discriminator that is always `closed`. + default: closed + x-stainless-const: true + reason: anyOf: - type: string description: >- - When `group_by=model`, this field provides the model name of the - grouped usage result. + Reason that the thread was closed. Defaults to null when no + reason is recorded. - type: 'null' - required: - - object - - seconds - - num_model_requests - x-oaiMeta: - name: Audio transcriptions usage object - example: | - { - "object": "organization.usage.audio_transcriptions.result", - "seconds": 10, - "num_model_requests": 1, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "tts-1" - } - UsageCodeInterpreterSessionsResult: type: object - description: >- - The aggregated code interpreter sessions usage details of the specific - time bucket. + required: + - type + - reason + title: Closed thread status + description: Indicates that a thread has been closed. + ThreadResource: properties: + id: + type: string + description: Identifier of the thread. object: type: string enum: - - organization.usage.code_interpreter_sessions.result + - chatkit.thread + description: Type discriminator that is always `chatkit.thread`. + default: chatkit.thread x-stainless-const: true - num_sessions: + created_at: type: integer - description: The number of code interpreter sessions. - project_id: + format: unixtime + description: Unix timestamp (in seconds) for when the thread was created. + title: anyOf: - type: string description: >- - When `group_by=project_id`, this field provides the project ID - of the grouped usage result. + Optional human-readable title for the thread. Defaults to null + when no title has been generated. - type: 'null' + status: + oneOf: + - $ref: '#/components/schemas/ActiveStatus' + - $ref: '#/components/schemas/LockedStatus' + - $ref: '#/components/schemas/ClosedStatus' + description: >- + Current status for the thread. Defaults to `active` for newly + created threads. + discriminator: + propertyName: type + user: + type: string + description: Free-form string that identifies your end user who owns the thread. + type: object required: + - id - object - - num_sessions - x-oaiMeta: - name: Code interpreter sessions usage object - example: | - { - "object": "organization.usage.code_interpreter_sessions.result", - "num_sessions": 1, - "project_id": "proj_abc" - } - UsageCompletionsResult: + - created_at + - title + - status + - user + title: The thread object + description: Represents a ChatKit thread and its current status. + example: + id: cthr_def456 + object: chatkit.thread + created_at: 1712345600 + title: Demo feedback + status: + type: active + user: user_456 + DeletedThreadResource: + properties: + id: + type: string + description: Identifier of the deleted thread. + object: + type: string + enum: + - chatkit.thread.deleted + description: Type discriminator that is always `chatkit.thread.deleted`. + default: chatkit.thread.deleted + x-stainless-const: true + deleted: + type: boolean + description: Indicates that the thread has been deleted. type: object - description: The aggregated completions usage details of the specific time bucket. + required: + - id + - object + - deleted + title: Deleted thread + description: Confirmation payload returned after deleting a thread. + ThreadListResource: properties: object: type: string enum: - - organization.usage.completions.result + - list + description: The type of object returned, must be `list`. + default: list x-stainless-const: true - input_tokens: - type: integer - description: >- - The aggregated number of text input tokens used, including cached - tokens. For customers subscribe to scale tier, this includes scale - tier tokens. - input_cached_tokens: - type: integer - description: >- - The aggregated number of text input tokens that has been cached from - previous requests. For customers subscribe to scale tier, this - includes scale tier tokens. - output_tokens: - type: integer - description: >- - The aggregated number of text output tokens used. For customers - subscribe to scale tier, this includes scale tier tokens. - input_audio_tokens: - type: integer - description: >- - The aggregated number of audio input tokens used, including cached - tokens. - output_audio_tokens: - type: integer - description: The aggregated number of audio output tokens used. - num_model_requests: - type: integer - description: The count of requests made to the model. - project_id: - anyOf: - - type: string - description: >- - When `group_by=project_id`, this field provides the project ID - of the grouped usage result. - - type: 'null' - user_id: - anyOf: - - type: string - description: >- - When `group_by=user_id`, this field provides the user ID of the - grouped usage result. - - type: 'null' - api_key_id: - anyOf: - - type: string - description: >- - When `group_by=api_key_id`, this field provides the API key ID - of the grouped usage result. - - type: 'null' - model: + data: + items: + $ref: '#/components/schemas/ThreadResource' + type: array + description: A list of items + first_id: anyOf: - type: string - description: >- - When `group_by=model`, this field provides the model name of the - grouped usage result. - - type: 'null' - batch: - anyOf: - - type: boolean - description: >- - When `group_by=batch`, this field tells whether the grouped - usage result is batch or not. + description: The ID of the first item in the list. - type: 'null' - service_tier: + last_id: anyOf: - type: string - description: >- - When `group_by=service_tier`, this field provides the service - tier of the grouped usage result. + description: The ID of the last item in the list. - type: 'null' + has_more: + type: boolean + description: Whether there are more items available. + type: object required: - object - - input_tokens - - output_tokens - - num_model_requests - x-oaiMeta: - name: Completions usage object - example: | - { - "object": "organization.usage.completions.result", - "input_tokens": 5000, - "output_tokens": 1000, - "input_cached_tokens": 4000, - "input_audio_tokens": 300, - "output_audio_tokens": 200, - "num_model_requests": 5, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "gpt-4o-mini-2024-07-18", - "batch": false, - "service_tier": "default" - } - UsageEmbeddingsResult: + - data + - first_id + - last_id + - has_more + title: Threads + description: A paginated list of ChatKit threads. + DragPoint: + properties: + x: + type: integer + description: The x-coordinate. + 'y': + type: integer + description: The y-coordinate. type: object - description: The aggregated embeddings usage details of the specific time bucket. + required: + - x + - 'y' + title: Coordinate + description: 'An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.' + BetaTokenCountsResource: properties: object: type: string enum: - - organization.usage.embeddings.result + - response.input_tokens + default: response.input_tokens x-stainless-const: true input_tokens: type: integer - description: The aggregated number of input tokens used. - num_model_requests: - type: integer - description: The count of requests made to the model. - project_id: + type: object + required: + - object + - input_tokens + title: Token counts + example: + object: response.input_tokens + input_tokens: 123 + BetaTokenCountsBody: + properties: + model: anyOf: - type: string description: >- - When `group_by=project_id`, this field provides the project ID - of the grouped usage result. + Model ID used to generate the response, like `gpt-4o` or `o3`. + OpenAI offers a wide range of models with different + capabilities, performance characteristics, and price points. + Refer to the [model guide](/docs/models) to browse and compare + available models. - type: 'null' - user_id: + input: anyOf: - - type: string + - oneOf: + - type: string + maxLength: 10485760 + description: >- + A text input to the model, equivalent to a text input with + the `user` role. + - items: + $ref: '#/components/schemas/BetaInputItem' + type: array + description: >- + A list of one or many input items to the model, containing + different content types. description: >- - When `group_by=user_id`, this field provides the user ID of the - grouped usage result. + Text, image, or file inputs to the model, used to generate a + response - type: 'null' - api_key_id: + previous_response_id: anyOf: - type: string description: >- - When `group_by=api_key_id`, this field provides the API key ID - of the grouped usage result. + The unique ID of the previous response to the model. Use this to + create multi-turn conversations. Learn more about [conversation + state](/docs/guides/conversation-state). Cannot be used in + conjunction with `conversation`. + example: resp_123 - type: 'null' - model: + tools: anyOf: - - type: string + - items: + $ref: '#/components/schemas/BetaTool' + type: array description: >- - When `group_by=model`, this field provides the model name of the - grouped usage result. + An array of tools the model may call while generating a + response. You can specify which tool to use by setting the + `tool_choice` parameter. - type: 'null' - required: - - object - - input_tokens - - num_model_requests - x-oaiMeta: - name: Embeddings usage object - example: | - { - "object": "organization.usage.embeddings.result", - "input_tokens": 20, - "num_model_requests": 2, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "text-embedding-ada-002-v2" - } - UsageFileSearchCallsResult: - type: object - description: >- - The aggregated file search calls usage details of the specific time - bucket. - properties: - object: - type: string - enum: - - organization.usage.file_searches.result - x-stainless-const: true - num_requests: - type: integer - description: The count of file search calls. - project_id: + text: anyOf: - - type: string - description: >- - When `group_by=project_id`, this field provides the project ID - of the grouped usage result. + - $ref: '#/components/schemas/BetaResponseTextParam' - type: 'null' - user_id: + reasoning: anyOf: - - type: string + - $ref: '#/components/schemas/BetaReasoning' description: >- - When `group_by=user_id`, this field provides the user ID of the - grouped usage result. + **gpt-5 and o-series models only** Configuration options for + [reasoning + models](https://platform.openai.com/docs/guides/reasoning). - type: 'null' - api_key_id: + truncation: + $ref: '#/components/schemas/BetaTruncationEnum' + description: >- + The truncation strategy to use for the model response. - `auto`: If + the input to this Response exceeds the model's context window size, + the model will truncate the response to fit the context window by + dropping items from the beginning of the conversation. - `disabled` + (default): If the input size will exceed the context window size for + a model, the request will fail with a 400 error. + deprecated: true + instructions: anyOf: - type: string description: >- - When `group_by=api_key_id`, this field provides the API key ID - of the grouped usage result. + A system (or developer) message inserted into the model's + context. + + When used along with `previous_response_id`, the instructions + from a previous response will not be carried over to the next + response. This makes it simple to swap out system (or developer) + messages in new responses. - type: 'null' - vector_store_id: + personality: + $ref: '#/components/schemas/BetaPersonalityEnum' + description: >- + A model-owned style preset to apply to this request. Omit this + parameter to use the model's default style. Supported values may + expand over time. Values must be at most 64 characters. + conversation: anyOf: - - type: string - description: >- - When `group_by=vector_store_id`, this field provides the vector - store ID of the grouped usage result. + - $ref: '#/components/schemas/BetaConversationParam' + - type: 'null' + tool_choice: + anyOf: + - $ref: '#/components/schemas/BetaToolChoiceParam' + description: Controls which tool the model should use, if any. + - type: 'null' + parallel_tool_calls: + anyOf: + - type: boolean + description: Whether to allow the model to run tool calls in parallel. - type: 'null' + type: object + required: [] + BetaToolChoiceParam: + description: | + How the model should select which tool (or tools) to use when generating + a response. See the `tools` parameter to see how to specify which tools + the model can call. + oneOf: + - $ref: '#/components/schemas/BetaToolChoiceOptions' + - $ref: '#/components/schemas/BetaToolChoiceAllowed' + - $ref: '#/components/schemas/BetaToolChoiceTypes' + - $ref: '#/components/schemas/BetaToolChoiceFunction' + - $ref: '#/components/schemas/BetaToolChoiceMCP' + - $ref: '#/components/schemas/BetaToolChoiceCustom' + - $ref: '#/components/schemas/BetaSpecificProgrammaticToolCallingParam' + - $ref: '#/components/schemas/BetaSpecificApplyPatchParam' + - $ref: '#/components/schemas/BetaSpecificFunctionShellParam' + BetaSpecificFunctionShellParam: + properties: + type: + type: string + enum: + - shell + description: The tool to call. Always `shell`. + default: shell + x-stainless-const: true + type: object required: - - object - - num_requests - x-oaiMeta: - name: File search calls usage object - example: | - { - "object": "organization.usage.file_searches.result", - "num_requests": 2, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "vector_store_id": "vs_abc" - } - UsageImagesResult: + - type + title: Specific shell tool choice + description: Forces the model to call the shell tool when a tool call is required. + BetaSpecificApplyPatchParam: + properties: + type: + type: string + enum: + - apply_patch + description: The tool to call. Always `apply_patch`. + default: apply_patch + x-stainless-const: true type: object - description: The aggregated images usage details of the specific time bucket. + required: + - type + title: Specific apply patch tool choice + description: >- + Forces the model to call the apply_patch tool when executing a tool + call. + BetaSpecificProgrammaticToolCallingParam: properties: - object: + type: type: string enum: - - organization.usage.images.result + - programmatic_tool_calling + description: The tool to call. Always `programmatic_tool_calling`. + default: programmatic_tool_calling x-stainless-const: true - images: - type: integer - description: The number of images processed. - num_model_requests: - type: integer - description: The count of requests made to the model. - source: - anyOf: - - type: string - description: >- - When `group_by=source`, this field provides the source of the - grouped usage result, possible values are `image.generation`, - `image.edit`, `image.variation`. - - type: 'null' - size: - anyOf: - - type: string - description: >- - When `group_by=size`, this field provides the image size of the - grouped usage result. - - type: 'null' - project_id: + type: object + required: + - type + BetaToolChoiceCustom: + type: object + title: Custom tool + description: | + Use this option to force the model to call a specific custom tool. + properties: + type: + type: string + enum: + - custom + description: For custom tool calling, the type is always `custom`. + x-stainless-const: true + name: + type: string + description: The name of the custom tool to call. + required: + - type + - name + BetaToolChoiceMCP: + type: object + title: MCP tool + description: > + Use this option to force the model to call a specific tool on a remote + MCP server. + properties: + type: + type: string + enum: + - mcp + description: For MCP tools, the type is always `mcp`. + x-stainless-const: true + server_label: + type: string + description: | + The label of the MCP server to use. + name: anyOf: - type: string - description: >- - When `group_by=project_id`, this field provides the project ID - of the grouped usage result. + description: | + The name of the tool to call on the server. - type: 'null' - user_id: + required: + - type + - server_label + BetaToolChoiceFunction: + type: object + title: Function tool + description: | + Use this option to force the model to call a specific function. + properties: + type: + type: string + enum: + - function + description: For function calling, the type is always `function`. + x-stainless-const: true + name: + type: string + description: The name of the function to call. + required: + - type + - name + BetaToolChoiceTypes: + type: object + title: Hosted tool + description: > + Indicates that the model should use a built-in tool to generate a + response. + + [Learn more about built-in tools](/docs/guides/tools). + properties: + type: + type: string + description: | + The type of hosted tool the model should to use. Learn more about + [built-in tools](/docs/guides/tools). + + Allowed values are: + - `file_search` + - `web_search_preview` + - `computer` + - `computer_use_preview` + - `computer_use` + - `code_interpreter` + - `image_generation` + enum: + - file_search + - web_search_preview + - computer + - computer_use_preview + - computer_use + - web_search_preview_2025_03_11 + - image_generation + - code_interpreter + required: + - type + BetaToolChoiceAllowed: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + properties: + type: + type: string + enum: + - allowed_tools + description: Allowed tool configuration type. Always `allowed_tools`. + x-stainless-const: true + mode: + type: string + enum: + - auto + - required + description: > + Constrains the tools available to the model to a pre-defined set. + + + `auto` allows the model to pick from among the allowed tools and + generate a + + message. + + + `required` requires the model to call one or more of the allowed + tools. + tools: + type: array + description: | + A list of tool definitions that the model should be allowed to call. + + For the Responses API, the list of tool definitions might look like: + ```json + [ + { "type": "function", "name": "get_weather" }, + { "type": "mcp", "server_label": "deepwiki" }, + { "type": "image_generation" } + ] + ``` + items: + type: object + description: | + A tool definition that the model should be allowed to call. + additionalProperties: true + x-oaiExpandable: false + required: + - type + - mode + - tools + BetaToolChoiceOptions: + type: string + title: Tool choice mode + description: > + Controls which (if any) tool is called by the model. + + + `none` means the model will not call any tool and instead generates a + message. + + + `auto` means the model can pick between generating a message or calling + one or + + more tools. + + + `required` means the model must call one or more tools. + enum: + - none + - auto + - required + BetaConversationParam: + description: > + The conversation that this response belongs to. Items from this + conversation are prepended to `input_items` for this response request. + + Input items and output items from this response are automatically added + to this conversation after this response completes. + default: null + oneOf: + - type: string + title: Conversation ID + description: | + The unique ID of the conversation. + - $ref: '#/components/schemas/BetaConversationParam-2' + BetaConversationParam-2: + properties: + id: + type: string + description: The unique ID of the conversation. + example: conv_123 + type: object + required: + - id + title: Conversation object + description: The conversation that this response belongs to. + BetaPersonalityEnum: + anyOf: + - type: string + - type: string + enum: + - friendly + - pragmatic + BetaTruncationEnum: + type: string + enum: + - auto + - disabled + BetaReasoning: + type: object + description: | + **gpt-5 and o-series models only** + + Configuration options for + [reasoning models](https://platform.openai.com/docs/guides/reasoning). + title: Reasoning + properties: + mode: + $ref: '#/components/schemas/BetaReasoningModeEnum' + description: | + Controls the reasoning execution mode for the request. + + When returned on a response, this is the effective execution mode. + effort: + $ref: '#/components/schemas/BetaReasoningEffort' + summary: anyOf: - type: string - description: >- - When `group_by=user_id`, this field provides the user ID of the - grouped usage result. + description: > + A summary of the reasoning performed by the model. This can be + + useful for debugging and understanding the model's reasoning + process. + + One of `auto`, `concise`, or `detailed`. + + + `concise` is supported for `computer-use-preview` models and all + reasoning models after `gpt-5`. + enum: + - auto + - concise + - detailed - type: 'null' - api_key_id: + context: anyOf: - type: string - description: >- - When `group_by=api_key_id`, this field provides the API key ID - of the grouped usage result. + description: > + Controls which reasoning items are rendered back to the model on + later turns. + + When returned on a response, this is the effective reasoning + context mode + + used for the response. + enum: + - auto + - current_turn + - all_turns - type: 'null' - model: + generate_summary: anyOf: - type: string - description: >- - When `group_by=model`, this field provides the model name of the - grouped usage result. + deprecated: true + description: > + **Deprecated:** use `summary` instead. + + + A summary of the reasoning performed by the model. This can be + + useful for debugging and understanding the model's reasoning + process. + + One of `auto`, `concise`, or `detailed`. + enum: + - auto + - concise + - detailed - type: 'null' - required: - - object - - images - - num_model_requests - x-oaiMeta: - name: Images usage object - example: | - { - "object": "organization.usage.images.result", - "images": 2, - "num_model_requests": 2, - "size": "1024x1024", - "source": "image.generation", - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "dall-e-3" - } - UsageModerationsResult: + BetaReasoningEffort: + anyOf: + - type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + - max + default: medium + description: > + Constrains effort on reasoning for reasoning models. Currently + supported + + values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and + `max`. + + Reducing reasoning effort can result in faster responses and fewer + tokens + + used on reasoning in a response. Not all reasoning models support + every + + value. See the + + [reasoning guide](https://platform.openai.com/docs/guides/reasoning) + + for model-specific support. + - type: 'null' + BetaReasoningModeEnum: + anyOf: + - type: string + - type: string + enum: + - standard + - pro + BetaResponseTextParam: + type: object + description: | + Configuration options for a text response from the model. Can be plain + text or structured JSON data. Learn more: + - [Text inputs and outputs](/docs/guides/text) + - [Structured Outputs](/docs/guides/structured-outputs) + properties: + format: + $ref: '#/components/schemas/BetaTextResponseFormatConfiguration' + verbosity: + $ref: '#/components/schemas/BetaVerbosity' + BetaVerbosity: + anyOf: + - type: string + enum: + - low + - medium + - high + default: medium + description: > + Constrains the verbosity of the model's response. Lower values will + result in + + more concise responses, while higher values will result in more + verbose responses. + + Currently supported values are `low`, `medium`, and `high`. + - type: 'null' + BetaTextResponseFormatConfiguration: + description: > + An object specifying the format that the model must output. + + + Configuring `{ "type": "json_schema" }` enables Structured Outputs, + + which ensures the model will match your supplied JSON schema. Learn more + in the + + [Structured Outputs guide](/docs/guides/structured-outputs). + + + The default format is `{ "type": "text" }` with no additional options. + + + **Not recommended for gpt-4o and newer models:** + + + Setting to `{ "type": "json_object" }` enables the older JSON mode, + which + + ensures the message the model generates is valid JSON. Using + `json_schema` + + is preferred for models that support it. + oneOf: + - $ref: '#/components/schemas/BetaResponseFormatText' + - $ref: '#/components/schemas/BetaTextResponseFormatJsonSchema' + - $ref: '#/components/schemas/BetaResponseFormatJsonObject' + BetaResponseFormatJsonObject: type: object - description: The aggregated moderations usage details of the specific time bucket. + title: JSON object + description: > + JSON object response format. An older method of generating JSON + responses. + + Using `json_schema` is recommended for models that support it. Note that + the + + model will not generate JSON without a system or user message + instructing it + + to do so. properties: - object: + type: type: string + description: The type of response format being defined. Always `json_object`. enum: - - organization.usage.moderations.result + - json_object x-stainless-const: true - input_tokens: - type: integer - description: The aggregated number of input tokens used. - num_model_requests: - type: integer - description: The count of requests made to the model. - project_id: - anyOf: - - type: string - description: >- - When `group_by=project_id`, this field provides the project ID - of the grouped usage result. - - type: 'null' - user_id: - anyOf: - - type: string - description: >- - When `group_by=user_id`, this field provides the user ID of the - grouped usage result. - - type: 'null' - api_key_id: - anyOf: - - type: string - description: >- - When `group_by=api_key_id`, this field provides the API key ID - of the grouped usage result. - - type: 'null' - model: - anyOf: - - type: string - description: >- - When `group_by=model`, this field provides the model name of the - grouped usage result. - - type: 'null' required: - - object - - input_tokens - - num_model_requests - x-oaiMeta: - name: Moderations usage object - example: | - { - "object": "organization.usage.moderations.result", - "input_tokens": 20, - "num_model_requests": 2, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "text-moderation" - } - UsageResponse: + - type + BetaTextResponseFormatJsonSchema: type: object + title: JSON schema + description: | + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](/docs/guides/structured-outputs). properties: - object: + type: type: string + description: The type of response format being defined. Always `json_schema`. enum: - - page + - json_schema x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/UsageTimeBucket' - has_more: - type: boolean - next_page: + description: + type: string + description: > + A description of what the response format is for, used by the model + to + + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/BetaResponseFormatJsonSchemaSchema' + strict: anyOf: - - type: string + - type: boolean + default: false + description: > + Whether to enable strict schema adherence when generating the + output. + + If set to true, the model will always follow the exact schema + defined + + in the `schema` field. Only a subset of JSON Schema is supported + when + + `strict` is `true`. To learn more, read the [Structured Outputs + + guide](/docs/guides/structured-outputs). - type: 'null' required: - - object - - data - - has_more - - next_page - UsageTimeBucket: + - type + - schema + - name + BetaResponseFormatJsonSchemaSchema: + type: object + title: JSON schema + description: | + The schema for the response format, described as a JSON Schema object. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + BetaResponseFormatText: type: object + title: Text + description: | + Default response format. Used to generate text responses. properties: - object: + type: type: string + description: The type of response format being defined. Always `text`. enum: - - bucket + - text x-stainless-const: true - start_time: - type: integer - end_time: - type: integer - results: - type: array - items: - oneOf: - - $ref: '#/components/schemas/UsageCompletionsResult' - - $ref: '#/components/schemas/UsageEmbeddingsResult' - - $ref: '#/components/schemas/UsageModerationsResult' - - $ref: '#/components/schemas/UsageImagesResult' - - $ref: '#/components/schemas/UsageAudioSpeechesResult' - - $ref: '#/components/schemas/UsageAudioTranscriptionsResult' - - $ref: '#/components/schemas/UsageVectorStoresResult' - - $ref: '#/components/schemas/UsageCodeInterpreterSessionsResult' - - $ref: '#/components/schemas/UsageFileSearchCallsResult' - - $ref: '#/components/schemas/UsageWebSearchCallsResult' - - $ref: '#/components/schemas/CostsResult' - discriminator: - propertyName: object required: - - object - - start_time - - end_time - - results - UsageVectorStoresResult: - type: object - description: The aggregated vector stores usage details of the specific time bucket. + - type + BetaTool: + description: | + A tool that can be used to generate a response. + discriminator: + propertyName: type + oneOf: + - $ref: '#/components/schemas/BetaFunctionTool' + - $ref: '#/components/schemas/BetaFileSearchTool' + - $ref: '#/components/schemas/BetaComputerTool' + - $ref: '#/components/schemas/BetaComputerUsePreviewTool' + - $ref: '#/components/schemas/BetaWebSearchTool' + - $ref: '#/components/schemas/BetaMCPTool' + - $ref: '#/components/schemas/BetaCodeInterpreterTool' + - $ref: '#/components/schemas/BetaProgrammaticToolCallingParam' + - $ref: '#/components/schemas/BetaImageGenTool' + - $ref: '#/components/schemas/BetaLocalShellToolParam' + - $ref: '#/components/schemas/BetaFunctionShellToolParam' + - $ref: '#/components/schemas/BetaCustomToolParam' + - $ref: '#/components/schemas/BetaNamespaceToolParam' + - $ref: '#/components/schemas/BetaToolSearchToolParam' + - $ref: '#/components/schemas/BetaWebSearchPreviewTool' + - $ref: '#/components/schemas/BetaApplyPatchToolParam' + BetaApplyPatchToolParam: properties: - object: + type: type: string enum: - - organization.usage.vector_stores.result + - apply_patch + description: The type of the tool. Always `apply_patch`. + default: apply_patch x-stainless-const: true - usage_bytes: - type: integer - description: The vector stores usage in bytes. - project_id: + allowed_callers: anyOf: - - type: string - description: >- - When `group_by=project_id`, this field provides the project ID - of the grouped usage result. + - items: + $ref: '#/components/schemas/BetaCallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). - type: 'null' - required: - - object - - usage_bytes - x-oaiMeta: - name: Vector stores usage object - example: | - { - "object": "organization.usage.vector_stores.result", - "usage_bytes": 1024, - "project_id": "proj_abc" - } - UsageWebSearchCallsResult: type: object + required: + - type + title: Apply patch tool description: >- - The aggregated web search calls usage details of the specific time - bucket. + Allows the assistant to create, delete, or update files using unified + diffs. + BetaCallableToolAllowedCaller: + type: string + enum: + - direct + - programmatic + BetaWebSearchPreviewTool: properties: - object: + type: type: string enum: - - organization.usage.web_searches.result + - web_search_preview + - web_search_preview_2025_03_11 + description: >- + The type of the web search tool. One of `web_search_preview` or + `web_search_preview_2025_03_11`. + default: web_search_preview x-stainless-const: true - num_model_requests: - type: integer - description: The count of model requests. - num_requests: - type: integer - description: The count of web search calls. - project_id: + user_location: anyOf: - - type: string - description: >- - When `group_by=project_id`, this field provides the project ID - of the grouped usage result. + - $ref: '#/components/schemas/BetaApproximateLocation' + description: The user's location. - type: 'null' - user_id: + search_context_size: + $ref: '#/components/schemas/BetaSearchContextSize' + description: >- + High level guidance for the amount of context window space to use + for the search. One of `low`, `medium`, or `high`. `medium` is the + default. + search_content_types: + items: + $ref: '#/components/schemas/BetaSearchContentType' + type: array + type: object + required: + - type + title: Web search preview + description: >- + This tool searches the web for relevant results to use in a response. + Learn more about the [web search + tool](https://platform.openai.com/docs/guides/tools-web-search). + BetaSearchContentType: + type: string + enum: + - text + - image + BetaSearchContextSize: + type: string + enum: + - low + - medium + - high + BetaApproximateLocation: + properties: + type: + type: string + enum: + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: anyOf: - type: string description: >- - When `group_by=user_id`, this field provides the user ID of the - grouped usage result. + The two-letter [ISO country + code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, + e.g. `US`. - type: 'null' - api_key_id: + region: anyOf: - type: string - description: >- - When `group_by=api_key_id`, this field provides the API key ID - of the grouped usage result. + description: Free text input for the region of the user, e.g. `California`. - type: 'null' - model: + city: anyOf: - type: string - description: >- - When `group_by=model`, this field provides the model name of the - grouped usage result. + description: Free text input for the city of the user, e.g. `San Francisco`. - type: 'null' - context_level: + timezone: anyOf: - type: string description: >- - When `group_by=context_level`, this field provides the search - context size of the grouped usage result. + The [IANA + timezone](https://timeapi.io/documentation/iana-timezones) of + the user, e.g. `America/Los_Angeles`. - type: 'null' - required: - - object - - num_model_requests - - num_requests - x-oaiMeta: - name: Web search calls usage object - example: | - { - "object": "organization.usage.web_searches.result", - "num_model_requests": 2, - "num_requests": 2, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "gpt-4o-mini-2024-07-18", - "context_level": "medium" - } - User: type: object - description: Represents an individual `user` within an organization. + required: + - type + BetaToolSearchToolParam: properties: - object: + type: type: string enum: - - organization.user - description: The object type, which is always `organization.user` + - tool_search + description: The type of the tool. Always `tool_search`. + default: tool_search x-stainless-const: true - id: - type: string - description: The identifier, which can be referenced in API endpoints - name: - anyOf: - - type: string - - type: 'null' - description: The name of the user - email: - anyOf: - - type: string - - type: 'null' - description: The email address of the user - role: - anyOf: - - type: string - - type: 'null' - description: '`owner` or `reader`' - added_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the user was added. - is_default: - type: boolean - description: Whether this is the organization's default user. - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the user was created. - user: - type: object - description: Nested user details. - properties: - object: - type: string - enum: - - user - x-stainless-const: true - id: - type: string - email: - anyOf: - - type: string - - type: 'null' - name: - anyOf: - - type: string - - type: 'null' - picture: - anyOf: - - type: string - - type: 'null' - enabled: - anyOf: - - type: boolean - - type: 'null' - banned: - anyOf: - - type: boolean - - type: 'null' - banned_at: - anyOf: - - type: integer - format: unixtime - - type: 'null' - required: - - object - - id - is_service_account: - type: boolean - description: Whether the user is a service account. - is_scale_tier_authorized_purchaser: - anyOf: - - type: boolean - - type: 'null' - description: Whether the user is an authorized purchaser for Scale Tier. - is_scim_managed: - type: boolean - description: Whether the user is managed through SCIM. - api_key_last_used_at: - anyOf: - - type: integer - format: unixtime - - type: 'null' - description: The Unix timestamp (in seconds) of the user's last API key usage. - technical_level: - anyOf: - - type: string - - type: 'null' - description: The technical level metadata for the user. - developer_persona: + execution: + $ref: '#/components/schemas/BetaToolSearchExecutionType' + description: Whether tool search is executed by the server or by the client. + description: anyOf: - type: string + description: >- + Description shown to the model for a client-executed tool search + tool. - type: 'null' - description: The developer persona metadata for the user. - projects: - anyOf: - - type: object - properties: - object: - type: string - enum: - - list - x-stainless-const: true - data: - type: array - items: - type: object - properties: - id: - anyOf: - - type: string - - type: 'null' - name: - anyOf: - - type: string - - type: 'null' - role: - anyOf: - - type: string - - type: 'null' - required: - - object - - data - - type: 'null' - description: Projects associated with the user, if included. - required: - - object - - id - - added_at - x-oaiMeta: - name: The user object - example: | - { - "object": "organization.user", - "id": "user_abc", - "name": "First Last", - "email": "user@example.com", - "role": "owner", - "added_at": 1711471533 - } - UserDeleteResponse: + parameters: + anyOf: + - $ref: '#/components/schemas/BetaEmptyModelParam' + description: Parameter schema for a client-executed tool search tool. + - type: 'null' + type: object + required: + - type + title: Tool search tool + description: Hosted or BYOT tool search configuration for deferred tools. + BetaEmptyModelParam: + properties: {} type: object + required: [] + BetaToolSearchExecutionType: + type: string + enum: + - server + - client + BetaNamespaceToolParam: properties: - object: + type: type: string enum: - - organization.user.deleted + - namespace + description: The type of the tool. Always `namespace`. + default: namespace x-stainless-const: true - id: + name: type: string - deleted: - type: boolean - required: - - object - - id - - deleted - UserListResource: + minLength: 1 + description: The namespace name used in tool calls (for example, `crm`). + description: + type: string + minLength: 1 + description: A description of the namespace shown to the model. + tools: + items: + oneOf: + - $ref: '#/components/schemas/BetaFunctionToolParam' + - $ref: '#/components/schemas/BetaCustomToolParam' + description: A function or custom tool that belongs to a namespace. + discriminator: + propertyName: type + type: array + minItems: 1 + description: The function/custom tools available inside this namespace. type: object - description: >- - Paginated list of user objects returned when inspecting group - membership. + required: + - type + - name + - description + - tools + title: Namespace + description: Groups function/custom tools under a shared namespace. + BetaCustomToolParam: properties: - object: + type: type: string enum: - - list - description: Always `list`. + - custom + description: The type of the custom tool. Always `custom`. + default: custom x-stainless-const: true - data: - type: array - description: Users in the current page. - items: - $ref: '#/components/schemas/GroupUser' - has_more: - type: boolean - description: Whether more users are available when paginating. - next: + name: + type: string + description: The name of the custom tool, used to identify it in tool calls. + description: + type: string description: >- - Cursor to fetch the next page of results, or `null` when no further - users are available. + Optional description of the custom tool, used to provide more + context. + format: + oneOf: + - $ref: '#/components/schemas/BetaCustomTextFormatParam' + - $ref: '#/components/schemas/BetaCustomGrammarFormatParam' + description: The input format for the custom tool. Default is unconstrained text. + discriminator: + propertyName: type + defer_loading: + type: boolean + description: Whether this tool should be deferred and discovered via tool search. + allowed_callers: anyOf: - - type: string + - items: + $ref: '#/components/schemas/BetaCallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). - type: 'null' - required: - - object - - data - - has_more - - next - x-oaiMeta: - name: Group user list - example: | - { - "object": "list", - "data": [ - { - "id": "user_abc123", - "name": "Ada Lovelace", - "email": "ada@example.com" - } - ], - "has_more": false, - "next": null - } - UserListResponse: type: object + required: + - type + - name + title: Custom tool + description: >- + A custom tool that processes input using a specified format. Learn more + about [custom tools](/docs/guides/function-calling#custom-tools) + BetaCustomGrammarFormatParam: properties: - object: + type: type: string enum: - - list + - grammar + description: Grammar format. Always `grammar`. + default: grammar x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/User' - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean - required: - - object - - data - - has_more - UserRoleAssignment: + syntax: + $ref: '#/components/schemas/BetaGrammarSyntax1' + description: The syntax of the grammar definition. One of `lark` or `regex`. + definition: + type: string + description: The grammar definition. type: object - description: Role assignment linking a user to a role. + required: + - type + - syntax + - definition + title: Grammar format + description: A grammar defined by the user. + BetaGrammarSyntax1: + type: string + enum: + - lark + - regex + BetaCustomTextFormatParam: properties: - object: + type: type: string enum: - - user.role - description: Always `user.role`. + - text + description: Unconstrained text format. Always `text`. + default: text x-stainless-const: true - user: - $ref: '#/components/schemas/User' - role: - $ref: '#/components/schemas/Role' - required: - - object - - user - - role - x-oaiMeta: - name: The user role object - example: | - { - "object": "user.role", - "user": { - "object": "organization.user", - "id": "user_abc123", - "name": "Ada Lovelace", - "email": "ada@example.com", - "role": "owner", - "added_at": 1711470000 - }, - "role": { - "object": "role", - "id": "role_01J1F8ROLE01", - "name": "API Group Manager", - "description": "Allows managing organization groups", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "resource_type": "api.organization", - "predefined_role": false - } - } - UserRoleUpdateRequest: type: object + required: + - type + title: Text format + description: Unconstrained free-form text. + BetaFunctionToolParam: properties: - role: + name: + type: string + maxLength: 128 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: anyOf: - type: string - type: 'null' - description: '`owner` or `reader`' - role_id: + parameters: anyOf: - - type: string + - $ref: '#/components/schemas/BetaEmptyModelParam' - type: 'null' - description: Role ID to assign to the user. - technical_level: + strict: anyOf: - - type: string + - type: boolean + description: >- + Whether to enforce strict parameter validation. If omitted, + Responses attempts to use strict validation when the schema is + compatible, and falls back to non-strict validation otherwise. - type: 'null' - description: Technical level metadata. - developer_persona: + type: + type: string + enum: + - function + default: function + x-stainless-const: true + output_schema: anyOf: - - type: string + - additionalProperties: {} + type: object + description: >- + A JSON Schema describing the JSON value encoded in string + outputs for this function tool. This does not describe + content-array outputs. + x-oaiTypeLabel: map + - type: 'null' + defer_loading: + type: boolean + description: >- + Whether this function should be deferred and discovered via tool + search. + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/BetaCallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). - type: 'null' - description: Developer persona metadata. - VadConfig: type: object - additionalProperties: false required: + - name - type + BetaFunctionShellToolParam: properties: type: type: string enum: - - server_vad - description: >- - Must be set to `server_vad` to enable manual chunking using server - side VAD. - prefix_padding_ms: - type: integer - default: 300 - description: | - Amount of audio to include before the VAD detected speech (in - milliseconds). - silence_duration_ms: - type: integer - default: 200 - description: | - Duration of silence to detect speech stop (in milliseconds). - With shorter values the model will respond more quickly, - but may jump in on short pauses from the user. - threshold: - type: number - default: 0.5 - description: > - Sensitivity threshold (0.0 to 1.0) for voice activity detection. A - - higher threshold will require louder audio to activate the model, - and - - thus might perform better in noisy environments. - ValidateGraderRequest: + - shell + description: The type of the shell tool. Always `shell`. + default: shell + x-stainless-const: true + environment: + anyOf: + - oneOf: + - $ref: '#/components/schemas/BetaContainerAutoParam' + - $ref: '#/components/schemas/BetaLocalEnvironmentParam' + - $ref: '#/components/schemas/BetaContainerReferenceParam' + discriminator: + propertyName: type + - type: 'null' + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/BetaCallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). + - type: 'null' type: object - title: ValidateGraderRequest - properties: - grader: - type: object - description: The grader used for the fine-tuning job. - oneOf: - - $ref: '#/components/schemas/GraderStringCheck' - - $ref: '#/components/schemas/GraderTextSimilarity' - - $ref: '#/components/schemas/GraderPython' - - $ref: '#/components/schemas/GraderScoreModel' - - $ref: '#/components/schemas/GraderMulti' required: - - grader - ValidateGraderResponse: - type: object - title: ValidateGraderResponse + - type + title: Shell tool + description: A tool that allows the model to execute shell commands. + BetaContainerReferenceParam: properties: - grader: - type: object - description: The grader used for the fine-tuning job. - oneOf: - - $ref: '#/components/schemas/GraderStringCheck' - - $ref: '#/components/schemas/GraderTextSimilarity' - - $ref: '#/components/schemas/GraderPython' - - $ref: '#/components/schemas/GraderScoreModel' - - $ref: '#/components/schemas/GraderMulti' - VectorStoreExpirationAfter: + type: + type: string + enum: + - container_reference + description: References a container created with the /v1/containers endpoint + default: container_reference + x-stainless-const: true + container_id: + type: string + description: The ID of the referenced container. + example: cntr_123 type: object - title: Vector store expiration policy - description: The expiration policy for a vector store. + required: + - type + - container_id + BetaLocalEnvironmentParam: properties: - anchor: - description: >- - Anchor timestamp after which the expiration policy applies. - Supported anchors: `last_active_at`. + type: type: string enum: - - last_active_at + - local + description: Use a local computer environment. + default: local x-stainless-const: true - days: - description: >- - The number of days after the anchor time that the vector store will - expire. - type: integer - minimum: 1 - maximum: 365 - required: - - anchor - - days - VectorStoreFileAttributes: - anyOf: - - type: object - description: > - Set of 16 key-value pairs that can be attached to an object. This - can be - - useful for storing additional information about the object in a - structured - - format, and querying for objects via API or the dashboard. Keys are - strings - - with a maximum length of 64 characters. Values are strings with a - maximum - - length of 512 characters, booleans, or numbers. - maxProperties: 16 - propertyNames: - type: string - maxLength: 64 - additionalProperties: - oneOf: - - type: string - maxLength: 512 - - type: number - - type: boolean - x-oaiTypeLabel: map - - type: 'null' - VectorStoreFileBatchObject: + skills: + items: + $ref: '#/components/schemas/BetaLocalSkillParam' + type: array + maxItems: 200 + description: An optional list of skills. type: object - title: Vector store file batch - description: A batch of files attached to a vector store. + required: + - type + BetaLocalSkillParam: properties: - id: - description: The identifier, which can be referenced in API endpoints. + name: type: string - object: - description: The object type, which is always `vector_store.file_batch`. + description: The name of the skill. + description: type: string - enum: - - vector_store.files_batch - x-stainless-const: true - created_at: - description: >- - The Unix timestamp (in seconds) for when the vector store files - batch was created. - type: integer - format: unixtime - vector_store_id: - description: >- - The ID of the [vector - store](/docs/api-reference/vector-stores/object) that the - [File](/docs/api-reference/files) is attached to. + description: The description of the skill. + path: type: string - status: - description: >- - The status of the vector store files batch, which can be either - `in_progress`, `completed`, `cancelled` or `failed`. + description: The path to the directory containing the skill. + type: object + required: + - name + - description + - path + BetaContainerAutoParam: + properties: + type: type: string enum: - - in_progress - - completed - - cancelled - - failed - file_counts: - type: object - properties: - in_progress: - description: The number of files that are currently being processed. - type: integer - completed: - description: The number of files that have been processed. - type: integer - failed: - description: The number of files that have failed to process. - type: integer - cancelled: - description: The number of files that where cancelled. - type: integer - total: - description: The total number of files. - type: integer - required: - - in_progress - - completed - - cancelled - - failed - - total - required: - - id - - object - - created_at - - vector_store_id - - status - - file_counts - x-oaiMeta: - name: The vector store files batch object - beta: true - example: | - { - "id": "vsfb_123", - "object": "vector_store.files_batch", - "created_at": 1698107661, - "vector_store_id": "vs_abc123", - "status": "completed", - "file_counts": { - "in_progress": 0, - "completed": 100, - "failed": 0, - "cancelled": 0, - "total": 100 - } - } - VectorStoreFileContentResponse: + - container_auto + description: Automatically creates a container for this request + default: container_auto + x-stainless-const: true + file_ids: + items: + type: string + example: file-123 + type: array + maxItems: 50 + description: An optional list of uploaded files to make available to your code. + memory_limit: + anyOf: + - $ref: '#/components/schemas/BetaContainerMemoryLimit' + description: The memory limit for the container. + - type: 'null' + network_policy: + oneOf: + - $ref: '#/components/schemas/BetaContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/BetaContainerNetworkPolicyAllowlistParam' + description: Network access policy for the container. + discriminator: + propertyName: type + skills: + items: + oneOf: + - $ref: '#/components/schemas/BetaSkillReferenceParam' + - $ref: '#/components/schemas/BetaInlineSkillParam' + discriminator: + propertyName: type + type: array + maxItems: 200 + description: An optional list of skills referenced by id or inline data. type: object - description: Represents the parsed content of a vector store file. + required: + - type + BetaInlineSkillParam: properties: - object: + type: type: string enum: - - vector_store.file_content.page - description: The object type, which is always `vector_store.file_content.page` + - inline + description: Defines an inline skill for this request. + default: inline x-stainless-const: true - data: - type: array - description: Parsed content of the file. - items: - type: object - properties: - type: - type: string - description: The content type (currently only `"text"`) - text: - type: string - description: The text content - has_more: - type: boolean - description: Indicates if there are more content pages to fetch. - next_page: - anyOf: - - type: string - description: The token for the next page, if any. - - type: 'null' - required: - - object - - data - - has_more - - next_page - VectorStoreFileObject: + name: + type: string + description: The name of the skill. + description: + type: string + description: The description of the skill. + source: + $ref: '#/components/schemas/BetaInlineSkillSourceParam' + description: Inline skill payload type: object - title: Vector store files - description: A list of files attached to a vector store. + required: + - type + - name + - description + - source + BetaInlineSkillSourceParam: properties: - id: - description: The identifier, which can be referenced in API endpoints. - type: string - object: - description: The object type, which is always `vector_store.file`. + type: type: string enum: - - vector_store.file + - base64 + description: The type of the inline skill source. Must be `base64`. + default: base64 x-stainless-const: true - usage_bytes: - description: >- - The total vector store usage in bytes. Note that this may be - different from the original file size. - type: integer - created_at: - description: >- - The Unix timestamp (in seconds) for when the vector store file was - created. - type: integer - format: unixtime - vector_store_id: - description: >- - The ID of the [vector - store](/docs/api-reference/vector-stores/object) that the - [File](/docs/api-reference/files) is attached to. + media_type: type: string - status: + enum: + - application/zip description: >- - The status of the vector store file, which can be either - `in_progress`, `completed`, `cancelled`, or `failed`. The status - `completed` indicates that the vector store file is ready for use. + The media type of the inline skill payload. Must be + `application/zip`. + default: application/zip + x-stainless-const: true + data: type: string - enum: - - in_progress - - completed - - cancelled - - failed - last_error: - anyOf: - - type: object - description: >- - The last error associated with this vector store file. Will be - `null` if there are no errors. - properties: - code: - type: string - description: >- - One of `server_error`, `unsupported_file`, or - `invalid_file`. - enum: - - server_error - - unsupported_file - - invalid_file - message: - type: string - description: A human-readable description of the error. - required: - - code - - message - - type: 'null' - chunking_strategy: - type: object - description: The strategy used to chunk the file. - oneOf: - - $ref: '#/components/schemas/StaticChunkingStrategyResponseParam' - - $ref: '#/components/schemas/OtherChunkingStrategyResponseParam' - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' - required: - - id - - object - - usage_bytes - - created_at - - vector_store_id - - status - - last_error - x-oaiMeta: - name: The vector store file object - beta: true - example: | - { - "id": "file-abc123", - "object": "vector_store.file", - "usage_bytes": 1234, - "created_at": 1698107661, - "vector_store_id": "vs_abc123", - "status": "completed", - "last_error": null, - "chunking_strategy": { - "type": "static", - "static": { - "max_chunk_size_tokens": 800, - "chunk_overlap_tokens": 400 - } - } - } - VectorStoreObject: + maxLength: 70254592 + minLength: 1 + description: Base64-encoded skill zip bundle. type: object - title: Vector store - description: >- - A vector store is a collection of processed files can be used by the - `file_search` tool. + required: + - type + - media_type + - data + description: Inline skill payload + BetaSkillReferenceParam: properties: - id: - description: The identifier, which can be referenced in API endpoints. - type: string - object: - description: The object type, which is always `vector_store`. + type: type: string enum: - - vector_store + - skill_reference + description: References a skill created with the /v1/skills endpoint. + default: skill_reference x-stainless-const: true - created_at: - description: >- - The Unix timestamp (in seconds) for when the vector store was - created. - type: integer - format: unixtime - name: - description: The name of the vector store. + skill_id: type: string - usage_bytes: - description: The total number of bytes used by the files in the vector store. - type: integer - file_counts: - type: object - properties: - in_progress: - description: The number of files that are currently being processed. - type: integer - completed: - description: The number of files that have been successfully processed. - type: integer - failed: - description: The number of files that have failed to process. - type: integer - cancelled: - description: The number of files that were cancelled. - type: integer - total: - description: The total number of files. - type: integer - required: - - in_progress - - completed - - failed - - cancelled - - total - status: - description: >- - The status of the vector store, which can be either `expired`, - `in_progress`, or `completed`. A status of `completed` indicates - that the vector store is ready for use. + maxLength: 64 + minLength: 1 + description: The ID of the referenced skill. + version: type: string - enum: - - expired - - in_progress - - completed - expires_after: - $ref: '#/components/schemas/VectorStoreExpirationAfter' - expires_at: - anyOf: - - description: >- - The Unix timestamp (in seconds) for when the vector store will - expire. - type: integer - format: unixtime - - type: 'null' - last_active_at: - anyOf: - - description: >- - The Unix timestamp (in seconds) for when the vector store was - last active. - type: integer - format: unixtime - - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - required: - - id - - object - - usage_bytes - - created_at - - status - - last_active_at - - name - - file_counts - - metadata - x-oaiMeta: - name: The vector store object - example: | - { - "id": "vs_123", - "object": "vector_store", - "created_at": 1698107661, - "usage_bytes": 123456, - "last_active_at": 1698107661, - "name": "my_vector_store", - "status": "completed", - "file_counts": { - "in_progress": 0, - "completed": 100, - "cancelled": 0, - "failed": 0, - "total": 100 - }, - "last_used_at": 1698107661 - } - VectorStoreSearchRequest: + description: >- + Optional skill version. Use a positive integer or 'latest'. Omit for + default. type: object - additionalProperties: false + required: + - type + - skill_id + BetaContainerNetworkPolicyAllowlistParam: properties: - query: - description: A query string for a search - oneOf: - - type: string - - type: array - items: - type: string - description: A list of queries to search for. - minItems: 1 - rewrite_query: - description: Whether to rewrite the natural language query for vector search. - type: boolean - default: false - max_num_results: + type: + type: string + enum: + - allowlist description: >- - The maximum number of results to return. This number should be - between 1 and 50 inclusive. - type: integer - default: 10 - minimum: 1 - maximum: 50 - filters: - description: A filter to apply based on file attributes. - oneOf: - - $ref: '#/components/schemas/ComparisonFilter' - - $ref: '#/components/schemas/CompoundFilter' - ranking_options: - description: Ranking options for search. - type: object - additionalProperties: false - properties: - ranker: - description: >- - Enable re-ranking; set to `none` to disable, which can help - reduce latency. - type: string - enum: - - none - - auto - - default-2024-11-15 - default: auto - score_threshold: - type: number - minimum: 0 - maximum: 1 - default: 0 + Allow outbound network access only to specified domains. Always + `allowlist`. + default: allowlist + x-stainless-const: true + allowed_domains: + items: + type: string + type: array + minItems: 1 + description: A list of allowed domains when type is `allowlist`. + domain_secrets: + items: + $ref: '#/components/schemas/BetaContainerNetworkPolicyDomainSecretParam' + type: array + minItems: 1 + description: Optional domain-scoped secrets for allowlisted domains. + type: object required: - - query - x-oaiMeta: - name: Vector store search request - VectorStoreSearchResultContentObject: + - type + - allowed_domains + BetaContainerNetworkPolicyDomainSecretParam: + properties: + domain: + type: string + minLength: 1 + description: The domain associated with the secret. + name: + type: string + minLength: 1 + description: The name of the secret to inject for the domain. + value: + type: string + maxLength: 10485760 + minLength: 1 + description: The secret value to inject for the domain. type: object - additionalProperties: false + required: + - domain + - name + - value + BetaContainerNetworkPolicyDisabledParam: properties: type: - description: The type of content. type: string enum: - - text - text: - description: The text content returned from search. + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + x-stainless-const: true + type: object + required: + - type + BetaContainerMemoryLimit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + BetaLocalShellToolParam: + properties: + type: type: string + enum: + - local_shell + description: The type of the local shell tool. Always `local_shell`. + default: local_shell + x-stainless-const: true + type: object required: - type - - text - x-oaiMeta: - name: Vector store search result content object - VectorStoreSearchResultItem: + title: Local shell tool + description: >- + A tool that allows the model to execute shell commands in a local + environment. + BetaImageGenTool: type: object - additionalProperties: false + title: Image generation tool + description: | + A tool that generates images using the GPT image models. properties: - file_id: + type: type: string - description: The ID of the vector store file. - filename: + enum: + - image_generation + description: | + The type of the image generation tool. Always `image_generation`. + x-stainless-const: true + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-1.5 + description: | + The image generation model to use. Default: `gpt-image-1`. + default: gpt-image-1 + quality: type: string - description: The name of the vector store file. - score: - type: number - description: The similarity score for the result. + enum: + - low + - medium + - high + - auto + description: | + The quality of the generated image. One of `low`, `medium`, `high`, + or `auto`. Default: `auto`. + default: auto + size: + anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + description: >- + The size of the generated images. For `gpt-image-2` and + `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as + `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height + must both be divisible by 16 and the requested aspect ratio must be + between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, + and the maximum supported resolution is `3840x2160`. The requested + size must also satisfy the model's current pixel and edge limits. + The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are + supported by the GPT image models; `auto` is supported for models + that allow automatic sizing. For `dall-e-2`, use one of `256x256`, + `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, + `1792x1024`, or `1024x1792`. + default: auto + output_format: + type: string + enum: + - png + - webp + - jpeg + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer minimum: 0 - maximum: 1 - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' - content: - type: array - description: Content chunks from the file. - items: - $ref: '#/components/schemas/VectorStoreSearchResultContentObject' - required: - - file_id - - filename - - score - - attributes - - content - x-oaiMeta: - name: Vector store search result item - VectorStoreSearchResultsPage: - type: object - additionalProperties: false - properties: - object: + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: type: string enum: - - vector_store.search_results.page - description: The object type, which is always `vector_store.search_results.page` - x-stainless-const: true - search_query: - type: array - items: - type: string - description: The query used for this search. - minItems: 1 - data: - type: array - description: The list of search result items. - items: - $ref: '#/components/schemas/VectorStoreSearchResultItem' - has_more: - type: boolean - description: Indicates if there are more results to fetch. - next_page: + - transparent + - opaque + - auto + description: | + Background type for the generated image. One of `transparent`, + `opaque`, or `auto`. Default: `auto`. + default: auto + input_fidelity: anyOf: - - type: string - description: The token for the next page, if any. + - $ref: '#/components/schemas/BetaInputFidelity' - type: 'null' - required: - - object - - search_query - - data - - has_more - - next_page - x-oaiMeta: - name: Vector store search results page - Verbosity: - anyOf: - - type: string - enum: - - low - - medium - - high - default: medium + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + required: [] + additionalProperties: false + partial_images: + type: integer + minimum: 0 + maximum: 3 description: > - Constrains the verbosity of the model's response. Lower values will - result in - - more concise responses, while higher values will result in more - verbose responses. - - Currently supported values are `low`, `medium`, and `high`. - - type: 'null' - VoiceConsentDeletedResource: - type: object - additionalProperties: false + Number of partial images to generate in streaming mode, from 0 + (default value) to 3. + default: 0 + action: + description: > + Whether to generate a new image or edit an existing image. Default: + `auto`. + $ref: '#/components/schemas/BetaImageGenActionEnum' + required: + - type + BetaImageGenActionEnum: + type: string + enum: + - generate + - edit + - auto + BetaInputFidelity: + type: string + enum: + - high + - low + description: >- + Control how much effort the model will exert to match the style and + features, especially facial features, of input images. This parameter is + only supported for `gpt-image-1` and `gpt-image-1.5` and later models, + unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults + to `low`. + BetaProgrammaticToolCallingParam: properties: - id: - type: string - description: The consent recording identifier. - example: cons_1234 - object: + type: type: string enum: - - audio.voice_consent + - programmatic_tool_calling + description: The type of the tool. Always `programmatic_tool_calling`. + default: programmatic_tool_calling x-stainless-const: true - deleted: - type: boolean + type: object required: - - id - - object - - deleted - x-oaiMeta: - name: The voice consent deletion object - example: | - { - "object": "audio.voice_consent", - "id": "cons_1234", - "deleted": true - } - VoiceConsentListResource: + - type + BetaCodeInterpreterTool: type: object - additionalProperties: false + title: Code interpreter + description: | + A tool that runs Python code to help generate a response to a prompt. properties: - object: + type: type: string enum: - - list + - code_interpreter + description: | + The type of the code interpreter tool. Always `code_interpreter`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/VoiceConsentResource' - first_id: - anyOf: + container: + description: > + The code interpreter container. Can be a container ID or an object + that + + specifies uploaded file IDs to make available to your code, along + with an + + optional `memory_limit` setting. + oneOf: - type: string - - type: 'null' - last_id: + description: The container ID. + - $ref: '#/components/schemas/BetaAutoCodeInterpreterToolParam' + allowed_callers: anyOf: - - type: string + - type: array + minItems: 1 + items: + $ref: '#/components/schemas/BetaCallableToolAllowedCaller' + description: The tool invocation context(s). - type: 'null' - has_more: - type: boolean required: - - object - - data - - has_more - x-oaiMeta: - name: The voice consent list object - example: | - { - "object": "list", - "data": [ - { - "object": "audio.voice_consent", - "id": "cons_1234", - "name": "John Doe", - "language": "en-US", - "created_at": 1734220800 - } - ], - "first_id": "cons_1234", - "last_id": "cons_1234", - "has_more": false - } - VoiceConsentResource: - type: object - title: Voice consent - description: A consent recording used to authorize creation of a custom voice. - additionalProperties: false + - type + - container + BetaAutoCodeInterpreterToolParam: properties: - object: + type: type: string - description: The object type, which is always `audio.voice_consent`. enum: - - audio.voice_consent + - auto + description: Always `auto`. + default: auto x-stainless-const: true - id: - type: string - description: The consent recording identifier. - example: cons_1234 - name: - type: string - description: The label provided when the consent recording was uploaded. - language: - type: string - description: >- - The BCP 47 language tag for the consent phrase (for example, - `en-US`). - created_at: - type: integer - format: unixtime - description: >- - The Unix timestamp (in seconds) for when the consent recording was - created. - required: - - object - - id - - name - - language - - created_at - x-oaiMeta: - name: The voice consent object - example: | - { - "object": "audio.voice_consent", - "id": "cons_1234", - "name": "John Doe", - "language": "en-US", - "created_at": 1734220800 - } - VoiceIdsOrCustomVoice: - title: Voice - description: | - A built-in voice name or a custom voice reference. - anyOf: - - $ref: '#/components/schemas/VoiceIdsShared' - - type: object - description: Custom voice reference. - additionalProperties: false - required: - - id - properties: - id: - type: string - description: The custom voice ID, e.g. `voice_1234`. - example: voice_1234 - VoiceIdsShared: - example: ash - anyOf: - - type: string - - type: string - enum: - - alloy - - ash - - ballad - - coral - - echo - - sage - - shimmer - - verse - - marin - - cedar - VoiceResource: + file_ids: + items: + type: string + example: file-123 + type: array + maxItems: 50 + description: An optional list of uploaded files to make available to your code. + memory_limit: + anyOf: + - $ref: '#/components/schemas/BetaContainerMemoryLimit' + description: The memory limit for the code interpreter container. + - type: 'null' + network_policy: + oneOf: + - $ref: '#/components/schemas/BetaContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/BetaContainerNetworkPolicyAllowlistParam' + description: Network access policy for the container. + discriminator: + propertyName: type type: object - title: Voice - description: A custom voice that can be used for audio output. - additionalProperties: false - properties: - object: - type: string - description: The object type, which is always `audio.voice`. - enum: - - audio.voice - x-stainless-const: true - id: - type: string - description: The voice identifier, which can be referenced in API endpoints. - name: - type: string - description: The name of the voice. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the voice was created. required: - - object - - id - - name - - created_at - x-oaiMeta: - name: The voice object - example: | - { - "object": "audio.voice", - "id": "voice_123abc", - "name": "My new voice", - "created_at": 1734220800 - } - WebSearchActionFind: + - type + title: CodeInterpreterToolAuto + description: >- + Configuration for a code interpreter container. Optionally specify the + IDs of the files to run the code on. + BetaMCPTool: type: object - title: Find action - description: | - Action type "find_in_page": Searches for a pattern within a loaded page. + title: MCP tool + description: > + Give the model access to additional tools via remote Model Context + Protocol + + (MCP) servers. [Learn more about MCP](/docs/guides/tools-remote-mcp). properties: type: type: string enum: - - find_in_page - description: | - The action type. + - mcp + description: The type of the MCP tool. Always `mcp`. x-stainless-const: true - url: + server_label: + type: string + description: | + A label for this MCP server, used to identify it in tool calls. + server_url: type: string format: uri description: | - The URL of the page searched for the pattern. - pattern: + The URL for the MCP server. One of `server_url`, `connector_id`, or + `tunnel_id` must be provided. + connector_id: + type: string + enum: + - connector_dropbox + - connector_gmail + - connector_googlecalendar + - connector_googledrive + - connector_microsoftteams + - connector_outlookcalendar + - connector_outlookemail + - connector_sharepoint + description: > + Identifier for service connectors, like those available in ChatGPT. + One of + + `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn + more + + about service connectors + [here](/docs/guides/tools-remote-mcp#connectors). + + + Currently supported `connector_id` values are: + + + - Dropbox: `connector_dropbox` + + - Gmail: `connector_gmail` + + - Google Calendar: `connector_googlecalendar` + + - Google Drive: `connector_googledrive` + + - Microsoft Teams: `connector_microsoftteams` + + - Outlook Calendar: `connector_outlookcalendar` + + - Outlook Email: `connector_outlookemail` + + - SharePoint: `connector_sharepoint` + tunnel_id: + type: string + pattern: ^tunnel_[a-z0-9]{32}$ + description: > + The Secure MCP Tunnel ID to use instead of a direct server URL. One + of + + `server_url`, `connector_id`, or `tunnel_id` must be provided. + authorization: + type: string + description: > + An OAuth access token that can be used with a remote MCP server, + either + + with a custom MCP server URL or a service connector. Your + application + + must handle the OAuth authorization flow and provide the token here. + server_description: type: string + description: > + Optional description of the MCP server, used to provide more + context. + headers: + anyOf: + - type: object + additionalProperties: + type: string + description: > + Optional HTTP headers to send to the MCP server. Use for + authentication + + or other purposes. + - type: 'null' + allowed_tools: + anyOf: + - description: | + List of allowed tool names or a filter object. + oneOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/BetaMCPToolFilter' + - type: 'null' + allowed_callers: + anyOf: + - type: array + minItems: 1 + items: + $ref: '#/components/schemas/BetaCallableToolAllowedCaller' + description: The tool invocation context(s). + - type: 'null' + require_approval: + anyOf: + - description: Specify which of the MCP server's tools require approval. + oneOf: + - type: object + title: MCP tool approval filter + description: > + Specify which of the MCP server's tools require approval. + Can be + + `always`, `never`, or a filter object associated with tools + + that require approval. + properties: + always: + $ref: '#/components/schemas/BetaMCPToolFilter' + never: + $ref: '#/components/schemas/BetaMCPToolFilter' + additionalProperties: false + - type: string + title: MCP tool approval setting + description: > + Specify a single approval policy for all tools. One of + `always` or + + `never`. When set to `always`, all tools will require + approval. When + + set to `never`, all tools will not require approval. + enum: + - always + - never + default: always + - type: 'null' + defer_loading: + type: boolean description: | - The pattern or text to search for within the page. + Whether this MCP tool is deferred and discovered via tool search. required: - type - - url - - pattern - WebSearchActionOpenPage: + - server_label + BetaMCPToolFilter: type: object - title: Open page action + title: MCP tool filter description: | - Action type "open_page" - Opens a specific URL from search results. + A filter object to specify which tools are allowed. + properties: + tool_names: + type: array + title: MCP allowed tools + items: + type: string + description: List of allowed tool names. + read_only: + type: boolean + description: > + Indicates whether or not a tool modifies data or is read-only. If an + + MCP server is [annotated with + `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), + + it will match this filter. + required: [] + additionalProperties: false + BetaWebSearchTool: + type: object + title: Web search + description: > + Search the Internet for sources related to the prompt. Learn more about + the + + [web search tool](/docs/guides/tools-web-search). properties: type: type: string enum: - - open_page - description: | - The action type. - x-stainless-const: true - url: - description: | - The URL opened by the model. + - web_search + - web_search_2025_08_26 + description: >- + The type of the web search tool. One of `web_search` or + `web_search_2025_08_26`. + default: web_search + filters: anyOf: - - type: string - format: uri + - type: object + description: | + Filters for the search. + properties: + allowed_domains: + anyOf: + - type: array + title: Allowed domains for the search. + description: > + Allowed domains for the search. If not provided, all + domains are allowed. + + Subdomains of the provided domains are allowed as well. + + + Example: `["pubmed.ncbi.nlm.nih.gov"]` + items: + type: string + description: Allowed domain for the search. + default: [] + - type: 'null' - type: 'null' - required: - - type - WebSearchActionSearch: - type: object - title: Search action - description: | - Action type "search" - Performs a web search query. - properties: - type: + user_location: + $ref: '#/components/schemas/BetaWebSearchApproximateLocation' + search_context_size: type: string enum: - - search - description: | - The action type. - x-stainless-const: true - query: - type: string - deprecated: true - description: | - The search query. - queries: - type: array - title: Search queries - description: | - The search queries. - items: - type: string - description: | - A search query. - sources: - type: array - title: Web search sources - description: | - The sources used in the search. - items: - type: object - title: Web search source - description: | - A source used in the search. - properties: - type: - type: string - enum: - - url - description: | - The type of source. Always `url`. - x-stainless-const: true - url: - type: string - format: uri - description: | - The URL of the source. - required: - - type - - url + - low + - medium + - high + default: medium + description: >- + High level guidance for the amount of context window space to use + for the search. One of `low`, `medium`, or `high`. `medium` is the + default. required: - type - WebSearchApproximateLocation: + BetaWebSearchApproximateLocation: anyOf: - type: object title: Web search approximate location @@ -78864,1575 +90785,2242 @@ components: of the user, e.g. `America/Los_Angeles`. - type: 'null' - type: 'null' - WebSearchContextSize: + BetaComputerUsePreviewTool: + properties: + type: + type: string + enum: + - computer_use_preview + description: The type of the computer use tool. Always `computer_use_preview`. + default: computer_use_preview + x-stainless-const: true + environment: + $ref: '#/components/schemas/BetaComputerEnvironment' + description: The type of computer environment to control. + display_width: + type: integer + description: The width of the computer display. + display_height: + type: integer + description: The height of the computer display. + type: object + required: + - type + - environment + - display_width + - display_height + title: Computer use preview + description: >- + A tool that controls a virtual computer. Learn more about the [computer + tool](https://platform.openai.com/docs/guides/tools-computer-use). + BetaComputerEnvironment: type: string - description: > - High level guidance for the amount of context window space to use for - the - - search. One of `low`, `medium`, or `high`. `medium` is the default. enum: - - low - - medium - - high - default: medium - WebSearchLocation: - type: object - title: Web search location - description: Approximate location parameters for the search. + - windows + - mac + - linux + - ubuntu + - browser + BetaComputerTool: properties: - country: - type: string - description: > - The two-letter - - [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the - user, - - e.g. `US`. - region: - type: string - description: | - Free text input for the region of the user, e.g. `California`. - city: - type: string - description: | - Free text input for the city of the user, e.g. `San Francisco`. - timezone: + type: type: string - description: > - The [IANA - timezone](https://timeapi.io/documentation/iana-timezones) - - of the user, e.g. `America/Los_Angeles`. - WebSearchTool: + enum: + - computer + description: The type of the computer tool. Always `computer`. + default: computer + x-stainless-const: true type: object - title: Web search - description: > - Search the Internet for sources related to the prompt. Learn more about - the - - [web search tool](/docs/guides/tools-web-search). + required: + - type + title: Computer + description: >- + A tool that controls a virtual computer. Learn more about the [computer + tool](https://platform.openai.com/docs/guides/tools-computer-use). + BetaFileSearchTool: properties: type: type: string enum: - - web_search - - web_search_2025_08_26 + - file_search + description: The type of the file search tool. Always `file_search`. + default: file_search + x-stainless-const: true + vector_store_ids: + items: + type: string + type: array + description: The IDs of the vector stores to search. + max_num_results: + type: integer description: >- - The type of the web search tool. One of `web_search` or - `web_search_2025_08_26`. - default: web_search + The maximum number of results to return. This number should be + between 1 and 50 inclusive. + ranking_options: + $ref: '#/components/schemas/BetaRankingOptions' + description: Ranking options for search. filters: anyOf: - - type: object - description: | - Filters for the search. - properties: - allowed_domains: - anyOf: - - type: array - title: Allowed domains for the search. - description: > - Allowed domains for the search. If not provided, all - domains are allowed. + - $ref: '#/components/schemas/BetaFilters' + description: A filter to apply. + - type: 'null' + type: object + required: + - type + - vector_store_ids + title: File search + description: >- + A tool that searches for relevant content from uploaded files. Learn + more about the [file search + tool](https://platform.openai.com/docs/guides/tools-file-search). + BetaFilters: + anyOf: + - $ref: '#/components/schemas/BetaComparisonFilter' + - $ref: '#/components/schemas/BetaCompoundFilter' + BetaCompoundFilter: + $recursiveAnchor: true + type: object + additionalProperties: false + title: Compound Filter + description: Combine multiple filters using `and` or `or`. + properties: + type: + type: string + description: 'Type of operation: `and` or `or`.' + enum: + - and + - or + filters: + type: array + description: >- + Array of filters to combine. Items can be `ComparisonFilter` or + `CompoundFilter`. + items: + oneOf: + - $ref: '#/components/schemas/BetaComparisonFilter' + - $recursiveRef: '#' + discriminator: + propertyName: type + required: + - type + - filters + x-oaiMeta: + name: CompoundFilter + BetaComparisonFilter: + type: object + additionalProperties: false + title: Comparison Filter + description: > + A filter used to compare a specified attribute key to a given value + using a defined comparison operation. + properties: + type: + type: string + default: eq + enum: + - eq + - ne + - gt + - gte + - lt + - lte + - in + - nin + description: > + Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, + `lte`, `in`, `nin`. - Subdomains of the provided domains are allowed as well. + - `eq`: equals + - `ne`: not equal - Example: `["pubmed.ncbi.nlm.nih.gov"]` - items: - type: string - description: Allowed domain for the search. - default: [] - - type: 'null' - - type: 'null' - user_location: - $ref: '#/components/schemas/WebSearchApproximateLocation' - search_context_size: + - `gt`: greater than + + - `gte`: greater than or equal + + - `lt`: less than + + - `lte`: less than or equal + + - `in`: in + + - `nin`: not in + key: type: string - enum: - - low - - medium - - high - default: medium + description: The key to compare against the value. + value: + oneOf: + - type: string + - type: number + - type: boolean + - type: array + items: + oneOf: + - type: string + - type: number description: >- - High level guidance for the amount of context window space to use - for the search. One of `low`, `medium`, or `high`. `medium` is the - default. + The value to compare against the attribute key; supports string, + number, or boolean types. required: - type - WebSearchToolCall: + - key + - value + x-oaiMeta: + name: ComparisonFilter + BetaRankingOptions: + properties: + ranker: + $ref: '#/components/schemas/BetaRankerVersionType' + description: The ranker to use for the file search. + score_threshold: + type: number + description: >- + The score threshold for the file search, a number between 0 and 1. + Numbers closer to 1 will attempt to return only the most relevant + results, but may return fewer results. + hybrid_search: + $ref: '#/components/schemas/BetaHybridSearchOptions' + description: >- + Weights that control how reciprocal rank fusion balances semantic + embedding matches versus sparse keyword matches when hybrid search + is enabled. type: object - title: Web search tool call - description: | - The results of a web search tool call. See the - [web search guide](/docs/guides/tools-web-search) for more information. + required: [] + BetaHybridSearchOptions: properties: - id: + embedding_weight: + type: number + description: The weight of the embedding in the reciprocal ranking fusion. + text_weight: + type: number + description: The weight of the text in the reciprocal ranking fusion. + type: object + required: + - embedding_weight + - text_weight + BetaRankerVersionType: + type: string + enum: + - auto + - default-2024-11-15 + BetaFunctionTool: + properties: + type: + type: string + enum: + - function + description: The type of the function tool. Always `function`. + default: function + x-stainless-const: true + name: type: string + description: The name of the function to call. + description: + anyOf: + - type: string + description: >- + A description of the function. Used by the model to determine + whether or not to call the function. + - type: 'null' + parameters: + anyOf: + - additionalProperties: {} + type: object + description: A JSON schema object describing the parameters of the function. + x-oaiTypeLabel: map + - type: 'null' + output_schema: + anyOf: + - additionalProperties: {} + type: object + description: >- + A JSON schema object describing the JSON value encoded in string + outputs for this function. + x-oaiTypeLabel: map + - type: 'null' + strict: + anyOf: + - type: boolean + description: >- + Whether strict parameter validation is enforced for this + function tool. + - type: 'null' + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/BetaCallableToolAllowedCaller' + type: array + description: The tool invocation context(s). + - type: 'null' + type: object + required: + - type + - name + - strict + - parameters + title: Function + description: >- + Defines a function in your own code the model can choose to call. Learn + more about [function + calling](https://platform.openai.com/docs/guides/function-calling). + BetaInputItem: + oneOf: + - $ref: '#/components/schemas/BetaEasyInputMessage' + - type: object + title: Item description: | - The unique ID of the web search tool call. + An item representing part of the context for the response to be + generated by the model. Can contain text, images, and audio inputs, + as well as previous assistant responses and tool call outputs. + $ref: '#/components/schemas/BetaItem' + - $ref: '#/components/schemas/BetaCompactionTriggerItemParam' + - $ref: '#/components/schemas/BetaItemReferenceParam' + - $ref: '#/components/schemas/BetaProgramItemParam' + - $ref: '#/components/schemas/BetaProgramOutputItemParam' + discriminator: + propertyName: type + BetaProgramOutputItemParam: + properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: + type: string + description: The unique ID of this program output item. + example: cmo_123 type: type: string enum: - - web_search_call - description: | - The type of the web search tool call. Always `web_search_call`. + - program_output + description: The item type. Always `program_output`. + default: program_output x-stainless-const: true + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The call ID of the program item. + result: + type: string + maxLength: 10485760 + description: The result produced by the program item. status: + $ref: '#/components/schemas/BetaProgramOutputItemStatus' + description: The terminal status of the program output. + type: object + required: + - id + - type + - call_id + - result + - status + BetaProgramOutputItemStatus: + type: string + enum: + - completed + - incomplete + Beta_AgentTagParam: + properties: + agent_name: + type: string + description: The canonical name of the agent that produced this item. + type: object + required: + - agent_name + description: The agent that produced this item. + x-oai-beta: responses_multi_agent=v1 + BetaProgramItemParam: + properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: + type: string + description: The unique ID of this program item. + example: cm_123 + type: type: string - description: | - The status of the web search tool call. enum: - - in_progress - - searching - - completed - - failed - action: - type: object - description: > - An object describing the specific action taken in this web search - call. - - Includes details on how the model used the web (search, open_page, - find_in_page). - oneOf: - - $ref: '#/components/schemas/WebSearchActionSearch' - - $ref: '#/components/schemas/WebSearchActionOpenPage' - - $ref: '#/components/schemas/WebSearchActionFind' - discriminator: - propertyName: type + - program + description: The item type. Always `program`. + default: program + x-stainless-const: true + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The stable call ID of the program item. + code: + type: string + maxLength: 10485760 + description: The JavaScript source executed by programmatic tool calling. + fingerprint: + type: string + maxLength: 10485760 + description: Opaque program replay fingerprint that must be round-tripped. + type: object required: - id - type - - status - - action - WebhookBatchCancelled: + - call_id + - code + - fingerprint + BetaItemReferenceParam: + properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + type: + anyOf: + - type: string + enum: + - item_reference + description: The type of item to reference. Always `item_reference`. + default: item_reference + x-stainless-const: true + - type: 'null' + id: + type: string + description: The ID of the item to reference. + type: object + required: + - id + title: Item reference + description: An internal identifier for an item to reference. + BetaCompactionTriggerItemParam: + properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + type: + type: string + enum: + - compaction_trigger + description: The type of the item. Always `compaction_trigger`. + default: compaction_trigger + x-stainless-const: true + type: object + required: + - type + title: Compaction trigger + description: Compacts the current context. Must be the final input item. + BetaItem: + type: object + description: | + Content item used to generate a response. + oneOf: + - $ref: '#/components/schemas/BetaInputMessage' + - $ref: '#/components/schemas/BetaOutputMessage' + - $ref: '#/components/schemas/BetaFileSearchToolCall' + - $ref: '#/components/schemas/BetaComputerToolCall' + - $ref: '#/components/schemas/BetaComputerCallOutputItemParam' + - $ref: '#/components/schemas/BetaWebSearchToolCall' + - $ref: '#/components/schemas/BetaFunctionToolCall' + - $ref: '#/components/schemas/BetaFunctionCallOutputItemParam' + - $ref: '#/components/schemas/BetaAgentMessageItemParam' + - $ref: '#/components/schemas/BetaMultiAgentCallItemParam' + - $ref: '#/components/schemas/BetaMultiAgentCallOutputItemParam' + - $ref: '#/components/schemas/BetaToolSearchCallItemParam' + - $ref: '#/components/schemas/BetaToolSearchOutputItemParam' + - $ref: '#/components/schemas/BetaAdditionalToolsItemParam' + - $ref: '#/components/schemas/BetaReasoningItem' + - $ref: '#/components/schemas/BetaCompactionSummaryItemParam' + - $ref: '#/components/schemas/BetaImageGenToolCall' + - $ref: '#/components/schemas/BetaCodeInterpreterToolCall' + - $ref: '#/components/schemas/BetaLocalShellToolCall' + - $ref: '#/components/schemas/BetaLocalShellToolCallOutput' + - $ref: '#/components/schemas/BetaFunctionShellCallItemParam' + - $ref: '#/components/schemas/BetaFunctionShellCallOutputItemParam' + - $ref: '#/components/schemas/BetaApplyPatchToolCallItemParam' + - $ref: '#/components/schemas/BetaApplyPatchToolCallOutputItemParam' + - $ref: '#/components/schemas/BetaMCPListTools' + - $ref: '#/components/schemas/BetaMCPApprovalRequest' + - $ref: '#/components/schemas/BetaMCPApprovalResponse' + - $ref: '#/components/schemas/BetaMCPToolCall' + - $ref: '#/components/schemas/BetaCustomToolCallOutput' + - $ref: '#/components/schemas/BetaCustomToolCall' + discriminator: + propertyName: type + BetaCustomToolCall: type: object - title: batch.cancelled + title: Custom tool call description: | - Sent when a batch API request has been cancelled. - required: - - created_at - - id - - data - - type + A call to a custom tool created by the model. properties: - created_at: - type: integer - format: unixtime - description: > - The Unix timestamp (in seconds) of when the batch API request was - cancelled. + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + type: + type: string + enum: + - custom_tool_call + x-stainless-const: true + description: | + The type of the custom tool call. Always `custom_tool_call`. id: type: string description: | - The unique ID of the event. - data: - type: object + The unique ID of the custom tool call in the OpenAI platform. + call_id: + type: string + description: > + An identifier used to map this custom tool call to a tool call + output. + caller: + anyOf: + - $ref: '#/components/schemas/BetaToolCallCaller' + - type: 'null' + namespace: + type: string description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the batch API request. - object: + The namespace of the custom tool being called. + name: type: string description: | - The object of the event. Always `event`. + The name of the custom tool being called. + input: + type: string + description: | + The input for the custom tool call generated by the model. + required: + - type + - call_id + - name + - input + BetaToolCallCaller: + oneOf: + - $ref: '#/components/schemas/BetaDirectToolCallCaller' + - $ref: '#/components/schemas/BetaProgramToolCallCaller' + description: The execution context that produced this tool call. + discriminator: + propertyName: type + BetaProgramToolCallCaller: + properties: + type: + type: string enum: - - event + - program + default: program x-stainless-const: true + caller_id: + type: string + description: The call ID of the program item that produced this tool call. + type: object + required: + - type + - caller_id + BetaDirectToolCallCaller: + properties: type: type: string - description: | - The type of the event. Always `batch.cancelled`. enum: - - batch.cancelled + - direct + default: direct x-stainless-const: true - x-oaiMeta: - name: batch.cancelled - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "batch.cancelled", - "created_at": 1719168000, - "data": { - "id": "batch_abc123" - } - } - WebhookBatchCompleted: type: object - title: batch.completed - description: | - Sent when a batch API request has been completed. required: - - created_at - - id - - data - type + BetaAgentTag: properties: - created_at: - type: integer - format: unixtime + agent_name: + type: string + description: The canonical name of the agent that produced this item. + type: object + required: + - agent_name + x-oai-beta: responses_multi_agent=v1 + BetaCustomToolCallOutput: + type: object + title: Custom tool call output + description: > + The output of a custom tool call from your code, being sent back to the + model. + properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + type: + type: string + enum: + - custom_tool_call_output + x-stainless-const: true description: > - The Unix timestamp (in seconds) of when the batch API request was - completed. + The type of the custom tool call output. Always + `custom_tool_call_output`. id: type: string description: | - The unique ID of the event. - data: - type: object + The unique ID of the custom tool call output in the OpenAI platform. + call_id: + type: string + description: > + The call ID, used to map this custom tool call output to a custom + tool call. + caller: + anyOf: + - $ref: '#/components/schemas/BetaToolCallCallerParam' + - type: 'null' + output: description: | - Event data payload. - required: - - id - properties: - id: - type: string + The output from the custom tool call generated by your code. + Can be a string or an list of output content. + oneOf: + - type: string description: | - The unique ID of the batch API request. - object: + A string of the output of the custom tool call. + title: string output + - type: array + items: + $ref: '#/components/schemas/BetaFunctionAndCustomToolCallOutput' + title: output content list + description: | + Text, image, or file output of the custom tool call. + required: + - type + - call_id + - output + BetaFunctionAndCustomToolCallOutput: + oneOf: + - $ref: '#/components/schemas/BetaInputTextContent' + - $ref: '#/components/schemas/BetaInputImageContent' + - $ref: '#/components/schemas/BetaInputFileContent' + discriminator: + propertyName: type + BetaInputFileContent: + properties: + type: type: string - description: | - The object of the event. Always `event`. enum: - - event + - input_file + description: The type of the input item. Always `input_file`. + default: input_file x-stainless-const: true - type: + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + - type: 'null' + filename: + type: string + description: The name of the file to be sent to the model. + file_data: type: string description: | - The type of the event. Always `batch.completed`. - enum: - - batch.completed - x-stainless-const: true - x-oaiMeta: - name: batch.completed - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "batch.completed", - "created_at": 1719168000, - "data": { - "id": "batch_abc123" - } - } - WebhookBatchExpired: + The content of the file to be sent to the model. + prompt_cache_breakpoint: + $ref: '#/components/schemas/BetaPromptCacheBreakpointConfig' + file_url: + type: string + format: uri + description: The URL of the file to be sent to the model. + detail: + $ref: '#/components/schemas/BetaFileInputDetail' + description: >- + 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`. type: object - title: batch.expired - description: | - Sent when a batch API request has expired. required: - - created_at - - id - - data - type + title: Input file + description: A file input to the model. + BetaFileInputDetail: + type: string + enum: + - auto + - low + - high + BetaPromptCacheBreakpointConfig: properties: - created_at: - type: integer - format: unixtime - description: > - The Unix timestamp (in seconds) of when the batch API request - expired. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the batch API request. - object: + mode: type: string - description: | - The object of the event. Always `event`. enum: - - event + - explicit + description: The breakpoint mode. Always `explicit`. + default: explicit x-stainless-const: true + type: object + required: + - mode + title: Prompt cache breakpoint + description: >- + 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. + BetaInputImageContent: + properties: type: type: string - description: | - The type of the event. Always `batch.expired`. enum: - - batch.expired + - input_image + description: The type of the input item. Always `input_image`. + default: input_image x-stainless-const: true - x-oaiMeta: - name: batch.expired - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "batch.expired", - "created_at": 1719168000, - "data": { - "id": "batch_abc123" - } - } - WebhookBatchFailed: + image_url: + anyOf: + - type: string + format: uri + description: >- + The URL of the image to be sent to the model. A fully qualified + URL or base64 encoded image in a data URL. + - type: 'null' + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + - type: 'null' + detail: + $ref: '#/components/schemas/BetaImageDetail' + description: >- + The detail level of the image to be sent to the model. One of + `high`, `low`, `auto`, or `original`. Defaults to `auto`. + prompt_cache_breakpoint: + $ref: '#/components/schemas/BetaPromptCacheBreakpointConfig' type: object - title: batch.failed - description: | - Sent when a batch API request has failed. required: - - created_at - - id - - data - type + - detail + title: Input image + description: >- + An image input to the model. Learn about [image + inputs](/docs/guides/vision). + BetaImageDetail: + type: string + enum: + - low + - high + - auto + - original + BetaInputTextContent: properties: - created_at: - type: integer - format: unixtime - description: > - The Unix timestamp (in seconds) of when the batch API request - failed. - id: + type: type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the batch API request. - object: + enum: + - input_text + description: The type of the input item. Always `input_text`. + default: input_text + x-stainless-const: true + text: + type: string + description: The text input to the model. + prompt_cache_breakpoint: + $ref: '#/components/schemas/BetaPromptCacheBreakpointConfig' + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + BetaToolCallCallerParam: + oneOf: + - $ref: '#/components/schemas/BetaDirectToolCallCallerParam' + - $ref: '#/components/schemas/BetaProgramToolCallCallerParam' + description: The execution context that produced this tool call. + discriminator: + propertyName: type + BetaProgramToolCallCallerParam: + properties: + type: type: string - description: | - The object of the event. Always `event`. enum: - - event + - program + description: The caller type. Always `program`. + default: program x-stainless-const: true + caller_id: + type: string + maxLength: 64 + minLength: 1 + description: The call ID of the program item that produced this tool call. + type: object + required: + - type + - caller_id + BetaDirectToolCallCallerParam: + properties: type: type: string - description: | - The type of the event. Always `batch.failed`. enum: - - batch.failed + - direct + description: The caller type. Always `direct`. + default: direct x-stainless-const: true - x-oaiMeta: - name: batch.failed - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "batch.failed", - "created_at": 1719168000, - "data": { - "id": "batch_abc123" - } - } - WebhookEvalRunCanceled: type: object - title: eval.run.canceled - description: | - Sent when an eval run has been canceled. required: - - created_at - - id - - data - type + BetaMCPToolCall: + type: object + title: MCP tool call + description: | + An invocation of a tool on an MCP server. properties: - created_at: - type: integer - format: unixtime + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + type: + type: string + enum: + - mcp_call description: | - The Unix timestamp (in seconds) of when the eval run was canceled. + The type of the item. Always `mcp_call`. + x-stainless-const: true id: type: string description: | - The unique ID of the event. - data: - type: object + The unique ID of the tool call. + server_label: + type: string description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the eval run. - object: + The label of the MCP server running the tool. + name: type: string description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true - type: + The name of the tool that was run. + arguments: type: string description: | - The type of the event. Always `eval.run.canceled`. - enum: - - eval.run.canceled - x-stainless-const: true - x-oaiMeta: - name: eval.run.canceled - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "eval.run.canceled", - "created_at": 1719168000, - "data": { - "id": "evalrun_abc123" - } - } - WebhookEvalRunFailed: + A JSON string of the arguments passed to the tool. + output: + anyOf: + - type: string + description: | + The output from the tool call. + - type: 'null' + error: + anyOf: + - type: string + description: | + The error from the tool call, if any. + - type: 'null' + status: + $ref: '#/components/schemas/BetaMCPToolCallStatus' + description: > + The status of the tool call. One of `in_progress`, `completed`, + `incomplete`, `calling`, or `failed`. + approval_request_id: + anyOf: + - type: string + description: > + Unique identifier for the MCP tool call approval request. + + Include this value in a subsequent `mcp_approval_response` input + to approve or reject the corresponding tool call. + - type: 'null' + required: + - type + - id + - server_label + - name + - arguments + BetaMCPToolCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + - calling + - failed + BetaMCPApprovalResponse: type: object - title: eval.run.failed + title: MCP approval response description: | - Sent when an eval run has failed. + A response to an MCP approval request. + properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + type: + type: string + enum: + - mcp_approval_response + description: | + The type of the item. Always `mcp_approval_response`. + x-stainless-const: true + id: + anyOf: + - type: string + description: | + The unique ID of the approval response + - type: 'null' + approval_request_id: + type: string + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + anyOf: + - type: string + description: | + Optional reason for the decision. + - type: 'null' required: - - created_at - - id - - data - type - properties: - created_at: - type: integer - format: unixtime + - request_id + - approve + - approval_request_id + BetaMCPApprovalRequest: + type: object + title: MCP approval request + description: | + A request for human approval of a tool invocation. + properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + type: + type: string + enum: + - mcp_approval_request description: | - The Unix timestamp (in seconds) of when the eval run failed. + The type of the item. Always `mcp_approval_request`. + x-stainless-const: true id: type: string description: | - The unique ID of the event. - data: - type: object + The unique ID of the approval request. + server_label: + type: string description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the eval run. - object: + The label of the MCP server making the request. + name: type: string description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true - type: + The name of the tool to run. + arguments: type: string description: | - The type of the event. Always `eval.run.failed`. - enum: - - eval.run.failed - x-stainless-const: true - x-oaiMeta: - name: eval.run.failed - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "eval.run.failed", - "created_at": 1719168000, - "data": { - "id": "evalrun_abc123" - } - } - WebhookEvalRunSucceeded: - type: object - title: eval.run.succeeded - description: | - Sent when an eval run has succeeded. + A JSON string of arguments for the tool. required: - - created_at - - id - - data - type + - id + - server_label + - name + - arguments + BetaMCPListTools: + type: object + title: MCP list tools + description: | + A list of tools available on an MCP server. properties: - created_at: - type: integer - format: unixtime + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + type: + type: string + enum: + - mcp_list_tools description: | - The Unix timestamp (in seconds) of when the eval run succeeded. + The type of the item. Always `mcp_list_tools`. + x-stainless-const: true id: type: string description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the eval run. - object: + The unique ID of the list. + server_label: type: string description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true - type: - type: string + The label of the MCP server. + tools: + type: array + items: + $ref: '#/components/schemas/BetaMCPListToolsTool' description: | - The type of the event. Always `eval.run.succeeded`. - enum: - - eval.run.succeeded - x-stainless-const: true - x-oaiMeta: - name: eval.run.succeeded - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "eval.run.succeeded", - "created_at": 1719168000, - "data": { - "id": "evalrun_abc123" - } - } - WebhookFineTuningJobCancelled: - type: object - title: fine_tuning.job.cancelled - description: | - Sent when a fine-tuning job has been cancelled. + The tools available on the server. + error: + anyOf: + - type: string + description: | + Error message if the server could not list tools. + - type: 'null' required: - - created_at - - id - - data - type + - id + - server_label + - tools + BetaMCPListToolsTool: + type: object + title: MCP list tools tool + description: | + A tool available on an MCP server. properties: - created_at: - type: integer - format: unixtime - description: > - The Unix timestamp (in seconds) of when the fine-tuning job was - cancelled. - id: + name: type: string description: | - The unique ID of the event. - data: + The name of the tool. + description: + anyOf: + - type: string + description: | + The description of the tool. + - type: 'null' + input_schema: type: object description: | - Event data payload. - required: - - id - properties: - id: - type: string + The JSON schema describing the tool's input. + annotations: + anyOf: + - type: object description: | - The unique ID of the fine-tuning job. - object: + Additional annotations about the tool. + - type: 'null' + required: + - name + - input_schema + BetaApplyPatchToolCallOutputItemParam: + properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + type: type: string - description: | - The object of the event. Always `event`. enum: - - event + - apply_patch_call_output + description: The type of the item. Always `apply_patch_call_output`. + default: apply_patch_call_output x-stainless-const: true + id: + anyOf: + - type: string + description: >- + The unique ID of the apply patch tool call output. Populated + when this item is returned via API. + example: apco_123 + - type: 'null' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/BetaToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' + status: + $ref: '#/components/schemas/BetaApplyPatchCallOutputStatusParam' + description: >- + The status of the apply patch tool call output. One of `completed` + or `failed`. + output: + anyOf: + - type: string + maxLength: 10485760 + description: >- + Optional human-readable log text from the apply patch tool + (e.g., patch results or errors). + - type: 'null' + type: object + required: + - type + - call_id + - status + title: Apply patch tool call output + description: The streamed output emitted by an apply patch tool call. + BetaApplyPatchCallOutputStatusParam: + type: string + enum: + - completed + - failed + title: Apply patch call output status + description: Outcome values reported for apply_patch tool call outputs. + BetaApplyPatchToolCallItemParam: + properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' type: type: string - description: | - The type of the event. Always `fine_tuning.job.cancelled`. enum: - - fine_tuning.job.cancelled + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call x-stainless-const: true - x-oaiMeta: - name: fine_tuning.job.cancelled - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "fine_tuning.job.cancelled", - "created_at": 1719168000, - "data": { - "id": "ftjob_abc123" - } - } - WebhookFineTuningJobFailed: + id: + anyOf: + - type: string + description: >- + The unique ID of the apply patch tool call. Populated when this + item is returned via API. + example: apc_123 + - type: 'null' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/BetaToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' + status: + $ref: '#/components/schemas/BetaApplyPatchCallStatusParam' + description: >- + The status of the apply patch tool call. One of `in_progress` or + `completed`. + operation: + $ref: '#/components/schemas/BetaApplyPatchOperationParam' + description: >- + The specific create, delete, or update instruction for the + apply_patch tool call. type: object - title: fine_tuning.job.failed - description: | - Sent when a fine-tuning job has failed. required: - - created_at - - id - - data - type + - call_id + - status + - operation + title: Apply patch tool call + description: >- + A tool call representing a request to create, delete, or update files + using diff patches. + BetaApplyPatchOperationParam: + oneOf: + - $ref: '#/components/schemas/BetaApplyPatchCreateFileOperationParam' + - $ref: '#/components/schemas/BetaApplyPatchDeleteFileOperationParam' + - $ref: '#/components/schemas/BetaApplyPatchUpdateFileOperationParam' + title: Apply patch operation + description: >- + One of the create_file, delete_file, or update_file operations supplied + to the apply_patch tool. + discriminator: + propertyName: type + BetaApplyPatchUpdateFileOperationParam: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the fine-tuning job failed. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the fine-tuning job. - object: + type: type: string - description: | - The object of the event. Always `event`. enum: - - event + - update_file + description: The operation type. Always `update_file`. + default: update_file x-stainless-const: true + path: + type: string + minLength: 1 + description: Path of the file to update relative to the workspace root. + diff: + type: string + maxLength: 10485760 + description: Unified diff content to apply to the existing file. + type: object + required: + - type + - path + - diff + title: Apply patch update file operation + description: Instruction for updating an existing file via the apply_patch tool. + BetaApplyPatchDeleteFileOperationParam: + properties: type: type: string - description: | - The type of the event. Always `fine_tuning.job.failed`. enum: - - fine_tuning.job.failed + - delete_file + description: The operation type. Always `delete_file`. + default: delete_file x-stainless-const: true - x-oaiMeta: - name: fine_tuning.job.failed - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "fine_tuning.job.failed", - "created_at": 1719168000, - "data": { - "id": "ftjob_abc123" - } - } - WebhookFineTuningJobSucceeded: + path: + type: string + minLength: 1 + description: Path of the file to delete relative to the workspace root. type: object - title: fine_tuning.job.succeeded - description: | - Sent when a fine-tuning job has succeeded. required: - - created_at - - id - - data - type + - path + title: Apply patch delete file operation + description: Instruction for deleting an existing file via the apply_patch tool. + BetaApplyPatchCreateFileOperationParam: properties: - created_at: - type: integer - format: unixtime - description: > - The Unix timestamp (in seconds) of when the fine-tuning job - succeeded. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the fine-tuning job. - object: + type: type: string - description: | - The object of the event. Always `event`. enum: - - event + - create_file + description: The operation type. Always `create_file`. + default: create_file x-stainless-const: true + path: + type: string + minLength: 1 + description: Path of the file to create relative to the workspace root. + diff: + type: string + maxLength: 10485760 + description: Unified diff content to apply when creating the file. + type: object + required: + - type + - path + - diff + title: Apply patch create file operation + description: Instruction for creating a new file via the apply_patch tool. + BetaApplyPatchCallStatusParam: + type: string + enum: + - in_progress + - completed + title: Apply patch call status + description: Status values reported for apply_patch tool calls. + BetaFunctionShellCallOutputItemParam: + properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: + anyOf: + - type: string + description: >- + The unique ID of the shell tool call output. Populated when this + item is returned via API. + example: sho_123 + - type: 'null' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/BetaToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' type: type: string - description: | - The type of the event. Always `fine_tuning.job.succeeded`. enum: - - fine_tuning.job.succeeded + - shell_call_output + description: The type of the item. Always `shell_call_output`. + default: shell_call_output x-stainless-const: true - x-oaiMeta: - name: fine_tuning.job.succeeded - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "fine_tuning.job.succeeded", - "created_at": 1719168000, - "data": { - "id": "ftjob_abc123" - } - } - WebhookRealtimeCallIncoming: + output: + items: + $ref: '#/components/schemas/BetaFunctionShellCallOutputContentParam' + type: array + description: >- + Captured chunks of stdout and stderr output, along with their + associated outcomes. + status: + anyOf: + - $ref: '#/components/schemas/BetaFunctionShellCallItemStatus' + description: The status of the shell call output. + - type: 'null' + max_output_length: + anyOf: + - type: integer + description: >- + The maximum number of UTF-8 characters captured for this shell + call's combined output. + - type: 'null' type: object - title: realtime.call.incoming - description: | - Sent when Realtime API Receives a incoming SIP call. required: - - created_at - - id - - data + - call_id - type + - output + title: Shell tool call output + description: The streamed output items emitted by a shell tool call. + BetaFunctionShellCallItemStatus: + type: string + enum: + - in_progress + - completed + - incomplete + title: Shell call status + description: Status values reported for shell tool calls. + BetaFunctionShellCallOutputContentParam: + properties: + stdout: + type: string + maxLength: 10485760 + description: Captured stdout output for the shell call. + stderr: + type: string + maxLength: 10485760 + description: Captured stderr output for the shell call. + outcome: + $ref: '#/components/schemas/BetaFunctionShellCallOutputOutcomeParam' + description: The exit or timeout outcome associated with this shell call. + type: object + required: + - stdout + - stderr + - outcome + title: Shell output content + description: Captured stdout and stderr for a portion of a shell tool call output. + BetaFunctionShellCallOutputOutcomeParam: + oneOf: + - $ref: '#/components/schemas/BetaFunctionShellCallOutputTimeoutOutcomeParam' + - $ref: '#/components/schemas/BetaFunctionShellCallOutputExitOutcomeParam' + title: Shell call outcome + description: The exit or timeout outcome associated with this shell call. + discriminator: + propertyName: type + BetaFunctionShellCallOutputExitOutcomeParam: properties: - created_at: - type: integer - format: unixtime - description: > - The Unix timestamp (in seconds) of when the model response was - completed. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - call_id - - sip_headers - properties: - call_id: - type: string - description: | - The unique ID of this call. - sip_headers: - type: array - description: | - Headers from the SIP Invite. - items: - type: object - description: | - A header from the SIP Invite. - required: - - name - - value - properties: - name: - type: string - description: | - Name of the SIP Header. - value: - type: string - description: | - Value of the SIP Header. - object: + type: type: string - description: | - The object of the event. Always `event`. enum: - - event + - exit + description: The outcome type. Always `exit`. + default: exit x-stainless-const: true + exit_code: + type: integer + description: The exit code returned by the shell process. + type: object + required: + - type + - exit_code + title: Shell call exit outcome + description: Indicates that the shell commands finished and returned an exit code. + BetaFunctionShellCallOutputTimeoutOutcomeParam: + properties: type: type: string - description: | - The type of the event. Always `realtime.call.incoming`. enum: - - realtime.call.incoming + - timeout + description: The outcome type. Always `timeout`. + default: timeout x-stainless-const: true - x-oaiMeta: - name: realtime.call.incoming - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "realtime.call.incoming", - "created_at": 1719168000, - "data": { - "call_id": "rtc_479a275623b54bdb9b6fbae2f7cbd408", - "sip_headers": [ - {"name": "Max-Forwards", "value": "63"}, - {"name": "CSeq", "value": "851287 INVITE"}, - {"name": "Content-Type", "value": "application/sdp"}, - ] - } - } - WebhookResponseCancelled: type: object - title: response.cancelled - description: | - Sent when a background response has been cancelled. required: - - created_at - - id - - data - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + BetaFunctionShellCallItemParam: properties: - created_at: - type: integer - format: unixtime - description: > - The Unix timestamp (in seconds) of when the model response was - cancelled. + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' id: + anyOf: + - type: string + description: >- + The unique ID of the shell tool call. Populated when this item + is returned via API. + example: sh_123 + - type: 'null' + call_id: type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the model response. - object: - type: string - description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/BetaToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' type: type: string - description: | - The type of the event. Always `response.cancelled`. enum: - - response.cancelled + - shell_call + description: The type of the item. Always `shell_call`. + default: shell_call x-stainless-const: true - x-oaiMeta: - name: response.cancelled - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "response.cancelled", - "created_at": 1719168000, - "data": { - "id": "resp_abc123" - } - } - WebhookResponseCompleted: + action: + $ref: '#/components/schemas/BetaFunctionShellActionParam' + description: >- + The shell commands and limits that describe how to run the tool + call. + status: + anyOf: + - $ref: '#/components/schemas/BetaFunctionShellCallItemStatus' + description: >- + The status of the shell call. One of `in_progress`, `completed`, + or `incomplete`. + - type: 'null' + environment: + anyOf: + - oneOf: + - $ref: '#/components/schemas/BetaLocalEnvironmentParam' + - $ref: '#/components/schemas/BetaContainerReferenceParam' + description: The environment to execute the shell commands in. + discriminator: + propertyName: type + - type: 'null' type: object - title: response.completed - description: | - Sent when a background response has been completed. required: - - created_at - - id - - data + - call_id - type + - action + title: Shell tool call + description: A tool representing a request to execute one or more shell commands. + BetaFunctionShellActionParam: properties: - created_at: - type: integer - format: unixtime + commands: + items: + type: string + type: array + description: Ordered shell commands for the execution environment to run. + timeout_ms: + anyOf: + - type: integer + description: >- + Maximum wall-clock time in milliseconds to allow the shell + commands to run. + - type: 'null' + max_output_length: + anyOf: + - type: integer + description: >- + Maximum number of UTF-8 characters to capture from combined + stdout and stderr output. + - type: 'null' + type: object + required: + - commands + title: Shell action + description: Commands and limits describing how to run the shell tool call. + BetaLocalShellToolCallOutput: + type: object + title: Local shell call output + description: | + The output of a local shell tool call. + properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + type: + type: string + enum: + - local_shell_call_output description: > - The Unix timestamp (in seconds) of when the model response was - completed. + The type of the local shell tool call output. Always + `local_shell_call_output`. + x-stainless-const: true id: type: string description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the model response. - object: - type: string - description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true - type: + The unique ID of the local shell tool call generated by the model. + output: type: string description: | - The type of the event. Always `response.completed`. - enum: - - response.completed - x-stainless-const: true - x-oaiMeta: - name: response.completed - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "response.completed", - "created_at": 1719168000, - "data": { - "id": "resp_abc123" - } - } - WebhookResponseFailed: - type: object - title: response.failed - description: | - Sent when a background response has failed. + A JSON string of the output of the local shell tool call. + status: + anyOf: + - type: string + enum: + - in_progress + - completed + - incomplete + description: > + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. + - type: 'null' required: - - created_at - id - - data - type + - call_id + - output + BetaLocalShellToolCall: + type: object + title: Local shell call + description: | + A tool call to run a command on the local shell. properties: - created_at: - type: integer - format: unixtime + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + type: + type: string + enum: + - local_shell_call description: | - The Unix timestamp (in seconds) of when the model response failed. + The type of the local shell call. Always `local_shell_call`. + x-stainless-const: true id: type: string description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the model response. - object: + The unique ID of the local shell call. + call_id: type: string description: | - The object of the event. Always `event`. + The unique ID of the local shell tool call generated by the model. + action: + $ref: '#/components/schemas/BetaLocalShellExecAction' + status: + type: string enum: - - event - x-stainless-const: true + - in_progress + - completed + - incomplete + description: | + The status of the local shell call. + required: + - type + - id + - call_id + - action + - status + BetaLocalShellExecAction: + properties: type: type: string - description: | - The type of the event. Always `response.failed`. enum: - - response.failed + - exec + description: The type of the local shell action. Always `exec`. + default: exec x-stainless-const: true - x-oaiMeta: - name: response.failed - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "response.failed", - "created_at": 1719168000, - "data": { - "id": "resp_abc123" - } - } - WebhookResponseIncomplete: + command: + items: + type: string + type: array + description: The command to run. + timeout_ms: + anyOf: + - type: integer + description: Optional timeout in milliseconds for the command. + - type: 'null' + working_directory: + anyOf: + - type: string + description: Optional working directory to run the command in. + - type: 'null' + env: + additionalProperties: + type: string + type: object + description: Environment variables to set for the command. + x-oaiTypeLabel: map + user: + anyOf: + - type: string + description: Optional user to run the command as. + - type: 'null' type: object - title: response.incomplete - description: | - Sent when a background response has been interrupted. required: - - created_at - - id - - data - type + - command + - env + title: Local shell exec action + description: Execute a shell command on the server. + BetaCodeInterpreterToolCall: + type: object + title: Code interpreter tool call + description: | + A tool call to run code. properties: - created_at: - type: integer - format: unixtime - description: > - The Unix timestamp (in seconds) of when the model response was - interrupted. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the model response. - object: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + type: type: string - description: | - The object of the event. Always `event`. enum: - - event + - code_interpreter_call + default: code_interpreter_call x-stainless-const: true - type: + description: > + The type of the code interpreter tool call. Always + `code_interpreter_call`. + id: type: string description: | - The type of the event. Always `response.incomplete`. - enum: - - response.incomplete - x-stainless-const: true - x-oaiMeta: - name: response.incomplete - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "response.incomplete", - "created_at": 1719168000, - "data": { - "id": "resp_abc123" - } - } - ModerationInputType: - type: string - enum: - - text - - image - ModerationResultBody: - properties: - type: + The unique ID of the code interpreter tool call. + status: type: string enum: - - moderation_result - description: >- - The object type, which was always `moderation_result` for successful - moderation results. - default: moderation_result - x-stainless-const: true - model: + - in_progress + - completed + - incomplete + - interpreting + - failed + description: > + The status of the code interpreter tool call. Valid values are + `in_progress`, `completed`, `incomplete`, `interpreting`, and + `failed`. + container_id: type: string - description: The moderation model that produced this result. - flagged: - type: boolean - description: >- - A boolean indicating whether the content was flagged by any - category. - categories: - additionalProperties: - type: boolean - type: object - description: >- - A dictionary of moderation categories to booleans, True if the input - is flagged under this category. - x-oaiTypeLabel: map - category_scores: - additionalProperties: - type: number - type: object - description: A dictionary of moderation categories to scores. - x-oaiTypeLabel: map - category_applied_input_types: - additionalProperties: - items: - $ref: '#/components/schemas/ModerationInputType' - type: array - type: object - description: >- - Which modalities of input are reflected by the score for each - category. - x-oaiTypeLabel: map - type: object + description: | + The ID of the container used to run the code. + code: + anyOf: + - type: string + description: | + The code to run, or null if not available. + - type: 'null' + outputs: + anyOf: + - type: array + items: + oneOf: + - $ref: '#/components/schemas/BetaCodeInterpreterOutputLogs' + - $ref: '#/components/schemas/BetaCodeInterpreterOutputImage' + discriminator: + propertyName: type + discriminator: + propertyName: type + description: > + The outputs generated by the code interpreter, such as logs or + images. + + Can be null if no outputs are available. + - type: 'null' required: - type - - model - - flagged - - categories - - category_scores - - category_applied_input_types - title: Moderation result - description: A moderation result produced for the response input or output. - ModerationParam: - properties: - model: - type: string - description: >- - The moderation model to use for moderated completions, e.g. - 'omni-moderation-latest'. - type: object - required: - - model - description: >- - Configuration for running moderation on the input and output of this - response. - SkillReferenceParam: + - id + - status + - container_id + - code + - outputs + BetaCodeInterpreterOutputImage: properties: type: type: string enum: - - skill_reference - description: References a skill created with the /v1/skills endpoint. - default: skill_reference + - image + description: The type of the output. Always `image`. + default: image x-stainless-const: true - skill_id: - type: string - maxLength: 64 - minLength: 1 - description: The ID of the referenced skill. - version: + url: type: string - description: >- - Optional skill version. Use a positive integer or 'latest'. Omit for - default. + format: uri + description: The URL of the image output from the code interpreter. type: object required: - type - - skill_id - InlineSkillSourceParam: + - url + title: Code interpreter output image + description: The image output from the code interpreter. + BetaCodeInterpreterOutputLogs: properties: type: type: string enum: - - base64 - description: The type of the inline skill source. Must be `base64`. - default: base64 - x-stainless-const: true - media_type: - type: string - enum: - - application/zip - description: >- - The media type of the inline skill payload. Must be - `application/zip`. - default: application/zip + - logs + description: The type of the output. Always `logs`. + default: logs x-stainless-const: true - data: + logs: type: string - maxLength: 70254592 - minLength: 1 - description: Base64-encoded skill zip bundle. + description: The logs output from the code interpreter. type: object required: - type - - media_type - - data - description: Inline skill payload - InlineSkillParam: + - logs + title: Code interpreter output logs + description: The logs output from the code interpreter. + BetaImageGenToolCall: + type: object + title: Image generation call + description: | + An image generation request made by the model. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. type: type: string enum: - - inline - description: Defines an inline skill for this request. - default: inline + - image_generation_call + description: > + The type of the image generation call. Always + `image_generation_call`. x-stainless-const: true - name: + id: type: string - description: The name of the skill. - description: + description: | + The unique ID of the image generation call. + status: type: string - description: The description of the skill. - source: - $ref: '#/components/schemas/InlineSkillSourceParam' - description: Inline skill payload - type: object + enum: + - in_progress + - completed + - generating + - failed + description: | + The status of the image generation call. + result: + anyOf: + - type: string + description: | + The generated image encoded in base64. + - type: 'null' required: - type - - name - - description - - source - ContainerNetworkPolicyDisabledParam: + - id + - status + - result + BetaCompactionSummaryItemParam: properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: + anyOf: + - type: string + description: The ID of the compaction item. + example: cmp_123 + - type: 'null' type: type: string enum: - - disabled - description: Disable outbound network access. Always `disabled`. - default: disabled + - compaction + description: The type of the item. Always `compaction`. + default: compaction x-stainless-const: true - type: object - required: - - type - ContainerNetworkPolicyDomainSecretParam: - properties: - domain: - type: string - minLength: 1 - description: The domain associated with the secret. - name: - type: string - minLength: 1 - description: The name of the secret to inject for the domain. - value: + encrypted_content: type: string maxLength: 10485760 - minLength: 1 - description: The secret value to inject for the domain. + description: The encrypted content of the compaction summary. type: object required: - - domain - - name - - value - ContainerNetworkPolicyAllowlistParam: + - type + - encrypted_content + title: Compaction item + description: >- + A compaction item generated by the [`v1/responses/compact` + API](/docs/api-reference/responses/compact). + BetaReasoningItem: + type: object + description: > + A description of the chain of thought used by a reasoning model while + generating + + a response. Be sure to include these items in your `input` to the + Responses API + + for subsequent turns of a conversation if you are manually + + [managing context](/docs/guides/conversation-state). + title: Reasoning properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. type: type: string + description: | + The type of the object. Always `reasoning`. enum: - - allowlist - description: >- - Allow outbound network access only to specified domains. Always - `allowlist`. - default: allowlist + - reasoning x-stainless-const: true - allowed_domains: - items: - type: string + id: + type: string + description: | + The unique identifier of the reasoning content. + encrypted_content: + anyOf: + - type: string + description: > + The encrypted content of the reasoning item - populated when a + response is + + generated with `reasoning.encrypted_content` in the `include` + parameter. + - type: 'null' + summary: type: array - minItems: 1 - description: A list of allowed domains when type is `allowlist`. - domain_secrets: + description: | + Reasoning summary content. items: - $ref: '#/components/schemas/ContainerNetworkPolicyDomainSecretParam' + $ref: '#/components/schemas/BetaSummaryTextContent' + content: type: array - minItems: 1 - description: Optional domain-scoped secrets for allowlisted domains. - type: object + description: | + Reasoning text content. + items: + $ref: '#/components/schemas/BetaReasoningTextContent' + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete required: + - id + - summary - type - - allowed_domains - IncludeEnum: - type: string - enum: - - file_search_call.results - - web_search_call.results - - web_search_call.action.sources - - message.input_image.image_url - - computer_call_output.output.image_url - - code_interpreter_call.outputs - - reasoning.encrypted_content - - message.output_text.logprobs - description: >- - Specify additional output data to include in the model response. - Currently supported values are: - - - `web_search_call.results`: Include the search results of the web - search tool call. - - - `web_search_call.action.sources`: Include the sources of the web - search tool call. - - - `code_interpreter_call.outputs`: Includes the outputs of python code - execution in code interpreter tool call items. - - - `computer_call_output.output.image_url`: Include image urls from the - computer call output. - - - `file_search_call.results`: Include the search results of the file - search tool call. - - - `message.input_image.image_url`: Include image urls from the input - message. - - - `message.output_text.logprobs`: Include logprobs with assistant - messages. - - - `reasoning.encrypted_content`: Includes an encrypted version of - reasoning tokens in reasoning item outputs. This enables reasoning items - to be used in multi-turn conversations when using the Responses API - statelessly (like when the `store` parameter is set to `false`, or when - an organization is enrolled in the zero data retention program). - MessageStatus: - type: string - enum: - - in_progress - - completed - - incomplete - MessageRole: - type: string - enum: - - unknown - - user - - assistant - - system - - critic - - discriminator - - developer - - tool - InputTextContent: + BetaReasoningTextContent: properties: type: type: string enum: - - input_text - description: The type of the input item. Always `input_text`. - default: input_text + - reasoning_text + description: The type of the reasoning text. Always `reasoning_text`. + default: reasoning_text x-stainless-const: true text: type: string - description: The text input to the model. + description: The reasoning text from the model. type: object required: - type - text - title: Input text - description: A text input to the model. - FileCitationBody: + title: Reasoning text + description: Reasoning text from the model. + BetaSummaryTextContent: properties: type: type: string enum: - - file_citation - description: The type of the file citation. Always `file_citation`. - default: file_citation + - summary_text + description: The type of the object. Always `summary_text`. + default: summary_text x-stainless-const: true - file_id: - type: string - description: The ID of the file. - index: - type: integer - description: The index of the file in the list of files. - filename: + text: type: string - description: The filename of the file cited. + description: A summary of the reasoning output from the model so far. type: object required: - type - - file_id - - index - - filename - title: File citation - description: A citation to a file. - UrlCitationBody: + - text + title: Summary text + description: A summary text from the model. + BetaAdditionalToolsItemParam: properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: + anyOf: + - type: string + description: The unique ID of this additional tools item. + example: at_123 + - type: 'null' type: type: string enum: - - url_citation - description: The type of the URL citation. Always `url_citation`. - default: url_citation + - additional_tools + description: The item type. Always `additional_tools`. + default: additional_tools x-stainless-const: true - url: - type: string - format: uri - description: The URL of the web resource. - start_index: - type: integer - description: The index of the first character of the URL citation in the message. - end_index: - type: integer - description: The index of the last character of the URL citation in the message. - title: + role: type: string - description: The title of the web resource. + enum: + - developer + description: >- + The role that provided the additional tools. Only `developer` is + supported. + default: developer + x-stainless-const: true + tools: + items: + $ref: '#/components/schemas/BetaTool' + type: array + description: A list of additional tools made available at this item. type: object required: - type - - url - - start_index - - end_index - - title - title: URL citation - description: A citation for a web resource used to generate a model response. - ContainerFileCitationBody: + - role + - tools + BetaToolSearchOutputItemParam: properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: + anyOf: + - type: string + description: The unique ID of this tool search output. + example: tso_123 + - type: 'null' + call_id: + anyOf: + - type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the tool search call generated by the model. + - type: 'null' type: type: string enum: - - container_file_citation - description: >- - The type of the container file citation. Always - `container_file_citation`. - default: container_file_citation + - tool_search_output + description: The item type. Always `tool_search_output`. + default: tool_search_output x-stainless-const: true - container_id: - type: string - description: The ID of the container file. - file_id: - type: string - description: The ID of the file. - start_index: - type: integer - description: >- - The index of the first character of the container file citation in - the message. - end_index: - type: integer - description: >- - The index of the last character of the container file citation in - the message. - filename: - type: string - description: The filename of the container file cited. + execution: + $ref: '#/components/schemas/BetaToolSearchExecutionType' + description: Whether tool search was executed by the server or by the client. + tools: + items: + $ref: '#/components/schemas/BetaTool' + type: array + description: The loaded tool definitions returned by the tool search output. + status: + anyOf: + - $ref: '#/components/schemas/BetaFunctionCallItemStatus' + description: The status of the tool search output. + - type: 'null' type: object required: - type - - container_id - - file_id - - start_index - - end_index - - filename - title: Container file citation - description: A citation for a container file used to generate a model response. - Annotation: - oneOf: - - $ref: '#/components/schemas/FileCitationBody' - - $ref: '#/components/schemas/UrlCitationBody' - - $ref: '#/components/schemas/ContainerFileCitationBody' - - $ref: '#/components/schemas/FilePath' - description: An annotation that applies to a span of output text. - discriminator: - propertyName: type - TopLogProb: + - tools + BetaFunctionCallItemStatus: + type: string + enum: + - in_progress + - completed + - incomplete + BetaToolSearchCallItemParam: properties: - token: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: + anyOf: + - type: string + description: The unique ID of this tool search call. + example: tsc_123 + - type: 'null' + call_id: + anyOf: + - type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the tool search call generated by the model. + - type: 'null' + type: type: string - logprob: - type: number - bytes: - items: - type: integer - type: array + enum: + - tool_search_call + description: The item type. Always `tool_search_call`. + default: tool_search_call + x-stainless-const: true + execution: + $ref: '#/components/schemas/BetaToolSearchExecutionType' + description: Whether tool search was executed by the server or by the client. + arguments: + $ref: '#/components/schemas/BetaEmptyModelParam' + description: The arguments supplied to the tool search call. + status: + anyOf: + - $ref: '#/components/schemas/BetaFunctionCallItemStatus' + description: The status of the tool search call. + - type: 'null' type: object required: - - token - - logprob - - bytes - title: Top log probability - description: The top log probability of a token. - LogProb: + - type + - arguments + BetaMultiAgentCallOutputItemParam: properties: - token: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: + anyOf: + - type: string + description: The unique ID of this multi-agent call output. + example: maco_123 + - type: 'null' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the multi-agent call. + type: type: string - logprob: - type: number - bytes: - items: - type: integer - type: array - top_logprobs: + enum: + - multi_agent_call_output + description: The item type. Always `multi_agent_call_output`. + default: multi_agent_call_output + x-stainless-const: true + action: + $ref: '#/components/schemas/BetaMultiAgentAction1' + description: The multi-agent action that produced this result. + output: items: - $ref: '#/components/schemas/TopLogProb' + $ref: '#/components/schemas/BetaOutputTextContentParam' type: array + description: Text output returned by the multi-agent action. type: object required: - - token - - logprob - - bytes - - top_logprobs - title: Log probability - description: The log probability of a token. - OutputTextContent: + - call_id + - type + - action + - output + x-oai-beta: responses_multi_agent=v1 + BetaOutputTextContentParam: properties: type: type: string enum: - output_text - description: The type of the output text. Always `output_text`. + description: The content type. Always `output_text`. default: output_text x-stainless-const: true text: type: string - description: The text output from the model. + maxLength: 10485760 + description: The text content. annotations: - items: - $ref: '#/components/schemas/Annotation' - type: array - description: The annotations of the text output. - logprobs: - items: - $ref: '#/components/schemas/LogProb' - type: array + oneOf: + - items: + $ref: '#/components/schemas/BetaFileCitationParam' + type: array + - items: + $ref: '#/components/schemas/BetaUrlCitationParam' + type: array + - items: + $ref: '#/components/schemas/BetaContainerFileCitationParam' + type: array + description: Citations associated with the text content. type: object required: - type - text - - annotations - - logprobs - title: Output text - description: A text output from the model. - TextContent: + BetaContainerFileCitationParam: properties: type: type: string enum: - - text - default: text + - container_file_citation + description: The citation type. Always `container_file_citation`. + default: container_file_citation x-stainless-const: true - text: + start_index: + type: integer + minimum: 0 + description: The index of the first character of the citation in the message. + end_index: + type: integer + minimum: 0 + description: The index of the last character of the citation in the message. + container_id: + type: string + description: The ID of the container. + example: cntr_123 + file_id: type: string + description: The ID of the container file. + example: cfile_123 + filename: + type: string + description: The filename of the container file cited. type: object required: - type - - text - title: Text Content - description: A text content. - SummaryTextContent: + - start_index + - end_index + - container_id + - file_id + - filename + BetaUrlCitationParam: properties: type: type: string enum: - - summary_text - description: The type of the object. Always `summary_text`. - default: summary_text + - url_citation + description: The citation type. Always `url_citation`. + default: url_citation x-stainless-const: true - text: + start_index: + type: integer + minimum: 0 + description: The index of the first character of the citation in the message. + end_index: + type: integer + minimum: 0 + description: The index of the last character of the citation in the message. + url: type: string - description: A summary of the reasoning output from the model so far. + format: uri + description: The URL of the cited resource. + title: + type: string + description: The title of the cited resource. type: object required: - type - - text - title: Summary text - description: A summary text from the model. - ReasoningTextContent: + - start_index + - end_index + - url + - title + BetaFileCitationParam: properties: type: type: string enum: - - reasoning_text - description: The type of the reasoning text. Always `reasoning_text`. - default: reasoning_text + - file_citation + description: The citation type. Always `file_citation`. + default: file_citation x-stainless-const: true - text: + index: + type: integer + minimum: 0 + description: The index of the file in the list of files. + file_id: type: string - description: The reasoning text from the model. + description: The ID of the file. + example: file-123 + filename: + type: string + description: The filename of the file cited. type: object required: - type - - text - title: Reasoning text - description: Reasoning text from the model. - RefusalContent: + - index + - file_id + - filename + BetaMultiAgentAction1: + type: string + enum: + - spawn_agent + - interrupt_agent + - list_agents + - send_message + - followup_task + - wait_agent + BetaMultiAgentCallItemParam: + properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: + anyOf: + - type: string + description: The unique ID of this multi-agent call. + example: mac_123 + - type: 'null' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID linking this call to its output. + type: + type: string + enum: + - multi_agent_call + description: The item type. Always `multi_agent_call`. + default: multi_agent_call + x-stainless-const: true + action: + $ref: '#/components/schemas/BetaMultiAgentAction1' + description: The multi-agent action that was executed. + arguments: + type: string + description: The action arguments as a JSON string. + type: object + required: + - call_id + - type + - action + - arguments + x-oai-beta: responses_multi_agent=v1 + BetaAgentMessageItemParam: properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: + anyOf: + - type: string + description: The unique ID of this agent message item. + example: amsg_123 + - type: 'null' type: type: string enum: - - refusal - description: The type of the refusal. Always `refusal`. - default: refusal + - agent_message + description: The item type. Always `agent_message`. + default: agent_message x-stainless-const: true - refusal: + author: type: string - description: The refusal explanation from the model. + description: The sending agent identity. + recipient: + type: string + description: The destination agent identity. + content: + items: + oneOf: + - $ref: '#/components/schemas/BetaInputTextContentParam' + - $ref: '#/components/schemas/BetaInputImageContentParamAutoParam' + - $ref: '#/components/schemas/BetaEncryptedContentParam' + description: A plaintext, image, or encrypted agent message content part. + discriminator: + propertyName: type + type: array + description: Plaintext, image, or encrypted content sent between agents. type: object required: - type - - refusal - title: Refusal - description: A refusal from the model. - ImageDetail: - type: string - enum: - - low - - high - - auto - - original - InputImageContent: + - author + - recipient + - content + title: Agent message + description: A message routed between agents. + x-oai-beta: responses_multi_agent=v1 + BetaEncryptedContentParam: + properties: + type: + type: string + enum: + - encrypted_content + description: The type of the input item. Always `encrypted_content`. + default: encrypted_content + x-stainless-const: true + encrypted_content: + type: string + maxLength: 10485760 + description: Opaque encrypted content. + type: object + required: + - type + - encrypted_content + title: Encrypted content + description: >- + Opaque encrypted content that Responses API decrypts inside trusted + model execution. + x-oai-beta: responses_multi_agent=v1 + BetaInputImageContentParamAutoParam: properties: type: type: string @@ -80444,6 +93032,7 @@ components: image_url: anyOf: - type: string + maxLength: 20971520 format: uri description: >- The URL of the image to be sent to the model. A fully qualified @@ -80453,61 +93042,140 @@ components: anyOf: - type: string description: The ID of the file to be sent to the model. + example: file-123 - type: 'null' detail: - $ref: '#/components/schemas/ImageDetail' - description: >- - The detail level of the image to be sent to the model. One of - `high`, `low`, `auto`, or `original`. Defaults to `auto`. + anyOf: + - $ref: '#/components/schemas/BetaDetailEnum' + description: >- + The detail level of the image to be sent to the model. One of + `high`, `low`, `auto`, or `original`. Defaults to `auto`. + - type: 'null' + prompt_cache_breakpoint: + anyOf: + - $ref: '#/components/schemas/BetaPromptCacheBreakpointParam' + - type: 'null' type: object required: - type - - detail title: Input image description: >- An image input to the model. Learn about [image - inputs](/docs/guides/vision). - ComputerScreenshotContent: + inputs](/docs/guides/vision) + BetaPromptCacheBreakpointParam: + properties: + mode: + type: string + enum: + - explicit + description: The breakpoint mode. Always `explicit`. + default: explicit + x-stainless-const: true + type: object + required: + - mode + title: Prompt cache breakpoint + description: >- + 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. + BetaDetailEnum: + type: string + enum: + - low + - high + - auto + - original + BetaInputTextContentParam: properties: type: type: string enum: - - computer_screenshot - description: >- - Specifies the event type. For a computer screenshot, this property - is always set to `computer_screenshot`. - default: computer_screenshot + - input_text + description: The type of the input item. Always `input_text`. + default: input_text x-stainless-const: true - image_url: + text: + type: string + maxLength: 10485760 + description: The text input to the model. + prompt_cache_breakpoint: anyOf: - - type: string - format: uri - description: The URL of the screenshot image. + - $ref: '#/components/schemas/BetaPromptCacheBreakpointParam' - type: 'null' - file_id: + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + BetaFunctionCallOutputItemParam: + properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: anyOf: - type: string - description: The identifier of an uploaded file that contains the screenshot. + description: >- + The unique ID of the function tool call output. Populated when + this item is returned via API. + example: fc_123 - type: 'null' - detail: - $ref: '#/components/schemas/ImageDetail' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the function tool call generated by the model. + type: + type: string + enum: + - function_call_output description: >- - The detail level of the screenshot image to be sent to the model. - One of `high`, `low`, `auto`, or `original`. Defaults to `auto`. + The type of the function tool call output. Always + `function_call_output`. + default: function_call_output + x-stainless-const: true + output: + oneOf: + - type: string + maxLength: 10485760 + description: A JSON string of the output of the function tool call. + - items: + oneOf: + - $ref: '#/components/schemas/BetaInputTextContentParam' + - $ref: '#/components/schemas/BetaInputImageContentParamAutoParam' + - $ref: '#/components/schemas/BetaInputFileContentParam' + description: A piece of message content, such as text, an image, or a file. + discriminator: + propertyName: type + type: array + description: >- + An array of content outputs (text, image, file) for the function + tool call. + description: Text, image, or file output of the function tool call. + caller: + anyOf: + - $ref: '#/components/schemas/BetaToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' + status: + anyOf: + - $ref: '#/components/schemas/BetaFunctionCallItemStatus' + description: >- + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + - type: 'null' type: object required: + - call_id - type - - image_url - - file_id - - detail - title: Computer screenshot - description: A screenshot of a computer. - FileInputDetail: - type: string - enum: - - low - - high - InputFileContent: + - output + title: Function tool call output + description: The output of a function tool call. + BetaInputFileContentParam: properties: type: type: string @@ -80520,308 +93188,468 @@ components: anyOf: - type: string description: The ID of the file to be sent to the model. + example: file-123 - type: 'null' filename: - type: string - description: The name of the file to be sent to the model. + anyOf: + - type: string + description: The name of the file to be sent to the model. + - type: 'null' file_data: - type: string - description: | - The content of the file to be sent to the model. + anyOf: + - type: string + maxLength: 73400320 + description: The base64-encoded data of the file to be sent to the model. + - type: 'null' file_url: - type: string - format: uri - description: The URL of the file to be sent to the model. + anyOf: + - type: string + format: uri + description: The URL of the file to be sent to the model. + - type: 'null' detail: - $ref: '#/components/schemas/FileInputDetail' + $ref: '#/components/schemas/BetaFileDetailEnum' description: >- - The detail level of the file to be sent to the model. Use `low` for - the default rendering behavior, or `high` to render the file at - higher quality. Defaults to `low`. + 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`. + prompt_cache_breakpoint: + anyOf: + - $ref: '#/components/schemas/BetaPromptCacheBreakpointParam' + - type: 'null' type: object - required: &ref_0 + required: - type title: Input file description: A file input to the model. - MessagePhase-2: + BetaFileDetailEnum: type: string enum: - - commentary - - final_answer - Message: + - auto + - low + - high + BetaFunctionToolCall: + type: object + title: Function tool call + description: > + A tool call to run a function. See the + + [function calling guide](/docs/guides/function-calling) for more + information. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + id: + type: string + description: | + The unique ID of the function tool call. type: type: string enum: - - message - description: The type of the message. Always set to `message`. - default: message + - function_call + description: | + The type of the function tool call. Always `function_call`. x-stainless-const: true - id: + call_id: type: string - description: The unique ID of the message. + description: | + The unique ID of the function tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/BetaToolCallCaller' + - type: 'null' + namespace: + type: string + description: | + The namespace of the function to run. + name: + type: string + description: | + The name of the function to run. + arguments: + type: string + description: | + A JSON string of the arguments to pass to the function. status: - $ref: '#/components/schemas/MessageStatus' - description: >- - The status of item. One of `in_progress`, `completed`, or + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API. - role: - $ref: '#/components/schemas/MessageRole' - description: >- - The role of the message. One of `unknown`, `user`, `assistant`, - `system`, `critic`, `discriminator`, `developer`, or `tool`. - content: - items: - oneOf: - - $ref: '#/components/schemas/InputTextContent' - - $ref: '#/components/schemas/OutputTextContent' - - $ref: '#/components/schemas/TextContent' - - $ref: '#/components/schemas/SummaryTextContent' - - $ref: '#/components/schemas/ReasoningTextContent' - - $ref: '#/components/schemas/RefusalContent' - - $ref: '#/components/schemas/InputImageContent' - - $ref: '#/components/schemas/ComputerScreenshotContent' - - $ref: '#/components/schemas/InputFileContent' - description: A content part that makes up an input or output item. - discriminator: - propertyName: type - type: array - description: The content of the message - phase: + enum: + - in_progress + - completed + - incomplete + required: + - type + - call_id + - name + - arguments + BetaWebSearchToolCall: + type: object + title: Web search tool call + description: | + The results of a web search tool call. See the + [web search guide](/docs/guides/tools-web-search) for more information. + properties: + agent: anyOf: - - $ref: '#/components/schemas/MessagePhase-2' - description: >- - Labels an `assistant` message as intermediate commentary - (`commentary`) or the final answer (`final_answer`). For models - like `gpt-5.3-codex` and beyond, when sending follow-up - requests, preserve and resend phase on all assistant messages — - dropping it can degrade performance. Not used for user messages. + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + id: + type: string + description: | + The unique ID of the web search tool call. + type: + type: string + enum: + - web_search_call + description: | + The type of the web search tool call. Always `web_search_call`. + x-stainless-const: true + status: + type: string + description: | + The status of the web search tool call. + enum: + - in_progress + - searching + - completed + - failed + action: + type: object + description: > + An object describing the specific action taken in this web search + call. + + Includes details on how the model used the web (search, open_page, + find_in_page). + oneOf: + - $ref: '#/components/schemas/BetaWebSearchActionSearch' + - $ref: '#/components/schemas/BetaWebSearchActionOpenPage' + - $ref: '#/components/schemas/BetaWebSearchActionFind' + discriminator: + propertyName: type + required: + - id + - type + - status + - action + BetaWebSearchActionFind: + type: object + title: Find action + description: | + Action type "find_in_page": Searches for a pattern within a loaded page. + properties: + type: + type: string + enum: + - find_in_page + description: | + The action type. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the page searched for the pattern. + pattern: + type: string + description: | + The pattern or text to search for within the page. + required: + - type + - url + - pattern + BetaWebSearchActionOpenPage: + type: object + title: Open page action + description: | + Action type "open_page" - Opens a specific URL from search results. + properties: + type: + type: string + enum: + - open_page + description: | + The action type. + x-stainless-const: true + url: + description: | + The URL opened by the model. + anyOf: + - type: string + format: uri - type: 'null' - type: object required: - type - - id - - status - - role - - content - title: Message - description: A message to or from the model. - FunctionCallStatus: - type: string - enum: - - in_progress - - completed - - incomplete - FunctionCallOutputStatusEnum: - type: string - enum: - - in_progress - - completed - - incomplete - ClickButtonType: - type: string - enum: - - left - - right - - wheel - - back - - forward - ClickParam: + BetaWebSearchActionSearch: + type: object + title: Search action + description: | + Action type "search" - Performs a web search query. properties: type: type: string enum: - - click - description: >- - Specifies the event type. For a click action, this property is - always `click`. - default: click + - search + description: | + The action type. x-stainless-const: true - button: - $ref: '#/components/schemas/ClickButtonType' - description: >- - Indicates which mouse button was pressed during the click. One of - `left`, `right`, `wheel`, `back`, or `forward`. - x: - type: integer - description: The x-coordinate where the click occurred. - 'y': - type: integer - description: The y-coordinate where the click occurred. - keys: - anyOf: - - items: + query: + type: string + deprecated: true + description: | + The search query. + queries: + type: array + title: Search queries + description: | + The search queries. + items: + type: string + description: | + A search query. + sources: + type: array + title: Web search sources + description: | + The sources used in the search. + items: + type: object + title: Web search source + description: | + A source used in the search. + properties: + type: type: string - type: array - description: The keys being held while clicking. - - type: 'null' - type: object + enum: + - url + description: | + The type of source. Always `url`. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the source. + required: + - type + - url required: - type - - button - - x - - 'y' - title: Click - description: A click action. - DoubleClickAction: + BetaComputerCallOutputItemParam: properties: + agent: + anyOf: + - $ref: '#/components/schemas/Beta_AgentTagParam' + description: The agent that produced this item. + - type: 'null' + id: + anyOf: + - type: string + description: The ID of the computer tool call output. + example: cuo_123 + - type: 'null' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The ID of the computer tool call that produced the output. type: type: string enum: - - double_click + - computer_call_output description: >- - Specifies the event type. For a double click action, this property - is always set to `double_click`. - default: double_click + The type of the computer tool call output. Always + `computer_call_output`. + default: computer_call_output x-stainless-const: true - x: - type: integer - description: The x-coordinate where the double click occurred. - 'y': - type: integer - description: The y-coordinate where the double click occurred. - keys: + output: + $ref: '#/components/schemas/BetaComputerScreenshotImage' + acknowledged_safety_checks: anyOf: - items: - type: string + $ref: '#/components/schemas/BetaComputerCallSafetyCheckParam' type: array - description: The keys being held while double-clicking. + description: >- + The safety checks reported by the API that have been + acknowledged by the developer. + - type: 'null' + status: + anyOf: + - $ref: '#/components/schemas/BetaFunctionCallItemStatus' + description: >- + The status of the message input. One of `in_progress`, + `completed`, or `incomplete`. Populated when input items are + returned via API. - type: 'null' type: object required: + - call_id - type - - x - - 'y' - - keys - title: DoubleClick - description: A double click action. - CoordParam: + - output + title: Computer tool call output + description: The output of a computer tool call. + BetaComputerCallSafetyCheckParam: properties: - x: - type: integer - description: The x-coordinate. - 'y': - type: integer - description: The y-coordinate. + id: + type: string + description: The ID of the pending safety check. + code: + anyOf: + - type: string + description: The type of the pending safety check. + - type: 'null' + message: + anyOf: + - type: string + description: Details about the pending safety check. + - type: 'null' type: object required: - - x - - 'y' - title: Coordinate - description: 'An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.' - DragParam: + - id + description: A pending safety check for the computer call. + BetaComputerScreenshotImage: + type: object + description: | + A computer screenshot image used with the computer use tool. properties: type: type: string enum: - - drag - description: >- - Specifies the event type. For a drag action, this property is always - set to `drag`. - default: drag - x-stainless-const: true - path: - items: - $ref: '#/components/schemas/CoordParam' - type: array - description: >- - An array of coordinates representing the path of the drag action. - Coordinates will appear as an array of objects, eg - - ``` - - [ - { x: 100, y: 200 }, - { x: 200, y: 300 } - ] + - computer_screenshot + default: computer_screenshot + description: > + Specifies the event type. For a computer screenshot, this property + is - ``` - keys: - anyOf: - - items: - type: string - type: array - description: The keys being held while dragging the mouse. - - type: 'null' - type: object + always set to `computer_screenshot`. + x-stainless-const: true + image_url: + type: string + format: uri + description: The URL of the screenshot image. + file_id: + type: string + description: The identifier of an uploaded file that contains the screenshot. required: - type - - path - title: Drag - description: A drag action. - KeyPressAction: + BetaComputerToolCall: + type: object + title: Computer tool call + description: > + A tool call to a computer use tool. See the + + [computer use guide](/docs/guides/tools-computer-use) for more + information. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. type: type: string + description: The type of the computer call. Always `computer_call`. enum: - - keypress - description: >- - Specifies the event type. For a keypress action, this property is - always set to `keypress`. - default: keypress - x-stainless-const: true - keys: - items: - type: string - description: One of the keys the model is requesting to be pressed. + - computer_call + default: computer_call + id: + type: string + description: The unique ID of the computer call. + call_id: + type: string + description: | + An identifier used when responding to the tool call with output. + action: + $ref: '#/components/schemas/BetaComputerAction' + actions: + $ref: '#/components/schemas/BetaComputerActionList' + pending_safety_checks: type: array - description: >- - The combination of keys the model is requesting to be pressed. This - is an array of strings, each representing a key. - type: object + items: + $ref: '#/components/schemas/BetaComputerCallSafetyCheckParam' + description: | + The pending safety checks for the computer call. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete required: - type - - keys - title: KeyPress - description: A collection of keypresses the model would like to perform. - MoveParam: + - id + - call_id + - pending_safety_checks + - status + BetaComputerActionList: + title: Computer Action List + type: array + description: | + Flattened batched actions for `computer_use`. Each action includes an + `type` discriminator and action-specific fields. + items: + $ref: '#/components/schemas/BetaComputerAction' + BetaComputerAction: + oneOf: + - $ref: '#/components/schemas/BetaClickParam' + - $ref: '#/components/schemas/BetaDoubleClickAction' + - $ref: '#/components/schemas/BetaDragParam' + - $ref: '#/components/schemas/BetaKeyPressAction' + - $ref: '#/components/schemas/BetaMoveParam' + - $ref: '#/components/schemas/BetaScreenshotParam' + - $ref: '#/components/schemas/BetaScrollParam' + - $ref: '#/components/schemas/BetaTypeParam' + - $ref: '#/components/schemas/BetaWaitParam' + discriminator: + propertyName: type + BetaWaitParam: properties: type: type: string enum: - - move + - wait description: >- - Specifies the event type. For a move action, this property is always - set to `move`. - default: move + Specifies the event type. For a wait action, this property is always + set to `wait`. + default: wait x-stainless-const: true - x: - type: integer - description: The x-coordinate to move to. - 'y': - type: integer - description: The y-coordinate to move to. - keys: - anyOf: - - items: - type: string - type: array - description: The keys being held while moving the mouse. - - type: 'null' type: object required: - type - - x - - 'y' - title: Move - description: A mouse move action. - ScreenshotParam: + title: Wait + description: A wait action. + BetaTypeParam: properties: type: type: string enum: - - screenshot + - type description: >- - Specifies the event type. For a screenshot action, this property is - always set to `screenshot`. - default: screenshot + Specifies the event type. For a type action, this property is always + set to `type`. + default: type x-stainless-const: true + text: + type: string + description: The text to type. type: object required: - type - title: Screenshot - description: A screenshot action. - ScrollParam: + - text + title: Type + description: An action to type in text. + BetaScrollParam: properties: type: type: string @@ -80860,1017 +93688,1264 @@ components: - scroll_y title: Scroll description: A scroll action. - TypeParam: + BetaScreenshotParam: properties: type: type: string enum: - - type + - screenshot description: >- - Specifies the event type. For a type action, this property is always - set to `type`. - default: type + Specifies the event type. For a screenshot action, this property is + always set to `screenshot`. + default: screenshot x-stainless-const: true - text: - type: string - description: The text to type. type: object required: - type - - text - title: Type - description: An action to type in text. - WaitParam: + title: Screenshot + description: A screenshot action. + BetaMoveParam: properties: type: type: string enum: - - wait + - move description: >- - Specifies the event type. For a wait action, this property is always - set to `wait`. - default: wait - x-stainless-const: true - type: object - required: - - type - title: Wait - description: A wait action. - ComputerCallSafetyCheckParam: - properties: - id: - type: string - description: The ID of the pending safety check. - code: - anyOf: - - type: string - description: The type of the pending safety check. - - type: 'null' - message: - anyOf: - - type: string - description: Details about the pending safety check. - - type: 'null' - type: object - required: - - id - description: A pending safety check for the computer call. - ComputerCallOutputStatus: - type: string - enum: - - completed - - incomplete - - failed - ToolSearchExecutionType: - type: string - enum: - - server - - client - ToolSearchCall: - properties: - type: - type: string - enum: - - tool_search_call - description: The type of the item. Always `tool_search_call`. - default: tool_search_call - x-stainless-const: true - id: - type: string - description: The unique ID of the tool search call item. - call_id: - anyOf: - - type: string - description: The unique ID of the tool search call generated by the model. - - type: 'null' - execution: - $ref: '#/components/schemas/ToolSearchExecutionType' - description: Whether tool search was executed by the server or by the client. - arguments: - description: Arguments used for the tool search call. - status: - $ref: '#/components/schemas/FunctionCallStatus' - description: The status of the tool search call item that was recorded. - created_by: - type: string - description: The identifier of the actor that created the item. - type: object - required: - - type - - id - - call_id - - execution - - arguments - - status - FunctionTool: - properties: - type: - type: string - enum: - - function - description: The type of the function tool. Always `function`. - default: function + Specifies the event type. For a move action, this property is always + set to `move`. + default: move x-stainless-const: true - name: - type: string - description: The name of the function to call. - description: - anyOf: - - type: string - description: >- - A description of the function. Used by the model to determine - whether or not to call the function. - - type: 'null' - parameters: - anyOf: - - additionalProperties: {} - type: object - description: A JSON schema object describing the parameters of the function. - x-oaiTypeLabel: map - - type: 'null' - strict: + x: + type: integer + description: The x-coordinate to move to. + 'y': + type: integer + description: The y-coordinate to move to. + keys: anyOf: - - type: boolean - description: Whether to enforce strict parameter validation. Default `true`. + - items: + type: string + type: array + description: The keys being held while moving the mouse. - type: 'null' - defer_loading: - type: boolean - description: Whether this function is deferred and loaded via tool search. type: object required: - type - - name - - strict - - parameters - title: Function - description: >- - Defines a function in your own code the model can choose to call. Learn - more about [function - calling](https://platform.openai.com/docs/guides/function-calling). - RankerVersionType: - type: string - enum: - - auto - - default-2024-11-15 - HybridSearchOptions: - properties: - embedding_weight: - type: number - description: The weight of the embedding in the reciprocal ranking fusion. - text_weight: - type: number - description: The weight of the text in the reciprocal ranking fusion. - type: object - required: - - embedding_weight - - text_weight - RankingOptions: + - x + - 'y' + title: Move + description: A mouse move action. + BetaKeyPressAction: properties: - ranker: - $ref: '#/components/schemas/RankerVersionType' - description: The ranker to use for the file search. - score_threshold: - type: number + type: + type: string + enum: + - keypress description: >- - The score threshold for the file search, a number between 0 and 1. - Numbers closer to 1 will attempt to return only the most relevant - results, but may return fewer results. - hybrid_search: - $ref: '#/components/schemas/HybridSearchOptions' + Specifies the event type. For a keypress action, this property is + always set to `keypress`. + default: keypress + x-stainless-const: true + keys: + items: + type: string + description: One of the keys the model is requesting to be pressed. + type: array description: >- - Weights that control how reciprocal rank fusion balances semantic - embedding matches versus sparse keyword matches when hybrid search - is enabled. + The combination of keys the model is requesting to be pressed. This + is an array of strings, each representing a key. type: object - required: [] - Filters: - anyOf: - - $ref: '#/components/schemas/ComparisonFilter' - - $ref: '#/components/schemas/CompoundFilter' - FileSearchTool: + required: + - type + - keys + title: KeyPress + description: A collection of keypresses the model would like to perform. + BetaDragParam: properties: type: type: string enum: - - file_search - description: The type of the file search tool. Always `file_search`. - default: file_search + - drag + description: >- + Specifies the event type. For a drag action, this property is always + set to `drag`. + default: drag x-stainless-const: true - vector_store_ids: + path: items: - type: string + $ref: '#/components/schemas/BetaCoordParam' type: array - description: The IDs of the vector stores to search. - max_num_results: - type: integer description: >- - The maximum number of results to return. This number should be - between 1 and 50 inclusive. - ranking_options: - $ref: '#/components/schemas/RankingOptions' - description: Ranking options for search. - filters: + An array of coordinates representing the path of the drag action. + Coordinates will appear as an array of objects, eg + + ``` + + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] + + ``` + keys: anyOf: - - $ref: '#/components/schemas/Filters' - description: A filter to apply. + - items: + type: string + type: array + description: The keys being held while dragging the mouse. - type: 'null' type: object required: - type - - vector_store_ids - title: File search - description: >- - A tool that searches for relevant content from uploaded files. Learn - more about the [file search - tool](https://platform.openai.com/docs/guides/tools-file-search). - ComputerTool: + - path + title: Drag + description: A drag action. + BetaCoordParam: + properties: + x: + type: integer + description: The x-coordinate. + 'y': + type: integer + description: The y-coordinate. + type: object + required: + - x + - 'y' + title: Coordinate + description: 'An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.' + BetaDoubleClickAction: properties: type: type: string enum: - - computer - description: The type of the computer tool. Always `computer`. - default: computer + - double_click + description: >- + Specifies the event type. For a double click action, this property + is always set to `double_click`. + default: double_click x-stainless-const: true + x: + type: integer + description: The x-coordinate where the double click occurred. + 'y': + type: integer + description: The y-coordinate where the double click occurred. + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while double-clicking. + - type: 'null' type: object required: - type - title: Computer - description: >- - A tool that controls a virtual computer. Learn more about the [computer - tool](https://platform.openai.com/docs/guides/tools-computer-use). - ComputerEnvironment: - type: string - enum: - - windows - - mac - - linux - - ubuntu - - browser - ComputerUsePreviewTool: + - x + - 'y' + - keys + title: DoubleClick + description: A double click action. + BetaClickParam: properties: type: type: string enum: - - computer_use_preview - description: The type of the computer use tool. Always `computer_use_preview`. - default: computer_use_preview + - click + description: >- + Specifies the event type. For a click action, this property is + always `click`. + default: click x-stainless-const: true - environment: - $ref: '#/components/schemas/ComputerEnvironment' - description: The type of computer environment to control. - display_width: + button: + $ref: '#/components/schemas/BetaClickButtonType' + description: >- + Indicates which mouse button was pressed during the click. One of + `left`, `right`, `wheel`, `back`, or `forward`. + x: type: integer - description: The width of the computer display. - display_height: + description: The x-coordinate where the click occurred. + 'y': type: integer - description: The height of the computer display. + description: The y-coordinate where the click occurred. + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while clicking. + - type: 'null' type: object required: - type - - environment - - display_width - - display_height - title: Computer use preview - description: >- - A tool that controls a virtual computer. Learn more about the [computer - tool](https://platform.openai.com/docs/guides/tools-computer-use). - ContainerMemoryLimit: + - button + - x + - 'y' + title: Click + description: A click action. + BetaClickButtonType: type: string enum: - - 1g - - 4g - - 16g - - 64g - AutoCodeInterpreterToolParam: + - left + - right + - wheel + - back + - forward + BetaFileSearchToolCall: + type: object + title: File search tool call + description: > + The results of a file search tool call. See the + + [file search guide](/docs/guides/tools-file-search) for more + information. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + id: + type: string + description: | + The unique ID of the file search tool call. type: type: string enum: - - auto - description: Always `auto`. - default: auto + - file_search_call + description: | + The type of the file search tool call. Always `file_search_call`. x-stainless-const: true - file_ids: + status: + type: string + description: | + The status of the file search tool call. One of `in_progress`, + `searching`, `incomplete` or `failed`, + enum: + - in_progress + - searching + - completed + - incomplete + - failed + queries: + type: array items: type: string - example: file-123 - type: array - maxItems: 50 - description: An optional list of uploaded files to make available to your code. - memory_limit: + description: | + The queries used to search for files. + results: anyOf: - - $ref: '#/components/schemas/ContainerMemoryLimit' - description: The memory limit for the code interpreter container. + - type: array + description: | + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/BetaVectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. - type: 'null' - network_policy: - oneOf: - - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' - - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' - description: Network access policy for the container. - discriminator: - propertyName: type + required: + - id + - type + - status + - queries + BetaVectorStoreFileAttributes: + anyOf: + - type: object + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be + + useful for storing additional information about the object in a + structured + + format, and querying for objects via API or the dashboard. Keys are + strings + + with a maximum length of 64 characters. Values are strings with a + maximum + + length of 512 characters, booleans, or numbers. + maxProperties: 16 + propertyNames: + type: string + maxLength: 64 + additionalProperties: + oneOf: + - type: string + maxLength: 512 + - type: number + - type: boolean + x-oaiTypeLabel: map + - type: 'null' + BetaOutputMessage: type: object + title: Output message + description: | + An output message from the model. + properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + id: + type: string + description: | + The unique ID of the output message. + type: + type: string + description: | + The type of the output message. Always `message`. + enum: + - message + x-stainless-const: true + role: + type: string + description: | + The role of the output message. Always `assistant`. + enum: + - assistant + x-stainless-const: true + content: + type: array + description: | + The content of the output message. + items: + $ref: '#/components/schemas/BetaOutputMessageContent' + phase: + anyOf: + - $ref: '#/components/schemas/BetaMessagePhase' + - type: 'null' + status: + type: string + description: > + The status of the message input. One of `in_progress`, `completed`, + or + + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete required: + - id - type - title: CodeInterpreterToolAuto - description: >- - Configuration for a code interpreter container. Optionally specify the - IDs of the files to run the code on. - InputFidelity: - type: string - enum: - - high - - low - description: >- - Control how much effort the model will exert to match the style and - features, especially facial features, of input images. This parameter is - only supported for `gpt-image-1` and `gpt-image-1.5` and later models, - unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults - to `low`. - ImageGenActionEnum: + - role + - content + - status + BetaMessagePhase: type: string + description: > + Labels an `assistant` message as intermediate commentary (`commentary`) + or the final answer (`final_answer`). + + For models like `gpt-5.3-codex` and beyond, when sending follow-up + requests, preserve and resend + + phase on all assistant messages — dropping it can degrade performance. + Not used for user messages. enum: - - generate - - edit - - auto - LocalShellToolParam: + - commentary + - final_answer + BetaOutputMessageContent: + oneOf: + - $ref: '#/components/schemas/BetaOutputTextContent' + - $ref: '#/components/schemas/BetaRefusalContent' + discriminator: + propertyName: type + BetaRefusalContent: properties: type: type: string enum: - - local_shell - description: The type of the local shell tool. Always `local_shell`. - default: local_shell + - refusal + description: The type of the refusal. Always `refusal`. + default: refusal x-stainless-const: true + refusal: + type: string + description: The refusal explanation from the model. type: object required: - type - title: Local shell tool - description: >- - A tool that allows the model to execute shell commands in a local - environment. - ContainerAutoParam: + - refusal + title: Refusal + description: A refusal from the model. + BetaOutputTextContent: properties: type: type: string enum: - - container_auto - description: Automatically creates a container for this request - default: container_auto + - output_text + description: The type of the output text. Always `output_text`. + default: output_text x-stainless-const: true - file_ids: + text: + type: string + description: The text output from the model. + annotations: items: - type: string - example: file-123 + $ref: '#/components/schemas/BetaAnnotation' type: array - maxItems: 50 - description: An optional list of uploaded files to make available to your code. - memory_limit: - anyOf: - - $ref: '#/components/schemas/ContainerMemoryLimit' - description: The memory limit for the container. - - type: 'null' - network_policy: - oneOf: - - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' - - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' - description: Network access policy for the container. - discriminator: - propertyName: type - skills: + description: The annotations of the text output. + logprobs: items: - oneOf: - - $ref: '#/components/schemas/SkillReferenceParam' - - $ref: '#/components/schemas/InlineSkillParam' - discriminator: - propertyName: type + $ref: '#/components/schemas/BetaLogProb' type: array - maxItems: 200 - description: An optional list of skills referenced by id or inline data. type: object required: - type - LocalSkillParam: + - text + - annotations + - logprobs + title: Output text + description: A text output from the model. + BetaLogProb: properties: - name: - type: string - description: The name of the skill. - description: - type: string - description: The description of the skill. - path: + token: type: string - description: The path to the directory containing the skill. + logprob: + type: number + bytes: + items: + type: integer + type: array + top_logprobs: + items: + $ref: '#/components/schemas/BetaTopLogProb' + type: array type: object required: - - name - - description - - path - LocalEnvironmentParam: + - token + - logprob + - bytes + - top_logprobs + title: Log probability + description: The log probability of a token. + BetaTopLogProb: properties: - type: + token: type: string - enum: - - local - description: Use a local computer environment. - default: local - x-stainless-const: true - skills: + logprob: + type: number + bytes: items: - $ref: '#/components/schemas/LocalSkillParam' + type: integer type: array - maxItems: 200 - description: An optional list of skills. type: object required: - - type - ContainerReferenceParam: - properties: - type: - type: string - enum: - - container_reference - description: References a container created with the /v1/containers endpoint - default: container_reference - x-stainless-const: true - container_id: - type: string - description: The ID of the referenced container. - example: cntr_123 + - token + - logprob + - bytes + title: Top log probability + description: The top log probability of a token. + BetaAnnotation: + oneOf: + - $ref: '#/components/schemas/BetaFileCitationBody' + - $ref: '#/components/schemas/BetaUrlCitationBody' + - $ref: '#/components/schemas/BetaContainerFileCitationBody' + - $ref: '#/components/schemas/BetaFilePath' + description: An annotation that applies to a span of output text. + discriminator: + propertyName: type + BetaFilePath: type: object - required: - - type - - container_id - FunctionShellToolParam: + title: File path + description: | + A path to a file. properties: type: type: string + description: | + The type of the file path. Always `file_path`. enum: - - shell - description: The type of the shell tool. Always `shell`. - default: shell + - file_path x-stainless-const: true - environment: - anyOf: - - oneOf: - - $ref: '#/components/schemas/ContainerAutoParam' - - $ref: '#/components/schemas/LocalEnvironmentParam' - - $ref: '#/components/schemas/ContainerReferenceParam' - discriminator: - propertyName: type - - type: 'null' - type: object + file_id: + type: string + description: | + The ID of the file. + index: + type: integer + description: | + The index of the file in the list of files. required: - type - title: Shell tool - description: A tool that allows the model to execute shell commands. - CustomTextFormatParam: + - file_id + - index + BetaContainerFileCitationBody: properties: type: type: string enum: - - text - description: Unconstrained text format. Always `text`. - default: text + - container_file_citation + description: >- + The type of the container file citation. Always + `container_file_citation`. + default: container_file_citation x-stainless-const: true + container_id: + type: string + description: The ID of the container file. + file_id: + type: string + description: The ID of the file. + start_index: + type: integer + description: >- + The index of the first character of the container file citation in + the message. + end_index: + type: integer + description: >- + The index of the last character of the container file citation in + the message. + filename: + type: string + description: The filename of the container file cited. type: object required: - type - title: Text format - description: Unconstrained free-form text. - GrammarSyntax1: - type: string - enum: - - lark - - regex - CustomGrammarFormatParam: + - container_id + - file_id + - start_index + - end_index + - filename + title: Container file citation + description: A citation for a container file used to generate a model response. + BetaUrlCitationBody: properties: type: type: string enum: - - grammar - description: Grammar format. Always `grammar`. - default: grammar + - url_citation + description: The type of the URL citation. Always `url_citation`. + default: url_citation x-stainless-const: true - syntax: - $ref: '#/components/schemas/GrammarSyntax1' - description: The syntax of the grammar definition. One of `lark` or `regex`. - definition: + url: type: string - description: The grammar definition. + format: uri + description: The URL of the web resource. + start_index: + type: integer + description: The index of the first character of the URL citation in the message. + end_index: + type: integer + description: The index of the last character of the URL citation in the message. + title: + type: string + description: The title of the web resource. type: object required: - type - - syntax - - definition - title: Grammar format - description: A grammar defined by the user. - CustomToolParam: + - url + - start_index + - end_index + - title + title: URL citation + description: A citation for a web resource used to generate a model response. + BetaFileCitationBody: properties: type: type: string enum: - - custom - description: The type of the custom tool. Always `custom`. - default: custom + - file_citation + description: The type of the file citation. Always `file_citation`. + default: file_citation x-stainless-const: true - name: + file_id: type: string - description: The name of the custom tool, used to identify it in tool calls. - description: + description: The ID of the file. + index: + type: integer + description: The index of the file in the list of files. + filename: type: string - description: >- - Optional description of the custom tool, used to provide more - context. - format: - oneOf: - - $ref: '#/components/schemas/CustomTextFormatParam' - - $ref: '#/components/schemas/CustomGrammarFormatParam' - description: The input format for the custom tool. Default is unconstrained text. - discriminator: - propertyName: type - defer_loading: - type: boolean - description: Whether this tool should be deferred and discovered via tool search. + description: The filename of the file cited. type: object required: - type - - name - title: Custom tool - description: >- - A custom tool that processes input using a specified format. Learn more - about [custom tools](/docs/guides/function-calling#custom-tools) - EmptyModelParam: - properties: {} + - file_id + - index + - filename + title: File citation + description: A citation to a file. + BetaInputMessage: type: object - required: [] - FunctionToolParam: + title: Input message + description: > + A message input to the model with a role indicating instruction + following + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. properties: - name: - type: string - maxLength: 128 - minLength: 1 - pattern: ^[a-zA-Z0-9_-]+$ - description: - anyOf: - - type: string - - type: 'null' - parameters: - anyOf: - - $ref: '#/components/schemas/EmptyModelParam' - - type: 'null' - strict: + agent: anyOf: - - type: boolean + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' + description: The agent that produced this item. type: type: string + description: | + The type of the message input. Always set to `message`. enum: - - function - default: function + - message x-stainless-const: true - defer_loading: - type: boolean - description: >- - Whether this function should be deferred and discovered via tool - search. - type: object - required: - - name - - type - NamespaceToolParam: - properties: - type: + role: type: string + description: > + The role of the message input. One of `user`, `system`, or + `developer`. enum: - - namespace - description: The type of the tool. Always `namespace`. - default: namespace - x-stainless-const: true - name: - type: string - minLength: 1 - description: The namespace name used in tool calls (for example, `crm`). - description: + - user + - system + - developer + status: type: string - minLength: 1 - description: A description of the namespace shown to the model. - tools: - items: - oneOf: - - $ref: '#/components/schemas/FunctionToolParam' - - $ref: '#/components/schemas/CustomToolParam' - description: A function or custom tool that belongs to a namespace. - discriminator: - propertyName: type - type: array - minItems: 1 - description: The function/custom tools available inside this namespace. - type: object + description: | + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + content: + $ref: '#/components/schemas/BetaInputMessageContentList' required: - - type - - name - - description - - tools - title: Namespace - description: Groups function/custom tools under a shared namespace. - ToolSearchToolParam: + - role + - content + BetaInputMessageContentList: + type: array + title: Input item content list + description: > + A list of one or many input items to the model, containing different + content + + types. + items: + $ref: '#/components/schemas/BetaInputContent' + BetaInputContent: + oneOf: + - $ref: '#/components/schemas/BetaInputTextContent' + - $ref: '#/components/schemas/BetaInputImageContent' + - $ref: '#/components/schemas/BetaInputFileContent' + discriminator: + propertyName: type + BetaEasyInputMessage: + type: object + title: Input message + description: > + A message input to the model with a role indicating instruction + following + + hierarchy. Instructions given with the `developer` or `system` role take + + precedence over instructions given with the `user` role. Messages with + the + + `assistant` role are presumed to have been generated by the model in + previous + + interactions. properties: - type: + role: type: string + description: > + The role of the message input. One of `user`, `assistant`, `system`, + or + + `developer`. enum: - - tool_search - description: The type of the tool. Always `tool_search`. - default: tool_search - x-stainless-const: true - execution: - $ref: '#/components/schemas/ToolSearchExecutionType' - description: Whether tool search is executed by the server or by the client. - description: - anyOf: + - user + - assistant + - system + - developer + content: + description: > + Text, image, or audio input to the model, used to generate a + response. + + Can also contain previous assistant responses. + oneOf: - type: string - description: >- - Description shown to the model for a client-executed tool search - tool. - - type: 'null' - parameters: + title: Text input + description: | + A text input to the model. + - $ref: '#/components/schemas/BetaInputMessageContentList' + phase: anyOf: - - $ref: '#/components/schemas/EmptyModelParam' - description: Parameter schema for a client-executed tool search tool. + - $ref: '#/components/schemas/BetaMessagePhase' - type: 'null' - type: object - required: - - type - title: Tool search tool - description: Hosted or BYOT tool search configuration for deferred tools. - ApproximateLocation: - properties: type: type: string + description: | + The type of the message input. Always `message`. enum: - - approximate - description: The type of location approximation. Always `approximate`. - default: approximate + - message x-stainless-const: true - country: + required: + - role + - content + BetaCompactResponseMethodPublicBody: + properties: + model: + $ref: '#/components/schemas/BetaModelIdsCompaction' + input: anyOf: - - type: string + - oneOf: + - type: string + maxLength: 10485760 + description: >- + A text input to the model, equivalent to a text input with + the `user` role. + - items: + $ref: '#/components/schemas/BetaInputItem' + type: array + description: >- + A list of one or many input items to the model, containing + different content types. description: >- - The two-letter [ISO country - code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, - e.g. `US`. + Text, image, or file inputs to the model, used to generate a + response - type: 'null' - region: + previous_response_id: anyOf: - type: string - description: Free text input for the region of the user, e.g. `California`. + description: >- + The unique ID of the previous response to the model. Use this to + create multi-turn conversations. Learn more about [conversation + state](/docs/guides/conversation-state). Cannot be used in + conjunction with `conversation`. + example: resp_123 - type: 'null' - city: + instructions: anyOf: - type: string - description: Free text input for the city of the user, e.g. `San Francisco`. + description: >- + A system (or developer) message inserted into the model's + context. + + When used along with `previous_response_id`, the instructions + from a previous response will not be carried over to the next + response. This makes it simple to swap out system (or developer) + messages in new responses. - type: 'null' - timezone: + prompt_cache_key: anyOf: - type: string - description: >- - The [IANA - timezone](https://timeapi.io/documentation/iana-timezones) of - the user, e.g. `America/Los_Angeles`. + maxLength: 64 + description: A key to use when reading from or writing to the prompt cache. + - type: 'null' + prompt_cache_retention: + anyOf: + - $ref: '#/components/schemas/BetaPromptCacheRetentionEnum' + description: How long to retain a prompt cache entry created by this request. + deprecated: true + - type: 'null' + prompt_cache_options: + anyOf: + - $ref: '#/components/schemas/BetaPromptCacheOptionsParam' + - type: 'null' + service_tier: + anyOf: + - $ref: '#/components/schemas/BetaServiceTierEnum' + description: The service tier to use for this request. - type: 'null' type: object - required: *ref_0 - SearchContextSize: - type: string - enum: - - low - - medium - - high - SearchContentType: + required: + - model + BetaServiceTierEnum: type: string enum: - - text - - image - WebSearchPreviewTool: + - auto + - default + - flex + - priority + BetaPromptCacheOptionsParam: properties: - type: - type: string - enum: - - web_search_preview - - web_search_preview_2025_03_11 + ttl: + $ref: '#/components/schemas/BetaPromptCacheTTLEnum' description: >- - The type of the web search tool. One of `web_search_preview` or - `web_search_preview_2025_03_11`. - default: web_search_preview - x-stainless-const: true - user_location: - anyOf: - - $ref: '#/components/schemas/ApproximateLocation' - description: The user's location. - - type: 'null' - search_context_size: - $ref: '#/components/schemas/SearchContextSize' + The minimum lifetime applied to every implicit and explicit cache + breakpoint written by the request. Defaults to `30m`, which is + currently the only supported value. The backend may retain cache + entries for longer. + mode: + $ref: '#/components/schemas/BetaPromptCacheModeEnum' description: >- - High level guidance for the amount of context window space to use - for the search. One of `low`, `medium`, or `high`. `medium` is the - default. - search_content_types: - items: - $ref: '#/components/schemas/SearchContentType' - type: array + Controls whether OpenAI automatically creates an implicit cache + breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates + one implicit breakpoint and writes up to the latest three explicit + breakpoints in the request. With `explicit`, OpenAI does not create + an implicit breakpoint and writes up to the latest four explicit + breakpoints. If there are no explicit breakpoints, the request does + not use prompt caching. type: object - required: *ref_0 - title: Web search preview + required: [] + title: Prompt cache options description: >- - This tool searches the web for relevant results to use in a response. - Learn more about the [web search - tool](https://platform.openai.com/docs/guides/tools-web-search). - ApplyPatchToolParam: - properties: - type: - type: string + Options for prompt caching. Supported for `gpt-5.6` and later models. By + default, OpenAI automatically chooses one implicit cache breakpoint. You + can add explicit breakpoints to content blocks with + `prompt_cache_breakpoint`. Each request can write up to four + breakpoints. For cache matching, OpenAI considers up to the latest 80 + breakpoints in the conversation, without a content-block lookback limit. + Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` + defaults to `30m`, which is currently the only supported value. See the + [prompt caching guide](/docs/guides/prompt-caching) for current details. + BetaPromptCacheModeEnum: + type: string + enum: + - implicit + - explicit + BetaPromptCacheTTLEnum: + type: string + enum: + - 30m + BetaPromptCacheRetentionEnum: + type: string + enum: + - in_memory + - 24h + BetaModelIdsCompaction: + anyOf: + - $ref: '#/components/schemas/BetaModelIdsResponses' + - type: string + - type: 'null' + description: >- + Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI + offers a wide range of models with different capabilities, performance + characteristics, and price points. Refer to the [model + guide](/docs/models) to browse and compare available models. + BetaModelIdsResponses: + example: gpt-5.1 + anyOf: + - $ref: '#/components/schemas/BetaModelIdsShared' + - type: string + title: ResponsesOnlyModel enum: - - apply_patch - description: The type of the tool. Always `apply_patch`. - default: apply_patch - x-stainless-const: true + - o1-pro + - o1-pro-2025-03-19 + - o3-pro + - o3-pro-2025-06-10 + - o3-deep-research + - o3-deep-research-2025-06-26 + - o4-mini-deep-research + - o4-mini-deep-research-2025-06-26 + - computer-use-preview + - computer-use-preview-2025-03-11 + - gpt-5-codex + - gpt-5-pro + - gpt-5-pro-2025-10-06 + - gpt-5.1-codex-max + BetaModelIdsShared: + example: gpt-5.4 + anyOf: + - type: string + - type: string + enum: + - gpt-5.6-sol + - gpt-5.6-terra + - gpt-5.6-luna + - gpt-5.4 + - gpt-5.4-mini + - gpt-5.4-nano + - gpt-5.4-mini-2026-03-17 + - gpt-5.4-nano-2026-03-17 + - gpt-5.3-chat-latest + - gpt-5.2 + - gpt-5.2-2025-12-11 + - gpt-5.2-chat-latest + - gpt-5.2-pro + - gpt-5.2-pro-2025-12-11 + - gpt-5.1 + - gpt-5.1-2025-11-13 + - gpt-5.1-codex + - gpt-5.1-mini + - gpt-5.1-chat-latest + - gpt-5 + - gpt-5-mini + - gpt-5-nano + - gpt-5-2025-08-07 + - gpt-5-mini-2025-08-07 + - gpt-5-nano-2025-08-07 + - gpt-5-chat-latest + - gpt-4.1 + - gpt-4.1-mini + - gpt-4.1-nano + - gpt-4.1-2025-04-14 + - gpt-4.1-mini-2025-04-14 + - gpt-4.1-nano-2025-04-14 + - o4-mini + - o4-mini-2025-04-16 + - o3 + - o3-2025-04-16 + - o3-mini + - o3-mini-2025-01-31 + - o1 + - o1-2024-12-17 + - o1-preview + - o1-preview-2024-09-12 + - o1-mini + - o1-mini-2024-09-12 + - gpt-4o + - gpt-4o-2024-11-20 + - gpt-4o-2024-08-06 + - gpt-4o-2024-05-13 + - gpt-4o-audio-preview + - gpt-4o-audio-preview-2024-10-01 + - gpt-4o-audio-preview-2024-12-17 + - gpt-4o-audio-preview-2025-06-03 + - gpt-4o-mini-audio-preview + - gpt-4o-mini-audio-preview-2024-12-17 + - gpt-4o-search-preview + - gpt-4o-mini-search-preview + - gpt-4o-search-preview-2025-03-11 + - gpt-4o-mini-search-preview-2025-03-11 + - chatgpt-4o-latest + - codex-mini-latest + - gpt-4o-mini + - gpt-4o-mini-2024-07-18 + - gpt-4-turbo + - gpt-4-turbo-2024-04-09 + - gpt-4-0125-preview + - gpt-4-turbo-preview + - gpt-4-1106-preview + - gpt-4-vision-preview + - gpt-4 + - gpt-4-0314 + - gpt-4-0613 + - gpt-4-32k + - gpt-4-32k-0314 + - gpt-4-32k-0613 + - gpt-3.5-turbo + - gpt-3.5-turbo-16k + - gpt-3.5-turbo-0301 + - gpt-3.5-turbo-0613 + - gpt-3.5-turbo-1106 + - gpt-3.5-turbo-0125 + - gpt-3.5-turbo-16k-0613 + BetaError: type: object - required: - - type - title: Apply patch tool - description: >- - Allows the assistant to create, delete, or update files using unified - diffs. - ToolSearchOutput: properties: - type: - type: string - enum: - - tool_search_output - description: The type of the item. Always `tool_search_output`. - default: tool_search_output - x-stainless-const: true - id: + code: + anyOf: + - type: string + - type: 'null' + message: type: string - description: The unique ID of the tool search output item. - call_id: + param: anyOf: - type: string - description: The unique ID of the tool search call generated by the model. - type: 'null' - execution: - $ref: '#/components/schemas/ToolSearchExecutionType' - description: Whether tool search was executed by the server or by the client. - tools: - items: - $ref: '#/components/schemas/Tool' - type: array - description: The loaded tool definitions returned by tool search. - status: - $ref: '#/components/schemas/FunctionCallOutputStatusEnum' - description: The status of the tool search output item that was recorded. - created_by: + type: type: string - description: The identifier of the actor that created the item. - type: object required: - type - - id - - call_id - - execution - - tools - - status - AdditionalTools: + - message + - param + - code + BetaResponseItemList: + type: object + description: A list of Response items. properties: - type: + object: type: string + description: The type of object returned, must be `list`. enum: - - additional_tools - description: The type of the item. Always `additional_tools`. - default: additional_tools + - list x-stainless-const: true - id: - type: string - description: The unique ID of the additional tools item. - role: - $ref: '#/components/schemas/MessageRole' - description: The role that provided the additional tools. - tools: - items: - $ref: '#/components/schemas/Tool' + data: type: array - description: The additional tool definitions made available at this item. - type: object + description: A list of items used to generate this response. + items: + $ref: '#/components/schemas/BetaItemResource' + has_more: + type: boolean + description: Whether there are more items available. + first_id: + type: string + description: The ID of the first item in the list. + last_id: + type: string + description: The ID of the last item in the list. required: - - type - - id - - role - - tools - CompactionBody: + - object + - data + - has_more + - first_id + - last_id + x-oaiMeta: + name: The input item list + group: responses + example: | + { + "object": "list", + "data": [ + { + "id": "msg_abc123", + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Tell me a three sentence bedtime story about a unicorn." + } + ] + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc123", + "has_more": false + } + BetaItemResource: + description: | + Content item used to generate a response. + oneOf: + - $ref: '#/components/schemas/BetaInputMessageResource' + - $ref: '#/components/schemas/BetaOutputMessage' + - $ref: '#/components/schemas/BetaFileSearchToolCall' + - $ref: '#/components/schemas/BetaComputerToolCall' + - $ref: '#/components/schemas/BetaComputerToolCallOutputResource' + - $ref: '#/components/schemas/BetaWebSearchToolCall' + - $ref: '#/components/schemas/BetaFunctionToolCallResource' + - $ref: '#/components/schemas/BetaFunctionToolCallOutputResource' + - $ref: '#/components/schemas/BetaAgentMessage' + - $ref: '#/components/schemas/BetaMultiAgentCall' + - $ref: '#/components/schemas/BetaMultiAgentCallOutput' + - $ref: '#/components/schemas/BetaToolSearchCall' + - $ref: '#/components/schemas/BetaToolSearchOutput' + - $ref: '#/components/schemas/BetaAdditionalTools' + - $ref: '#/components/schemas/BetaReasoningItem' + - $ref: '#/components/schemas/BetaProgram' + - $ref: '#/components/schemas/BetaProgramOutput' + - $ref: '#/components/schemas/BetaCompactionBody' + - $ref: '#/components/schemas/BetaImageGenToolCall' + - $ref: '#/components/schemas/BetaCodeInterpreterToolCall' + - $ref: '#/components/schemas/BetaLocalShellToolCall' + - $ref: '#/components/schemas/BetaLocalShellToolCallOutput' + - $ref: '#/components/schemas/BetaFunctionShellCall' + - $ref: '#/components/schemas/BetaFunctionShellCallOutput' + - $ref: '#/components/schemas/BetaApplyPatchToolCall' + - $ref: '#/components/schemas/BetaApplyPatchToolCallOutput' + - $ref: '#/components/schemas/BetaMCPListTools' + - $ref: '#/components/schemas/BetaMCPApprovalRequest' + - $ref: '#/components/schemas/BetaMCPApprovalResponseResource' + - $ref: '#/components/schemas/BetaMCPToolCall' + - $ref: '#/components/schemas/BetaCustomToolCallResource' + - $ref: '#/components/schemas/BetaCustomToolCallOutputResource' + discriminator: + propertyName: type + BetaCustomToolCallOutputResource: + title: ResponseCustomToolCallOutputItem + allOf: + - $ref: '#/components/schemas/BetaCustomToolCallOutput' + - type: object + properties: + id: + type: string + description: | + The unique ID of the custom tool call output item. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/BetaFunctionCallOutputStatusEnum' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + BetaFunctionCallOutputStatusEnum: + type: string + enum: + - in_progress + - completed + - incomplete + BetaCustomToolCallResource: + title: ResponseCustomToolCallItem + allOf: + - $ref: '#/components/schemas/BetaCustomToolCall' + - type: object + properties: + id: + type: string + description: | + The unique ID of the custom tool call item. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/BetaFunctionCallStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + BetaFunctionCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + BetaMCPApprovalResponseResource: + type: object + title: MCP approval response + description: | + A response to an MCP approval request. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. type: type: string enum: - - compaction - description: The type of the item. Always `compaction`. - default: compaction + - mcp_approval_response + description: | + The type of the item. Always `mcp_approval_response`. x-stainless-const: true id: type: string - description: The unique ID of the compaction item. - encrypted_content: - type: string - description: The encrypted content that was produced by compaction. - created_by: + description: | + The unique ID of the approval response + approval_request_id: type: string - description: The identifier of the actor that created the item. - type: object + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + anyOf: + - type: string + description: | + Optional reason for the decision. + - type: 'null' required: - type - id - - encrypted_content - title: Compaction item - description: >- - A compaction item generated by the [`v1/responses/compact` - API](/docs/api-reference/responses/compact). - CodeInterpreterOutputLogs: - properties: - type: - type: string - enum: - - logs - description: The type of the output. Always `logs`. - default: logs - x-stainless-const: true - logs: - type: string - description: The logs output from the code interpreter. - type: object - required: - - type - - logs - title: Code interpreter output logs - description: The logs output from the code interpreter. - CodeInterpreterOutputImage: + - request_id + - approve + - approval_request_id + BetaApplyPatchToolCallOutput: properties: + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: - - image - description: The type of the output. Always `image`. - default: image + - apply_patch_call_output + description: The type of the item. Always `apply_patch_call_output`. + default: apply_patch_call_output x-stainless-const: true - url: + id: type: string - format: uri - description: The URL of the image output from the code interpreter. - type: object - required: - - type - - url - title: Code interpreter output image - description: The image output from the code interpreter. - LocalShellExecAction: - properties: - type: + description: >- + The unique ID of the apply patch tool call output. Populated when + this item is returned via API. + call_id: type: string - enum: - - exec - description: The type of the local shell action. Always `exec`. - default: exec - x-stainless-const: true - command: - items: - type: string - type: array - description: The command to run. - timeout_ms: - anyOf: - - type: integer - description: Optional timeout in milliseconds for the command. - - type: 'null' - working_directory: + description: The unique ID of the apply patch tool call generated by the model. + caller: anyOf: - - type: string - description: Optional working directory to run the command in. + - $ref: '#/components/schemas/BetaToolCallCaller' + description: The execution context that produced this tool call. - type: 'null' - env: - additionalProperties: - type: string - type: object - description: Environment variables to set for the command. - x-oaiTypeLabel: map - user: + status: + $ref: '#/components/schemas/BetaApplyPatchCallOutputStatus' + description: >- + The status of the apply patch tool call output. One of `completed` + or `failed`. + output: anyOf: - type: string - description: Optional user to run the command as. + description: Optional textual output returned by the apply patch tool. - type: 'null' + created_by: + type: string + description: The ID of the entity that created this tool call output. type: object required: - type - - command - - env - title: Local shell exec action - description: Execute a shell command on the server. - FunctionShellAction: - properties: - commands: - items: - type: string - description: A list of commands to run. - type: array - timeout_ms: - anyOf: - - type: integer - description: Optional timeout in milliseconds for the commands. - - type: 'null' - max_output_length: - anyOf: - - type: integer - description: >- - Optional maximum number of characters to return from each - command. - - type: 'null' - type: object - required: - - commands - - timeout_ms - - max_output_length - title: Shell exec action - description: Execute a shell command. - FunctionShellCallStatus: + - id + - call_id + - status + title: Apply patch tool call output + description: The output emitted by an apply patch tool call. + BetaApplyPatchCallOutputStatus: type: string enum: - - in_progress - completed - - incomplete - LocalEnvironmentResource: - properties: - type: - type: string - enum: - - local - description: The environment type. Always `local`. - default: local - x-stainless-const: true - type: object - required: - - type - title: Local Environment - description: Represents the use of a local environment to perform shell actions. - ContainerReferenceResource: - properties: - type: - type: string - enum: - - container_reference - description: The environment type. Always `container_reference`. - default: container_reference - x-stainless-const: true - container_id: - type: string - type: object - required: - - type - - container_id - title: Container Reference - description: Represents a container created with /v1/containers. - FunctionShellCall: + - failed + BetaApplyPatchToolCall: properties: + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: - - shell_call - description: The type of the item. Always `shell_call`. - default: shell_call + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call x-stainless-const: true id: type: string description: >- - The unique ID of the shell tool call. Populated when this item is - returned via API. + The unique ID of the apply patch tool call. Populated when this item + is returned via API. call_id: type: string - description: The unique ID of the shell tool call generated by the model. - action: - $ref: '#/components/schemas/FunctionShellAction' - description: >- - The shell commands and limits that describe how to run the tool - call. - status: - $ref: '#/components/schemas/FunctionShellCallStatus' - description: >- - The status of the shell call. One of `in_progress`, `completed`, or - `incomplete`. - environment: + description: The unique ID of the apply patch tool call generated by the model. + caller: anyOf: - - oneOf: - - $ref: '#/components/schemas/LocalEnvironmentResource' - - $ref: '#/components/schemas/ContainerReferenceResource' - discriminator: - propertyName: type + - $ref: '#/components/schemas/BetaToolCallCaller' + description: The execution context that produced this tool call. - type: 'null' + status: + $ref: '#/components/schemas/BetaApplyPatchCallStatus' + description: >- + The status of the apply patch tool call. One of `in_progress` or + `completed`. + operation: + oneOf: + - $ref: '#/components/schemas/BetaApplyPatchCreateFileOperation' + - $ref: '#/components/schemas/BetaApplyPatchDeleteFileOperation' + - $ref: '#/components/schemas/BetaApplyPatchUpdateFileOperation' + title: Apply patch operation + description: >- + One of the create_file, delete_file, or update_file operations + applied via apply_patch. + discriminator: + propertyName: type created_by: type: string description: The ID of the entity that created this tool call. @@ -81879,81 +94954,84 @@ components: - type - id - call_id - - action - status - - environment - title: Shell tool call + - operation + title: Apply patch tool call description: >- - A tool call that executes one or more shell commands in a managed - environment. - FunctionShellCallOutputStatusEnum: - type: string - enum: - - in_progress - - completed - - incomplete - FunctionShellCallOutputTimeoutOutcome: + A tool call that applies file diffs by creating, deleting, or updating + files. + BetaApplyPatchUpdateFileOperation: properties: type: type: string enum: - - timeout - description: The outcome type. Always `timeout`. - default: timeout + - update_file + description: Update an existing file with the provided diff. + default: update_file x-stainless-const: true + path: + type: string + description: Path of the file to update. + diff: + type: string + description: Diff to apply. type: object required: - type - title: Shell call timeout outcome - description: Indicates that the shell call exceeded its configured time limit. - FunctionShellCallOutputExitOutcome: + - path + - diff + title: Apply patch update file operation + description: Instruction describing how to update a file via the apply_patch tool. + BetaApplyPatchDeleteFileOperation: properties: type: type: string enum: - - exit - description: The outcome type. Always `exit`. - default: exit + - delete_file + description: Delete the specified file. + default: delete_file x-stainless-const: true - exit_code: - type: integer - description: Exit code from the shell process. + path: + type: string + description: Path of the file to delete. type: object required: - type - - exit_code - title: Shell call exit outcome - description: Indicates that the shell commands finished and returned an exit code. - FunctionShellCallOutputContent: + - path + title: Apply patch delete file operation + description: Instruction describing how to delete a file via the apply_patch tool. + BetaApplyPatchCreateFileOperation: properties: - stdout: + type: type: string - description: The standard output that was captured. - stderr: + enum: + - create_file + description: Create a new file with the provided diff. + default: create_file + x-stainless-const: true + path: type: string - description: The standard error output that was captured. - outcome: - oneOf: - - $ref: '#/components/schemas/FunctionShellCallOutputTimeoutOutcome' - - $ref: '#/components/schemas/FunctionShellCallOutputExitOutcome' - title: Shell call outcome - description: >- - Represents either an exit outcome (with an exit code) or a timeout - outcome for a shell call output chunk. - discriminator: - propertyName: type - created_by: + description: Path of the file to create. + diff: type: string - description: The identifier of the actor that created the item. + description: Diff to apply. type: object required: - - stdout - - stderr - - outcome - title: Shell call output content - description: The content of a shell tool call output that was emitted. - FunctionShellCallOutput: + - type + - path + - diff + title: Apply patch create file operation + description: Instruction describing how to create a file via the apply_patch tool. + BetaApplyPatchCallStatus: + type: string + enum: + - in_progress + - completed + BetaFunctionShellCallOutput: properties: + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: @@ -81969,14 +95047,19 @@ components: call_id: type: string description: The unique ID of the shell tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/BetaToolCallCaller' + description: The execution context that produced this tool call. + - type: 'null' status: - $ref: '#/components/schemas/FunctionShellCallOutputStatusEnum' + $ref: '#/components/schemas/BetaFunctionShellCallOutputStatusEnum' description: >- The status of the shell call output. One of `in_progress`, `completed`, or `incomplete`. output: items: - $ref: '#/components/schemas/FunctionShellCallOutputContent' + $ref: '#/components/schemas/BetaFunctionShellCallOutputContent' type: array description: An array of shell call output contents max_output_length: @@ -82000,106 +95083,115 @@ components: - max_output_length title: Shell call output description: The output of a shell tool call that was emitted. - ApplyPatchCallStatus: - type: string - enum: - - in_progress - - completed - ApplyPatchCreateFileOperation: + BetaFunctionShellCallOutputContent: properties: - type: + stdout: type: string - enum: - - create_file - description: Create a new file with the provided diff. - default: create_file - x-stainless-const: true - path: + description: The standard output that was captured. + stderr: type: string - description: Path of the file to create. - diff: + description: The standard error output that was captured. + outcome: + oneOf: + - $ref: '#/components/schemas/BetaFunctionShellCallOutputTimeoutOutcome' + - $ref: '#/components/schemas/BetaFunctionShellCallOutputExitOutcome' + title: Shell call outcome + description: >- + Represents either an exit outcome (with an exit code) or a timeout + outcome for a shell call output chunk. + discriminator: + propertyName: type + created_by: type: string - description: Diff to apply. + description: The identifier of the actor that created the item. type: object required: - - type - - path - - diff - title: Apply patch create file operation - description: Instruction describing how to create a file via the apply_patch tool. - ApplyPatchDeleteFileOperation: + - stdout + - stderr + - outcome + title: Shell call output content + description: The content of a shell tool call output that was emitted. + BetaFunctionShellCallOutputExitOutcome: properties: type: type: string enum: - - delete_file - description: Delete the specified file. - default: delete_file + - exit + description: The outcome type. Always `exit`. + default: exit x-stainless-const: true - path: - type: string - description: Path of the file to delete. + exit_code: + type: integer + description: Exit code from the shell process. type: object required: - type - - path - title: Apply patch delete file operation - description: Instruction describing how to delete a file via the apply_patch tool. - ApplyPatchUpdateFileOperation: + - exit_code + title: Shell call exit outcome + description: Indicates that the shell commands finished and returned an exit code. + BetaFunctionShellCallOutputTimeoutOutcome: properties: type: type: string enum: - - update_file - description: Update an existing file with the provided diff. - default: update_file + - timeout + description: The outcome type. Always `timeout`. + default: timeout x-stainless-const: true - path: - type: string - description: Path of the file to update. - diff: - type: string - description: Diff to apply. type: object required: - type - - path - - diff - title: Apply patch update file operation - description: Instruction describing how to update a file via the apply_patch tool. - ApplyPatchToolCall: + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + BetaFunctionShellCallOutputStatusEnum: + type: string + enum: + - in_progress + - completed + - incomplete + BetaFunctionShellCall: properties: + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: - - apply_patch_call - description: The type of the item. Always `apply_patch_call`. - default: apply_patch_call + - shell_call + description: The type of the item. Always `shell_call`. + default: shell_call x-stainless-const: true id: type: string description: >- - The unique ID of the apply patch tool call. Populated when this item - is returned via API. + The unique ID of the shell tool call. Populated when this item is + returned via API. call_id: type: string - description: The unique ID of the apply patch tool call generated by the model. - status: - $ref: '#/components/schemas/ApplyPatchCallStatus' + description: The unique ID of the shell tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/BetaToolCallCaller' + description: The execution context that produced this tool call. + - type: 'null' + action: + $ref: '#/components/schemas/BetaFunctionShellAction' description: >- - The status of the apply patch tool call. One of `in_progress` or - `completed`. - operation: - oneOf: - - $ref: '#/components/schemas/ApplyPatchCreateFileOperation' - - $ref: '#/components/schemas/ApplyPatchDeleteFileOperation' - - $ref: '#/components/schemas/ApplyPatchUpdateFileOperation' - title: Apply patch operation + The shell commands and limits that describe how to run the tool + call. + status: + $ref: '#/components/schemas/BetaFunctionShellCallStatus' description: >- - One of the create_file, delete_file, or update_file operations - applied via apply_patch. - discriminator: - propertyName: type + The status of the shell call. One of `in_progress`, `completed`, or + `incomplete`. + environment: + anyOf: + - oneOf: + - $ref: '#/components/schemas/BetaLocalEnvironmentResource' + - $ref: '#/components/schemas/BetaContainerReferenceResource' + discriminator: + propertyName: type + - type: 'null' created_by: type: string description: The ID of the entity that created this tool call. @@ -82108,3182 +95200,5064 @@ components: - type - id - call_id + - action - status - - operation - title: Apply patch tool call + - environment + title: Shell tool call description: >- - A tool call that applies file diffs by creating, deleting, or updating - files. - ApplyPatchCallOutputStatus: - type: string - enum: - - completed - - failed - ApplyPatchToolCallOutput: + A tool call that executes one or more shell commands in a managed + environment. + BetaContainerReferenceResource: properties: type: type: string enum: - - apply_patch_call_output - description: The type of the item. Always `apply_patch_call_output`. - default: apply_patch_call_output + - container_reference + description: The environment type. Always `container_reference`. + default: container_reference x-stainless-const: true - id: - type: string - description: >- - The unique ID of the apply patch tool call output. Populated when - this item is returned via API. - call_id: + container_id: type: string - description: The unique ID of the apply patch tool call generated by the model. - status: - $ref: '#/components/schemas/ApplyPatchCallOutputStatus' - description: >- - The status of the apply patch tool call output. One of `completed` - or `failed`. - output: - anyOf: - - type: string - description: Optional textual output returned by the apply patch tool. - - type: 'null' - created_by: + type: object + required: + - type + - container_id + title: Container Reference + description: Represents a container created with /v1/containers. + BetaLocalEnvironmentResource: + properties: + type: type: string - description: The ID of the entity that created this tool call output. + enum: + - local + description: The environment type. Always `local`. + default: local + x-stainless-const: true type: object required: - type - - id - - call_id - - status - title: Apply patch tool call output - description: The output emitted by an apply patch tool call. - MCPToolCallStatus: - type: string - enum: - - in_progress - - completed - - incomplete - - calling - - failed - DetailEnum: - type: string - enum: - - low - - high - - auto - - original - FunctionCallItemStatus: + title: Local Environment + description: Represents the use of a local environment to perform shell actions. + BetaFunctionShellCallStatus: type: string enum: - in_progress - completed - incomplete - ComputerCallOutputItemParam: + BetaFunctionShellAction: properties: - id: - anyOf: - - type: string - description: The ID of the computer tool call output. - example: cuo_123 - - type: 'null' - call_id: - type: string - maxLength: 64 - minLength: 1 - description: The ID of the computer tool call that produced the output. - type: - type: string - enum: - - computer_call_output - description: >- - The type of the computer tool call output. Always - `computer_call_output`. - default: computer_call_output - x-stainless-const: true - output: - $ref: '#/components/schemas/ComputerScreenshotImage' - acknowledged_safety_checks: + commands: + items: + type: string + description: A list of commands to run. + type: array + timeout_ms: anyOf: - - items: - $ref: '#/components/schemas/ComputerCallSafetyCheckParam' - type: array - description: >- - The safety checks reported by the API that have been - acknowledged by the developer. + - type: integer + description: Optional timeout in milliseconds for the commands. - type: 'null' - status: + max_output_length: anyOf: - - $ref: '#/components/schemas/FunctionCallItemStatus' + - type: integer description: >- - The status of the message input. One of `in_progress`, - `completed`, or `incomplete`. Populated when input items are - returned via API. + Optional maximum number of characters to return from each + command. - type: 'null' type: object required: - - call_id - - type - - output - title: Computer tool call output - description: The output of a computer tool call. - InputTextContentParam: + - commands + - timeout_ms + - max_output_length + title: Shell exec action + description: Execute a shell command. + BetaCompactionBody: properties: + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: - - input_text - description: The type of the input item. Always `input_text`. - default: input_text + - compaction + description: The type of the item. Always `compaction`. + default: compaction x-stainless-const: true - text: + id: type: string - maxLength: 10485760 - description: The text input to the model. + description: The unique ID of the compaction item. + encrypted_content: + type: string + description: The encrypted content that was produced by compaction. + created_by: + type: string + description: The identifier of the actor that created the item. type: object required: - type - - text - title: Input text - description: A text input to the model. - InputImageContentParamAutoParam: + - id + - encrypted_content + title: Compaction item + description: >- + A compaction item generated by the [`v1/responses/compact` + API](/docs/api-reference/responses/compact). + BetaProgramOutput: properties: + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: - - input_image - description: The type of the input item. Always `input_image`. - default: input_image + - program_output + description: The type of the item. Always `program_output`. + default: program_output x-stainless-const: true - image_url: - anyOf: - - type: string - maxLength: 20971520 - format: uri - description: >- - The URL of the image to be sent to the model. A fully qualified - URL or base64 encoded image in a data URL. - - type: 'null' - file_id: - anyOf: - - type: string - description: The ID of the file to be sent to the model. - example: file-123 - - type: 'null' - detail: - anyOf: - - $ref: '#/components/schemas/DetailEnum' - description: >- - The detail level of the image to be sent to the model. One of - `high`, `low`, `auto`, or `original`. Defaults to `auto`. - - type: 'null' + id: + type: string + description: The unique ID of the program output item. + call_id: + type: string + description: The call ID of the program item. + result: + type: string + description: The result produced by the program item. + status: + $ref: '#/components/schemas/BetaProgramOutputStatus' + description: The terminal status of the program output item. type: object required: - type - title: Input image - description: >- - An image input to the model. Learn about [image - inputs](/docs/guides/vision) - FileDetailEnum: + - id + - call_id + - result + - status + BetaProgramOutputStatus: type: string enum: - - low - - high - InputFileContentParam: + - completed + - incomplete + BetaProgram: properties: + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: - - input_file - description: The type of the input item. Always `input_file`. - default: input_file + - program + description: The type of the item. Always `program`. + default: program x-stainless-const: true - file_id: - anyOf: - - type: string - description: The ID of the file to be sent to the model. - example: file-123 - - type: 'null' - filename: - anyOf: - - type: string - description: The name of the file to be sent to the model. - - type: 'null' - file_data: - anyOf: - - type: string - maxLength: 73400320 - description: The base64-encoded data of the file to be sent to the model. - - type: 'null' - file_url: - anyOf: - - type: string - format: uri - description: The URL of the file to be sent to the model. - - type: 'null' - detail: - $ref: '#/components/schemas/FileDetailEnum' - description: >- - The detail level of the file to be sent to the model. Use `low` for - the default rendering behavior, or `high` to render the file at - higher quality. Defaults to `low`. + id: + type: string + description: The unique ID of the program item. + call_id: + type: string + description: The stable call ID of the program item. + code: + type: string + description: The JavaScript source executed by programmatic tool calling. + fingerprint: + type: string + description: Opaque program replay fingerprint that must be round-tripped. type: object required: - type - title: Input file - description: A file input to the model. - FunctionCallOutputItemParam: + - id + - call_id + - code + - fingerprint + BetaAdditionalTools: properties: - id: - anyOf: - - type: string - description: >- - The unique ID of the function tool call output. Populated when - this item is returned via API. - example: fc_123 - - type: 'null' - call_id: - type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the function tool call generated by the model. + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: - - function_call_output - description: >- - The type of the function tool call output. Always - `function_call_output`. - default: function_call_output + - additional_tools + description: The type of the item. Always `additional_tools`. + default: additional_tools x-stainless-const: true - output: - oneOf: - - type: string - maxLength: 10485760 - description: A JSON string of the output of the function tool call. - - items: - oneOf: - - $ref: '#/components/schemas/InputTextContentParam' - - $ref: '#/components/schemas/InputImageContentParamAutoParam' - - $ref: '#/components/schemas/InputFileContentParam' - description: A piece of message content, such as text, an image, or a file. - discriminator: - propertyName: type - type: array - description: >- - An array of content outputs (text, image, file) for the function - tool call. - description: Text, image, or file output of the function tool call. - status: - anyOf: - - $ref: '#/components/schemas/FunctionCallItemStatus' - description: >- - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. - - type: 'null' + id: + type: string + description: The unique ID of the additional tools item. + role: + $ref: '#/components/schemas/BetaMessageRole' + description: The role that provided the additional tools. + tools: + items: + $ref: '#/components/schemas/BetaTool' + type: array + description: The additional tool definitions made available at this item. type: object required: - - call_id - type - - output - title: Function tool call output - description: The output of a function tool call. - ToolSearchCallItemParam: + - id + - role + - tools + BetaMessageRole: + type: string + enum: + - unknown + - user + - assistant + - system + - critic + - discriminator + - developer + - tool + BetaToolSearchOutput: properties: + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. + type: + type: string + enum: + - tool_search_output + description: The type of the item. Always `tool_search_output`. + default: tool_search_output + x-stainless-const: true id: - anyOf: - - type: string - description: The unique ID of this tool search call. - example: tsc_123 - - type: 'null' + type: string + description: The unique ID of the tool search output item. call_id: anyOf: - type: string - maxLength: 64 - minLength: 1 description: The unique ID of the tool search call generated by the model. - type: 'null' + execution: + $ref: '#/components/schemas/BetaToolSearchExecutionType' + description: Whether tool search was executed by the server or by the client. + tools: + items: + $ref: '#/components/schemas/BetaTool' + type: array + description: The loaded tool definitions returned by tool search. + status: + $ref: '#/components/schemas/BetaFunctionCallOutputStatusEnum' + description: The status of the tool search output item that was recorded. + created_by: + type: string + description: The identifier of the actor that created the item. + type: object + required: + - type + - id + - call_id + - execution + - tools + - status + BetaToolSearchCall: + properties: + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: - tool_search_call - description: The item type. Always `tool_search_call`. + description: The type of the item. Always `tool_search_call`. default: tool_search_call x-stainless-const: true + id: + type: string + description: The unique ID of the tool search call item. + call_id: + anyOf: + - type: string + description: The unique ID of the tool search call generated by the model. + - type: 'null' execution: - $ref: '#/components/schemas/ToolSearchExecutionType' + $ref: '#/components/schemas/BetaToolSearchExecutionType' description: Whether tool search was executed by the server or by the client. arguments: - $ref: '#/components/schemas/EmptyModelParam' - description: The arguments supplied to the tool search call. + description: Arguments used for the tool search call. status: - anyOf: - - $ref: '#/components/schemas/FunctionCallItemStatus' - description: The status of the tool search call. - - type: 'null' + $ref: '#/components/schemas/BetaFunctionCallStatus' + description: The status of the tool search call item that was recorded. + created_by: + type: string + description: The identifier of the actor that created the item. type: object required: - type + - id + - call_id + - execution - arguments - ToolSearchOutputItemParam: + - status + BetaMultiAgentCallOutput: properties: - id: - anyOf: - - type: string - description: The unique ID of this tool search output. - example: tso_123 - - type: 'null' - call_id: - anyOf: - - type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the tool search call generated by the model. - - type: 'null' + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: - - tool_search_output - description: The item type. Always `tool_search_output`. - default: tool_search_output + - multi_agent_call_output + description: >- + The type of the multi-agent result. Always + `multi_agent_call_output`. + default: multi_agent_call_output x-stainless-const: true - execution: - $ref: '#/components/schemas/ToolSearchExecutionType' - description: Whether tool search was executed by the server or by the client. - tools: + id: + type: string + description: The unique ID of the multi-agent call output item. + call_id: + type: string + description: The unique ID of the multi-agent call. + action: + $ref: '#/components/schemas/BetaMultiAgentAction' + description: The multi-agent action that produced this result. + output: items: - $ref: '#/components/schemas/Tool' + $ref: '#/components/schemas/BetaOutputTextContent' type: array - description: The loaded tool definitions returned by the tool search output. - status: - anyOf: - - $ref: '#/components/schemas/FunctionCallItemStatus' - description: The status of the tool search output. - - type: 'null' + description: Text output returned by the multi-agent action. type: object required: - type - - tools - AdditionalToolsItemParam: - properties: - id: - anyOf: - - type: string - description: The unique ID of this additional tools item. - example: at_123 - - type: 'null' + - id + - call_id + - action + - output + x-oai-beta: responses_multi_agent=v1 + BetaMultiAgentAction: + type: string + enum: + - spawn_agent + - interrupt_agent + - list_agents + - send_message + - followup_task + - wait_agent + BetaMultiAgentCall: + properties: + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: - - additional_tools - description: The item type. Always `additional_tools`. - default: additional_tools + - multi_agent_call + description: The type of the multi-agent call. Always `multi_agent_call`. + default: multi_agent_call x-stainless-const: true - role: + id: + type: string + description: The unique ID of the multi-agent call item. + call_id: + type: string + description: The unique ID linking this call to its output. + action: + $ref: '#/components/schemas/BetaMultiAgentAction' + description: The multi-agent action to execute. + arguments: + type: string + description: The JSON string of arguments generated for the action. + type: object + required: + - type + - id + - call_id + - action + - arguments + x-oai-beta: responses_multi_agent=v1 + BetaAgentMessage: + properties: + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. + type: type: string enum: - - developer - description: >- - The role that provided the additional tools. Only `developer` is - supported. - default: developer + - agent_message + description: The type of the item. Always `agent_message`. + default: agent_message x-stainless-const: true - tools: + id: + type: string + description: The unique ID of the agent message. + author: + type: string + description: The sending agent identity. + recipient: + type: string + description: The destination agent identity. + content: items: - $ref: '#/components/schemas/Tool' + oneOf: + - $ref: '#/components/schemas/BetaInputTextContent' + - $ref: '#/components/schemas/BetaOutputTextContent' + - $ref: '#/components/schemas/BetaTextContent' + - $ref: '#/components/schemas/BetaSummaryTextContent' + - $ref: '#/components/schemas/BetaReasoningTextContent' + - $ref: '#/components/schemas/BetaRefusalContent' + - $ref: '#/components/schemas/BetaInputImageContent' + - $ref: '#/components/schemas/BetaComputerScreenshotContent' + - $ref: '#/components/schemas/BetaInputFileContent' + - $ref: '#/components/schemas/BetaEncryptedContent' + description: A content part that makes up an input or output item. + discriminator: + propertyName: type type: array - description: A list of additional tools made available at this item. + description: Encrypted content sent between agents. type: object required: - type - - role - - tools - CompactionSummaryItemParam: + - id + - author + - recipient + - content + x-oai-beta: responses_multi_agent=v1 + BetaEncryptedContent: properties: - id: - anyOf: - - type: string - description: The ID of the compaction item. - example: cmp_123 - - type: 'null' type: type: string enum: - - compaction - description: The type of the item. Always `compaction`. - default: compaction + - encrypted_content + description: The type of the input item. Always `encrypted_content`. + default: encrypted_content x-stainless-const: true encrypted_content: type: string - maxLength: 10485760 - description: The encrypted content of the compaction summary. + description: Opaque encrypted content. type: object required: - type - encrypted_content - title: Compaction item + title: Encrypted content description: >- - A compaction item generated by the [`v1/responses/compact` - API](/docs/api-reference/responses/compact). - FunctionShellActionParam: + Opaque encrypted content that Responses API decrypts inside trusted + model execution. + x-oai-beta: responses_multi_agent=v1 + BetaComputerScreenshotContent: properties: - commands: - items: - type: string - type: array - description: Ordered shell commands for the execution environment to run. - timeout_ms: + type: + type: string + enum: + - computer_screenshot + description: >- + Specifies the event type. For a computer screenshot, this property + is always set to `computer_screenshot`. + default: computer_screenshot + x-stainless-const: true + image_url: anyOf: - - type: integer - description: >- - Maximum wall-clock time in milliseconds to allow the shell - commands to run. + - type: string + format: uri + description: The URL of the screenshot image. - type: 'null' - max_output_length: + file_id: anyOf: - - type: integer - description: >- - Maximum number of UTF-8 characters to capture from combined - stdout and stderr output. + - type: string + description: The identifier of an uploaded file that contains the screenshot. - type: 'null' + detail: + $ref: '#/components/schemas/BetaImageDetail' + description: >- + The detail level of the screenshot image to be sent to the model. + One of `high`, `low`, `auto`, or `original`. Defaults to `auto`. + prompt_cache_breakpoint: + $ref: '#/components/schemas/BetaPromptCacheBreakpointConfig' type: object required: - - commands - title: Shell action - description: Commands and limits describing how to run the shell tool call. - FunctionShellCallItemStatus: - type: string - enum: - - in_progress - - completed - - incomplete - title: Shell call status - description: Status values reported for shell tool calls. - FunctionShellCallItemParam: + - type + - image_url + - file_id + - detail + title: Computer screenshot + description: A screenshot of a computer. + BetaTextContent: properties: - id: - anyOf: - - type: string - description: >- - The unique ID of the shell tool call. Populated when this item - is returned via API. - example: sh_123 - - type: 'null' - call_id: - type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the shell tool call generated by the model. type: type: string enum: - - shell_call - description: The type of the item. Always `shell_call`. - default: shell_call + - text + default: text x-stainless-const: true - action: - $ref: '#/components/schemas/FunctionShellActionParam' - description: >- - The shell commands and limits that describe how to run the tool - call. - status: - anyOf: - - $ref: '#/components/schemas/FunctionShellCallItemStatus' - description: >- - The status of the shell call. One of `in_progress`, `completed`, - or `incomplete`. - - type: 'null' - environment: - anyOf: - - oneOf: - - $ref: '#/components/schemas/LocalEnvironmentParam' - - $ref: '#/components/schemas/ContainerReferenceParam' - description: The environment to execute the shell commands in. - discriminator: - propertyName: type - - type: 'null' + text: + type: string type: object required: - - call_id - type - - action - title: Shell tool call - description: A tool representing a request to execute one or more shell commands. - FunctionShellCallOutputTimeoutOutcomeParam: + - text + title: Text Content + description: A text content. + BetaFunctionToolCallOutputResource: + allOf: + - $ref: '#/components/schemas/BetaFunctionToolCallOutput' + - type: object + properties: + id: + type: string + description: | + The unique ID of the function call tool output. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/BetaFunctionCallOutputStatusEnum' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + BetaFunctionToolCallOutput: + type: object + title: Function tool call output + description: | + The output of a function tool call. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. + id: + type: string + description: > + The unique ID of the function tool call output. Populated when this + item + + is returned via API. type: type: string enum: - - timeout - description: The outcome type. Always `timeout`. - default: timeout + - function_call_output + description: > + The type of the function tool call output. Always + `function_call_output`. x-stainless-const: true - type: object + call_id: + type: string + description: | + The unique ID of the function tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/BetaToolCallCallerParam' + - type: 'null' + output: + description: | + The output from the function call generated by your code. + Can be a string or an list of output content. + oneOf: + - type: string + description: | + A string of the output of the function call. + title: string output + - type: array + items: + $ref: '#/components/schemas/BetaFunctionAndCustomToolCallOutput' + title: output content list + description: | + Text, image, or file output of the function call. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete required: - type - title: Shell call timeout outcome - description: Indicates that the shell call exceeded its configured time limit. - FunctionShellCallOutputExitOutcomeParam: + - call_id + - output + BetaFunctionToolCallResource: + allOf: + - $ref: '#/components/schemas/BetaFunctionToolCall' + - type: object + properties: + id: + type: string + description: | + The unique ID of the function tool call. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/BetaFunctionCallStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + BetaComputerToolCallOutputResource: + allOf: + - $ref: '#/components/schemas/BetaComputerToolCallOutput' + - type: object + properties: + id: + type: string + description: | + The unique ID of the computer call tool output. + status: + description: > + The status of the message input. One of `in_progress`, + `completed`, or + + `incomplete`. Populated when input items are returned via API. + $ref: '#/components/schemas/BetaComputerCallOutputStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + BetaComputerCallOutputStatus: + type: string + enum: + - completed + - incomplete + - failed + BetaComputerToolCallOutput: + type: object + title: Computer tool call output + description: | + The output of a computer tool call. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that produced this item. type: type: string + description: > + The type of the computer tool call output. Always + `computer_call_output`. enum: - - exit - description: The outcome type. Always `exit`. - default: exit + - computer_call_output + default: computer_call_output x-stainless-const: true - exit_code: - type: integer - description: The exit code returned by the shell process. - type: object + id: + type: string + description: | + The ID of the computer tool call output. + call_id: + type: string + description: | + The ID of the computer tool call that produced the output. + acknowledged_safety_checks: + type: array + description: > + The safety checks reported by the API that have been acknowledged by + the + + developer. + items: + $ref: '#/components/schemas/BetaComputerCallSafetyCheckParam' + output: + $ref: '#/components/schemas/BetaComputerScreenshotImage' + status: + type: string + description: > + The status of the message input. One of `in_progress`, `completed`, + or + + `incomplete`. Populated when input items are returned via API. + enum: + - in_progress + - completed + - incomplete required: - type - - exit_code - title: Shell call exit outcome - description: Indicates that the shell commands finished and returned an exit code. - FunctionShellCallOutputOutcomeParam: - oneOf: - - $ref: '#/components/schemas/FunctionShellCallOutputTimeoutOutcomeParam' - - $ref: '#/components/schemas/FunctionShellCallOutputExitOutcomeParam' - title: Shell call outcome - description: The exit or timeout outcome associated with this shell call. - discriminator: - propertyName: type - FunctionShellCallOutputContentParam: + - call_id + - output + BetaInputMessageResource: + allOf: + - $ref: '#/components/schemas/BetaInputMessage' + - type: object + properties: + id: + type: string + description: | + The unique ID of the message input. + required: + - id + - type + BetaCompactResource: properties: - stdout: + id: type: string - maxLength: 10485760 - description: Captured stdout output for the shell call. - stderr: + description: The unique identifier for the compacted response. + object: type: string - maxLength: 10485760 - description: Captured stderr output for the shell call. - outcome: - $ref: '#/components/schemas/FunctionShellCallOutputOutcomeParam' - description: The exit or timeout outcome associated with this shell call. + enum: + - response.compaction + description: The object type. Always `response.compaction`. + default: response.compaction + x-stainless-const: true + output: + items: + $ref: '#/components/schemas/BetaItemField' + type: array + description: The compacted list of output items. + created_at: + type: integer + format: unixtime + description: >- + Unix timestamp (in seconds) when the compacted conversation was + created. + usage: + $ref: '#/components/schemas/BetaResponseUsage' + description: >- + Token accounting for the compaction pass, including cached, + reasoning, and total tokens. type: object required: - - stdout - - stderr - - outcome - title: Shell output content - description: Captured stdout and stderr for a portion of a shell tool call output. - FunctionShellCallOutputItemParam: + - id + - object + - output + - created_at + - usage + title: The compacted response object + example: + id: resp_001 + object: response.compaction + output: + - type: message + role: user + content: + - type: input_text + text: Summarize our launch checklist from last week. + - type: message + role: user + content: + - type: input_text + text: You are performing a CONTEXT CHECKPOINT COMPACTION... + - type: compaction + id: cmp_001 + encrypted_content: encrypted-summary + created_at: 1731459200 + usage: + input_tokens: 42897 + output_tokens: 12000 + total_tokens: 54912 + BetaResponseUsage: + type: object + description: | + Represents token usage details including input tokens, output tokens, + a breakdown of output tokens, and the total tokens used. + properties: + input_tokens: + type: integer + description: The number of input tokens. + input_tokens_details: + type: object + description: A detailed breakdown of the input tokens. + properties: + cached_tokens: + type: integer + description: | + The number of tokens that were retrieved from the cache. + [More on prompt caching](/docs/guides/prompt-caching). + cache_write_tokens: + type: integer + description: The number of input tokens that were written to the cache. + required: + - cached_tokens + - cache_write_tokens + output_tokens: + type: integer + description: The number of output tokens. + output_tokens_details: + type: object + description: A detailed breakdown of the output tokens. + properties: + reasoning_tokens: + type: integer + description: The number of reasoning tokens. + required: + - reasoning_tokens + total_tokens: + type: integer + description: The total number of tokens used. + required: + - input_tokens + - input_tokens_details + - output_tokens + - output_tokens_details + - total_tokens + BetaItemField: + oneOf: + - $ref: '#/components/schemas/BetaMessage' + - $ref: '#/components/schemas/BetaProgram' + - $ref: '#/components/schemas/BetaProgramOutput' + - $ref: '#/components/schemas/BetaFunctionToolCall' + - $ref: '#/components/schemas/BetaMultiAgentCall' + - $ref: '#/components/schemas/BetaMultiAgentCallOutput' + - $ref: '#/components/schemas/BetaToolSearchCall' + - $ref: '#/components/schemas/BetaToolSearchOutput' + - $ref: '#/components/schemas/BetaAdditionalTools' + - $ref: '#/components/schemas/BetaAgentMessage' + - $ref: '#/components/schemas/BetaFunctionToolCallOutput' + - $ref: '#/components/schemas/BetaFileSearchToolCall' + - $ref: '#/components/schemas/BetaWebSearchToolCall' + - $ref: '#/components/schemas/BetaImageGenToolCall' + - $ref: '#/components/schemas/BetaComputerToolCall' + - $ref: '#/components/schemas/BetaComputerToolCallOutputResource' + - $ref: '#/components/schemas/BetaReasoningItem' + - $ref: '#/components/schemas/BetaCompactionBody' + - $ref: '#/components/schemas/BetaCodeInterpreterToolCall' + - $ref: '#/components/schemas/BetaLocalShellToolCall' + deprecated: true + - $ref: '#/components/schemas/BetaLocalShellToolCallOutput' + deprecated: true + - $ref: '#/components/schemas/BetaFunctionShellCall' + - $ref: '#/components/schemas/BetaFunctionShellCallOutput' + - $ref: '#/components/schemas/BetaApplyPatchToolCall' + - $ref: '#/components/schemas/BetaApplyPatchToolCallOutput' + - $ref: '#/components/schemas/BetaMCPListTools' + - $ref: '#/components/schemas/BetaMCPApprovalRequest' + - $ref: '#/components/schemas/BetaMCPApprovalResponseResource' + - $ref: '#/components/schemas/BetaMCPToolCall' + - $ref: '#/components/schemas/BetaCustomToolCall' + - $ref: '#/components/schemas/BetaCustomToolCallOutput' + description: >- + An item representing a message, tool call, tool output, reasoning, or + other response element. + discriminator: + propertyName: type + BetaMessage: properties: - id: - anyOf: - - type: string - description: >- - The unique ID of the shell tool call output. Populated when this - item is returned via API. - example: sho_123 - - type: 'null' - call_id: - type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the shell tool call generated by the model. + agent: + $ref: '#/components/schemas/BetaAgentTag' + description: The agent that produced this item. type: type: string enum: - - shell_call_output - description: The type of the item. Always `shell_call_output`. - default: shell_call_output + - message + description: The type of the message. Always set to `message`. + default: message x-stainless-const: true - output: + id: + type: string + description: The unique ID of the message. + status: + $ref: '#/components/schemas/BetaMessageStatus' + description: >- + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + role: + $ref: '#/components/schemas/BetaMessageRole' + description: >- + The role of the message. One of `unknown`, `user`, `assistant`, + `system`, `critic`, `discriminator`, `developer`, or `tool`. + content: items: - $ref: '#/components/schemas/FunctionShellCallOutputContentParam' + oneOf: + - $ref: '#/components/schemas/BetaInputTextContent' + - $ref: '#/components/schemas/BetaOutputTextContent' + - $ref: '#/components/schemas/BetaTextContent' + - $ref: '#/components/schemas/BetaSummaryTextContent' + - $ref: '#/components/schemas/BetaReasoningTextContent' + - $ref: '#/components/schemas/BetaRefusalContent' + - $ref: '#/components/schemas/BetaInputImageContent' + - $ref: '#/components/schemas/BetaComputerScreenshotContent' + - $ref: '#/components/schemas/BetaInputFileContent' + - $ref: '#/components/schemas/BetaEncryptedContent' + description: A content part that makes up an input or output item. + discriminator: + propertyName: type type: array - description: >- - Captured chunks of stdout and stderr output, along with their - associated outcomes. - status: - anyOf: - - $ref: '#/components/schemas/FunctionShellCallItemStatus' - description: The status of the shell call output. - - type: 'null' - max_output_length: + description: The content of the message + phase: anyOf: - - type: integer + - $ref: '#/components/schemas/BetaMessagePhase-2' description: >- - The maximum number of UTF-8 characters captured for this shell - call's combined output. + Labels an `assistant` message as intermediate commentary + (`commentary`) or the final answer (`final_answer`). For models + like `gpt-5.3-codex` and beyond, when sending follow-up + requests, preserve and resend phase on all assistant messages — + dropping it can degrade performance. Not used for user messages. - type: 'null' type: object required: - - call_id - type - - output - title: Shell tool call output - description: The streamed output items emitted by a shell tool call. - ApplyPatchCallStatusParam: + - id + - status + - role + - content + title: Message + description: A message to or from the model. + BetaMessagePhase-2: + type: string + enum: + - commentary + - final_answer + BetaMessageStatus: type: string enum: - in_progress - completed - title: Apply patch call status - description: Status values reported for apply_patch tool calls. - ApplyPatchCreateFileOperationParam: + - incomplete + BetaResponseCustomToolCallInputDoneEvent: + title: ResponseCustomToolCallInputDone + type: object + description: | + Event indicating that input for a custom tool call is complete. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string enum: - - create_file - description: The operation type. Always `create_file`. - default: create_file + - response.custom_tool_call_input.done + description: The event type identifier. x-stainless-const: true - path: + sequence_number: + type: integer + description: The sequence number of this event. + output_index: + type: integer + description: The index of the output this event applies to. + item_id: type: string - minLength: 1 - description: Path of the file to create relative to the workspace root. - diff: + description: Unique identifier for the API item associated with this event. + input: type: string - maxLength: 10485760 - description: Unified diff content to apply when creating the file. - type: object + description: The complete input data for the custom tool call. required: - type - - path - - diff - title: Apply patch create file operation - description: Instruction for creating a new file via the apply_patch tool. - ApplyPatchDeleteFileOperationParam: - properties: - type: - type: string - enum: - - delete_file - description: The operation type. Always `delete_file`. - default: delete_file - x-stainless-const: true - path: - type: string - minLength: 1 - description: Path of the file to delete relative to the workspace root. + - output_index + - item_id + - input + - sequence_number + x-oaiMeta: + name: response.custom_tool_call_input.done + group: responses + example: | + { + "type": "response.custom_tool_call_input.done", + "output_index": 0, + "item_id": "ctc_1234567890abcdef", + "input": "final complete input text" + } + BetaResponseCustomToolCallInputDeltaEvent: + title: ResponseCustomToolCallInputDelta type: object - required: - - type - - path - title: Apply patch delete file operation - description: Instruction for deleting an existing file via the apply_patch tool. - ApplyPatchUpdateFileOperationParam: + description: > + Event representing a delta (partial update) to the input of a custom + tool call. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string enum: - - update_file - description: The operation type. Always `update_file`. - default: update_file + - response.custom_tool_call_input.delta + description: The event type identifier. x-stainless-const: true - path: + sequence_number: + type: integer + description: The sequence number of this event. + output_index: + type: integer + description: The index of the output this delta applies to. + item_id: type: string - minLength: 1 - description: Path of the file to update relative to the workspace root. - diff: + description: Unique identifier for the API item associated with this event. + delta: type: string - maxLength: 10485760 - description: Unified diff content to apply to the existing file. - type: object + description: The incremental input data (delta) for the custom tool call. required: - type - - path - - diff - title: Apply patch update file operation - description: Instruction for updating an existing file via the apply_patch tool. - ApplyPatchOperationParam: - oneOf: - - $ref: '#/components/schemas/ApplyPatchCreateFileOperationParam' - - $ref: '#/components/schemas/ApplyPatchDeleteFileOperationParam' - - $ref: '#/components/schemas/ApplyPatchUpdateFileOperationParam' - title: Apply patch operation - description: >- - One of the create_file, delete_file, or update_file operations supplied - to the apply_patch tool. - discriminator: - propertyName: type - ApplyPatchToolCallItemParam: + - output_index + - item_id + - delta + - sequence_number + x-oaiMeta: + name: response.custom_tool_call_input.delta + group: responses + example: | + { + "type": "response.custom_tool_call_input.delta", + "output_index": 0, + "item_id": "ctc_1234567890abcdef", + "delta": "partial input text" + } + BetaResponseQueuedEvent: + type: object + title: ResponseQueuedEvent + description: | + Emitted when a response is queued and waiting to be processed. properties: - type: - type: string - enum: - - apply_patch_call - description: The type of the item. Always `apply_patch_call`. - default: apply_patch_call - x-stainless-const: true - id: + agent: anyOf: - - type: string - description: >- - The unique ID of the apply patch tool call. Populated when this - item is returned via API. - example: apc_123 + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - call_id: - type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the apply patch tool call generated by the model. - status: - $ref: '#/components/schemas/ApplyPatchCallStatusParam' - description: >- - The status of the apply patch tool call. One of `in_progress` or - `completed`. - operation: - $ref: '#/components/schemas/ApplyPatchOperationParam' - description: >- - The specific create, delete, or update instruction for the - apply_patch tool call. - type: object - required: - - type - - call_id - - status - - operation - title: Apply patch tool call - description: >- - A tool call representing a request to create, delete, or update files - using diff patches. - ApplyPatchCallOutputStatusParam: - type: string - enum: - - completed - - failed - title: Apply patch call output status - description: Outcome values reported for apply_patch tool call outputs. - ApplyPatchToolCallOutputItemParam: - properties: + description: The agent that owns this multi-agent streaming event. type: type: string enum: - - apply_patch_call_output - description: The type of the item. Always `apply_patch_call_output`. - default: apply_patch_call_output + - response.queued + description: The type of the event. Always 'response.queued'. x-stainless-const: true - id: - anyOf: - - type: string - description: >- - The unique ID of the apply patch tool call output. Populated - when this item is returned via API. - example: apco_123 - - type: 'null' - call_id: + response: + $ref: '#/components/schemas/BetaResponse' + description: The full response object that is queued. + sequence_number: + type: integer + description: The sequence number for this event. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.queued + group: responses + example: | + { + "type": "response.queued", + "response": { + "id": "res_123", + "status": "queued", + "created_at": "2021-01-01T00:00:00Z", + "updated_at": "2021-01-01T00:00:00Z" + }, + "sequence_number": 1 + } + BetaResponse: + title: The response object + allOf: + - $ref: '#/components/schemas/BetaModelResponseProperties' + - $ref: '#/components/schemas/BetaResponseProperties' + - type: object + properties: + truncation: + anyOf: + - type: string + description: > + The truncation strategy to use for the model response. + + - `auto`: If the input to this Response exceeds + the model's context window size, the model will truncate the + response to fit the context window by dropping items from the beginning of the conversation. + - `disabled` (default): If the input size will exceed the + context window + size for a model, the request will fail with a 400 error. + enum: + - auto + - disabled + default: disabled + - type: 'null' + id: + type: string + description: | + Unique identifier for this Response. + object: + type: string + description: | + The object type of this resource - always set to `response`. + enum: + - response + x-stainless-const: true + status: + type: string + description: > + The status of the response generation. One of `completed`, + `failed`, + + `in_progress`, `cancelled`, `queued`, or `incomplete`. + enum: + - completed + - failed + - in_progress + - cancelled + - queued + - incomplete + created_at: + type: number + format: unixtime + description: | + Unix timestamp (in seconds) of when this Response was created. + completed_at: + anyOf: + - type: number + format: unixtime + description: > + Unix timestamp (in seconds) of when this Response was + completed. + + Only present when the status is `completed`. + - type: 'null' + error: + $ref: '#/components/schemas/BetaResponseError' + incomplete_details: + anyOf: + - type: object + description: | + Details about why the response is incomplete. + properties: + reason: + type: string + description: The reason why the response is incomplete. + enum: + - max_output_tokens + - content_filter + - type: 'null' + output: + type: array + description: > + An array of content items generated by the model. + + + - The length and order of items in the `output` array is + dependent + on the model's response. + - Rather than accessing the first item in the `output` array and + assuming it's an `assistant` message with the content generated by + the model, you might consider using the `output_text` property where + supported in SDKs. + items: + $ref: '#/components/schemas/BetaOutputItem' + reasoning: + anyOf: + - $ref: '#/components/schemas/BetaReasoning' + - type: 'null' + instructions: + anyOf: + - description: > + A system (or developer) message inserted into the model's + context. + + + When using along with `previous_response_id`, the + instructions from a previous + + response will not be carried over to the next response. This + makes it simple + + to swap out system (or developer) messages in new responses. + oneOf: + - type: string + description: > + A text input to the model, equivalent to a text input + with the + + `developer` role. + - type: array + title: Input item list + description: > + A list of one or many input items to the model, + containing + + different content types. + items: + $ref: '#/components/schemas/BetaInputItem' + - type: 'null' + output_text: + anyOf: + - type: string + description: > + SDK-only convenience property that contains the aggregated + text output + + from all `output_text` items in the `output` array, if any + are present. + + Supported in the Python and JavaScript SDKs. + x-oaiSupportedSDKs: + - python + - javascript + - type: 'null' + usage: + $ref: '#/components/schemas/BetaResponseUsage' + prompt_cache_options: + $ref: '#/components/schemas/BetaPromptCacheOptions' + moderation: + anyOf: + - $ref: '#/components/schemas/BetaModeration' + description: > + Moderation results for the response input and output, if + moderated completions were requested. + - type: 'null' + parallel_tool_calls: + type: boolean + description: | + Whether to allow the model to run tool calls in parallel. + default: true + conversation: + anyOf: + - default: null + $ref: '#/components/schemas/BetaConversation-2' + - type: 'null' + max_output_tokens: + anyOf: + - description: > + An upper bound for the number of tokens that can be + generated for a response, including visible output tokens + and [reasoning tokens](/docs/guides/reasoning). + type: integer + - type: 'null' + required: + - id + - object + - created_at + - error + - incomplete_details + - instructions + - model + - tools + - output + - parallel_tool_calls + - metadata + - tool_choice + - temperature + - top_p + example: + id: resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41 + object: response + created_at: 1741476777 + status: completed + completed_at: 1741476778 + error: null + incomplete_details: null + instructions: null + max_output_tokens: null + model: gpt-4o-2024-08-06 + output: + - type: message + id: msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41 + status: completed + role: assistant + content: + - type: output_text + text: >- + The image depicts a scenic landscape with a wooden boardwalk + or pathway leading through lush, green grass under a blue sky + with some clouds. The setting suggests a peaceful natural + area, possibly a park or nature reserve. There are trees and + shrubs in the background. + annotations: [] + parallel_tool_calls: true + previous_response_id: null + reasoning: + effort: null + summary: null + context: null + store: true + temperature: 1 + text: + format: + type: text + tool_choice: auto + tools: [] + top_p: 1 + truncation: disabled + usage: + input_tokens: 328 + input_tokens_details: + cached_tokens: 0 + output_tokens: 52 + output_tokens_details: + reasoning_tokens: 0 + total_tokens: 380 + user: null + metadata: {} + BetaConversation-2: + properties: + id: type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the apply patch tool call generated by the model. - status: - $ref: '#/components/schemas/ApplyPatchCallOutputStatusParam' description: >- - The status of the apply patch tool call output. One of `completed` - or `failed`. + The unique ID of the conversation that this response was associated + with. + type: object + required: + - id + title: Conversation + description: >- + The conversation that this response belonged to. Input items and output + items from this response were automatically added to this conversation. + BetaModeration: + properties: + input: + oneOf: + - $ref: '#/components/schemas/BetaModerationResultBody' + - $ref: '#/components/schemas/BetaModerationErrorBody' + description: Moderation for the response input. + discriminator: + propertyName: type output: - anyOf: - - type: string - maxLength: 10485760 - description: >- - Optional human-readable log text from the apply patch tool - (e.g., patch results or errors). - - type: 'null' + oneOf: + - $ref: '#/components/schemas/BetaModerationResultBody' + - $ref: '#/components/schemas/BetaModerationErrorBody' + description: Moderation for the response output. + discriminator: + propertyName: type type: object required: - - type - - call_id - - status - title: Apply patch tool call output - description: The streamed output emitted by an apply patch tool call. - CompactionTriggerItemParam: + - input + - output + title: Moderation + description: Moderation results or errors for the response input and output. + BetaModerationErrorBody: properties: type: type: string enum: - - compaction_trigger - description: The type of the item. Always `compaction_trigger`. - default: compaction_trigger + - error + description: The object type, which was always `error` for moderation failures. + default: error x-stainless-const: true + code: + type: string + description: The error code. + message: + type: string + description: The error message. type: object required: - type - title: Compaction trigger - description: Compacts the current context. Must be the final input item. - ItemReferenceParam: + - code + - message + title: Moderation error + description: >- + An error produced while attempting moderation for the response input or + output. + BetaModerationResultBody: properties: type: - anyOf: - - type: string - enum: - - item_reference - description: The type of item to reference. Always `item_reference`. - default: item_reference - x-stainless-const: true - - type: 'null' - id: - type: string - description: The ID of the item to reference. - type: object - required: - - id - title: Item reference - description: An internal identifier for an item to reference. - ConversationResource: - properties: - id: - type: string - description: The unique ID of the conversation. - object: type: string enum: - - conversation - description: The object type, which is always `conversation`. - default: conversation + - moderation_result + description: >- + The object type, which was always `moderation_result` for successful + moderation results. + default: moderation_result x-stainless-const: true - metadata: + model: + type: string + description: The moderation model that produced this result. + flagged: + type: boolean description: >- - Set of 16 key-value pairs that can be attached to an object. This - can be useful for storing additional information about the - object in a structured format, and querying for objects via - API or the dashboard. - Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. - created_at: - type: integer - format: unixtime + A boolean indicating whether the content was flagged by any + category. + categories: + additionalProperties: + type: boolean + type: object description: >- - The time at which the conversation was created, measured in seconds - since the Unix epoch. + A dictionary of moderation categories to booleans, True if the input + is flagged under this category. + x-oaiTypeLabel: map + category_scores: + additionalProperties: + type: number + type: object + description: A dictionary of moderation categories to scores. + x-oaiTypeLabel: map + category_applied_input_types: + additionalProperties: + items: + $ref: '#/components/schemas/BetaModerationInputType' + type: array + type: object + description: >- + Which modalities of input are reflected by the score for each + category. + x-oaiTypeLabel: map type: object required: - - id - - object - - metadata - - created_at - ImageGenOutputTokensDetails: + - type + - model + - flagged + - categories + - category_scores + - category_applied_input_types + title: Moderation result + description: A moderation result produced for the response input or output. + BetaModerationInputType: + type: string + enum: + - text + - image + BetaPromptCacheOptions: properties: - image_tokens: - type: integer - description: The number of image output tokens generated by the model. - text_tokens: - type: integer - description: The number of text output tokens generated by the model. + ttl: + $ref: '#/components/schemas/BetaPromptCacheTTLEnum' + description: The minimum lifetime applied to each cache breakpoint. + mode: + $ref: '#/components/schemas/BetaPromptCacheModeEnum' + description: Whether implicit prompt-cache breakpoints were enabled. type: object required: - - image_tokens - - text_tokens - title: Image generation output token details - description: The output token details for the image generation. - ImageGenInputUsageDetails: - properties: - text_tokens: - type: integer - description: The number of text tokens in the input prompt. - image_tokens: - type: integer - description: The number of image tokens in the input prompt. + - ttl + - mode + title: Prompt cache options + description: >- + The prompt-caching options that were applied to the response. Supported + for `gpt-5.6` and later models. + BetaOutputItem: + oneOf: + - $ref: '#/components/schemas/BetaOutputMessage' + - $ref: '#/components/schemas/BetaFileSearchToolCall' + - $ref: '#/components/schemas/BetaFunctionToolCall' + - $ref: '#/components/schemas/BetaFunctionToolCallOutputResource' + - $ref: '#/components/schemas/BetaAgentMessage' + - $ref: '#/components/schemas/BetaMultiAgentCall' + - $ref: '#/components/schemas/BetaMultiAgentCallOutput' + - $ref: '#/components/schemas/BetaWebSearchToolCall' + - $ref: '#/components/schemas/BetaComputerToolCall' + - $ref: '#/components/schemas/BetaComputerToolCallOutputResource' + - $ref: '#/components/schemas/BetaReasoningItem' + - $ref: '#/components/schemas/BetaProgram' + - $ref: '#/components/schemas/BetaProgramOutput' + - $ref: '#/components/schemas/BetaToolSearchCall' + - $ref: '#/components/schemas/BetaToolSearchOutput' + - $ref: '#/components/schemas/BetaAdditionalTools' + - $ref: '#/components/schemas/BetaCompactionBody' + - $ref: '#/components/schemas/BetaImageGenToolCall' + - $ref: '#/components/schemas/BetaCodeInterpreterToolCall' + - $ref: '#/components/schemas/BetaLocalShellToolCall' + - $ref: '#/components/schemas/BetaLocalShellToolCallOutput' + - $ref: '#/components/schemas/BetaFunctionShellCall' + - $ref: '#/components/schemas/BetaFunctionShellCallOutput' + - $ref: '#/components/schemas/BetaApplyPatchToolCall' + - $ref: '#/components/schemas/BetaApplyPatchToolCallOutput' + - $ref: '#/components/schemas/BetaMCPToolCall' + - $ref: '#/components/schemas/BetaMCPListTools' + - $ref: '#/components/schemas/BetaMCPApprovalRequest' + - $ref: '#/components/schemas/BetaMCPApprovalResponseResource' + - $ref: '#/components/schemas/BetaCustomToolCall' + - $ref: '#/components/schemas/BetaCustomToolCallOutputResource' + discriminator: + propertyName: type + BetaResponseError: + anyOf: + - type: object + description: > + An error object returned when the model fails to generate a + Response. + properties: + code: + $ref: '#/components/schemas/BetaResponseErrorCode' + message: + type: string + description: | + A human-readable description of the error. + required: + - code + - message + - type: 'null' + BetaResponseErrorCode: + type: string + description: | + The error code for the response. + enum: + - server_error + - rate_limit_exceeded + - invalid_prompt + - bio_policy + - vector_store_timeout + - invalid_image + - invalid_image_format + - invalid_base64_image + - invalid_image_url + - image_too_large + - image_too_small + - image_parse_error + - image_content_policy_violation + - invalid_image_mode + - image_file_too_large + - unsupported_image_media_type + - empty_image_file + - failed_to_download_image + - image_file_not_found + BetaResponseProperties: type: object - required: - - text_tokens - - image_tokens - title: Input usage details - description: The input tokens detailed information for the image generation. - ImageGenUsage: properties: - input_tokens: - type: integer - description: The number of tokens (images and text) in the input prompt. - total_tokens: - type: integer - description: >- - The total number of tokens (images and text) used for the image - generation. - output_tokens: - type: integer - description: The number of output tokens generated by the model. - output_tokens_details: - $ref: '#/components/schemas/ImageGenOutputTokensDetails' - input_tokens_details: - $ref: '#/components/schemas/ImageGenInputUsageDetails' + previous_response_id: + anyOf: + - type: string + description: > + The unique ID of the previous response to the model. Use this to + + create multi-turn conversations. Learn more about + + [conversation state](/docs/guides/conversation-state). Cannot be + used in conjunction with `conversation`. + - type: 'null' + model: + description: > + Model ID used to generate the response, like `gpt-4o` or `o3`. + OpenAI + + offers a wide range of models with different capabilities, + performance + + characteristics, and price points. Refer to the [model + guide](/docs/models) + + to browse and compare available models. + $ref: '#/components/schemas/BetaModelIdsResponses' + background: + anyOf: + - type: boolean + description: | + Whether to run the model response in the background. + [Learn more](/docs/guides/background). + default: false + - type: 'null' + max_tool_calls: + anyOf: + - description: > + The maximum number of total calls to built-in tools that can be + processed in a response. This maximum number applies across all + built-in tool calls, not per individual tool. Any further + attempts to call a tool by the model will be ignored. + type: integer + - type: 'null' + text: + $ref: '#/components/schemas/BetaResponseTextParam' + tools: + $ref: '#/components/schemas/BetaToolsArray' + tool_choice: + $ref: '#/components/schemas/BetaToolChoiceParam' + prompt: + $ref: '#/components/schemas/BetaPrompt' + BetaPrompt: + anyOf: + - type: object + description: | + Reference to a prompt template and its variables. + [Learn more](/docs/guides/text?api-mode=responses#reusable-prompts). + required: + - id + properties: + id: + type: string + description: The unique identifier of the prompt template to use. + version: + anyOf: + - type: string + description: Optional version of the prompt template. + - type: 'null' + variables: + $ref: '#/components/schemas/BetaResponsePromptVariables' + - type: 'null' + BetaResponsePromptVariables: + anyOf: + - type: object + title: Prompt Variables + description: | + Optional map of values to substitute in for variables in your + prompt. The substitution values can either be strings, or other + Response input types like images or files. + x-oaiExpandable: true + x-oaiTypeLabel: map + additionalProperties: + x-oaiExpandable: true + x-oaiTypeLabel: map + oneOf: + - type: string + - $ref: '#/components/schemas/BetaInputTextContent' + - $ref: '#/components/schemas/BetaInputImageContent' + - $ref: '#/components/schemas/BetaInputFileContent' + - type: 'null' + BetaToolsArray: + type: array + description: > + An array of tools the model may call while generating a response. You + + can specify which tool to use by setting the `tool_choice` parameter. + + + We support the following categories of tools: + + - **Built-in tools**: Tools that are provided by OpenAI that extend the + model's capabilities, like [web search](/docs/guides/tools-web-search) + or [file search](/docs/guides/tools-file-search). Learn more about + [built-in tools](/docs/guides/tools). + - **MCP Tools**: Integrations with third-party systems via custom MCP + servers + or predefined connectors such as Google Drive and SharePoint. Learn more about + [MCP Tools](/docs/guides/tools-connectors-mcp). + - **Function calls (custom tools)**: Functions that are defined by you, + enabling the model to call your own code with strongly typed arguments + and outputs. Learn more about + [function calling](/docs/guides/function-calling). You can also use + custom tools to call your own code. + items: + $ref: '#/components/schemas/BetaTool' + BetaModelResponseProperties: type: object - required: - - input_tokens - - total_tokens - - output_tokens - - input_tokens_details - title: Image generation usage - description: >- - For `gpt-image-1` only, the token usage information for the image - generation. - SpecificApplyPatchParam: properties: - type: + metadata: + $ref: '#/components/schemas/BetaMetadata' + top_logprobs: + anyOf: + - description: > + An integer between 0 and 20 specifying the maximum number of + most likely + + tokens to return at each token position, each with an associated + log + + probability. In some cases, the number of returned tokens may be + fewer than + + requested. + type: integer + minimum: 0 + maximum: 20 + - type: 'null' + temperature: + anyOf: + - type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + description: > + What sampling temperature to use, between 0 and 2. Higher values + like 0.8 will make the output more random, while lower values + like 0.2 will make it more focused and deterministic. + + We generally recommend altering this or `top_p` but not both. + - type: 'null' + top_p: + anyOf: + - type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + description: > + An alternative to sampling with temperature, called nucleus + sampling, + + where the model considers the results of the tokens with top_p + probability + + mass. So 0.1 means only the tokens comprising the top 10% + probability mass + + are considered. + + + We generally recommend altering this or `temperature` but not + both. + - type: 'null' + user: + type: string + example: user-1234 + deprecated: true + description: > + This field is being replaced by `safety_identifier` and + `prompt_cache_key`. Use `prompt_cache_key` instead to maintain + caching optimizations. + + A stable identifier for your end-users. + + Used to boost cache hit rates by better bucketing similar requests + and to help OpenAI detect and prevent abuse. [Learn + more](/docs/guides/safety-best-practices#safety-identifiers). + safety_identifier: + type: string + maxLength: 64 + example: safety-identifier-1234 + description: > + A stable identifier used to help detect users of your application + that may be violating OpenAI's usage policies. + + The IDs should be a string that uniquely identifies each user, with + a maximum length of 64 characters. We recommend hashing their + username or email address, in order to avoid sending us any + identifying information. [Learn + more](/docs/guides/safety-best-practices#safety-identifiers). + prompt_cache_key: type: string + example: prompt-cache-key-1234 + description: > + Used by OpenAI to cache responses for similar requests to optimize + your cache hit rates. Replaces the `user` field. [Learn + more](/docs/guides/prompt-caching). + service_tier: + $ref: '#/components/schemas/BetaServiceTier' + prompt_cache_retention: + deprecated: true + anyOf: + - type: string + enum: + - in_memory + - 24h + description: > + Deprecated. Use `prompt_cache_options.ttl` instead. + + + The retention policy for the prompt cache. Set to `24h` to + enable extended prompt caching, which keeps cached prefixes + active for longer, up to a maximum of 24 hours. [Learn + more](/docs/guides/prompt-caching#prompt-cache-retention). + + This field expresses a maximum retention policy, while + + `prompt_cache_options.ttl` expresses a minimum cache lifetime. + The two + + fields are independent and do not interact. + + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is + supported. + + + For older models that support both `in_memory` and `24h`, the + default depends on your organization's data retention policy: + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified. + - type: 'null' + BetaServiceTier: + anyOf: + - type: string + description: | + Specifies the processing type used for serving the request. + - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. + - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. + - If set to '[flex](/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier. + - When not set, the default behavior is 'auto'. + + When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. enum: - - apply_patch - description: The tool to call. Always `apply_patch`. - default: apply_patch - x-stainless-const: true + - auto + - default + - flex + - scale + - priority + default: auto + - type: 'null' + BetaMetadata: + anyOf: + - type: object + description: > + Set of 16 key-value pairs that can be attached to an object. This + can be + + useful for storing additional information about the object in a + structured + + format, and querying for objects via API or the dashboard. + + + Keys are strings with a maximum length of 64 characters. Values are + strings + + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + - type: 'null' + BetaResponseOutputTextAnnotationAddedEvent: type: object - required: - - type - title: Specific apply patch tool choice - description: >- - Forces the model to call the apply_patch tool when executing a tool - call. - SpecificFunctionShellParam: + title: ResponseOutputTextAnnotationAddedEvent + description: | + Emitted when an annotation is added to output text content. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string enum: - - shell - description: The tool to call. Always `shell`. - default: shell + - response.output_text.annotation.added + description: >- + The type of the event. Always + 'response.output_text.annotation.added'. x-stainless-const: true - type: object + item_id: + type: string + description: >- + The unique identifier of the item to which the annotation is being + added. + output_index: + type: integer + description: The index of the output item in the response's output array. + content_index: + type: integer + description: The index of the content part within the output item. + annotation_index: + type: integer + description: The index of the annotation within the content part. + sequence_number: + type: integer + description: The sequence number of this event. + annotation: + type: object + description: >- + The annotation object being added. (See annotation schema for + details.) required: - type - title: Specific shell tool choice - description: Forces the model to call the shell tool when a tool call is required. - ConversationParam-2: - properties: - id: - type: string - description: The unique ID of the conversation. - example: conv_123 + - item_id + - output_index + - content_index + - annotation_index + - annotation + - sequence_number + x-oaiMeta: + name: response.output_text.annotation.added + group: responses + example: | + { + "type": "response.output_text.annotation.added", + "item_id": "item-abc", + "output_index": 0, + "content_index": 0, + "annotation_index": 0, + "annotation": { + "type": "text_annotation", + "text": "This is a test annotation", + "start": 0, + "end": 10 + }, + "sequence_number": 1 + } + BetaResponseMCPListToolsInProgressEvent: type: object - required: - - id - title: Conversation object - description: The conversation that this response belongs to. - ContextManagementParam: + title: ResponseMCPListToolsInProgressEvent + description: > + Emitted when the system is in the process of retrieving the list of + available MCP tools. properties: - type: - type: string - description: >- - The context management entry type. Currently only 'compaction' is - supported. - compact_threshold: + agent: anyOf: - - type: integer - minimum: 1000 - description: >- - Token threshold at which compaction should be triggered for this - entry. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - type: object - required: - - type - ModerationErrorBody: - properties: + description: The agent that owns this multi-agent streaming event. type: type: string enum: - - error - description: The object type, which was always `error` for moderation failures. - default: error + - response.mcp_list_tools.in_progress + description: The type of the event. Always 'response.mcp_list_tools.in_progress'. x-stainless-const: true - code: - type: string - description: The error code. - message: + item_id: type: string - description: The error message. - type: object + description: The ID of the MCP tool call item that is being processed. + output_index: + type: integer + description: The index of the output item that is being processed. + sequence_number: + type: integer + description: The sequence number of this event. required: - type - - code - - message - title: Moderation error - description: >- - An error produced while attempting moderation for the response input or - output. - Moderation: - properties: - input: - oneOf: - - $ref: '#/components/schemas/ModerationResultBody' - - $ref: '#/components/schemas/ModerationErrorBody' - description: Moderation for the response input. - discriminator: - propertyName: type - output: - oneOf: - - $ref: '#/components/schemas/ModerationResultBody' - - $ref: '#/components/schemas/ModerationErrorBody' - description: Moderation for the response output. - discriminator: - propertyName: type - type: object - required: - - input - - output - title: Moderation - description: Moderation results or errors for the response input and output. - Conversation-2: - properties: - id: - type: string - description: >- - The unique ID of the conversation that this response was associated - with. + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_list_tools.in_progress + group: responses + example: | + { + "type": "response.mcp_list_tools.in_progress", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" + } + BetaResponseMCPListToolsFailedEvent: type: object - required: - - id - title: Conversation - description: >- - The conversation that this response belonged to. Input items and output - items from this response were automatically added to this conversation. - CreateConversationBody: + title: ResponseMCPListToolsFailedEvent + description: | + Emitted when the attempt to list available MCP tools has failed. properties: - metadata: - anyOf: - - $ref: '#/components/schemas/Metadata' - description: >- - Set of 16 key-value pairs that can be attached to an object. - This can be useful for storing additional information - about the object in a structured format, and querying - for objects via API or the dashboard. - Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. - - type: 'null' - items: + agent: anyOf: - - items: - $ref: '#/components/schemas/InputItem' - type: array - maxItems: 20 - description: >- - Initial items to include in the conversation context. You may - add up to 20 items at a time. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - type: object - required: [] - UpdateConversationBody: - properties: - metadata: - $ref: '#/components/schemas/Metadata' - description: >- - Set of 16 key-value pairs that can be attached to an object. This - can be useful for storing additional information about the - object in a structured format, and querying for objects via - API or the dashboard. - Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. - type: object - required: - - metadata - DeletedConversationResource: - properties: - object: + description: The agent that owns this multi-agent streaming event. + type: type: string enum: - - conversation.deleted - default: conversation.deleted + - response.mcp_list_tools.failed + description: The type of the event. Always 'response.mcp_list_tools.failed'. x-stainless-const: true - deleted: - type: boolean - id: + item_id: type: string - type: object + description: The ID of the MCP tool call item that failed. + output_index: + type: integer + description: The index of the output item that failed. + sequence_number: + type: integer + description: The sequence number of this event. required: - - object - - deleted - - id - OrderEnum: - type: string - enum: - - asc - - desc - VideoModel: - anyOf: - - type: string - - type: string - enum: - - sora-2 - - sora-2-pro - - sora-2-2025-10-06 - - sora-2-pro-2025-10-06 - - sora-2-2025-12-08 - VideoStatus: - type: string - enum: - - queued - - in_progress - - completed - - failed - VideoSize: - type: string - enum: - - 720x1280 - - 1280x720 - - 1024x1792 - - 1792x1024 - Error-2: - properties: - code: - type: string - description: A machine-readable error code that was returned. - message: - type: string - description: A human-readable description of the error that was returned. + - type + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_list_tools.failed + group: responses + example: | + { + "type": "response.mcp_list_tools.failed", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" + } + BetaResponseMCPListToolsCompletedEvent: type: object - required: - - code - - message - title: Error - description: An error that occurred while generating the response. - VideoResource: + title: ResponseMCPListToolsCompletedEvent + description: > + Emitted when the list of available MCP tools has been successfully + retrieved. properties: - id: - type: string - description: Unique identifier for the video job. - object: - type: string - enum: - - video - description: The object type, which is always `video`. - default: video - x-stainless-const: true - model: - $ref: '#/components/schemas/VideoModel' - description: The video generation model that produced the job. - status: - $ref: '#/components/schemas/VideoStatus' - description: Current lifecycle status of the video job. - progress: - type: integer - description: Approximate completion percentage for the generation task. - created_at: - type: integer - format: unixtime - description: Unix timestamp (seconds) for when the job was created. - completed_at: - anyOf: - - type: integer - format: unixtime - description: >- - Unix timestamp (seconds) for when the job completed, if - finished. - - type: 'null' - expires_at: - anyOf: - - type: integer - format: unixtime - description: >- - Unix timestamp (seconds) for when the downloadable assets - expire, if set. - - type: 'null' - prompt: - anyOf: - - type: string - description: The prompt that was used to generate the video. - - type: 'null' - size: - $ref: '#/components/schemas/VideoSize' - description: The resolution of the generated video. - seconds: - type: string - description: >- - Duration of the generated clip in seconds. For extensions, this is - the stitched total duration. - remixed_from_video_id: - anyOf: - - type: string - description: Identifier of the source video if this video is a remix. - - type: 'null' - error: + agent: anyOf: - - $ref: '#/components/schemas/Error-2' - description: >- - Error payload that explains why generation failed, if - applicable. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - type: object - required: - - id - - object - - model - - status - - progress - - created_at - - completed_at - - expires_at - - prompt - - size - - seconds - - remixed_from_video_id - - error - title: Video job - description: Structured information describing a generated video job. - VideoListResource: - properties: - object: + description: The agent that owns this multi-agent streaming event. + type: type: string enum: - - list - description: The type of object returned, must be `list`. - default: list + - response.mcp_list_tools.completed + description: The type of the event. Always 'response.mcp_list_tools.completed'. x-stainless-const: true - data: - items: - $ref: '#/components/schemas/VideoResource' - type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: - anyOf: - - type: string - description: The ID of the last item in the list. - - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. - type: object - required: - - object - - data - - first_id - - last_id - - has_more - ImageRefParam-2: - properties: - image_url: - type: string - maxLength: 20971520 - format: uri - description: A fully qualified URL or base64-encoded data URL. - file_id: - type: string - example: file-123 - type: object - required: [] - VideoSeconds: - type: string - enum: - - '4' - - '8' - - '12' - CreateVideoMultipartBody: - properties: - model: - $ref: '#/components/schemas/VideoModel' - description: >- - The video generation model to use (allowed values: sora-2, - sora-2-pro). Defaults to `sora-2`. - prompt: - type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes the video to generate. - input_reference: - oneOf: - - type: string - format: binary - description: >- - Optional reference asset upload or reference object that guides - generation. - - $ref: '#/components/schemas/ImageRefParam-2' - seconds: - $ref: '#/components/schemas/VideoSeconds' - description: >- - Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 - seconds. - size: - $ref: '#/components/schemas/VideoSize' - description: >- - Output resolution formatted as width x height (allowed values: - 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280. - type: object - required: - - prompt - title: Create video multipart request - description: Multipart parameters for creating a new video generation job. - CreateVideoJsonBody: - properties: - model: - $ref: '#/components/schemas/VideoModel' - description: >- - The video generation model to use (allowed values: sora-2, - sora-2-pro). Defaults to `sora-2`. - prompt: + item_id: type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes the video to generate. - input_reference: - $ref: '#/components/schemas/ImageRefParam-2' - description: >- - Optional reference object that guides generation. Provide exactly - one of `image_url` or `file_id`. - seconds: - $ref: '#/components/schemas/VideoSeconds' - description: >- - Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 - seconds. - size: - $ref: '#/components/schemas/VideoSize' - description: >- - Output resolution formatted as width x height (allowed values: - 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280. - type: object + description: The ID of the MCP tool call item that produced this output. + output_index: + type: integer + description: The index of the output item that was processed. + sequence_number: + type: integer + description: The sequence number of this event. required: - - prompt - title: Create video JSON request - description: JSON parameters for creating a new video generation job. - CreateVideoCharacterBody: - properties: - video: - type: string - format: binary - description: Video file used to create a character. - name: - type: string - maxLength: 80 - minLength: 1 - description: Display name for this API character. + - type + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_list_tools.completed + group: responses + example: | + { + "type": "response.mcp_list_tools.completed", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" + } + BetaResponseMCPCallInProgressEvent: type: object - required: - - video - - name - title: Create character request - description: Parameters for creating a character from an uploaded video. - VideoCharacterResource: + title: ResponseMCPCallInProgressEvent + description: | + Emitted when an MCP tool call is in progress. properties: - id: + agent: anyOf: - - type: string - description: Identifier for the character creation cameo. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - name: + description: The agent that owns this multi-agent streaming event. + type: + type: string + enum: + - response.mcp_call.in_progress + description: The type of the event. Always 'response.mcp_call.in_progress'. + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number of this event. + output_index: + type: integer + description: The index of the output item in the response's output array. + item_id: + type: string + description: The unique identifier of the MCP tool call item being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.mcp_call.in_progress + group: responses + example: | + { + "type": "response.mcp_call.in_progress", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90" + } + BetaResponseMCPCallFailedEvent: + type: object + title: ResponseMCPCallFailedEvent + description: | + Emitted when an MCP tool call has failed. + properties: + agent: anyOf: - - type: string - description: Display name for the character. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - created_at: + description: The agent that owns this multi-agent streaming event. + type: + type: string + enum: + - response.mcp_call.failed + description: The type of the event. Always 'response.mcp_call.failed'. + x-stainless-const: true + item_id: + type: string + description: The ID of the MCP tool call item that failed. + output_index: type: integer - format: unixtime - description: Unix timestamp (in seconds) when the character was created. - type: object + description: The index of the output item that failed. + sequence_number: + type: integer + description: The sequence number of this event. required: - - id - - name - - created_at - VideoReferenceInputParam: + - type + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_call.failed + group: responses + example: | + { + "type": "response.mcp_call.failed", + "sequence_number": 1, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", + "output_index": 0 + } + BetaResponseMCPCallCompletedEvent: + type: object + title: ResponseMCPCallCompletedEvent + description: | + Emitted when an MCP tool call has completed successfully. properties: - id: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string - description: The identifier of the completed video. - example: video_123 - type: object + enum: + - response.mcp_call.completed + description: The type of the event. Always 'response.mcp_call.completed'. + x-stainless-const: true + item_id: + type: string + description: The ID of the MCP tool call item that completed. + output_index: + type: integer + description: The index of the output item that completed. + sequence_number: + type: integer + description: The sequence number of this event. required: - - id - description: Reference to the completed video. - CreateVideoEditMultipartBody: + - type + - item_id + - output_index + - sequence_number + x-oaiMeta: + name: response.mcp_call.completed + group: responses + example: | + { + "type": "response.mcp_call.completed", + "sequence_number": 1, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", + "output_index": 0 + } + BetaResponseMCPCallArgumentsDoneEvent: + type: object + title: ResponseMCPCallArgumentsDoneEvent + description: | + Emitted when the arguments for an MCP tool call are finalized. properties: - video: - oneOf: - - type: string - format: binary - description: Reference to the completed video to edit. - - $ref: '#/components/schemas/VideoReferenceInputParam' - prompt: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes how to edit the source video. - type: object + enum: + - response.mcp_call_arguments.done + description: The type of the event. Always 'response.mcp_call_arguments.done'. + x-stainless-const: true + output_index: + type: integer + description: The index of the output item in the response's output array. + item_id: + type: string + description: The unique identifier of the MCP tool call item being processed. + arguments: + type: string + description: > + A JSON string containing the finalized arguments for the MCP tool + call. + sequence_number: + type: integer + description: The sequence number of this event. required: - - video - - prompt - title: Create video edit multipart request - description: Parameters for editing an existing generated video. - CreateVideoEditJsonBody: + - type + - output_index + - item_id + - arguments + - sequence_number + x-oaiMeta: + name: response.mcp_call_arguments.done + group: responses + example: | + { + "type": "response.mcp_call_arguments.done", + "output_index": 0, + "item_id": "item-abc", + "arguments": "{\"arg1\": \"value1\", \"arg2\": \"value2\"}", + "sequence_number": 1 + } + BetaResponseMCPCallArgumentsDeltaEvent: + type: object + title: ResponseMCPCallArgumentsDeltaEvent + description: > + Emitted when there is a delta (partial update) to the arguments of an + MCP tool call. properties: - video: - $ref: '#/components/schemas/VideoReferenceInputParam' - description: Reference to the completed video to edit. - prompt: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes how to edit the source video. - type: object + enum: + - response.mcp_call_arguments.delta + description: The type of the event. Always 'response.mcp_call_arguments.delta'. + x-stainless-const: true + output_index: + type: integer + description: The index of the output item in the response's output array. + item_id: + type: string + description: The unique identifier of the MCP tool call item being processed. + delta: + type: string + description: > + A JSON string containing the partial update to the arguments for the + MCP tool call. + sequence_number: + type: integer + description: The sequence number of this event. required: - - video - - prompt - title: Create video edit JSON request - description: JSON parameters for editing an existing generated video. - CreateVideoExtendMultipartBody: + - type + - output_index + - item_id + - delta + - sequence_number + x-oaiMeta: + name: response.mcp_call_arguments.delta + group: responses + example: | + { + "type": "response.mcp_call_arguments.delta", + "output_index": 0, + "item_id": "item-abc", + "delta": "{", + "sequence_number": 1 + } + BetaResponseImageGenCallPartialImageEvent: + type: object + title: ResponseImageGenCallPartialImageEvent + description: > + Emitted when a partial image is available during image generation + streaming. properties: - video: - oneOf: - - $ref: '#/components/schemas/VideoReferenceInputParam' - - type: string - format: binary - description: Reference to the completed video to extend. - prompt: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string - maxLength: 32000 - minLength: 1 - description: Updated text prompt that directs the extension generation. - seconds: - $ref: '#/components/schemas/VideoSeconds' + enum: + - response.image_generation_call.partial_image description: >- - Length of the newly generated extension segment in seconds (allowed - values: 4, 8, 12, 16, 20). - type: object - required: - - video - - prompt - - seconds - title: Create video extension multipart request - description: Multipart parameters for extending an existing generated video. - CreateVideoExtendJsonBody: - properties: - video: - $ref: '#/components/schemas/VideoReferenceInputParam' - description: Reference to the completed video to extend. - prompt: + The type of the event. Always + 'response.image_generation_call.partial_image'. + x-stainless-const: true + output_index: + type: integer + description: The index of the output item in the response's output array. + item_id: type: string - maxLength: 32000 - minLength: 1 - description: Updated text prompt that directs the extension generation. - seconds: - $ref: '#/components/schemas/VideoSeconds' + description: The unique identifier of the image generation item being processed. + sequence_number: + type: integer + description: The sequence number of the image generation item being processed. + partial_image_index: + type: integer description: >- - Length of the newly generated extension segment in seconds (allowed - values: 4, 8, 12, 16, 20). - type: object + 0-based index for the partial image (backend is 1-based, but this is + 0-based for the user). + partial_image_b64: + type: string + description: >- + Base64-encoded partial image data, suitable for rendering as an + image. required: - - video - - prompt - - seconds - title: Create video extension JSON request - description: JSON parameters for extending an existing generated video. - DeletedVideoResource: + - type + - output_index + - item_id + - sequence_number + - partial_image_index + - partial_image_b64 + x-oaiMeta: + name: response.image_generation_call.partial_image + group: responses + example: | + { + "type": "response.image_generation_call.partial_image", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0, + "partial_image_index": 0, + "partial_image_b64": "..." + } + BetaResponseImageGenCallInProgressEvent: + type: object + title: ResponseImageGenCallInProgressEvent + description: | + Emitted when an image generation tool call is in progress. properties: - object: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string enum: - - video.deleted - description: The object type that signals the deletion response. - default: video.deleted + - response.image_generation_call.in_progress + description: >- + The type of the event. Always + 'response.image_generation_call.in_progress'. x-stainless-const: true - deleted: - type: boolean - description: Indicates that the video resource was deleted. - id: + output_index: + type: integer + description: The index of the output item in the response's output array. + item_id: type: string - description: Identifier of the deleted video. - type: object + description: The unique identifier of the image generation item being processed. + sequence_number: + type: integer + description: The sequence number of the image generation item being processed. required: - - object - - deleted - - id - title: Deleted video response - description: Confirmation payload returned after deleting a video. - VideoContentVariant: - type: string - enum: - - video - - thumbnail - - spritesheet - CreateVideoRemixBody: - properties: - prompt: - type: string - maxLength: 32000 - minLength: 1 - description: Updated text prompt that directs the remix generation. + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.image_generation_call.in_progress + group: responses + example: | + { + "type": "response.image_generation_call.in_progress", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0 + } + BetaResponseImageGenCallGeneratingEvent: type: object - required: - - prompt - title: Create video remix request - description: Parameters for remixing an existing generated video. - TruncationEnum: - type: string - enum: - - auto - - disabled - PersonalityEnum: - anyOf: - - type: string - - type: string - enum: - - friendly - - pragmatic - TokenCountsBody: + title: ResponseImageGenCallGeneratingEvent + description: > + Emitted when an image generation tool call is actively generating an + image (intermediate state). properties: - model: - anyOf: - - type: string - description: >- - Model ID used to generate the response, like `gpt-4o` or `o3`. - OpenAI offers a wide range of models with different - capabilities, performance characteristics, and price points. - Refer to the [model guide](/docs/models) to browse and compare - available models. - - type: 'null' - input: - anyOf: - - oneOf: - - type: string - maxLength: 10485760 - description: >- - A text input to the model, equivalent to a text input with - the `user` role. - - items: - $ref: '#/components/schemas/InputItem' - type: array - description: >- - A list of one or many input items to the model, containing - different content types. - description: >- - Text, image, or file inputs to the model, used to generate a - response - - type: 'null' - previous_response_id: - anyOf: - - type: string - description: >- - The unique ID of the previous response to the model. Use this to - create multi-turn conversations. Learn more about [conversation - state](/docs/guides/conversation-state). Cannot be used in - conjunction with `conversation`. - example: resp_123 - - type: 'null' - tools: - anyOf: - - items: - $ref: '#/components/schemas/Tool' - type: array - description: >- - An array of tools the model may call while generating a - response. You can specify which tool to use by setting the - `tool_choice` parameter. - - type: 'null' - text: - anyOf: - - $ref: '#/components/schemas/ResponseTextParam' - - type: 'null' - reasoning: + agent: anyOf: - - $ref: '#/components/schemas/Reasoning' - description: >- - **gpt-5 and o-series models only** Configuration options for - [reasoning - models](https://platform.openai.com/docs/guides/reasoning). + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - truncation: - $ref: '#/components/schemas/TruncationEnum' + description: The agent that owns this multi-agent streaming event. + type: + type: string + enum: + - response.image_generation_call.generating description: >- - The truncation strategy to use for the model response. - `auto`: If - the input to this Response exceeds the model's context window size, - the model will truncate the response to fit the context window by - dropping items from the beginning of the conversation. - `disabled` - (default): If the input size will exceed the context window size for - a model, the request will fail with a 400 error. - instructions: + The type of the event. Always + 'response.image_generation_call.generating'. + x-stainless-const: true + output_index: + type: integer + description: The index of the output item in the response's output array. + item_id: + type: string + description: The unique identifier of the image generation item being processed. + sequence_number: + type: integer + description: The sequence number of the image generation item being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.image_generation_call.generating + group: responses + example: | + { + "type": "response.image_generation_call.generating", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0 + } + BetaResponseImageGenCallCompletedEvent: + type: object + title: ResponseImageGenCallCompletedEvent + description: > + Emitted when an image generation tool call has completed and the final + image is available. + properties: + agent: anyOf: - - type: string - description: >- - A system (or developer) message inserted into the model's - context. - - When used along with `previous_response_id`, the instructions - from a previous response will not be carried over to the next - response. This makes it simple to swap out system (or developer) - messages in new responses. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - personality: - $ref: '#/components/schemas/PersonalityEnum' + description: The agent that owns this multi-agent streaming event. + type: + type: string + enum: + - response.image_generation_call.completed description: >- - A model-owned style preset to apply to this request. Omit this - parameter to use the model's default style. Supported values may - expand over time. Values must be at most 64 characters. - conversation: - anyOf: - - $ref: '#/components/schemas/ConversationParam' - - type: 'null' - tool_choice: + The type of the event. Always + 'response.image_generation_call.completed'. + x-stainless-const: true + output_index: + type: integer + description: The index of the output item in the response's output array. + sequence_number: + type: integer + description: The sequence number of this event. + item_id: + type: string + description: The unique identifier of the image generation item being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.image_generation_call.completed + group: responses + example: | + { + "type": "response.image_generation_call.completed", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 1 + } + BetaResponseReasoningTextDoneEvent: + type: object + description: Emitted when a reasoning text is completed. + properties: + agent: anyOf: - - $ref: '#/components/schemas/ToolChoiceParam' - description: Controls which tool the model should use, if any. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - parallel_tool_calls: + description: The agent that owns this multi-agent streaming event. + type: + type: string + description: | + The type of the event. Always `response.reasoning_text.done`. + enum: + - response.reasoning_text.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this reasoning text is associated with. + output_index: + type: integer + description: | + The index of the output item this reasoning text is associated with. + content_index: + type: integer + description: | + The index of the reasoning content part. + text: + type: string + description: | + The full text of the completed reasoning content. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - text + - sequence_number + x-oaiMeta: + name: response.reasoning_text.done + group: responses + example: | + { + "type": "response.reasoning_text.done", + "item_id": "rs_123", + "output_index": 0, + "content_index": 0, + "text": "The user is asking...", + "sequence_number": 4 + } + BetaResponseReasoningTextDeltaEvent: + type: object + description: Emitted when a delta is added to a reasoning text. + properties: + agent: anyOf: - - type: boolean - description: Whether to allow the model to run tool calls in parallel. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: + type: string + description: | + The type of the event. Always `response.reasoning_text.delta`. + enum: + - response.reasoning_text.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this reasoning text delta is associated with. + output_index: + type: integer + description: > + The index of the output item this reasoning text delta is associated + with. + content_index: + type: integer + description: > + The index of the reasoning content part this delta is associated + with. + delta: + type: string + description: | + The text delta that was added to the reasoning content. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - delta + - sequence_number + x-oaiMeta: + name: response.reasoning_text.delta + group: responses + example: | + { + "type": "response.reasoning_text.delta", + "item_id": "rs_123", + "output_index": 0, + "content_index": 0, + "delta": "The", + "sequence_number": 1 + } + BetaResponseReasoningSummaryTextDoneEvent: type: object - required: [] - TokenCountsResource: + description: Emitted when a reasoning summary text is completed. properties: - object: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string + description: > + The type of the event. Always + `response.reasoning_summary_text.done`. enum: - - response.input_tokens - default: response.input_tokens + - response.reasoning_summary_text.done x-stainless-const: true - input_tokens: + item_id: + type: string + description: | + The ID of the item this summary text is associated with. + output_index: type: integer - type: object + description: | + The index of the output item this summary text is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + text: + type: string + description: | + The full text of the completed reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. required: - - object - - input_tokens - title: Token counts - example: - object: response.input_tokens - input_tokens: 123 - PromptCacheRetentionEnum: - type: string - enum: - - in_memory - - 24h - ServiceTierEnum: - type: string - enum: - - auto - - default - - flex - - priority - CompactResponseMethodPublicBody: + - type + - item_id + - output_index + - summary_index + - text + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_text.done + group: responses + example: | + { + "type": "response.reasoning_summary_text.done", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "text": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!", + "sequence_number": 1 + } + BetaResponseReasoningSummaryTextDeltaEvent: + type: object + description: Emitted when a delta is added to a reasoning summary text. properties: - model: - $ref: '#/components/schemas/ModelIdsCompaction' - input: + agent: anyOf: - - oneOf: - - type: string - maxLength: 10485760 - description: >- - A text input to the model, equivalent to a text input with - the `user` role. - - items: - $ref: '#/components/schemas/InputItem' - type: array - description: >- - A list of one or many input items to the model, containing - different content types. - description: >- - Text, image, or file inputs to the model, used to generate a - response + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - previous_response_id: + description: The agent that owns this multi-agent streaming event. + type: + type: string + description: > + The type of the event. Always + `response.reasoning_summary_text.delta`. + enum: + - response.reasoning_summary_text.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this summary text delta is associated with. + output_index: + type: integer + description: > + The index of the output item this summary text delta is associated + with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + delta: + type: string + description: | + The text delta that was added to the summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - summary_index + - delta + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_text.delta + group: responses + example: | + { + "type": "response.reasoning_summary_text.delta", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "delta": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!", + "sequence_number": 1 + } + BetaResponseReasoningSummaryPartDoneEvent: + type: object + description: Emitted when a reasoning summary part is completed. + properties: + agent: anyOf: - - type: string - description: >- - The unique ID of the previous response to the model. Use this to - create multi-turn conversations. Learn more about [conversation - state](/docs/guides/conversation-state). Cannot be used in - conjunction with `conversation`. - example: resp_123 + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - instructions: - anyOf: - - type: string - description: >- - A system (or developer) message inserted into the model's - context. + description: The agent that owns this multi-agent streaming event. + type: + type: string + description: > + The type of the event. Always + `response.reasoning_summary_part.done`. + enum: + - response.reasoning_summary_part.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this summary part is associated with. + output_index: + type: integer + description: | + The index of the output item this summary part is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + status: + type: string + description: > + The completion status of the summary part. Omitted when the part + completed - When used along with `previous_response_id`, the instructions - from a previous response will not be carried over to the next - response. This makes it simple to swap out system (or developer) - messages in new responses. - - type: 'null' - prompt_cache_key: - anyOf: - - type: string - maxLength: 64 - description: A key to use when reading from or writing to the prompt cache. - - type: 'null' - prompt_cache_retention: - anyOf: - - $ref: '#/components/schemas/PromptCacheRetentionEnum' - description: How long to retain a prompt cache entry created by this request. - - type: 'null' - service_tier: - anyOf: - - $ref: '#/components/schemas/ServiceTierEnum' - description: The service tier to use for this request. - - type: 'null' - type: object + normally and set to `incomplete` when generation was interrupted. + enum: + - incomplete + sequence_number: + type: integer + description: | + The sequence number of this event. + part: + type: object + description: | + The completed summary part. + properties: + type: + type: string + description: The type of the summary part. Always `summary_text`. + enum: + - summary_text + x-stainless-const: true + text: + type: string + description: The text of the summary part. + required: + - type + - text required: - - model - ItemField: - oneOf: - - $ref: '#/components/schemas/Message' - - $ref: '#/components/schemas/FunctionToolCall' - - $ref: '#/components/schemas/ToolSearchCall' - - $ref: '#/components/schemas/ToolSearchOutput' - - $ref: '#/components/schemas/AdditionalTools' - - $ref: '#/components/schemas/FunctionToolCallOutput' - - $ref: '#/components/schemas/FileSearchToolCall' - - $ref: '#/components/schemas/WebSearchToolCall' - - $ref: '#/components/schemas/ImageGenToolCall' - - $ref: '#/components/schemas/ComputerToolCall' - - $ref: '#/components/schemas/ComputerToolCallOutputResource' - - $ref: '#/components/schemas/ReasoningItem' - - $ref: '#/components/schemas/CompactionBody' - - $ref: '#/components/schemas/CodeInterpreterToolCall' - - $ref: '#/components/schemas/LocalShellToolCall' - deprecated: true - - $ref: '#/components/schemas/LocalShellToolCallOutput' - deprecated: true - - $ref: '#/components/schemas/FunctionShellCall' - - $ref: '#/components/schemas/FunctionShellCallOutput' - - $ref: '#/components/schemas/ApplyPatchToolCall' - - $ref: '#/components/schemas/ApplyPatchToolCallOutput' - - $ref: '#/components/schemas/MCPListTools' - - $ref: '#/components/schemas/MCPApprovalRequest' - - $ref: '#/components/schemas/MCPApprovalResponseResource' - - $ref: '#/components/schemas/MCPToolCall' - - $ref: '#/components/schemas/CustomToolCall' - - $ref: '#/components/schemas/CustomToolCallOutput' - description: >- - An item representing a message, tool call, tool output, reasoning, or - other response element. - discriminator: - propertyName: type - CompactResource: + - type + - item_id + - output_index + - summary_index + - part + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_part.done + group: responses + example: | + { + "type": "response.reasoning_summary_part.done", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "part": { + "type": "summary_text", + "text": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!" + }, + "sequence_number": 1 + } + BetaResponseReasoningSummaryPartAddedEvent: + type: object + description: Emitted when a new reasoning summary part is added. properties: - id: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string - description: The unique identifier for the compacted response. - object: + description: > + The type of the event. Always + `response.reasoning_summary_part.added`. + enum: + - response.reasoning_summary_part.added + x-stainless-const: true + item_id: + type: string + description: | + The ID of the item this summary part is associated with. + output_index: + type: integer + description: | + The index of the output item this summary part is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + part: + type: object + description: | + The summary part that was added. + properties: + type: + type: string + description: The type of the summary part. Always `summary_text`. + enum: + - summary_text + x-stainless-const: true + text: + type: string + description: The text of the summary part. + required: + - type + - text + required: + - type + - item_id + - output_index + - summary_index + - part + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_part.added + group: responses + example: | + { + "type": "response.reasoning_summary_part.added", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "part": { + "type": "summary_text", + "text": "" + }, + "sequence_number": 1 + } + BetaResponseTextDoneEvent: + type: object + description: Emitted when text content is finalized. + properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string + description: | + The type of the event. Always `response.output_text.done`. enum: - - response.compaction - description: The object type. Always `response.compaction`. - default: response.compaction + - response.output_text.done x-stainless-const: true - output: - items: - $ref: '#/components/schemas/ItemField' - type: array - description: The compacted list of output items. - created_at: + item_id: + type: string + description: | + The ID of the output item that the text content is finalized. + output_index: type: integer - format: unixtime - description: >- - Unix timestamp (in seconds) when the compacted conversation was - created. - usage: - $ref: '#/components/schemas/ResponseUsage' - description: >- - Token accounting for the compaction pass, including cached, - reasoning, and total tokens. - type: object + description: | + The index of the output item that the text content is finalized. + content_index: + type: integer + description: | + The index of the content part that the text content is finalized. + text: + type: string + description: | + The text content that is finalized. + sequence_number: + type: integer + description: The sequence number for this event. + logprobs: + type: array + description: | + The log probabilities of the tokens in the delta. + items: + $ref: '#/components/schemas/BetaResponseLogProb' required: - - id - - object - - output - - created_at - - usage - title: The compacted response object - example: - id: resp_001 - object: response.compaction - output: - - type: message - role: user - content: - - type: input_text - text: Summarize our launch checklist from last week. - - type: message - role: user - content: - - type: input_text - text: You are performing a CONTEXT CHECKPOINT COMPACTION... - - type: compaction - id: cmp_001 - encrypted_content: encrypted-summary - created_at: 1731459200 - usage: - input_tokens: 42897 - output_tokens: 12000 - total_tokens: 54912 - SkillResource: + - type + - item_id + - output_index + - content_index + - text + - sequence_number + - logprobs + x-oaiMeta: + name: response.output_text.done + group: responses + example: | + { + "type": "response.output_text.done", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "sequence_number": 1 + } + BetaResponseLogProb: + type: object + description: > + A logprob is the logarithmic probability that the model assigns to + producing + + a particular token at a given position in the sequence. Less-negative + (higher) + + logprob values indicate greater model confidence in that token choice. properties: - id: + token: + description: A possible text token. type: string - description: Unique identifier for the skill. - object: + logprob: + description: | + The log probability of this token. + type: number + top_logprobs: + description: | + The log probabilities of up to 20 of the most likely tokens. + type: array + items: + type: object + properties: + token: + description: A possible text token. + type: string + logprob: + description: The log probability of this token. + type: number + required: + - token + - logprob + BetaResponseTextDeltaEvent: + type: object + description: Emitted when there is an additional text delta. + properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string + description: | + The type of the event. Always `response.output_text.delta`. enum: - - skill - description: The object type, which is `skill`. - default: skill + - response.output_text.delta x-stainless-const: true - name: - type: string - description: Name of the skill. - description: + item_id: type: string - description: Description of the skill. - created_at: + description: | + The ID of the output item that the text delta was added to. + output_index: type: integer - format: unixtime - description: Unix timestamp (seconds) for when the skill was created. - default_version: - type: string - description: Default version for the skill. - latest_version: + description: | + The index of the output item that the text delta was added to. + content_index: + type: integer + description: | + The index of the content part that the text delta was added to. + delta: type: string - description: Latest version for the skill. - type: object + description: | + The text delta that was added. + sequence_number: + type: integer + description: The sequence number for this event. + logprobs: + type: array + description: | + The log probabilities of the tokens in the delta. + items: + $ref: '#/components/schemas/BetaResponseLogProb' required: - - id - - object - - name - - description - - created_at - - default_version - - latest_version - SkillListResource: + - type + - item_id + - output_index + - content_index + - delta + - sequence_number + - logprobs + x-oaiMeta: + name: response.output_text.delta + group: responses + example: | + { + "type": "response.output_text.delta", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "delta": "In", + "sequence_number": 1 + } + BetaResponseRefusalDoneEvent: + type: object + description: Emitted when refusal text is finalized. properties: - object: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string + description: | + The type of the event. Always `response.refusal.done`. enum: - - list - description: The type of object returned, must be `list`. - default: list + - response.refusal.done x-stainless-const: true - data: - items: - $ref: '#/components/schemas/SkillResource' - type: array - description: A list of items - first_id: + item_id: + type: string + description: | + The ID of the output item that the refusal text is finalized. + output_index: + type: integer + description: | + The index of the output item that the refusal text is finalized. + content_index: + type: integer + description: | + The index of the content part that the refusal text is finalized. + refusal: + type: string + description: | + The refusal text that is finalized. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - refusal + - sequence_number + x-oaiMeta: + name: response.refusal.done + group: responses + example: | + { + "type": "response.refusal.done", + "item_id": "item-abc", + "output_index": 1, + "content_index": 2, + "refusal": "final refusal text", + "sequence_number": 1 + } + BetaResponseRefusalDeltaEvent: + type: object + description: Emitted when there is a partial refusal text. + properties: + agent: anyOf: - - type: string - description: The ID of the first item in the list. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - last_id: + description: The agent that owns this multi-agent streaming event. + type: + type: string + description: | + The type of the event. Always `response.refusal.delta`. + enum: + - response.refusal.delta + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the refusal text is added to. + output_index: + type: integer + description: | + The index of the output item that the refusal text is added to. + content_index: + type: integer + description: | + The index of the content part that the refusal text is added to. + delta: + type: string + description: | + The refusal text that is added. + sequence_number: + type: integer + description: | + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - delta + - sequence_number + x-oaiMeta: + name: response.refusal.delta + group: responses + example: | + { + "type": "response.refusal.delta", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "delta": "refusal text so far", + "sequence_number": 1 + } + BetaResponseOutputItemDoneEvent: + type: object + description: Emitted when an output item is marked done. + properties: + agent: anyOf: - - type: string - description: The ID of the last item in the list. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. - type: object + description: The agent that owns this multi-agent streaming event. + type: + type: string + description: | + The type of the event. Always `response.output_item.done`. + enum: + - response.output_item.done + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that was marked done. + sequence_number: + type: integer + description: | + The sequence number of this event. + item: + $ref: '#/components/schemas/BetaOutputItem' + description: | + The output item that was marked done. required: - - object - - data - - first_id - - last_id - - has_more - CreateSkillBody: - properties: - files: - oneOf: - - items: - type: string - format: binary - type: array - maxItems: 500 - description: Skill files to upload (directory upload) or a single zip file. - - type: string - format: binary - description: Skill zip file to upload. + - type + - output_index + - item + - sequence_number + x-oaiMeta: + name: response.output_item.done + group: responses + example: | + { + "type": "response.output_item.done", + "output_index": 0, + "item": { + "id": "msg_123", + "status": "completed", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "annotations": [] + } + ] + }, + "sequence_number": 1 + } + BetaResponseOutputItemAddedEvent: type: object - required: - - files - title: Create skill request - description: >- - Uploads a skill either as a directory (multipart `files[]`) or as a - single zip file. - SetDefaultSkillVersionBody: + description: Emitted when a new output item is added. properties: - default_version: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string - description: The skill version number to set as default. - type: object + description: | + The type of the event. Always `response.output_item.added`. + enum: + - response.output_item.added + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that was added. + sequence_number: + type: integer + description: | + The sequence number of this event. + item: + $ref: '#/components/schemas/BetaOutputItem' + description: | + The output item that was added. required: - - default_version - title: Update skill request - description: Updates the default version pointer for a skill. - DeletedSkillResource: + - type + - output_index + - item + - sequence_number + x-oaiMeta: + name: response.output_item.added + group: responses + example: | + { + "type": "response.output_item.added", + "output_index": 0, + "item": { + "id": "msg_123", + "status": "in_progress", + "type": "message", + "role": "assistant", + "content": [] + }, + "sequence_number": 1 + } + BetaResponseInProgressEvent: + type: object + description: Emitted when the response is in progress. properties: - object: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string + description: | + The type of the event. Always `response.in_progress`. enum: - - skill.deleted - default: skill.deleted + - response.in_progress x-stainless-const: true - deleted: - type: boolean - id: - type: string - type: object + response: + $ref: '#/components/schemas/BetaResponse' + description: | + The response that is in progress. + sequence_number: + type: integer + description: The sequence number of this event. required: - - object - - deleted - - id - SkillVersionResource: + - type + - response + - sequence_number + x-oaiMeta: + name: response.in_progress + group: responses + example: | + { + "type": "response.in_progress", + "response": { + "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", + "object": "response", + "created_at": 1741487325, + "status": "in_progress", + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", + "output": [], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + BetaResponseFunctionCallArgumentsDoneEvent: + type: object + description: Emitted when function-call arguments are finalized. properties: - object: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string enum: - - skill.version - description: The object type, which is `skill.version`. - default: skill.version + - response.function_call_arguments.done x-stainless-const: true - id: - type: string - description: Unique identifier for the skill version. - skill_id: - type: string - description: Identifier of the skill for this version. - version: + item_id: type: string - description: Version number for this skill. - created_at: - type: integer - format: unixtime - description: Unix timestamp (seconds) for when the version was created. + description: The ID of the item. name: type: string - description: Name of the skill version. - description: + description: The name of the function that was called. + output_index: + type: integer + description: The index of the output item. + sequence_number: + type: integer + description: The sequence number of this event. + arguments: type: string - description: Description of the skill version. - type: object + description: The function-call arguments. required: - - object - - id - - skill_id - - version - - created_at + - type + - item_id - name - - description - SkillVersionListResource: + - output_index + - arguments + - sequence_number + x-oaiMeta: + name: response.function_call_arguments.done + group: responses + example: | + { + "type": "response.function_call_arguments.done", + "item_id": "item-abc", + "name": "get_weather", + "output_index": 1, + "arguments": "{ \"arg\": 123 }", + "sequence_number": 1 + } + BetaResponseFunctionCallArgumentsDeltaEvent: + type: object + description: Emitted when there is a partial function-call arguments delta. properties: - object: - type: string - enum: - - list - description: The type of object returned, must be `list`. - default: list - x-stainless-const: true - data: - items: - $ref: '#/components/schemas/SkillVersionResource' - type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: + agent: anyOf: - - type: string - description: The ID of the last item in the list. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. - type: object - required: - - object - - data - - first_id - - last_id - - has_more - CreateSkillVersionBody: - properties: - files: - oneOf: - - items: - type: string - format: binary - type: array - maxItems: 500 - description: Skill files to upload (directory upload) or a single zip file. - - type: string - format: binary - description: Skill zip file to upload. - default: - type: boolean - description: Whether to set this version as the default. - type: object - required: - - files - title: Create skill version request - description: Uploads a new immutable version of a skill. - DeletedSkillVersionResource: - properties: - object: + description: The agent that owns this multi-agent streaming event. + type: type: string + description: > + The type of the event. Always + `response.function_call_arguments.delta`. enum: - - skill.version.deleted - default: skill.version.deleted + - response.function_call_arguments.delta x-stainless-const: true - deleted: - type: boolean - id: + item_id: type: string - version: + description: > + The ID of the output item that the function-call arguments delta is + added to. + output_index: + type: integer + description: > + The index of the output item that the function-call arguments delta + is added to. + sequence_number: + type: integer + description: The sequence number of this event. + delta: type: string - description: The deleted skill version. - type: object + description: | + The function-call arguments delta that is added. required: - - object - - deleted - - id - - version - ChatkitWorkflowTracing: - properties: - enabled: - type: boolean - description: Indicates whether tracing is enabled. + - type + - item_id + - output_index + - delta + - sequence_number + x-oaiMeta: + name: response.function_call_arguments.delta + group: responses + example: | + { + "type": "response.function_call_arguments.delta", + "item_id": "item-abc", + "output_index": 0, + "delta": "{ \"arg\":" + "sequence_number": 1 + } + BetaResponseFileSearchCallSearchingEvent: type: object - required: - - enabled - title: Tracing Configuration - description: Controls diagnostic tracing during the session. - ChatkitWorkflow: + description: Emitted when a file search is currently searching. properties: - id: - type: string - description: Identifier of the workflow backing the session. - version: - anyOf: - - type: string - description: >- - Specific workflow version used for the session. Defaults to null - when using the latest deployment. - - type: 'null' - state_variables: + agent: anyOf: - - additionalProperties: - oneOf: - - type: string - - type: integer - - type: boolean - - type: number - type: object - description: >- - State variable key-value pairs applied when invoking the - workflow. Defaults to null when no overrides were provided. - x-oaiTypeLabel: map + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - tracing: - $ref: '#/components/schemas/ChatkitWorkflowTracing' - description: Tracing settings applied to the workflow. - type: object - required: - - id - - version - - state_variables - - tracing - title: Workflow - description: Workflow metadata and state returned for the session. - ChatSessionRateLimits: - properties: - max_requests_per_1_minute: + description: The agent that owns this multi-agent streaming event. + type: + type: string + description: | + The type of the event. Always `response.file_search_call.searching`. + enum: + - response.file_search_call.searching + x-stainless-const: true + output_index: type: integer - description: Maximum allowed requests per one-minute window. - type: object + description: | + The index of the output item that the file search call is searching. + item_id: + type: string + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. required: - - max_requests_per_1_minute - title: Rate limits - description: Active per-minute request limit for the session. - ChatSessionStatus: - type: string - enum: - - active - - expired - - cancelled - ChatSessionAutomaticThreadTitling: - properties: - enabled: - type: boolean - description: Whether automatic thread titling is enabled. + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.file_search_call.searching + group: responses + example: | + { + "type": "response.file_search_call.searching", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 + } + BetaResponseFileSearchCallInProgressEvent: type: object - required: - - enabled - title: Automatic thread titling - description: Automatic thread title preferences for the session. - ChatSessionFileUpload: + description: Emitted when a file search call is initiated. properties: - enabled: - type: boolean - description: Indicates if uploads are enabled for the session. - max_file_size: - anyOf: - - type: integer - description: Maximum upload size in megabytes. - - type: 'null' - max_files: + agent: anyOf: - - type: integer - description: Maximum number of uploads allowed during the session. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - type: object + description: The agent that owns this multi-agent streaming event. + type: + type: string + description: > + The type of the event. Always + `response.file_search_call.in_progress`. + enum: + - response.file_search_call.in_progress + x-stainless-const: true + output_index: + type: integer + description: | + The index of the output item that the file search call is initiated. + item_id: + type: string + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. required: - - enabled - - max_file_size - - max_files - title: File upload settings - description: Upload permissions and limits applied to the session. - ChatSessionHistory: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.file_search_call.in_progress + group: responses + example: | + { + "type": "response.file_search_call.in_progress", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 + } + BetaResponseFileSearchCallCompletedEvent: + type: object + description: Emitted when a file search call is completed (results found). properties: - enabled: - type: boolean - description: Indicates if chat history is persisted for the session. - recent_threads: + agent: anyOf: - - type: integer - description: >- - Number of prior threads surfaced in history views. Defaults to - null when all history is retained. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - type: object - required: - - enabled - - recent_threads - title: History settings - description: History retention preferences returned for the session. - ChatSessionChatkitConfiguration: - properties: - automatic_thread_titling: - $ref: '#/components/schemas/ChatSessionAutomaticThreadTitling' - description: Automatic thread titling preferences. - file_upload: - $ref: '#/components/schemas/ChatSessionFileUpload' - description: Upload settings for the session. - history: - $ref: '#/components/schemas/ChatSessionHistory' - description: History retention configuration. - type: object - required: - - automatic_thread_titling - - file_upload - - history - title: ChatKit configuration - description: ChatKit configuration for the session. - ChatSessionResource: - properties: - id: - type: string - description: Identifier for the ChatKit session. - object: + description: The agent that owns this multi-agent streaming event. + type: type: string + description: | + The type of the event. Always `response.file_search_call.completed`. enum: - - chatkit.session - description: Type discriminator that is always `chatkit.session`. - default: chatkit.session + - response.file_search_call.completed x-stainless-const: true - expires_at: + output_index: type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the session expires. - client_secret: - type: string - description: Ephemeral client secret that authenticates session requests. - workflow: - $ref: '#/components/schemas/ChatkitWorkflow' - description: Workflow metadata for the session. - user: + description: | + The index of the output item that the file search call is initiated. + item_id: type: string - description: User identifier associated with the session. - rate_limits: - $ref: '#/components/schemas/ChatSessionRateLimits' - description: Resolved rate limit values. - max_requests_per_1_minute: + description: | + The ID of the output item that the file search call is initiated. + sequence_number: type: integer - description: Convenience copy of the per-minute request limit. - status: - $ref: '#/components/schemas/ChatSessionStatus' - description: Current lifecycle state of the session. - chatkit_configuration: - $ref: '#/components/schemas/ChatSessionChatkitConfiguration' - description: Resolved ChatKit feature configuration for the session. - type: object + description: The sequence number of this event. required: - - id - - object - - expires_at - - client_secret - - workflow - - user - - rate_limits - - max_requests_per_1_minute - - status - - chatkit_configuration - title: The chat session object - description: Represents a ChatKit session and its resolved configuration. - example: - id: cksess_123 - object: chatkit.session - client_secret: ek_token_123 - expires_at: 1712349876 - workflow: - id: workflow_alpha - version: 2024-10-01T00:00:00.000Z - user: user_789 - rate_limits: - max_requests_per_1_minute: 60 - max_requests_per_1_minute: 60 - status: cancelled - chatkit_configuration: - automatic_thread_titling: - enabled: true - file_upload: - enabled: true - max_file_size: 16 - max_files: 20 - history: - enabled: true - recent_threads: 10 - WorkflowTracingParam: - properties: - enabled: - type: boolean - description: Whether tracing is enabled during the session. Defaults to true. + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.file_search_call.completed + group: responses + example: | + { + "type": "response.file_search_call.completed", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 + } + BetaResponseErrorEvent: type: object - required: [] - title: Tracing Configuration - description: Controls diagnostic tracing during the session. - WorkflowParam: + description: Emitted when an error occurs. properties: - id: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string - description: Identifier for the workflow invoked by the session. - version: + description: | + The type of the event. Always `error`. + enum: + - error + x-stainless-const: true + code: + anyOf: + - type: string + description: | + The error code. + - type: 'null' + message: type: string - description: >- - Specific workflow version to run. Defaults to the latest deployed - version. - state_variables: - additionalProperties: - oneOf: - - type: string - maxLength: 10485760 - - type: integer - - type: boolean - - type: number - type: object - maxProperties: 64 - description: >- - State variables forwarded to the workflow. Keys may be up to 64 - characters, values must be primitive types, and the map defaults to - an empty object. - x-oaiTypeLabel: map - tracing: - $ref: '#/components/schemas/WorkflowTracingParam' - description: >- - Optional tracing overrides for the workflow invocation. When - omitted, tracing is enabled by default. + description: | + The error message. + param: + anyOf: + - type: string + description: | + The error parameter. + - type: 'null' + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - code + - message + - param + - sequence_number + x-oaiMeta: + name: error + group: responses + example: | + { + "type": "error", + "code": "ERR_SOMETHING", + "message": "Something went wrong", + "param": null, + "sequence_number": 1 + } + BetaResponseCreatedEvent: type: object - required: - - id - title: Workflow settings - description: Workflow reference and overrides applied to the chat session. - ExpiresAfterParam: + description: | + An event that is emitted when a response is created. properties: - anchor: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string + description: | + The type of the event. Always `response.created`. enum: - - created_at - description: >- - Base timestamp used to calculate expiration. Currently fixed to - `created_at`. - default: created_at + - response.created x-stainless-const: true - seconds: + response: + $ref: '#/components/schemas/BetaResponse' + description: | + The response that was created. + sequence_number: type: integer - maximum: 600 - minimum: 1 - format: int64 - description: Number of seconds after the anchor when the session expires. - type: object + description: The sequence number for this event. required: - - anchor - - seconds - title: Expiration overrides - description: Controls when the session expires relative to an anchor timestamp. - RateLimitsParam: - properties: - max_requests_per_1_minute: - type: integer - minimum: 1 - description: >- - Maximum number of requests allowed per minute for the session. - Defaults to 10. - type: object - required: [] - title: Rate limit overrides - description: Controls request rate limits for the session. - AutomaticThreadTitlingParam: - properties: - enabled: - type: boolean - description: Enable automatic thread title generation. Defaults to true. + - type + - response + - sequence_number + x-oaiMeta: + name: response.created + group: responses + example: | + { + "type": "response.created", + "response": { + "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", + "object": "response", + "created_at": 1741487325, + "status": "in_progress", + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-2024-08-06", + "output": [], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + BetaResponseContentPartDoneEvent: type: object - required: [] - title: Automatic thread titling configuration - description: Controls whether ChatKit automatically generates thread titles. - FileUploadParam: + description: Emitted when a content part is done. properties: - enabled: - type: boolean - description: Enable uploads for this session. Defaults to false. - max_file_size: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: + type: string + description: | + The type of the event. Always `response.content_part.done`. + enum: + - response.content_part.done + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the content part was added to. + output_index: type: integer - maximum: 512 - minimum: 1 - description: >- - Maximum size in megabytes for each uploaded file. Defaults to 512 - MB, which is the maximum allowable size. - max_files: + description: | + The index of the output item that the content part was added to. + content_index: type: integer - minimum: 1 - description: >- - Maximum number of files that can be uploaded to the session. - Defaults to 10. - type: object - required: [] - title: File upload configuration - description: Controls whether users can upload files. - HistoryParam: - properties: - enabled: - type: boolean - description: >- - Enables chat users to access previous ChatKit threads. Defaults to - true. - recent_threads: + description: | + The index of the content part that is done. + sequence_number: type: integer - minimum: 1 - description: >- - Number of recent ChatKit threads users have access to. Defaults to - unlimited when unset. + description: The sequence number of this event. + part: + $ref: '#/components/schemas/BetaOutputContent' + description: | + The content part that is done. + required: + - type + - item_id + - output_index + - content_index + - part + - sequence_number + x-oaiMeta: + name: response.content_part.done + group: responses + example: | + { + "type": "response.content_part.done", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "sequence_number": 1, + "part": { + "type": "output_text", + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "annotations": [] + } + } + BetaOutputContent: + oneOf: + - $ref: '#/components/schemas/BetaOutputTextContent' + - $ref: '#/components/schemas/BetaRefusalContent' + - $ref: '#/components/schemas/BetaReasoningTextContent' + discriminator: + propertyName: type + BetaResponseContentPartAddedEvent: type: object - required: [] - title: Chat history configuration - description: Controls how much historical context is retained for the session. - ChatkitConfigurationParam: + description: Emitted when a new content part is added. properties: - automatic_thread_titling: - $ref: '#/components/schemas/AutomaticThreadTitlingParam' - description: >- - Configuration for automatic thread titling. When omitted, automatic - thread titling is enabled by default. - file_upload: - $ref: '#/components/schemas/FileUploadParam' - description: >- - Configuration for upload enablement and limits. When omitted, - uploads are disabled by default (max_files 10, max_file_size 512 - MB). - history: - $ref: '#/components/schemas/HistoryParam' - description: >- - Configuration for chat history retention. When omitted, history is - enabled by default with no limit on recent_threads (null). + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: + type: string + description: | + The type of the event. Always `response.content_part.added`. + enum: + - response.content_part.added + x-stainless-const: true + item_id: + type: string + description: | + The ID of the output item that the content part was added to. + output_index: + type: integer + description: | + The index of the output item that the content part was added to. + content_index: + type: integer + description: | + The index of the content part that was added. + part: + $ref: '#/components/schemas/BetaOutputContent' + description: | + The content part that was added. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - part + - sequence_number + x-oaiMeta: + name: response.content_part.added + group: responses + example: | + { + "type": "response.content_part.added", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "part": { + "type": "output_text", + "text": "", + "annotations": [] + }, + "sequence_number": 1 + } + BetaResponseCompletedEvent: type: object - required: [] - title: ChatKit configuration overrides - description: Optional per-session configuration settings for ChatKit behavior. - CreateChatSessionBody: + description: Emitted when the model response is complete. properties: - workflow: - $ref: '#/components/schemas/WorkflowParam' - description: Workflow that powers the session. - user: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string - minLength: 1 - description: >- - A free-form string that identifies your end user; ensures this - Session can access other objects that have the same `user` scope. - expires_after: - $ref: '#/components/schemas/ExpiresAfterParam' - description: >- - Optional override for session expiration timing in seconds from - creation. Defaults to 10 minutes. - rate_limits: - $ref: '#/components/schemas/RateLimitsParam' - description: >- - Optional override for per-minute request limits. When omitted, - defaults to 10. - chatkit_configuration: - $ref: '#/components/schemas/ChatkitConfigurationParam' - description: Optional overrides for ChatKit runtime configuration features - type: object + description: | + The type of the event. Always `response.completed`. + enum: + - response.completed + x-stainless-const: true + response: + $ref: '#/components/schemas/BetaResponse' + description: | + Properties of the completed response. + sequence_number: + type: integer + description: The sequence number for this event. required: - - workflow - - user - title: Create chat session request - description: Parameters for provisioning a new ChatKit session. - UserMessageInputText: + - type + - response + - sequence_number + x-oaiMeta: + name: response.completed + group: responses + example: | + { + "type": "response.completed", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "completed", + "completed_at": 1740855870, + "error": null, + "incomplete_details": null, + "input": [], + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_123", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "annotations": [] + } + ] + } + ], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + BetaResponseCodeInterpreterCallInterpretingEvent: + type: object + description: >- + Emitted when the code interpreter is actively interpreting the code + snippet. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string + description: >- + The type of the event. Always + `response.code_interpreter_call.interpreting`. enum: - - input_text - description: Type discriminator that is always `input_text`. - default: input_text + - response.code_interpreter_call.interpreting x-stainless-const: true - text: + output_index: + type: integer + description: >- + The index of the output item in the response for which the code + interpreter is interpreting code. + item_id: type: string - description: Plain-text content supplied by the user. - type: object + description: The unique identifier of the code interpreter tool call item. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. required: - type - - text - title: User message input - description: Text block that a user contributed to the thread. - UserMessageQuotedText: + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call.interpreting + group: responses + example: | + { + "type": "response.code_interpreter_call.interpreting", + "output_index": 4, + "item_id": "ci_12345", + "sequence_number": 1 + } + BetaResponseCodeInterpreterCallInProgressEvent: + type: object + description: Emitted when a code interpreter call is in progress. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string + description: >- + The type of the event. Always + `response.code_interpreter_call.in_progress`. enum: - - quoted_text - description: Type discriminator that is always `quoted_text`. - default: quoted_text + - response.code_interpreter_call.in_progress x-stainless-const: true - text: + output_index: + type: integer + description: >- + The index of the output item in the response for which the code + interpreter call is in progress. + item_id: type: string - description: Quoted text content. - type: object + description: The unique identifier of the code interpreter tool call item. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. required: - type - - text - title: User message quoted text - description: Quoted snippet that the user referenced in their message. - AttachmentType: - type: string - enum: - - image - - file - Attachment: + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call.in_progress + group: responses + example: | + { + "type": "response.code_interpreter_call.in_progress", + "output_index": 0, + "item_id": "ci_12345", + "sequence_number": 1 + } + BetaResponseCodeInterpreterCallCompletedEvent: + type: object + description: Emitted when the code interpreter call is completed. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: - $ref: '#/components/schemas/AttachmentType' - description: Attachment discriminator. - id: - type: string - description: Identifier for the attachment. - name: type: string - description: Original display name for the attachment. - mime_type: + description: >- + The type of the event. Always + `response.code_interpreter_call.completed`. + enum: + - response.code_interpreter_call.completed + x-stainless-const: true + output_index: + type: integer + description: >- + The index of the output item in the response for which the code + interpreter call is completed. + item_id: type: string - description: MIME type of the attachment. - preview_url: - anyOf: - - type: string - format: uri - description: Preview URL for rendering the attachment inline. - - type: 'null' - type: object + description: The unique identifier of the code interpreter tool call item. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. required: - type - - id - - name - - mime_type - - preview_url - title: Attachment - description: Attachment metadata included on thread items. - ToolChoice: - properties: - id: - type: string - description: Identifier of the requested tool. + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call.completed + group: responses + example: | + { + "type": "response.code_interpreter_call.completed", + "output_index": 5, + "item_id": "ci_12345", + "sequence_number": 1 + } + BetaResponseCodeInterpreterCallCodeDoneEvent: type: object - required: - - id - title: Tool choice - description: Tool selection that the assistant should honor when executing the item. - InferenceOptions: + description: Emitted when the code snippet is finalized by the code interpreter. properties: - tool_choice: - anyOf: - - $ref: '#/components/schemas/ToolChoice' - description: >- - Preferred tool to invoke. Defaults to null when ChatKit should - auto-select. - - type: 'null' - model: + agent: anyOf: - - type: string - description: >- - Model name that generated the response. Defaults to null when - using the session default. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - type: object - required: - - tool_choice - - model - title: Inference options - description: Model and tool overrides applied when generating the assistant response. - UserMessageItem: - properties: - id: - type: string - description: Identifier of the thread item. - object: + description: The agent that owns this multi-agent streaming event. + type: type: string + description: >- + The type of the event. Always + `response.code_interpreter_call_code.done`. enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - response.code_interpreter_call_code.done x-stainless-const: true - created_at: + output_index: type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: + description: >- + The index of the output item in the response for which the code is + finalized. + item_id: type: string - description: Identifier of the parent thread. + description: The unique identifier of the code interpreter tool call item. + code: + type: string + description: The final code snippet output by the code interpreter. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. + required: + - type + - output_index + - item_id + - code + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call_code.done + group: responses + example: | + { + "type": "response.code_interpreter_call_code.done", + "output_index": 3, + "item_id": "ci_12345", + "code": "print('done')", + "sequence_number": 1 + } + BetaResponseCodeInterpreterCallCodeDeltaEvent: + type: object + description: Emitted when a partial code snippet is streamed by the code interpreter. + properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string + description: >- + The type of the event. Always + `response.code_interpreter_call_code.delta`. enum: - - chatkit.user_message - default: chatkit.user_message + - response.code_interpreter_call_code.delta x-stainless-const: true - content: - items: - oneOf: - - $ref: '#/components/schemas/UserMessageInputText' - - $ref: '#/components/schemas/UserMessageQuotedText' - description: Content blocks that comprise a user message. - discriminator: - propertyName: type - type: array - description: Ordered content elements supplied by the user. - attachments: - items: - $ref: '#/components/schemas/Attachment' - type: array + output_index: + type: integer description: >- - Attachments associated with the user message. Defaults to an empty - list. - inference_options: + The index of the output item in the response for which the code is + being streamed. + item_id: + type: string + description: The unique identifier of the code interpreter tool call item. + delta: + type: string + description: The partial code snippet being streamed by the code interpreter. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. + required: + - type + - output_index + - item_id + - delta + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call_code.delta + group: responses + example: | + { + "type": "response.code_interpreter_call_code.delta", + "output_index": 0, + "item_id": "ci_12345", + "delta": "print('Hello, world')", + "sequence_number": 1 + } + BetaResponseAudioTranscriptDoneEvent: + type: object + description: Emitted when the full audio transcript is completed. + properties: + agent: anyOf: - - $ref: '#/components/schemas/InferenceOptions' - description: >- - Inference overrides applied to the message. Defaults to null - when unset. + - $ref: '#/components/schemas/BetaAgentTag' - type: 'null' - type: object + description: The agent that owns this multi-agent streaming event. + type: + type: string + description: | + The type of the event. Always `response.audio.transcript.done`. + enum: + - response.audio.transcript.done + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number of this event. required: - - id - - object - - created_at - - thread_id - type - - content - - attachments - - inference_options - title: User Message Item - description: User-authored messages within a thread. - FileAnnotationSource: + - response_id + - sequence_number + x-oaiMeta: + name: response.audio.transcript.done + group: responses + example: | + { + "type": "response.audio.transcript.done", + "response_id": "resp_123", + "sequence_number": 1 + } + BetaResponseAudioTranscriptDeltaEvent: + type: object + description: Emitted when there is a partial transcript of audio. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string + description: | + The type of the event. Always `response.audio.transcript.delta`. enum: - - file - description: Type discriminator that is always `file`. - default: file + - response.audio.transcript.delta x-stainless-const: true - filename: + delta: type: string - description: Filename referenced by the annotation. - type: object + description: | + The partial transcript of the audio response. + sequence_number: + type: integer + description: The sequence number of this event. required: - type - - filename - title: File annotation source - description: Attachment source referenced by an annotation. - FileAnnotation: + - response_id + - delta + - sequence_number + x-oaiMeta: + name: response.audio.transcript.delta + group: responses + example: | + { + "type": "response.audio.transcript.delta", + "response_id": "resp_123", + "delta": " ... partial transcript ... ", + "sequence_number": 1 + } + BetaResponseAudioDoneEvent: + type: object + description: Emitted when the audio response is complete. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string + description: | + The type of the event. Always `response.audio.done`. enum: - - file - description: Type discriminator that is always `file` for this annotation. - default: file + - response.audio.done x-stainless-const: true - source: - $ref: '#/components/schemas/FileAnnotationSource' - description: File attachment referenced by the annotation. - type: object + sequence_number: + type: integer + description: | + The sequence number of the delta. required: - type - - source - title: File annotation - description: Annotation that references an uploaded file. - UrlAnnotationSource: + - sequence_number + - response_id + x-oaiMeta: + name: response.audio.done + group: responses + example: | + { + "type": "response.audio.done", + "response_id": "resp-123", + "sequence_number": 1 + } + BetaResponseAudioDeltaEvent: + type: object + description: Emitted when there is a partial audio response. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string + description: | + The type of the event. Always `response.audio.delta`. enum: - - url - description: Type discriminator that is always `url`. - default: url + - response.audio.delta x-stainless-const: true - url: + sequence_number: + type: integer + description: | + A sequence number for this chunk of the stream response. + delta: type: string - format: uri - description: URL referenced by the annotation. - type: object + description: | + A chunk of Base64 encoded response audio bytes. required: - type - - url - title: URL annotation source - description: URL backing an annotation entry. - UrlAnnotation: + - delta + - sequence_number + x-oaiMeta: + name: response.audio.delta + group: responses + example: | + { + "type": "response.audio.delta", + "response_id": "resp_123", + "delta": "base64encoded...", + "sequence_number": 1 + } + BetaResponseIncompleteEvent: + type: object + description: | + An event that is emitted when a response finishes as incomplete. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string + description: | + The type of the event. Always `response.incomplete`. enum: - - url - description: Type discriminator that is always `url` for this annotation. - default: url + - response.incomplete x-stainless-const: true - source: - $ref: '#/components/schemas/UrlAnnotationSource' - description: URL referenced by the annotation. - type: object + response: + $ref: '#/components/schemas/BetaResponse' + description: | + The response that was incomplete. + sequence_number: + type: integer + description: The sequence number of this event. required: - type - - source - title: URL annotation - description: Annotation that references a URL. - ResponseOutputText: + - response + - sequence_number + x-oaiMeta: + name: response.incomplete + group: responses + example: | + { + "type": "response.incomplete", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "incomplete", + "completed_at": null, + "error": null, + "incomplete_details": { + "reason": "max_tokens" + }, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + BetaResponseFailedEvent: + type: object + description: | + An event that is emitted when a response fails. properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string + description: | + The type of the event. Always `response.failed`. enum: - - output_text - description: Type discriminator that is always `output_text`. - default: output_text + - response.failed x-stainless-const: true - text: - type: string - description: Assistant generated text. - annotations: - items: - oneOf: - - $ref: '#/components/schemas/FileAnnotation' - - $ref: '#/components/schemas/UrlAnnotation' - description: Annotation object describing a cited source. - discriminator: - propertyName: type - type: array - description: Ordered list of annotations attached to the response text. - type: object + sequence_number: + type: integer + description: The sequence number of this event. + response: + $ref: '#/components/schemas/BetaResponse' + description: | + The response that failed. required: - type - - text - - annotations - title: Assistant message content - description: Assistant response text accompanied by optional annotations. - AssistantMessageItem: + - response + - sequence_number + x-oaiMeta: + name: response.failed + group: responses + example: | + { + "type": "response.failed", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "failed", + "completed_at": null, + "error": { + "code": "server_error", + "message": "The model failed to generate a response." + }, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + } + } + BetaResponseWebSearchCallCompletedEvent: + type: object + description: Emitted when a web search call is completed. properties: - id: - type: string - description: Identifier of the thread item. - object: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string + description: | + The type of the event. Always `response.web_search_call.completed`. enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - response.web_search_call.completed x-stainless-const: true - created_at: + output_index: type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: + description: > + The index of the output item that the web search call is associated + with. + item_id: type: string - description: Identifier of the parent thread. + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.completed + group: responses + example: | + { + "type": "response.web_search_call.completed", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + BetaResponseWebSearchCallSearchingEvent: + type: object + description: Emitted when a web search call is executing. + properties: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. type: type: string + description: | + The type of the event. Always `response.web_search_call.searching`. enum: - - chatkit.assistant_message - description: Type discriminator that is always `chatkit.assistant_message`. - default: chatkit.assistant_message + - response.web_search_call.searching x-stainless-const: true - content: - items: - $ref: '#/components/schemas/ResponseOutputText' - type: array - description: Ordered assistant response segments. - type: object + output_index: + type: integer + description: > + The index of the output item that the web search call is associated + with. + item_id: + type: string + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. required: - - id - - object - - created_at - - thread_id - type - - content - title: Assistant message - description: Assistant-authored message within a thread. - WidgetMessageItem: + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.searching + group: responses + example: | + { + "type": "response.web_search_call.searching", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + BetaResponseWebSearchCallInProgressEvent: + type: object + description: Emitted when a web search call is initiated. properties: - id: - type: string - description: Identifier of the thread item. - object: + agent: + anyOf: + - $ref: '#/components/schemas/BetaAgentTag' + - type: 'null' + description: The agent that owns this multi-agent streaming event. + type: type: string + description: > + The type of the event. Always + `response.web_search_call.in_progress`. enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - response.web_search_call.in_progress x-stainless-const: true - created_at: + output_index: type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: + description: > + The index of the output item that the web search call is associated + with. + item_id: type: string - description: Identifier of the parent thread. + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.web_search_call.in_progress + group: responses + example: | + { + "type": "response.web_search_call.in_progress", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 + } + BetaOutputAudio: + type: object + title: Output audio + description: | + An audio output from the model. + properties: type: type: string + description: | + The type of the output audio. Always `output_audio`. enum: - - chatkit.widget - description: Type discriminator that is always `chatkit.widget`. - default: chatkit.widget + - output_audio x-stainless-const: true - widget: + data: type: string - description: Serialized widget payload rendered in the UI. - type: object + description: | + Base64-encoded audio data from the model. + transcript: + type: string + description: | + The transcript of the audio data from the model. required: - - id - - object - - created_at - - thread_id - type - - widget - title: Widget message - description: Thread item that renders a widget payload. - ClientToolCallStatus: - type: string - enum: - - in_progress - - completed - ClientToolCallItem: + - data + - transcript + BetaInputAudio: + type: object + title: Input audio + description: | + An audio input to the model. properties: - id: - type: string - description: Identifier of the thread item. - object: - type: string - enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item - x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: - type: string - description: Identifier of the parent thread. type: type: string + description: | + The type of the input item. Always `input_audio`. enum: - - chatkit.client_tool_call - description: Type discriminator that is always `chatkit.client_tool_call`. - default: chatkit.client_tool_call + - input_audio x-stainless-const: true - status: - $ref: '#/components/schemas/ClientToolCallStatus' - description: Execution status for the tool call. - call_id: - type: string - description: Identifier for the client tool call. - name: - type: string - description: Tool name that was invoked. - arguments: - type: string - description: JSON-encoded arguments that were sent to the tool. - output: - anyOf: - - type: string - description: >- - JSON-encoded output captured from the tool. Defaults to null - while execution is in progress. - - type: 'null' - type: object + input_audio: + type: object + properties: + data: + type: string + description: | + Base64-encoded audio data. + format: + type: string + description: > + The format of the audio data. Currently supported formats are + `mp3` and + + `wav`. + enum: + - mp3 + - wav + required: + - data + - format required: - - id - - object - - created_at - - thread_id - type - - status - - call_id - - name - - arguments - - output - title: Client tool call - description: Record of a client side tool invocation initiated by the assistant. - TaskType: + - input_audio + BetaInputParam: + description: | + Text, image, or file inputs to the model, used to generate a response. + + Learn more: + - [Text inputs and outputs](/docs/guides/text) + - [Image inputs](/docs/guides/images) + - [File inputs](/docs/guides/pdf-files) + - [Conversation state](/docs/guides/conversation-state) + - [Function calling](/docs/guides/function-calling) + oneOf: + - type: string + title: Text input + description: | + A text input to the model, equivalent to a text input with the + `user` role. + - type: array + title: Input item list + description: | + A list of one or many input items to the model, containing + different content types. + items: + $ref: '#/components/schemas/BetaInputItem' + BetaContent: + description: | + Multi-modal input and output contents. + oneOf: + - title: Input content types + $ref: '#/components/schemas/BetaInputContent' + - title: Output content types + $ref: '#/components/schemas/BetaOutputContent' + BetaIncludeEnum: type: string enum: - - custom - - thought - TaskItem: + - file_search_call.results + - web_search_call.results + - web_search_call.action.sources + - message.input_image.image_url + - computer_call_output.output.image_url + - code_interpreter_call.outputs + - reasoning.encrypted_content + - message.output_text.logprobs + description: >- + Specify additional output data to include in the model response. + Currently supported values are: + + - `web_search_call.results`: Include the search results of the web + search tool call. + + - `web_search_call.action.sources`: Include the sources of the web + search tool call. + + - `code_interpreter_call.outputs`: Includes the outputs of python code + execution in code interpreter tool call items. + + - `computer_call_output.output.image_url`: Include image urls from the + computer call output. + + - `file_search_call.results`: Include the search results of the file + search tool call. + + - `message.input_image.image_url`: Include image urls from the input + message. + + - `message.output_text.logprobs`: Include logprobs with assistant + messages. + + - `reasoning.encrypted_content`: Includes an encrypted version of + reasoning tokens in reasoning item outputs. This enables reasoning items + to be used in multi-turn conversations when using the Responses API + statelessly (like when the `store` parameter is set to `false`, or when + an organization is enrolled in the zero data retention program). + BetaResponsesServerEvent: + discriminator: + propertyName: type + description: | + Server events emitted by the Responses WebSocket server. + anyOf: + - $ref: '#/components/schemas/BetaResponseStreamEvent' + - $ref: '#/components/schemas/BetaResponseInjectCreatedEvent' + - $ref: '#/components/schemas/BetaResponseInjectFailedEvent' + BetaResponseInjectFailedEvent: + type: object + title: ResponseInjectFailedEvent + description: > + Emitted when injected input could not be committed to a response. The + event + + returns the uncommitted raw input so the client can retry it in another + + response when appropriate. properties: - id: - type: string - description: Identifier of the thread item. - object: + type: type: string enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - response.inject.failed + description: The event discriminator. Always `response.inject.failed`. x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: + response_id: type: string - description: Identifier of the parent thread. - type: + description: The ID of the response that rejected the input. + input: + type: array + description: The raw input items that were not committed. + items: + $ref: '#/components/schemas/BetaInputItem' + error: + type: object + description: Information about why the input was not committed. + properties: + code: + type: string + enum: + - response_already_completed + - response_not_found + description: A machine-readable error code. + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + sequence_number: + type: integer + description: The sequence number for this event. + stream_id: type: string - enum: - - chatkit.task - description: Type discriminator that is always `chatkit.task`. - default: chatkit.task - x-stainless-const: true - task_type: - $ref: '#/components/schemas/TaskType' - description: Subtype for the task. - heading: - anyOf: - - type: string - description: >- - Optional heading for the task. Defaults to null when not - provided. - - type: 'null' - summary: - anyOf: - - type: string - description: >- - Optional summary that describes the task. Defaults to null when - omitted. - - type: 'null' - type: object + description: > + The multiplexed WebSocket stream that emitted the event. This field + is + + present only when WebSocket multiplexing is enabled separately. required: - - id - - object - - created_at - - thread_id - type - - task_type - - heading - - summary - title: Task item - description: Task emitted by the workflow to show progress and status updates. - TaskGroupTask: - properties: - type: - $ref: '#/components/schemas/TaskType' - description: Subtype for the grouped task. - heading: - anyOf: - - type: string - description: >- - Optional heading for the grouped task. Defaults to null when not - provided. - - type: 'null' - summary: - anyOf: - - type: string - description: >- - Optional summary that describes the grouped task. Defaults to - null when omitted. - - type: 'null' + - response_id + - input + - error + - sequence_number + x-oai-beta: responses_multi_agent=v1 + x-oaiMeta: + example: | + { + "type": "response.inject.failed", + "response_id": "resp_123", + "input": [ + { + "type": "function_call_output", + "call_id": "call_123", + "output": "{\"temperature\":72}" + } + ], + "error": { + "code": "response_already_completed", + "message": "Response 'resp_123' has already completed." + }, + "sequence_number": 9 + } + BetaResponseInjectCreatedEvent: type: object - required: - - type - - heading - - summary - title: Task group task - description: Task entry that appears within a TaskGroup. - TaskGroupItem: + title: ResponseInjectCreatedEvent + description: > + Emitted when all injected input items were validated and committed to + the + + active response. properties: - id: - type: string - description: Identifier of the thread item. - object: + type: type: string enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - response.inject.created + description: The event discriminator. Always `response.inject.created`. x-stainless-const: true - created_at: + response_id: + type: string + description: The ID of the response that accepted the input. + sequence_number: type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: + description: The sequence number for this event. + stream_id: type: string - description: Identifier of the parent thread. + description: > + The multiplexed WebSocket stream that emitted the event. This field + is + + present only when WebSocket multiplexing is enabled separately. + required: + - type + - response_id + - sequence_number + x-oai-beta: responses_multi_agent=v1 + x-oaiMeta: + example: | + { + "type": "response.inject.created", + "response_id": "resp_123", + "sequence_number": 8 + } + BetaResponseStreamEvent: + anyOf: + - $ref: '#/components/schemas/BetaResponseAudioDeltaEvent' + - $ref: '#/components/schemas/BetaResponseAudioDoneEvent' + - $ref: '#/components/schemas/BetaResponseAudioTranscriptDeltaEvent' + - $ref: '#/components/schemas/BetaResponseAudioTranscriptDoneEvent' + - $ref: '#/components/schemas/BetaResponseCodeInterpreterCallCodeDeltaEvent' + - $ref: '#/components/schemas/BetaResponseCodeInterpreterCallCodeDoneEvent' + - $ref: '#/components/schemas/BetaResponseCodeInterpreterCallCompletedEvent' + - $ref: '#/components/schemas/BetaResponseCodeInterpreterCallInProgressEvent' + - $ref: >- + #/components/schemas/BetaResponseCodeInterpreterCallInterpretingEvent + - $ref: '#/components/schemas/BetaResponseCompletedEvent' + - $ref: '#/components/schemas/BetaResponseContentPartAddedEvent' + - $ref: '#/components/schemas/BetaResponseContentPartDoneEvent' + - $ref: '#/components/schemas/BetaResponseCreatedEvent' + - $ref: '#/components/schemas/BetaResponseErrorEvent' + - $ref: '#/components/schemas/BetaResponseFileSearchCallCompletedEvent' + - $ref: '#/components/schemas/BetaResponseFileSearchCallInProgressEvent' + - $ref: '#/components/schemas/BetaResponseFileSearchCallSearchingEvent' + - $ref: '#/components/schemas/BetaResponseFunctionCallArgumentsDeltaEvent' + - $ref: '#/components/schemas/BetaResponseFunctionCallArgumentsDoneEvent' + - $ref: '#/components/schemas/BetaResponseInProgressEvent' + - $ref: '#/components/schemas/BetaResponseFailedEvent' + - $ref: '#/components/schemas/BetaResponseIncompleteEvent' + - $ref: '#/components/schemas/BetaResponseOutputItemAddedEvent' + - $ref: '#/components/schemas/BetaResponseOutputItemDoneEvent' + - $ref: '#/components/schemas/BetaResponseReasoningSummaryPartAddedEvent' + - $ref: '#/components/schemas/BetaResponseReasoningSummaryPartDoneEvent' + - $ref: '#/components/schemas/BetaResponseReasoningSummaryTextDeltaEvent' + - $ref: '#/components/schemas/BetaResponseReasoningSummaryTextDoneEvent' + - $ref: '#/components/schemas/BetaResponseReasoningTextDeltaEvent' + - $ref: '#/components/schemas/BetaResponseReasoningTextDoneEvent' + - $ref: '#/components/schemas/BetaResponseRefusalDeltaEvent' + - $ref: '#/components/schemas/BetaResponseRefusalDoneEvent' + - $ref: '#/components/schemas/BetaResponseTextDeltaEvent' + - $ref: '#/components/schemas/BetaResponseTextDoneEvent' + - $ref: '#/components/schemas/BetaResponseWebSearchCallCompletedEvent' + - $ref: '#/components/schemas/BetaResponseWebSearchCallInProgressEvent' + - $ref: '#/components/schemas/BetaResponseWebSearchCallSearchingEvent' + - $ref: '#/components/schemas/BetaResponseImageGenCallCompletedEvent' + - $ref: '#/components/schemas/BetaResponseImageGenCallGeneratingEvent' + - $ref: '#/components/schemas/BetaResponseImageGenCallInProgressEvent' + - $ref: '#/components/schemas/BetaResponseImageGenCallPartialImageEvent' + - $ref: '#/components/schemas/BetaResponseMCPCallArgumentsDeltaEvent' + - $ref: '#/components/schemas/BetaResponseMCPCallArgumentsDoneEvent' + - $ref: '#/components/schemas/BetaResponseMCPCallCompletedEvent' + - $ref: '#/components/schemas/BetaResponseMCPCallFailedEvent' + - $ref: '#/components/schemas/BetaResponseMCPCallInProgressEvent' + - $ref: '#/components/schemas/BetaResponseMCPListToolsCompletedEvent' + - $ref: '#/components/schemas/BetaResponseMCPListToolsFailedEvent' + - $ref: '#/components/schemas/BetaResponseMCPListToolsInProgressEvent' + - $ref: '#/components/schemas/BetaResponseOutputTextAnnotationAddedEvent' + - $ref: '#/components/schemas/BetaResponseQueuedEvent' + - $ref: '#/components/schemas/BetaResponseCustomToolCallInputDeltaEvent' + - $ref: '#/components/schemas/BetaResponseCustomToolCallInputDoneEvent' + discriminator: + propertyName: type + BetaResponsesClientEvent: + discriminator: + propertyName: type + description: | + Client events accepted by the Responses WebSocket server. + anyOf: + - $ref: '#/components/schemas/BetaResponsesClientEventResponseCreate' + - $ref: '#/components/schemas/BetaResponseInjectEvent' + BetaResponseInjectEvent: + type: object + title: ResponseInjectEvent + description: | + Injects input items into an active response over a WebSocket connection. + The items are validated and committed atomically. Currently, the server + accepts client-owned tool outputs that resume a waiting agent. + properties: type: type: string enum: - - chatkit.task_group - description: Type discriminator that is always `chatkit.task_group`. - default: chatkit.task_group + - response.inject + description: The event discriminator. Always `response.inject`. x-stainless-const: true - tasks: - items: - $ref: '#/components/schemas/TaskGroupTask' + response_id: + type: string + description: The ID of the active response that should receive the input. + input: type: array - description: Tasks included in the group. - type: object + maxItems: 16384 + description: Input items to inject into the active response. + items: + $ref: '#/components/schemas/BetaInputItem' required: - - id - - object - - created_at - - thread_id - type - - tasks - title: Task group - description: Collection of workflow tasks grouped together in the thread. - ThreadItem: - oneOf: - - $ref: '#/components/schemas/UserMessageItem' - - $ref: '#/components/schemas/AssistantMessageItem' - - $ref: '#/components/schemas/WidgetMessageItem' - - $ref: '#/components/schemas/ClientToolCallItem' - - $ref: '#/components/schemas/TaskItem' - - $ref: '#/components/schemas/TaskGroupItem' - title: The thread item - discriminator: - propertyName: type - ThreadItemListResource: + - response_id + - input + x-oai-beta: responses_multi_agent=v1 + x-oaiMeta: + example: | + { + "type": "response.inject", + "response_id": "resp_123", + "input": [ + { + "type": "function_call_output", + "call_id": "call_123", + "output": "{\"temperature\":72}" + } + ] + } + BetaResponsesClientEventResponseCreate: + allOf: + - type: object + properties: + type: + type: string + enum: + - response.create + description: | + The type of the client event. Always `response.create`. + x-stainless-const: true + required: + - type + - $ref: '#/components/schemas/BetaCreateResponse' + description: > + Client event for creating a response over a persistent WebSocket + connection. + + This payload uses the same top-level fields as `POST /v1/responses`. + + + Notes: + + - `stream` is implicit over WebSocket and should not be sent. + + - `background` is not supported over WebSocket. + x-oaiMeta: + example: | + { + "type": "response.create", + "model": "gpt-5.5", + "input": "Say hello." + } + BetaCreateResponse: + allOf: + - $ref: '#/components/schemas/BetaCreateModelResponseProperties' + - $ref: '#/components/schemas/BetaResponseProperties' + - type: object + properties: + truncation: + deprecated: true + anyOf: + - type: string + description: > + The truncation strategy to use for the model response. + + - `auto`: If the input to this Response exceeds + the model's context window size, the model will truncate the + response to fit the context window by dropping items from the beginning of the conversation. + - `disabled` (default): If the input size will exceed the + context window + size for a model, the request will fail with a 400 error. + enum: + - auto + - disabled + default: disabled + - type: 'null' + reasoning: + anyOf: + - $ref: '#/components/schemas/BetaReasoning' + - type: 'null' + input: + $ref: '#/components/schemas/BetaInputParam' + include: + anyOf: + - type: array + description: >- + Specify additional output data to include in the model + response. Currently supported values are: + + - `web_search_call.action.sources`: Include the sources of + the web search tool call. + + - `code_interpreter_call.outputs`: Includes the outputs of + python code execution in code interpreter tool call items. + + - `computer_call_output.output.image_url`: Include image + urls from the computer call output. + + - `file_search_call.results`: Include the search results of + the file search tool call. + + - `message.input_image.image_url`: Include image urls from + the input message. + + - `message.output_text.logprobs`: Include logprobs with + assistant messages. + + - `reasoning.encrypted_content`: Includes an encrypted + version of reasoning tokens in reasoning item outputs. This + enables reasoning items to be used in multi-turn + conversations when using the Responses API statelessly (like + when the `store` parameter is set to `false`, or when an + organization is enrolled in the zero data retention + program). + items: + $ref: '#/components/schemas/BetaIncludeEnum' + - type: 'null' + parallel_tool_calls: + anyOf: + - type: boolean + description: | + Whether to allow the model to run tool calls in parallel. + default: true + - type: 'null' + store: + anyOf: + - type: boolean + description: > + Whether to store the generated model response for later + retrieval via + + API. + default: true + - type: 'null' + instructions: + anyOf: + - type: string + description: > + A system (or developer) message inserted into the model's + context. + + + When using along with `previous_response_id`, the + instructions from a previous + + response will not be carried over to the next response. This + makes it simple + + to swap out system (or developer) messages in new responses. + - type: 'null' + moderation: + anyOf: + - $ref: '#/components/schemas/BetaModerationParam' + description: > + Configuration for running moderation on the input and output + of this response. + - type: 'null' + stream: + anyOf: + - description: > + If set to true, the model response data will be streamed to + the client + + as it is generated using [server-sent + events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + + See the [Streaming section + below](/docs/api-reference/responses-streaming) + + for more information. + type: boolean + default: false + - type: 'null' + stream_options: + $ref: '#/components/schemas/BetaResponseStreamOptions' + conversation: + anyOf: + - $ref: '#/components/schemas/BetaConversationParam' + - type: 'null' + context_management: + anyOf: + - type: array + description: | + Context management configuration for this request. + minItems: 1 + items: + $ref: '#/components/schemas/BetaContextManagementParam' + - type: 'null' + max_output_tokens: + anyOf: + - description: > + An upper bound for the number of tokens that can be + generated for a response, including visible output tokens + and [reasoning tokens](/docs/guides/reasoning). + type: integer + minimum: 16 + - type: 'null' + multi_agent: + anyOf: + - $ref: '#/components/schemas/BetaMultiAgentParam' + description: Configuration for server-hosted multi-agent execution. + - type: 'null' + BetaMultiAgentParam: properties: - object: - type: string - enum: - - list - description: The type of object returned, must be `list`. - default: list - x-stainless-const: true - data: - items: - $ref: '#/components/schemas/ThreadItem' - type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: - anyOf: - - type: string - description: The ID of the last item in the list. - - type: 'null' - has_more: + enabled: type: boolean - description: Whether there are more items available. - type: object - required: - - object - - data - - first_id - - last_id - - has_more - title: Thread Items - description: A paginated list of thread items rendered for the ChatKit API. - ActiveStatus: - properties: - type: - type: string - enum: - - active - description: Status discriminator that is always `active`. - default: active - x-stainless-const: true - type: object - required: - - type - title: Active thread status - description: Indicates that a thread is active. - LockedStatus: - properties: - type: - type: string - enum: - - locked - description: Status discriminator that is always `locked`. - default: locked - x-stainless-const: true - reason: - anyOf: - - type: string - description: >- - Reason that the thread was locked. Defaults to null when no - reason is recorded. - - type: 'null' + description: >- + Whether to enable server-hosted multi-agent execution for this + response. + max_concurrent_subagents: + type: integer + minimum: 1 + description: >- + `max_concurrent_subagents` sets the maximum number of subagents that + can be active simultaneously across the entire agent tree. It + includes all descendants—children, grandchildren, and deeper + subagents—but excludes the root agent. + + The API does not impose a fixed upper bound on this setting. The + default is `3`, which is recommended for most workloads. Multi-agent + runs also have no fixed limit on tree depth or the total number of + subagents created during a run. type: object required: - - type - - reason - title: Locked thread status - description: Indicates that a thread is locked and cannot accept new input. - ClosedStatus: + - enabled + description: Configuration for server-hosted multi-agent execution. + x-oai-beta: responses_multi_agent=v1 + BetaContextManagementParam: properties: type: type: string - enum: - - closed - description: Status discriminator that is always `closed`. - default: closed - x-stainless-const: true - reason: + description: >- + The context management entry type. Currently only 'compaction' is + supported. + compact_threshold: anyOf: - - type: string + - type: integer + minimum: 1000 description: >- - Reason that the thread was closed. Defaults to null when no - reason is recorded. + Token threshold at which compaction should be triggered for this + entry. - type: 'null' type: object required: - type - - reason - title: Closed thread status - description: Indicates that a thread has been closed. - ThreadResource: + BetaResponseStreamOptions: + anyOf: + - description: > + Options for streaming responses. Only set this when you set `stream: + true`. + type: object + default: null + properties: + include_obfuscation: + type: boolean + description: > + When true, stream obfuscation will be enabled. Stream + obfuscation adds + + random characters to an `obfuscation` field on streaming delta + events to + + normalize payload sizes as a mitigation to certain side-channel + attacks. + + These obfuscation fields are included by default, but add a + small amount + + of overhead to the data stream. You can set + `include_obfuscation` to + + false to optimize for bandwidth if you trust the network links + between + + your application and the OpenAI API. + - type: 'null' + BetaModerationParam: properties: - id: - type: string - description: Identifier of the thread. - object: + model: type: string - enum: - - chatkit.thread - description: Type discriminator that is always `chatkit.thread`. - default: chatkit.thread - x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the thread was created. - title: + description: >- + The moderation model to use for moderated completions, e.g. + 'omni-moderation-latest'. + policy: anyOf: - - type: string - description: >- - Optional human-readable title for the thread. Defaults to null - when no title has been generated. + - $ref: '#/components/schemas/BetaModerationPolicyParam' + description: The policy to apply to moderated response input and output. - type: 'null' - status: - oneOf: - - $ref: '#/components/schemas/ActiveStatus' - - $ref: '#/components/schemas/LockedStatus' - - $ref: '#/components/schemas/ClosedStatus' - description: >- - Current status for the thread. Defaults to `active` for newly - created threads. - discriminator: - propertyName: type - user: - type: string - description: Free-form string that identifies your end user who owns the thread. - type: object - required: - - id - - object - - created_at - - title - - status - - user - title: The thread object - description: Represents a ChatKit thread and its current status. - example: - id: cthr_def456 - object: chatkit.thread - created_at: 1712345600 - title: Demo feedback - status: - type: active - user: user_456 - DeletedThreadResource: - properties: - id: - type: string - description: Identifier of the deleted thread. - object: - type: string - enum: - - chatkit.thread.deleted - description: Type discriminator that is always `chatkit.thread.deleted`. - default: chatkit.thread.deleted - x-stainless-const: true - deleted: - type: boolean - description: Indicates that the thread has been deleted. type: object required: - - id - - object - - deleted - title: Deleted thread - description: Confirmation payload returned after deleting a thread. - ThreadListResource: + - model + description: >- + Configuration for running moderation on the input and output of this + response. + BetaModerationPolicyParam: properties: - object: - type: string - enum: - - list - description: The type of object returned, must be `list`. - default: list - x-stainless-const: true - data: - items: - $ref: '#/components/schemas/ThreadResource' - type: array - description: A list of items - first_id: + input: anyOf: - - type: string - description: The ID of the first item in the list. + - $ref: '#/components/schemas/BetaModerationConfigParam' + description: The moderation policy for the response input. - type: 'null' - last_id: + output: anyOf: - - type: string - description: The ID of the last item in the list. + - $ref: '#/components/schemas/BetaModerationConfigParam' + description: The moderation policy for the response output. - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. type: object - required: - - object - - data - - first_id - - last_id - - has_more - title: Threads - description: A paginated list of ChatKit threads. - DragPoint: + required: [] + description: The policy to apply to moderated response input and output. + BetaModerationConfigParam: properties: - x: - type: integer - description: The x-coordinate. - 'y': - type: integer - description: The y-coordinate. + mode: + $ref: '#/components/schemas/BetaModerationMode' type: object required: - - x - - 'y' - title: Coordinate - description: 'An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.' + - mode + description: The moderation policy for the response input. + BetaModerationMode: + type: string + enum: + - score + - block + BetaCreateModelResponseProperties: + allOf: + - $ref: '#/components/schemas/BetaModelResponseProperties' + - type: object + properties: + prompt_cache_options: + $ref: '#/components/schemas/BetaPromptCacheOptionsParam' + top_logprobs: + description: > + An integer between 0 and 20 specifying the maximum number of + most likely + + tokens to return at each token position, each with an associated + log + + probability. In some cases, the number of returned tokens may be + fewer than + + requested. + type: integer + minimum: 0 + maximum: 20 securitySchemes: ApiKeyAuth: type: http @@ -85482,6 +100456,174 @@ x-oaiMeta: - type: object key: ResponseErrorEvent path: + - id: responses-websocket-client-events + title: Client events + description: | + Events sent by the client over a Responses API WebSocket connection. + navigationGroup: responses + sections: + - type: object + key: ResponsesClientEventResponseCreate + path: + - id: responses-websocket-server-events + title: Server events (WebSocket only) + description: | + Events emitted only over a Responses API WebSocket connection. + navigationGroup: responses + - id: responses-websocket-shared-events + title: Server events + description: | + These events use the same payloads over WebSocket and + [HTTP streaming](./streaming-events). + navigationGroup: responses + sections: + - type: object + key: ResponseCreatedEvent + path: + - type: object + key: ResponseInProgressEvent + path: + - type: object + key: ResponseCompletedEvent + path: + - type: object + key: ResponseFailedEvent + path: + - type: object + key: ResponseIncompleteEvent + path: + - type: object + key: ResponseOutputItemAddedEvent + path: + - type: object + key: ResponseOutputItemDoneEvent + path: + - type: object + key: ResponseContentPartAddedEvent + path: + - type: object + key: ResponseContentPartDoneEvent + path: + - type: object + key: ResponseTextDeltaEvent + path: response/output_text/delta + - type: object + key: ResponseTextDoneEvent + path: response/output_text/done + - type: object + key: ResponseRefusalDeltaEvent + path: + - type: object + key: ResponseRefusalDoneEvent + path: + - type: object + key: ResponseFunctionCallArgumentsDeltaEvent + path: + - type: object + key: ResponseFunctionCallArgumentsDoneEvent + path: + - type: object + key: ResponseFileSearchCallInProgressEvent + path: + - type: object + key: ResponseFileSearchCallSearchingEvent + path: + - type: object + key: ResponseFileSearchCallCompletedEvent + path: + - type: object + key: ResponseWebSearchCallInProgressEvent + path: + - type: object + key: ResponseWebSearchCallSearchingEvent + path: + - type: object + key: ResponseWebSearchCallCompletedEvent + path: + - type: object + key: ResponseReasoningSummaryPartAddedEvent + path: + - type: object + key: ResponseReasoningSummaryPartDoneEvent + path: + - type: object + key: ResponseReasoningSummaryTextDeltaEvent + path: + - type: object + key: ResponseReasoningSummaryTextDoneEvent + path: + - type: object + key: ResponseReasoningTextDeltaEvent + path: + - type: object + key: ResponseReasoningTextDoneEvent + path: + - type: object + key: ResponseImageGenCallCompletedEvent + path: + - type: object + key: ResponseImageGenCallGeneratingEvent + path: + - type: object + key: ResponseImageGenCallInProgressEvent + path: + - type: object + key: ResponseImageGenCallPartialImageEvent + path: + - type: object + key: ResponseMCPCallArgumentsDeltaEvent + path: + - type: object + key: ResponseMCPCallArgumentsDoneEvent + path: + - type: object + key: ResponseMCPCallCompletedEvent + path: + - type: object + key: ResponseMCPCallFailedEvent + path: + - type: object + key: ResponseMCPCallInProgressEvent + path: + - type: object + key: ResponseMCPListToolsCompletedEvent + path: + - type: object + key: ResponseMCPListToolsFailedEvent + path: + - type: object + key: ResponseMCPListToolsInProgressEvent + path: + - type: object + key: ResponseCodeInterpreterCallInProgressEvent + path: + - type: object + key: ResponseCodeInterpreterCallInterpretingEvent + path: + - type: object + key: ResponseCodeInterpreterCallCompletedEvent + path: + - type: object + key: ResponseCodeInterpreterCallCodeDeltaEvent + path: + - type: object + key: ResponseCodeInterpreterCallCodeDoneEvent + path: + - type: object + key: ResponseOutputTextAnnotationAddedEvent + path: + - type: object + key: ResponseQueuedEvent + path: + - type: object + key: ResponseCustomToolCallInputDeltaEvent + path: + - type: object + key: ResponseCustomToolCallInputDoneEvent + path: + - type: object + key: ResponseErrorEvent + path: - id: webhook-events title: Webhook Events description: > @@ -85506,6 +100648,9 @@ x-oaiMeta: - type: object key: WebhookResponseIncomplete path: + - type: object + key: WebhookSafetyIdentifierBlocked + path: - type: object key: WebhookBatchCompleted path: