// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import * as ResponsesAPI from './responses'; import { APIPromise } from '../core/api-promise'; import { RequestOptions } from '../internal/request-options'; export class Responses extends APIResource { /** * Runs inference using the OpenAI Responses API contract, taking an `input` rather * than a chat `messages` array. * * This endpoint is restricted to OpenAI-vendor models: requests whose `model` * (`vendor/name`) resolves to any other vendor are rejected with an * unsupported-vendor error, unlike /v5/chat/completions and /v5/inference which * support many vendors. Use it when you specifically need Responses API features * such as `previous_response_id` chaining, `instructions`, or `store`; use * /v5/chat/completions for the standard messages-based chat contract. When * `stream` is set the response streams as server-sent events; otherwise a single * `response` object is returned. */ create(body: ResponseCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/v5/responses', { body, ...options }); } } /** * A tool call representing a request to create, delete, or update files using diff * patches. */ export interface ApplyPatchCall { call_id: string; /** * Instruction for creating a new file via the apply_patch tool. */ operation: | ApplyPatchCall.ApplyPatchCallOperationCreateFile | ApplyPatchCall.ApplyPatchCallOperationDeleteFile | ApplyPatchCall.ApplyPatchCallOperationUpdateFile; status: 'in_progress' | 'completed'; type: 'apply_patch_call'; id?: string; [k: string]: unknown; } export namespace ApplyPatchCall { /** * Instruction for creating a new file via the apply_patch tool. */ export interface ApplyPatchCallOperationCreateFile { diff: string; path: string; type: 'create_file'; [k: string]: unknown; } /** * Instruction for deleting an existing file via the apply_patch tool. */ export interface ApplyPatchCallOperationDeleteFile { path: string; type: 'delete_file'; [k: string]: unknown; } /** * Instruction for updating an existing file via the apply_patch tool. */ export interface ApplyPatchCallOperationUpdateFile { diff: string; path: string; type: 'update_file'; [k: string]: unknown; } } /** * The streamed output emitted by an apply patch tool call. */ export interface ApplyPatchCallOutput { call_id: string; status: 'completed' | 'failed'; type: 'apply_patch_call_output'; id?: string; output?: string; [k: string]: unknown; } /** * Allows the assistant to create, delete, or update files using unified diffs. */ export interface ApplyPatchTool { type: 'apply_patch'; [k: string]: unknown; } /** * A tool that controls a virtual computer. * * Learn more about the * [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). */ export interface ComputerTool { display_height: number; display_width: number; environment: 'windows' | 'mac' | 'linux' | 'ubuntu' | 'browser'; type: 'computer_use_preview'; [k: string]: unknown; } export interface ContainerNetworkPolicyAllowlist { allowed_domains: Array; type: 'allowlist'; domain_secrets?: Array; [k: string]: unknown; } export namespace ContainerNetworkPolicyAllowlist { export interface DomainSecret { domain: string; name: string; value: string; [k: string]: unknown; } } export interface ContainerNetworkPolicyDisabled { type: 'disabled'; [k: string]: unknown; } export interface ContainerReference { container_id: string; type: 'container_reference'; [k: string]: unknown; } export interface ContainerReferenceParam { container_id: string; type: 'container_reference'; [k: string]: unknown; } /** * The conversation that this response belonged to. * * Input items and output items from this response were automatically added to this * conversation. */ export interface Conversation { id: string; [k: string]: unknown; } /** * A custom tool that processes input using a specified format. * * Learn more about * [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools) */ export interface CustomTool { name: string; type: 'custom'; description?: string; /** * Unconstrained free-form text. */ format?: CustomTool.Text | CustomTool.Grammar; [k: string]: unknown; } export namespace CustomTool { /** * Unconstrained free-form text. */ export interface Text { type: 'text'; [k: string]: unknown; } /** * A grammar defined by the user. */ export interface Grammar { definition: string; syntax: 'lark' | 'regex'; type: 'grammar'; [k: string]: unknown; } } /** * 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. */ export interface EasyInputMessage { content: string | Array; role: 'user' | 'assistant' | 'system' | 'developer'; phase?: 'commentary' | 'final_answer'; type?: 'message'; [k: string]: unknown; } /** * 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). */ export interface FileSearchTool { type: 'file_search'; vector_store_ids: Array; /** * A filter used to compare a specified attribute key to a given value using a * defined comparison operation. */ filters?: FileSearchTool.ComparisonFilter | FileSearchTool.CompoundFilter; max_num_results?: number; /** * Ranking options for search. */ ranking_options?: FileSearchTool.RankingOptions; [k: string]: unknown; } export namespace FileSearchTool { /** * A filter used to compare a specified attribute key to a given value using a * defined comparison operation. */ export interface ComparisonFilter { key: string; type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte'; value: string | number | boolean | Array; [k: string]: unknown; } /** * Combine multiple filters using `and` or `or`. */ export interface CompoundFilter { filters: Array; type: 'and' | 'or'; [k: string]: unknown; } export namespace CompoundFilter { /** * A filter used to compare a specified attribute key to a given value using a * defined comparison operation. */ export interface ComparisonFilter { key: string; type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte'; value: string | number | boolean | Array; [k: string]: unknown; } } /** * Ranking options for search. */ export interface RankingOptions { /** * Weights that control how reciprocal rank fusion balances semantic embedding * matches versus sparse keyword matches when hybrid search is enabled. */ hybrid_search?: RankingOptions.HybridSearch; ranker?: 'auto' | 'default-2024-11-15'; score_threshold?: number; [k: string]: unknown; } export namespace RankingOptions { /** * Weights that control how reciprocal rank fusion balances semantic embedding * matches versus sparse keyword matches when hybrid search is enabled. */ export interface HybridSearch { embedding_weight: number; text_weight: number; [k: string]: unknown; } } } /** * A tool that allows the model to execute shell commands. */ export interface FunctionShellTool { type: 'shell'; environment?: FunctionShellTool.ContainerAuto | LocalEnvironment | ContainerReference; [k: string]: unknown; } export namespace FunctionShellTool { export interface ContainerAuto { type: 'container_auto'; file_ids?: Array; memory_limit?: '1g' | '4g' | '16g' | '64g'; network_policy?: | ResponsesAPI.ContainerNetworkPolicyDisabled | ResponsesAPI.ContainerNetworkPolicyAllowlist; skills?: Array; [k: string]: unknown; } export namespace ContainerAuto { export interface SkillReference { skill_id: string; type: 'skill_reference'; version?: string; [k: string]: unknown; } export interface InlineSkill { description: string; name: string; /** * Inline skill payload */ source: InlineSkill.Source; type: 'inline'; [k: string]: unknown; } export namespace InlineSkill { /** * Inline skill payload */ export interface Source { data: string; media_type: 'application/zip'; type: 'base64'; [k: string]: unknown; } } } } /** * 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). */ export interface FunctionTool { name: string; type: 'function'; description?: string; parameters?: { [key: string]: unknown }; strict?: boolean; [k: string]: unknown; } /** * Details about why the response is incomplete. */ export interface IncompleteDetails { reason?: 'max_output_tokens' | 'content_filter'; [k: string]: unknown; } export interface LocalEnvironment { type: 'local'; skills?: Array; [k: string]: unknown; } export namespace LocalEnvironment { export interface Skill { description: string; name: string; path: string; [k: string]: unknown; } } export interface LocalEnvironmentParam { type: 'local'; skills?: Array; [k: string]: unknown; } export namespace LocalEnvironmentParam { export interface Skill { description: string; name: string; path: string; [k: string]: unknown; } } /** * A request for human approval of a tool invocation. */ export interface McpApprovalRequest { id: string; arguments: string; name: string; server_label: string; type: 'mcp_approval_request'; [k: string]: unknown; } export interface OpenAIResponse { id: string; created_at: number; model: | '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' | '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' | (string & {}); object: 'response'; output: Array< | OpenAIResponseOutputMessage | OpenAIResponseFileSearchToolCall | OpenAIResponseFunctionToolCall | OpenAIResponseFunctionWebSearch | OpenAIResponseComputerToolCall | OpenAIResponseReasoningItem | ResponseCompactionItem | OpenAITypesResponsesResponseOutputItemImageGenerationCall | OpenAIResponseCodeInterpreterToolCall | OpenAITypesResponsesResponseOutputItemLocalShellCall | ResponseFunctionShellToolCall | ResponseFunctionShellToolCallOutput | ResponseApplyPatchToolCall | ResponseApplyPatchToolCallOutput | OpenAITypesResponsesResponseOutputItemMcpCall | OpenAITypesResponsesResponseOutputItemMcpListTools | McpApprovalRequest | OpenAIResponseCustomToolCall >; parallel_tool_calls: boolean; /** * Constrains the tools available to the model to a pre-defined set. */ tool_choice: | 'none' | 'auto' | 'required' | ToolChoiceAllowed | ToolChoiceTypes | ToolChoiceFunction | ToolChoiceMcp | ToolChoiceCustom | ToolChoiceApplyPatch | ToolChoiceShell; tools: Array< | FunctionTool | FileSearchTool | ComputerTool | WebSearchTool | OpenAIResponse.Mcp | OpenAIResponse.CodeInterpreter | OpenAIResponse.ImageGeneration | OpenAIResponse.LocalShell | FunctionShellTool | CustomTool | WebSearchPreviewTool | ApplyPatchTool >; background?: boolean; completed_at?: number; /** * The conversation that this response belonged to. * * Input items and output items from this response were automatically added to this * conversation. */ conversation?: Conversation; /** * An error object returned when the model fails to generate a Response. */ error?: OpenAIResponseError; /** * Details about why the response is incomplete. */ incomplete_details?: IncompleteDetails; instructions?: | string | Array< | EasyInputMessage | OpenAITypesResponsesResponseInputItemMessage | OpenAIResponseOutputMessage | OpenAIResponseFileSearchToolCall | OpenAIResponseComputerToolCall | OpenAITypesResponsesResponseInputItemComputerCallOutput | OpenAIResponseFunctionWebSearch | OpenAIResponseFunctionToolCall | OpenAITypesResponsesResponseInputItemFunctionCallOutput | OpenAIResponseReasoningItem | ResponseCompactionItemParam | OpenAITypesResponsesResponseInputItemImageGenerationCall | OpenAIResponseCodeInterpreterToolCall | OpenAITypesResponsesResponseInputItemLocalShellCall | OpenAITypesResponsesResponseInputItemLocalShellCallOutput | ShellCall | ShellCallOutput | ApplyPatchCall | ApplyPatchCallOutput | OpenAITypesResponsesResponseInputItemMcpListTools | McpApprovalRequest | OpenAITypesResponsesResponseInputItemMcpApprovalResponse | OpenAITypesResponsesResponseInputItemMcpCall | OpenAIResponseCustomToolCallOutput | OpenAIResponseCustomToolCall | OpenAITypesResponsesResponseInputItemItemReference >; max_output_tokens?: number; max_tool_calls?: number; metadata?: { [key: string]: string }; previous_response_id?: string; /** * Reference to a prompt template and its variables. * [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). */ prompt?: OpenAIResponsePrompt; prompt_cache_key?: string; prompt_cache_retention?: 'in-memory' | '24h'; /** * **gpt-5 and o-series models only** * * Configuration options for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). */ reasoning?: Reasoning; safety_identifier?: string; service_tier?: 'auto' | 'default' | 'flex' | 'scale' | 'priority'; status?: 'completed' | 'failed' | 'in_progress' | 'cancelled' | 'queued' | 'incomplete'; temperature?: number; /** * Configuration options for a text response from the model. * * Can be plain text or structured JSON data. Learn more: * * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) */ text?: OpenAIResponseTextConfig; top_logprobs?: number; top_p?: number; truncation?: 'auto' | 'disabled'; /** * Represents token usage details including input tokens, output tokens, a * breakdown of output tokens, and the total tokens used. */ usage?: OpenAIResponseUsage; user?: string; [k: string]: unknown; } export namespace OpenAIResponse { /** * Give the model access to additional tools via remote Model Context Protocol * (MCP) servers. * [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp). */ export interface Mcp { server_label: string; type: 'mcp'; /** * A filter object to specify which tools are allowed. */ allowed_tools?: Array | Mcp.McpAllowedToolsMcpToolFilter; authorization?: string; connector_id?: | 'connector_dropbox' | 'connector_gmail' | 'connector_googlecalendar' | 'connector_googledrive' | 'connector_microsoftteams' | 'connector_outlookcalendar' | 'connector_outlookemail' | 'connector_sharepoint'; headers?: { [key: string]: string }; /** * Specify which of the MCP server's tools require approval. * * Can be `always`, `never`, or a filter object associated with tools that require * approval. */ require_approval?: Mcp.McpRequireApprovalMcpToolApprovalFilter | 'always' | 'never'; server_description?: string; server_url?: string; [k: string]: unknown; } export namespace Mcp { /** * A filter object to specify which tools are allowed. */ export interface McpAllowedToolsMcpToolFilter { read_only?: boolean; tool_names?: Array; [k: string]: unknown; } /** * Specify which of the MCP server's tools require approval. * * Can be `always`, `never`, or a filter object associated with tools that require * approval. */ export interface McpRequireApprovalMcpToolApprovalFilter { /** * A filter object to specify which tools are allowed. */ always?: McpRequireApprovalMcpToolApprovalFilter.Always; /** * A filter object to specify which tools are allowed. */ never?: McpRequireApprovalMcpToolApprovalFilter.Never; [k: string]: unknown; } export namespace McpRequireApprovalMcpToolApprovalFilter { /** * A filter object to specify which tools are allowed. */ export interface Always { read_only?: boolean; tool_names?: Array; [k: string]: unknown; } /** * A filter object to specify which tools are allowed. */ export interface Never { read_only?: boolean; tool_names?: Array; [k: string]: unknown; } } } /** * A tool that runs Python code to help generate a response to a prompt. */ export interface CodeInterpreter { /** * Configuration for a code interpreter container. * * Optionally specify the IDs of the files to run the code on. */ container: string | CodeInterpreter.CodeInterpreterContainerCodeInterpreterToolAuto; type: 'code_interpreter'; [k: string]: unknown; } export namespace CodeInterpreter { /** * Configuration for a code interpreter container. * * Optionally specify the IDs of the files to run the code on. */ export interface CodeInterpreterContainerCodeInterpreterToolAuto { type: 'auto'; file_ids?: Array; memory_limit?: '1g' | '4g' | '16g' | '64g'; network_policy?: | ResponsesAPI.ContainerNetworkPolicyDisabled | ResponsesAPI.ContainerNetworkPolicyAllowlist; [k: string]: unknown; } } /** * A tool that generates images using the GPT image models. */ export interface ImageGeneration { type: 'image_generation'; action?: 'generate' | 'edit' | 'auto'; background?: 'transparent' | 'opaque' | 'auto'; input_fidelity?: 'high' | 'low'; /** * Optional mask for inpainting. * * Contains `image_url` (string, optional) and `file_id` (string, optional). */ input_image_mask?: ImageGeneration.InputImageMask; model?: (string & {}) | 'gpt-image-1' | 'gpt-image-1-mini' | 'gpt-image-1.5'; moderation?: 'auto' | 'low'; output_compression?: number; output_format?: 'png' | 'webp' | 'jpeg'; partial_images?: number; quality?: 'low' | 'medium' | 'high' | 'auto'; size?: '1024x1024' | '1024x1536' | '1536x1024' | 'auto'; [k: string]: unknown; } export namespace ImageGeneration { /** * Optional mask for inpainting. * * Contains `image_url` (string, optional) and `file_id` (string, optional). */ export interface InputImageMask { file_id?: string; image_url?: string; [k: string]: unknown; } } /** * A tool that allows the model to execute shell commands in a local environment. */ export interface LocalShell { type: 'local_shell'; [k: string]: unknown; } } /** * A tool call to run code. */ export interface OpenAIResponseCodeInterpreterToolCall { id: string; container_id: string; status: 'in_progress' | 'completed' | 'incomplete' | 'interpreting' | 'failed'; type: 'code_interpreter_call'; code?: string; outputs?: Array< OpenAIResponseCodeInterpreterToolCall.OutputLogs | OpenAIResponseCodeInterpreterToolCall.OutputImage >; [k: string]: unknown; } export namespace OpenAIResponseCodeInterpreterToolCall { /** * The logs output from the code interpreter. */ export interface OutputLogs { logs: string; type: 'logs'; [k: string]: unknown; } /** * The image output from the code interpreter. */ export interface OutputImage { type: 'image'; url: string; [k: string]: unknown; } } /** * A tool call to a computer use tool. * * See the * [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) * for more information. */ export interface OpenAIResponseComputerToolCall { id: string; /** * A click action. */ action: | OpenAIResponseComputerToolCall.ActionClick | OpenAIResponseComputerToolCall.ActionDoubleClick | OpenAIResponseComputerToolCall.ActionDrag | OpenAIResponseComputerToolCall.ActionKeypress | OpenAIResponseComputerToolCall.ActionMove | OpenAIResponseComputerToolCall.ActionScreenshot | OpenAIResponseComputerToolCall.ActionScroll | OpenAIResponseComputerToolCall.ActionType | OpenAIResponseComputerToolCall.ActionWait; call_id: string; pending_safety_checks: Array; status: 'in_progress' | 'completed' | 'incomplete'; type: 'computer_call'; [k: string]: unknown; } export namespace OpenAIResponseComputerToolCall { /** * A click action. */ export interface ActionClick { button: 'left' | 'right' | 'wheel' | 'back' | 'forward'; type: 'click'; x: number; y: number; [k: string]: unknown; } /** * A double click action. */ export interface ActionDoubleClick { type: 'double_click'; x: number; y: number; [k: string]: unknown; } /** * A drag action. */ export interface ActionDrag { path: Array; type: 'drag'; [k: string]: unknown; } export namespace ActionDrag { /** * An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`. */ export interface Path { x: number; y: number; [k: string]: unknown; } } /** * A collection of keypresses the model would like to perform. */ export interface ActionKeypress { keys: Array; type: 'keypress'; [k: string]: unknown; } /** * A mouse move action. */ export interface ActionMove { type: 'move'; x: number; y: number; [k: string]: unknown; } /** * A screenshot action. */ export interface ActionScreenshot { type: 'screenshot'; [k: string]: unknown; } /** * A scroll action. */ export interface ActionScroll { scroll_x: number; scroll_y: number; type: 'scroll'; x: number; y: number; [k: string]: unknown; } /** * An action to type in text. */ export interface ActionType { text: string; type: 'type'; [k: string]: unknown; } /** * A wait action. */ export interface ActionWait { type: 'wait'; [k: string]: unknown; } /** * A pending safety check for the computer call. */ export interface PendingSafetyCheck { id: string; code?: string; message?: string; [k: string]: unknown; } } /** * A call to a custom tool created by the model. */ export interface OpenAIResponseCustomToolCall { call_id: string; input: string; name: string; type: 'custom_tool_call'; id?: string; [k: string]: unknown; } /** * The output of a custom tool call from your code, being sent back to the model. */ export interface OpenAIResponseCustomToolCallOutput { call_id: string; output: string | Array; type: 'custom_tool_call_output'; id?: string; [k: string]: unknown; } /** * An error object returned when the model fails to generate a Response. */ export interface OpenAIResponseError { code: | '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'; message: string; [k: string]: unknown; } /** * The results of a file search tool call. * * See the * [file search guide](https://platform.openai.com/docs/guides/tools-file-search) * for more information. */ export interface OpenAIResponseFileSearchToolCall { id: string; queries: Array; status: 'in_progress' | 'searching' | 'completed' | 'incomplete' | 'failed'; type: 'file_search_call'; results?: Array; [k: string]: unknown; } export namespace OpenAIResponseFileSearchToolCall { export interface Result { attributes?: { [key: string]: string | number | boolean }; file_id?: string; filename?: string; score?: number; text?: string; [k: string]: unknown; } } /** * A tool call to run a function. * * See the * [function calling guide](https://platform.openai.com/docs/guides/function-calling) * for more information. */ export interface OpenAIResponseFunctionToolCall { arguments: string; call_id: string; name: string; type: 'function_call'; id?: string; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } /** * The results of a web search tool call. * * See the * [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for * more information. */ export interface OpenAIResponseFunctionWebSearch { id: string; /** * Action type "search" - Performs a web search query. */ action: | OpenAIResponseFunctionWebSearch.OpenAITypesResponsesResponseFunctionWebSearchActionSearch | OpenAIResponseFunctionWebSearch.OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage | OpenAIResponseFunctionWebSearch.ActionFind; status: 'in_progress' | 'searching' | 'completed' | 'failed'; type: 'web_search_call'; [k: string]: unknown; } export namespace OpenAIResponseFunctionWebSearch { /** * Action type "search" - Performs a web search query. */ export interface OpenAITypesResponsesResponseFunctionWebSearchActionSearch { query: string; type: 'search'; queries?: Array; sources?: Array; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseFunctionWebSearchActionSearch { /** * A source used in the search. */ export interface Source { type: 'url'; url: string; [k: string]: unknown; } } /** * Action type "open_page" - Opens a specific URL from search results. */ export interface OpenAITypesResponsesResponseFunctionWebSearchActionOpenPage { type: 'open_page'; url?: string; [k: string]: unknown; } /** * Action type "find_in_page": Searches for a pattern within a loaded page. */ export interface ActionFind { pattern: string; type: 'find_in_page'; url: string; [k: string]: unknown; } } /** * A file input to the model. */ export interface OpenAIResponseInputFile { type: 'input_file'; file_data?: string; file_id?: string; file_url?: string; filename?: string; [k: string]: unknown; } /** * A file input to the model. */ export interface OpenAIResponseInputFileParam { type: 'input_file'; file_data?: string; file_id?: string; file_url?: string; filename?: string; [k: string]: unknown; } /** * An image input to the model. * * Learn about [image inputs](https://platform.openai.com/docs/guides/vision). */ export interface OpenAIResponseInputImage { detail: 'low' | 'high' | 'auto'; type: 'input_image'; file_id?: string; image_url?: string; [k: string]: unknown; } /** * An image input to the model. * * Learn about [image inputs](https://platform.openai.com/docs/guides/vision). */ export interface OpenAIResponseInputImageParam { detail: 'low' | 'high' | 'auto'; type: 'input_image'; file_id?: string; image_url?: string; [k: string]: unknown; } /** * A text input to the model. */ export interface OpenAIResponseInputText { text: string; type: 'input_text'; [k: string]: unknown; } /** * A text input to the model. */ export interface OpenAIResponseInputTextParam { text: string; type: 'input_text'; [k: string]: unknown; } /** * An output message from the model. */ export interface OpenAIResponseOutputMessage { id: string; content: Array; role: 'assistant'; status: 'in_progress' | 'completed' | 'incomplete'; type: 'message'; phase?: 'commentary' | 'final_answer'; [k: string]: unknown; } /** * A refusal from the model. */ export interface OpenAIResponseOutputRefusal { refusal: string; type: 'refusal'; [k: string]: unknown; } /** * A text output from the model. */ export interface OpenAIResponseOutputText { annotations: Array< | OpenAIResponseOutputText.AnnotationFileCitation | OpenAIResponseOutputText.OpenAITypesResponsesResponseOutputTextAnnotationURLCitation | OpenAIResponseOutputText.AnnotationContainerFileCitation | OpenAIResponseOutputText.AnnotationFilePath >; text: string; type: 'output_text'; logprobs?: Array; [k: string]: unknown; } export namespace OpenAIResponseOutputText { /** * A citation to a file. */ export interface AnnotationFileCitation { file_id: string; filename: string; index: number; type: 'file_citation'; [k: string]: unknown; } /** * A citation for a web resource used to generate a model response. */ export interface OpenAITypesResponsesResponseOutputTextAnnotationURLCitation { end_index: number; start_index: number; title: string; type: 'url_citation'; url: string; [k: string]: unknown; } /** * A citation for a container file used to generate a model response. */ export interface AnnotationContainerFileCitation { container_id: string; end_index: number; file_id: string; filename: string; start_index: number; type: 'container_file_citation'; [k: string]: unknown; } /** * A path to a file. */ export interface AnnotationFilePath { file_id: string; index: number; type: 'file_path'; [k: string]: unknown; } /** * The log probability of a token. */ export interface Logprob { token: string; bytes: Array; logprob: number; top_logprobs: Array; [k: string]: unknown; } export namespace Logprob { /** * The top log probability of a token. */ export interface TopLogprob { token: string; bytes: Array; logprob: number; [k: string]: unknown; } } } /** * Reference to a prompt template and its variables. * [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). */ export interface OpenAIResponsePrompt { id: string; variables?: { [key: string]: string | OpenAIResponseInputText | OpenAIResponseInputImage | OpenAIResponseInputFile; }; version?: string; [k: string]: unknown; } /** * 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](https://platform.openai.com/docs/guides/conversation-state). */ export interface OpenAIResponseReasoningItem { id: string; summary: Array; type: 'reasoning'; content?: Array; encrypted_content?: string; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } export namespace OpenAIResponseReasoningItem { /** * A summary text from the model. */ export interface Summary { text: string; type: 'summary_text'; [k: string]: unknown; } /** * Reasoning text from the model. */ export interface Content { text: string; type: 'reasoning_text'; [k: string]: unknown; } } /** * Configuration options for a text response from the model. * * Can be plain text or structured JSON data. Learn more: * * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) */ export interface OpenAIResponseTextConfig { /** * Default response format. Used to generate text responses. */ format?: | OpenAIResponseTextConfig.ResponseFormatText | OpenAIResponseTextConfig.ResponseFormatTextJsonSchemaConfig | OpenAIResponseTextConfig.ResponseFormatJsonObject; verbosity?: 'low' | 'medium' | 'high'; [k: string]: unknown; } export namespace OpenAIResponseTextConfig { /** * Default response format. Used to generate text responses. */ export interface ResponseFormatText { type: 'text'; [k: string]: unknown; } /** * JSON Schema response format. * * Used to generate structured JSON responses. Learn more about * [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs). */ export interface ResponseFormatTextJsonSchemaConfig { name: string; schema: { [key: string]: unknown }; type: 'json_schema'; description?: string; strict?: boolean; [k: string]: unknown; } /** * 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. */ export interface ResponseFormatJsonObject { type: 'json_object'; [k: string]: unknown; } } /** * Represents token usage details including input tokens, output tokens, a * breakdown of output tokens, and the total tokens used. */ export interface OpenAIResponseUsage { input_tokens: number; /** * A detailed breakdown of the input tokens. */ input_tokens_details: OpenAIResponseUsage.InputTokensDetails; output_tokens: number; /** * A detailed breakdown of the output tokens. */ output_tokens_details: OpenAIResponseUsage.OutputTokensDetails; total_tokens: number; [k: string]: unknown; } export namespace OpenAIResponseUsage { /** * A detailed breakdown of the input tokens. */ export interface InputTokensDetails { cached_tokens: number; [k: string]: unknown; } /** * A detailed breakdown of the output tokens. */ export interface OutputTokensDetails { reasoning_tokens: number; [k: string]: unknown; } } /** * The output of a computer tool call. */ export interface OpenAITypesResponsesResponseInputItemComputerCallOutput { call_id: string; /** * A computer screenshot image used with the computer use tool. */ output: ResponseComputerToolCallOutputScreenshot; type: 'computer_call_output'; id?: string; acknowledged_safety_checks?: Array; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseInputItemComputerCallOutput { /** * A pending safety check for the computer call. */ export interface AcknowledgedSafetyCheck { id: string; code?: string; message?: string; [k: string]: unknown; } } /** * The output of a function tool call. */ export interface OpenAITypesResponsesResponseInputItemFunctionCallOutput { call_id: string; output: | string | Array< | OpenAITypesResponsesResponseInputItemFunctionCallOutput.ResponseInputTextContent | OpenAITypesResponsesResponseInputItemFunctionCallOutput.ResponseInputImageContent | OpenAITypesResponsesResponseInputItemFunctionCallOutput.ResponseInputFileContent >; type: 'function_call_output'; id?: string; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseInputItemFunctionCallOutput { /** * A text input to the model. */ export interface ResponseInputTextContent { text: string; type: 'input_text'; [k: string]: unknown; } /** * An image input to the model. * * Learn about [image inputs](https://platform.openai.com/docs/guides/vision) */ export interface ResponseInputImageContent { type: 'input_image'; detail?: 'low' | 'high' | 'auto'; file_id?: string; image_url?: string; [k: string]: unknown; } /** * A file input to the model. */ export interface ResponseInputFileContent { type: 'input_file'; file_data?: string; file_id?: string; file_url?: string; filename?: string; [k: string]: unknown; } } /** * An image generation request made by the model. */ export interface OpenAITypesResponsesResponseInputItemImageGenerationCall { id: string; status: 'in_progress' | 'completed' | 'generating' | 'failed'; type: 'image_generation_call'; result?: string; [k: string]: unknown; } /** * An internal identifier for an item to reference. */ export interface OpenAITypesResponsesResponseInputItemItemReference { id: string; type?: 'item_reference'; [k: string]: unknown; } /** * A tool call to run a command on the local shell. */ export interface OpenAITypesResponsesResponseInputItemLocalShellCall { id: string; /** * Execute a shell command on the server. */ action: OpenAITypesResponsesResponseInputItemLocalShellCall.Action; call_id: string; status: 'in_progress' | 'completed' | 'incomplete'; type: 'local_shell_call'; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseInputItemLocalShellCall { /** * Execute a shell command on the server. */ export interface Action { command: Array; env: { [key: string]: string }; type: 'exec'; timeout_ms?: number; user?: string; working_directory?: string; [k: string]: unknown; } } /** * The output of a local shell tool call. */ export interface OpenAITypesResponsesResponseInputItemLocalShellCallOutput { id: string; output: string; type: 'local_shell_call_output'; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } /** * A response to an MCP approval request. */ export interface OpenAITypesResponsesResponseInputItemMcpApprovalResponse { approval_request_id: string; approve: boolean; type: 'mcp_approval_response'; id?: string; reason?: string; [k: string]: unknown; } /** * An invocation of a tool on an MCP server. */ export interface OpenAITypesResponsesResponseInputItemMcpCall { id: string; arguments: string; name: string; server_label: string; type: 'mcp_call'; approval_request_id?: string; error?: string; output?: string; status?: 'in_progress' | 'completed' | 'incomplete' | 'calling' | 'failed'; [k: string]: unknown; } /** * A list of tools available on an MCP server. */ export interface OpenAITypesResponsesResponseInputItemMcpListTools { id: string; server_label: string; tools: Array; type: 'mcp_list_tools'; error?: string; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseInputItemMcpListTools { /** * A tool available on an MCP server. */ export interface Tool { input_schema: unknown; name: string; annotations?: unknown; description?: string; [k: string]: unknown; } } /** * 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. */ export interface OpenAITypesResponsesResponseInputItemMessage { content: Array; role: 'user' | 'system' | 'developer'; status?: 'in_progress' | 'completed' | 'incomplete'; type?: 'message'; [k: string]: unknown; } /** * An image generation request made by the model. */ export interface OpenAITypesResponsesResponseOutputItemImageGenerationCall { id: string; status: 'in_progress' | 'completed' | 'generating' | 'failed'; type: 'image_generation_call'; result?: string; [k: string]: unknown; } /** * A tool call to run a command on the local shell. */ export interface OpenAITypesResponsesResponseOutputItemLocalShellCall { id: string; /** * Execute a shell command on the server. */ action: OpenAITypesResponsesResponseOutputItemLocalShellCall.Action; call_id: string; status: 'in_progress' | 'completed' | 'incomplete'; type: 'local_shell_call'; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseOutputItemLocalShellCall { /** * Execute a shell command on the server. */ export interface Action { command: Array; env: { [key: string]: string }; type: 'exec'; timeout_ms?: number; user?: string; working_directory?: string; [k: string]: unknown; } } /** * An invocation of a tool on an MCP server. */ export interface OpenAITypesResponsesResponseOutputItemMcpCall { id: string; arguments: string; name: string; server_label: string; type: 'mcp_call'; approval_request_id?: string; error?: string; output?: string; status?: 'in_progress' | 'completed' | 'incomplete' | 'calling' | 'failed'; [k: string]: unknown; } /** * A list of tools available on an MCP server. */ export interface OpenAITypesResponsesResponseOutputItemMcpListTools { id: string; server_label: string; tools: Array; type: 'mcp_list_tools'; error?: string; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseOutputItemMcpListTools { /** * A tool available on an MCP server. */ export interface Tool { input_schema: unknown; name: string; annotations?: unknown; description?: string; [k: string]: unknown; } } /** * Reasoning text from the model. */ export interface PartReasoningText { text: string; type: 'reasoning_text'; [k: string]: unknown; } /** * **gpt-5 and o-series models only** * * Configuration options for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). */ export interface Reasoning { effort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'; generate_summary?: 'auto' | 'concise' | 'detailed'; summary?: 'auto' | 'concise' | 'detailed'; [k: string]: unknown; } /** * A tool call that applies file diffs by creating, deleting, or updating files. */ export interface ResponseApplyPatchToolCall { id: string; call_id: string; /** * Instruction describing how to create a file via the apply_patch tool. */ operation: | ResponseApplyPatchToolCall.OperationCreateFile | ResponseApplyPatchToolCall.OperationDeleteFile | ResponseApplyPatchToolCall.OperationUpdateFile; status: 'in_progress' | 'completed'; type: 'apply_patch_call'; created_by?: string; [k: string]: unknown; } export namespace ResponseApplyPatchToolCall { /** * Instruction describing how to create a file via the apply_patch tool. */ export interface OperationCreateFile { diff: string; path: string; type: 'create_file'; [k: string]: unknown; } /** * Instruction describing how to delete a file via the apply_patch tool. */ export interface OperationDeleteFile { path: string; type: 'delete_file'; [k: string]: unknown; } /** * Instruction describing how to update a file via the apply_patch tool. */ export interface OperationUpdateFile { diff: string; path: string; type: 'update_file'; [k: string]: unknown; } } /** * The output emitted by an apply patch tool call. */ export interface ResponseApplyPatchToolCallOutput { id: string; call_id: string; status: 'completed' | 'failed'; type: 'apply_patch_call_output'; created_by?: string; output?: string; [k: string]: unknown; } /** * A compaction item generated by the * [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact). */ export interface ResponseCompactionItem { id: string; encrypted_content: string; type: 'compaction'; created_by?: string; [k: string]: unknown; } /** * A compaction item generated by the * [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact). */ export interface ResponseCompactionItemParam { encrypted_content: string; type: 'compaction'; id?: string; [k: string]: unknown; } /** * A computer screenshot image used with the computer use tool. */ export interface ResponseComputerToolCallOutputScreenshot { type: 'computer_screenshot'; file_id?: string; image_url?: string; [k: string]: unknown; } /** * A tool call that executes one or more shell commands in a managed environment. */ export interface ResponseFunctionShellToolCall { id: string; /** * The shell commands and limits that describe how to run the tool call. */ action: ResponseFunctionShellToolCall.Action; call_id: string; status: 'in_progress' | 'completed' | 'incomplete'; type: 'shell_call'; created_by?: string; /** * Represents the use of a local environment to perform shell actions. */ environment?: | ResponseFunctionShellToolCall.ResponseLocalEnvironment | ResponseFunctionShellToolCall.ResponseContainerReference; [k: string]: unknown; } export namespace ResponseFunctionShellToolCall { /** * The shell commands and limits that describe how to run the tool call. */ export interface Action { commands: Array; max_output_length?: number; timeout_ms?: number; [k: string]: unknown; } /** * Represents the use of a local environment to perform shell actions. */ export interface ResponseLocalEnvironment { type: 'local'; [k: string]: unknown; } /** * Represents a container created with /v1/containers. */ export interface ResponseContainerReference { container_id: string; type: 'container_reference'; [k: string]: unknown; } } /** * The output of a shell tool call that was emitted. */ export interface ResponseFunctionShellToolCallOutput { id: string; call_id: string; output: Array; status: 'in_progress' | 'completed' | 'incomplete'; type: 'shell_call_output'; created_by?: string; max_output_length?: number; [k: string]: unknown; } export namespace ResponseFunctionShellToolCallOutput { /** * The content of a shell tool call output that was emitted. */ export interface Output { /** * Indicates that the shell call exceeded its configured time limit. */ outcome: Output.OutputOutcomeTimeout | Output.OutputOutcomeExit; stderr: string; stdout: string; created_by?: string; [k: string]: unknown; } export namespace Output { /** * Indicates that the shell call exceeded its configured time limit. */ export interface OutputOutcomeTimeout { type: 'timeout'; [k: string]: unknown; } /** * Indicates that the shell commands finished and returned an exit code. */ export interface OutputOutcomeExit { exit_code: number; type: 'exit'; [k: string]: unknown; } } } /** * A tool representing a request to execute one or more shell commands. */ export interface ShellCall { /** * The shell commands and limits that describe how to run the tool call. */ action: ShellCall.Action; call_id: string; type: 'shell_call'; id?: string; environment?: LocalEnvironment | ContainerReference; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } export namespace ShellCall { /** * The shell commands and limits that describe how to run the tool call. */ export interface Action { commands: Array; max_output_length?: number; timeout_ms?: number; [k: string]: unknown; } } /** * The streamed output items emitted by a shell tool call. */ export interface ShellCallOutput { call_id: string; output: Array; type: 'shell_call_output'; id?: string; max_output_length?: number; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } export namespace ShellCallOutput { /** * Captured stdout and stderr for a portion of a shell tool call output. */ export interface Output { /** * Indicates that the shell call exceeded its configured time limit. */ outcome: Output.OutcomeTimeout | Output.OutcomeExit; stderr: string; stdout: string; [k: string]: unknown; } export namespace Output { /** * Indicates that the shell call exceeded its configured time limit. */ export interface OutcomeTimeout { type: 'timeout'; [k: string]: unknown; } /** * Indicates that the shell commands finished and returned an exit code. */ export interface OutcomeExit { exit_code: number; type: 'exit'; [k: string]: unknown; } } } /** * Constrains the tools available to the model to a pre-defined set. */ export interface ToolChoiceAllowed { mode: 'auto' | 'required'; tools: Array<{ [key: string]: unknown }>; type: 'allowed_tools'; [k: string]: unknown; } /** * Forces the model to call the apply_patch tool when executing a tool call. */ export interface ToolChoiceApplyPatch { type: 'apply_patch'; [k: string]: unknown; } /** * Use this option to force the model to call a specific custom tool. */ export interface ToolChoiceCustom { name: string; type: 'custom'; [k: string]: unknown; } /** * Use this option to force the model to call a specific function. */ export interface ToolChoiceFunction { name: string; type: 'function'; [k: string]: unknown; } /** * Use this option to force the model to call a specific tool on a remote MCP * server. */ export interface ToolChoiceMcp { server_label: string; type: 'mcp'; name?: string; [k: string]: unknown; } /** * Forces the model to call the shell tool when a tool call is required. */ export interface ToolChoiceShell { type: 'shell'; [k: string]: unknown; } /** * Indicates that the model should use a built-in tool to generate a response. * [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools). */ export interface ToolChoiceTypes { type: | 'file_search' | 'web_search_preview' | 'computer_use_preview' | 'web_search_preview_2025_03_11' | 'image_generation' | 'code_interpreter'; [k: string]: unknown; } /** * 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). */ export interface WebSearchPreviewTool { type: 'web_search_preview' | 'web_search_preview_2025_03_11'; search_context_size?: 'low' | 'medium' | 'high'; /** * The user's location. */ user_location?: WebSearchPreviewTool.UserLocation; [k: string]: unknown; } export namespace WebSearchPreviewTool { /** * The user's location. */ export interface UserLocation { type: 'approximate'; city?: string; country?: string; region?: string; timezone?: string; [k: string]: unknown; } } /** * Search the Internet for sources related to the prompt. * * Learn more about the * [web search tool](https://platform.openai.com/docs/guides/tools-web-search). */ export interface WebSearchTool { type: 'web_search' | 'web_search_2025_08_26'; /** * Filters for the search. */ filters?: WebSearchTool.Filters; search_context_size?: 'low' | 'medium' | 'high'; /** * The approximate location of the user. */ user_location?: WebSearchTool.UserLocation; [k: string]: unknown; } export namespace WebSearchTool { /** * Filters for the search. */ export interface Filters { allowed_domains?: Array; [k: string]: unknown; } /** * The approximate location of the user. */ export interface UserLocation { city?: string; country?: string; region?: string; timezone?: string; type?: 'approximate'; [k: string]: unknown; } } /** * Emitted when there is a partial audio response. */ export type ResponseCreateResponse = | OpenAIResponse | ResponseCreateResponse.ResponseAudioDeltaEvent | ResponseCreateResponse.ResponseAudioDoneEvent | ResponseCreateResponse.ResponseAudioTranscriptDeltaEvent | ResponseCreateResponse.ResponseAudioTranscriptDoneEvent | ResponseCreateResponse.ResponseCodeInterpreterCallCodeDeltaEvent | ResponseCreateResponse.ResponseCodeInterpreterCallCodeDoneEvent | ResponseCreateResponse.ResponseCodeInterpreterCallCompletedEvent | ResponseCreateResponse.ResponseCodeInterpreterCallInProgressEvent | ResponseCreateResponse.ResponseCodeInterpreterCallInterpretingEvent | ResponseCreateResponse.ResponseCompletedEvent | ResponseCreateResponse.ResponseContentPartAddedEvent | ResponseCreateResponse.ResponseContentPartDoneEvent | ResponseCreateResponse.ResponseCreatedEvent | ResponseCreateResponse.ResponseErrorEvent | ResponseCreateResponse.ResponseFileSearchCallCompletedEvent | ResponseCreateResponse.ResponseFileSearchCallInProgressEvent | ResponseCreateResponse.ResponseFileSearchCallSearchingEvent | ResponseCreateResponse.ResponseFunctionCallArgumentsDeltaEvent | ResponseCreateResponse.ResponseFunctionCallArgumentsDoneEvent | ResponseCreateResponse.ResponseInProgressEvent | ResponseCreateResponse.ResponseFailedEvent | ResponseCreateResponse.ResponseIncompleteEvent | ResponseCreateResponse.ResponseOutputItemAddedEvent | ResponseCreateResponse.ResponseOutputItemDoneEvent | ResponseCreateResponse.ResponseReasoningSummaryPartAddedEvent | ResponseCreateResponse.ResponseReasoningSummaryPartDoneEvent | ResponseCreateResponse.ResponseReasoningSummaryTextDeltaEvent | ResponseCreateResponse.ResponseReasoningSummaryTextDoneEvent | ResponseCreateResponse.ResponseReasoningTextDeltaEvent | ResponseCreateResponse.ResponseReasoningTextDoneEvent | ResponseCreateResponse.ResponseRefusalDeltaEvent | ResponseCreateResponse.ResponseRefusalDoneEvent | ResponseCreateResponse.ResponseTextDeltaEvent | ResponseCreateResponse.ResponseTextDoneEvent | ResponseCreateResponse.ResponseWebSearchCallCompletedEvent | ResponseCreateResponse.ResponseWebSearchCallInProgressEvent | ResponseCreateResponse.ResponseWebSearchCallSearchingEvent | ResponseCreateResponse.ResponseImageGenCallCompletedEvent | ResponseCreateResponse.ResponseImageGenCallGeneratingEvent | ResponseCreateResponse.ResponseImageGenCallInProgressEvent | ResponseCreateResponse.ResponseImageGenCallPartialImageEvent | ResponseCreateResponse.ResponseMcpCallArgumentsDeltaEvent | ResponseCreateResponse.ResponseMcpCallArgumentsDoneEvent | ResponseCreateResponse.ResponseMcpCallCompletedEvent | ResponseCreateResponse.ResponseMcpCallFailedEvent | ResponseCreateResponse.ResponseMcpCallInProgressEvent | ResponseCreateResponse.ResponseMcpListToolsCompletedEvent | ResponseCreateResponse.ResponseMcpListToolsFailedEvent | ResponseCreateResponse.ResponseMcpListToolsInProgressEvent | ResponseCreateResponse.ResponseOutputTextAnnotationAddedEvent | ResponseCreateResponse.ResponseQueuedEvent | ResponseCreateResponse.ResponseCustomToolCallInputDeltaEvent | ResponseCreateResponse.ResponseCustomToolCallInputDoneEvent | ResponseCreateResponse.GenericResponseEvent; export namespace ResponseCreateResponse { /** * Emitted when there is a partial audio response. */ export interface ResponseAudioDeltaEvent { delta: string; sequence_number: number; type: 'response.audio.delta'; [k: string]: unknown; } /** * Emitted when the audio response is complete. */ export interface ResponseAudioDoneEvent { sequence_number: number; type: 'response.audio.done'; [k: string]: unknown; } /** * Emitted when there is a partial transcript of audio. */ export interface ResponseAudioTranscriptDeltaEvent { delta: string; sequence_number: number; type: 'response.audio.transcript.delta'; [k: string]: unknown; } /** * Emitted when the full audio transcript is completed. */ export interface ResponseAudioTranscriptDoneEvent { sequence_number: number; type: 'response.audio.transcript.done'; [k: string]: unknown; } /** * Emitted when a partial code snippet is streamed by the code interpreter. */ export interface ResponseCodeInterpreterCallCodeDeltaEvent { delta: string; item_id: string; output_index: number; sequence_number: number; type: 'response.code_interpreter_call_code.delta'; [k: string]: unknown; } /** * Emitted when the code snippet is finalized by the code interpreter. */ export interface ResponseCodeInterpreterCallCodeDoneEvent { code: string; item_id: string; output_index: number; sequence_number: number; type: 'response.code_interpreter_call_code.done'; [k: string]: unknown; } /** * Emitted when the code interpreter call is completed. */ export interface ResponseCodeInterpreterCallCompletedEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.code_interpreter_call.completed'; [k: string]: unknown; } /** * Emitted when a code interpreter call is in progress. */ export interface ResponseCodeInterpreterCallInProgressEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.code_interpreter_call.in_progress'; [k: string]: unknown; } /** * Emitted when the code interpreter is actively interpreting the code snippet. */ export interface ResponseCodeInterpreterCallInterpretingEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.code_interpreter_call.interpreting'; [k: string]: unknown; } /** * Emitted when the model response is complete. */ export interface ResponseCompletedEvent { response: ResponsesAPI.OpenAIResponse; sequence_number: number; type: 'response.completed'; [k: string]: unknown; } /** * Emitted when a new content part is added. */ export interface ResponseContentPartAddedEvent { content_index: number; item_id: string; output_index: number; /** * A text output from the model. */ part: | ResponsesAPI.OpenAIResponseOutputText | ResponsesAPI.OpenAIResponseOutputRefusal | ResponsesAPI.PartReasoningText; sequence_number: number; type: 'response.content_part.added'; [k: string]: unknown; } /** * Emitted when a content part is done. */ export interface ResponseContentPartDoneEvent { content_index: number; item_id: string; output_index: number; /** * A text output from the model. */ part: | ResponsesAPI.OpenAIResponseOutputText | ResponsesAPI.OpenAIResponseOutputRefusal | ResponsesAPI.PartReasoningText; sequence_number: number; type: 'response.content_part.done'; [k: string]: unknown; } /** * An event that is emitted when a response is created. */ export interface ResponseCreatedEvent { response: ResponsesAPI.OpenAIResponse; sequence_number: number; type: 'response.created'; [k: string]: unknown; } /** * Emitted when an error occurs. */ export interface ResponseErrorEvent { message: string; sequence_number: number; type: 'error'; code?: string; param?: string; [k: string]: unknown; } /** * Emitted when a file search call is completed (results found). */ export interface ResponseFileSearchCallCompletedEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.file_search_call.completed'; [k: string]: unknown; } /** * Emitted when a file search call is initiated. */ export interface ResponseFileSearchCallInProgressEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.file_search_call.in_progress'; [k: string]: unknown; } /** * Emitted when a file search is currently searching. */ export interface ResponseFileSearchCallSearchingEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.file_search_call.searching'; [k: string]: unknown; } /** * Emitted when there is a partial function-call arguments delta. */ export interface ResponseFunctionCallArgumentsDeltaEvent { delta: string; item_id: string; output_index: number; sequence_number: number; type: 'response.function_call_arguments.delta'; [k: string]: unknown; } /** * Emitted when function-call arguments are finalized. */ export interface ResponseFunctionCallArgumentsDoneEvent { arguments: string; item_id: string; name: string; output_index: number; sequence_number: number; type: 'response.function_call_arguments.done'; [k: string]: unknown; } /** * Emitted when the response is in progress. */ export interface ResponseInProgressEvent { response: ResponsesAPI.OpenAIResponse; sequence_number: number; type: 'response.in_progress'; [k: string]: unknown; } /** * An event that is emitted when a response fails. */ export interface ResponseFailedEvent { response: ResponsesAPI.OpenAIResponse; sequence_number: number; type: 'response.failed'; [k: string]: unknown; } /** * An event that is emitted when a response finishes as incomplete. */ export interface ResponseIncompleteEvent { response: ResponsesAPI.OpenAIResponse; sequence_number: number; type: 'response.incomplete'; [k: string]: unknown; } /** * Emitted when a new output item is added. */ export interface ResponseOutputItemAddedEvent { /** * An output message from the model. */ item: | ResponsesAPI.OpenAIResponseOutputMessage | ResponsesAPI.OpenAIResponseFileSearchToolCall | ResponsesAPI.OpenAIResponseFunctionToolCall | ResponsesAPI.OpenAIResponseFunctionWebSearch | ResponsesAPI.OpenAIResponseComputerToolCall | ResponsesAPI.OpenAIResponseReasoningItem | ResponsesAPI.ResponseCompactionItem | ResponsesAPI.OpenAITypesResponsesResponseOutputItemImageGenerationCall | ResponsesAPI.OpenAIResponseCodeInterpreterToolCall | ResponsesAPI.OpenAITypesResponsesResponseOutputItemLocalShellCall | ResponsesAPI.ResponseFunctionShellToolCall | ResponsesAPI.ResponseFunctionShellToolCallOutput | ResponsesAPI.ResponseApplyPatchToolCall | ResponsesAPI.ResponseApplyPatchToolCallOutput | ResponsesAPI.OpenAITypesResponsesResponseOutputItemMcpCall | ResponsesAPI.OpenAITypesResponsesResponseOutputItemMcpListTools | ResponsesAPI.McpApprovalRequest | ResponsesAPI.OpenAIResponseCustomToolCall; output_index: number; sequence_number: number; type: 'response.output_item.added'; [k: string]: unknown; } /** * Emitted when an output item is marked done. */ export interface ResponseOutputItemDoneEvent { /** * An output message from the model. */ item: | ResponsesAPI.OpenAIResponseOutputMessage | ResponsesAPI.OpenAIResponseFileSearchToolCall | ResponsesAPI.OpenAIResponseFunctionToolCall | ResponsesAPI.OpenAIResponseFunctionWebSearch | ResponsesAPI.OpenAIResponseComputerToolCall | ResponsesAPI.OpenAIResponseReasoningItem | ResponsesAPI.ResponseCompactionItem | ResponsesAPI.OpenAITypesResponsesResponseOutputItemImageGenerationCall | ResponsesAPI.OpenAIResponseCodeInterpreterToolCall | ResponsesAPI.OpenAITypesResponsesResponseOutputItemLocalShellCall | ResponsesAPI.ResponseFunctionShellToolCall | ResponsesAPI.ResponseFunctionShellToolCallOutput | ResponsesAPI.ResponseApplyPatchToolCall | ResponsesAPI.ResponseApplyPatchToolCallOutput | ResponsesAPI.OpenAITypesResponsesResponseOutputItemMcpCall | ResponsesAPI.OpenAITypesResponsesResponseOutputItemMcpListTools | ResponsesAPI.McpApprovalRequest | ResponsesAPI.OpenAIResponseCustomToolCall; output_index: number; sequence_number: number; type: 'response.output_item.done'; [k: string]: unknown; } /** * Emitted when a new reasoning summary part is added. */ export interface ResponseReasoningSummaryPartAddedEvent { item_id: string; output_index: number; /** * The summary part that was added. */ part: ResponseReasoningSummaryPartAddedEvent.Part; sequence_number: number; summary_index: number; type: 'response.reasoning_summary_part.added'; [k: string]: unknown; } export namespace ResponseReasoningSummaryPartAddedEvent { /** * The summary part that was added. */ export interface Part { text: string; type: 'summary_text'; [k: string]: unknown; } } /** * Emitted when a reasoning summary part is completed. */ export interface ResponseReasoningSummaryPartDoneEvent { item_id: string; output_index: number; /** * The completed summary part. */ part: ResponseReasoningSummaryPartDoneEvent.Part; sequence_number: number; summary_index: number; type: 'response.reasoning_summary_part.done'; [k: string]: unknown; } export namespace ResponseReasoningSummaryPartDoneEvent { /** * The completed summary part. */ export interface Part { text: string; type: 'summary_text'; [k: string]: unknown; } } /** * Emitted when a delta is added to a reasoning summary text. */ export interface ResponseReasoningSummaryTextDeltaEvent { delta: string; item_id: string; output_index: number; sequence_number: number; summary_index: number; type: 'response.reasoning_summary_text.delta'; [k: string]: unknown; } /** * Emitted when a reasoning summary text is completed. */ export interface ResponseReasoningSummaryTextDoneEvent { item_id: string; output_index: number; sequence_number: number; summary_index: number; text: string; type: 'response.reasoning_summary_text.done'; [k: string]: unknown; } /** * Emitted when a delta is added to a reasoning text. */ export interface ResponseReasoningTextDeltaEvent { content_index: number; delta: string; item_id: string; output_index: number; sequence_number: number; type: 'response.reasoning_text.delta'; [k: string]: unknown; } /** * Emitted when a reasoning text is completed. */ export interface ResponseReasoningTextDoneEvent { content_index: number; item_id: string; output_index: number; sequence_number: number; text: string; type: 'response.reasoning_text.done'; [k: string]: unknown; } /** * Emitted when there is a partial refusal text. */ export interface ResponseRefusalDeltaEvent { content_index: number; delta: string; item_id: string; output_index: number; sequence_number: number; type: 'response.refusal.delta'; [k: string]: unknown; } /** * Emitted when refusal text is finalized. */ export interface ResponseRefusalDoneEvent { content_index: number; item_id: string; output_index: number; refusal: string; sequence_number: number; type: 'response.refusal.done'; [k: string]: unknown; } /** * Emitted when there is an additional text delta. */ export interface ResponseTextDeltaEvent { content_index: number; delta: string; item_id: string; logprobs: Array; output_index: number; sequence_number: number; type: 'response.output_text.delta'; [k: string]: unknown; } export namespace ResponseTextDeltaEvent { /** * 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. */ export interface Logprob { token: string; logprob: number; top_logprobs?: Array; [k: string]: unknown; } export namespace Logprob { export interface TopLogprob { token?: string; logprob?: number; [k: string]: unknown; } } } /** * Emitted when text content is finalized. */ export interface ResponseTextDoneEvent { content_index: number; item_id: string; logprobs: Array; output_index: number; sequence_number: number; text: string; type: 'response.output_text.done'; [k: string]: unknown; } export namespace ResponseTextDoneEvent { /** * 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. */ export interface Logprob { token: string; logprob: number; top_logprobs?: Array; [k: string]: unknown; } export namespace Logprob { export interface TopLogprob { token?: string; logprob?: number; [k: string]: unknown; } } } /** * Emitted when a web search call is completed. */ export interface ResponseWebSearchCallCompletedEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.web_search_call.completed'; [k: string]: unknown; } /** * Emitted when a web search call is initiated. */ export interface ResponseWebSearchCallInProgressEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.web_search_call.in_progress'; [k: string]: unknown; } /** * Emitted when a web search call is executing. */ export interface ResponseWebSearchCallSearchingEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.web_search_call.searching'; [k: string]: unknown; } /** * Emitted when an image generation tool call has completed and the final image is * available. */ export interface ResponseImageGenCallCompletedEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.image_generation_call.completed'; [k: string]: unknown; } /** * Emitted when an image generation tool call is actively generating an image * (intermediate state). */ export interface ResponseImageGenCallGeneratingEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.image_generation_call.generating'; [k: string]: unknown; } /** * Emitted when an image generation tool call is in progress. */ export interface ResponseImageGenCallInProgressEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.image_generation_call.in_progress'; [k: string]: unknown; } /** * Emitted when a partial image is available during image generation streaming. */ export interface ResponseImageGenCallPartialImageEvent { item_id: string; output_index: number; partial_image_b64: string; partial_image_index: number; sequence_number: number; type: 'response.image_generation_call.partial_image'; [k: string]: unknown; } /** * Emitted when there is a delta (partial update) to the arguments of an MCP tool * call. */ export interface ResponseMcpCallArgumentsDeltaEvent { delta: string; item_id: string; output_index: number; sequence_number: number; type: 'response.mcp_call_arguments.delta'; [k: string]: unknown; } /** * Emitted when the arguments for an MCP tool call are finalized. */ export interface ResponseMcpCallArgumentsDoneEvent { arguments: string; item_id: string; output_index: number; sequence_number: number; type: 'response.mcp_call_arguments.done'; [k: string]: unknown; } /** * Emitted when an MCP tool call has completed successfully. */ export interface ResponseMcpCallCompletedEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.mcp_call.completed'; [k: string]: unknown; } /** * Emitted when an MCP tool call has failed. */ export interface ResponseMcpCallFailedEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.mcp_call.failed'; [k: string]: unknown; } /** * Emitted when an MCP tool call is in progress. */ export interface ResponseMcpCallInProgressEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.mcp_call.in_progress'; [k: string]: unknown; } /** * Emitted when the list of available MCP tools has been successfully retrieved. */ export interface ResponseMcpListToolsCompletedEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.mcp_list_tools.completed'; [k: string]: unknown; } /** * Emitted when the attempt to list available MCP tools has failed. */ export interface ResponseMcpListToolsFailedEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.mcp_list_tools.failed'; [k: string]: unknown; } /** * Emitted when the system is in the process of retrieving the list of available * MCP tools. */ export interface ResponseMcpListToolsInProgressEvent { item_id: string; output_index: number; sequence_number: number; type: 'response.mcp_list_tools.in_progress'; [k: string]: unknown; } /** * Emitted when an annotation is added to output text content. */ export interface ResponseOutputTextAnnotationAddedEvent { annotation: unknown; annotation_index: number; content_index: number; item_id: string; output_index: number; sequence_number: number; type: 'response.output_text.annotation.added'; [k: string]: unknown; } /** * Emitted when a response is queued and waiting to be processed. */ export interface ResponseQueuedEvent { response: ResponsesAPI.OpenAIResponse; sequence_number: number; type: 'response.queued'; [k: string]: unknown; } /** * Event representing a delta (partial update) to the input of a custom tool call. */ export interface ResponseCustomToolCallInputDeltaEvent { delta: string; item_id: string; output_index: number; sequence_number: number; type: 'response.custom_tool_call_input.delta'; [k: string]: unknown; } /** * Event indicating that input for a custom tool call is complete. */ export interface ResponseCustomToolCallInputDoneEvent { input: string; item_id: string; output_index: number; sequence_number: number; type: 'response.custom_tool_call_input.done'; [k: string]: unknown; } export interface GenericResponseEvent { type: string; [k: string]: unknown; } } export interface ResponseCreateParams { input: | string | Array< | ResponseCreateParams.EasyInputMessageParam | ResponseCreateParams.OpenAITypesResponsesResponseInputParamMessage | ResponseCreateParams.ResponseOutputMessageParam | ResponseCreateParams.ResponseFileSearchToolCallParam | ResponseCreateParams.ResponseComputerToolCallParam | ResponseCreateParams.OpenAITypesResponsesResponseInputParamComputerCallOutput | ResponseCreateParams.ResponseFunctionWebSearchParam | ResponseCreateParams.ResponseFunctionToolCallParam | ResponseCreateParams.OpenAITypesResponsesResponseInputParamFunctionCallOutput | ResponseCreateParams.ResponseReasoningItemParam | ResponseCreateParams.ResponseCompactionItemParamParam | ResponseCreateParams.OpenAITypesResponsesResponseInputParamImageGenerationCall | ResponseCreateParams.ResponseCodeInterpreterToolCallParam | ResponseCreateParams.OpenAITypesResponsesResponseInputParamLocalShellCall | ResponseCreateParams.OpenAITypesResponsesResponseInputParamLocalShellCallOutput | ResponseCreateParams.OpenAITypesResponsesResponseInputParamShellCall | ResponseCreateParams.OpenAITypesResponsesResponseInputParamShellCallOutput | ResponseCreateParams.OpenAITypesResponsesResponseInputParamApplyPatchCall | ResponseCreateParams.OpenAITypesResponsesResponseInputParamApplyPatchCallOutput | ResponseCreateParams.OpenAITypesResponsesResponseInputParamMcpListTools | McpApprovalRequest | ResponseCreateParams.OpenAITypesResponsesResponseInputParamMcpApprovalResponse | ResponseCreateParams.OpenAITypesResponsesResponseInputParamMcpCall | ResponseCreateParams.ResponseCustomToolCallOutputParam | ResponseCreateParams.ResponseCustomToolCallParam | ResponseCreateParams.OpenAITypesResponsesResponseInputParamItemReference >; /** * model specified as `model_vendor/model`, for example `openai/gpt-4o` */ model: string; /** * Which fields to include in the response */ include?: Array; /** * Instructions for the response generation */ instructions?: string; /** * Maximum number of output tokens */ max_output_tokens?: number; /** * Metadata for the response */ metadata?: { [key: string]: unknown }; /** * Whether to enable parallel tool calls */ parallel_tool_calls?: boolean; /** * ID of the previous response for chaining */ previous_response_id?: string; /** * Reasoning configuration for the response */ reasoning?: { [key: string]: unknown }; /** * Whether to store the response */ store?: boolean; /** * Whether to stream the response */ stream?: boolean; /** * Sampling temperature for randomness control */ temperature?: number; /** * Text configuration parameters */ text?: { [key: string]: unknown }; /** * Tool choice configuration */ tool_choice?: string | { [key: string]: unknown }; /** * Tools available for the response */ tools?: Array<{ [key: string]: unknown }>; /** * Top-p sampling parameter */ top_p?: number; /** * Truncation configuration */ truncation?: 'auto' | 'disabled'; [k: string]: unknown; } export namespace ResponseCreateParams { /** * 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. */ export interface EasyInputMessageParam { content: | string | Array< | ResponsesAPI.OpenAIResponseInputTextParam | ResponsesAPI.OpenAIResponseInputImageParam | ResponsesAPI.OpenAIResponseInputFileParam >; role: 'user' | 'assistant' | 'system' | 'developer'; phase?: 'commentary' | 'final_answer'; type?: 'message'; [k: string]: unknown; } /** * 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. */ export interface OpenAITypesResponsesResponseInputParamMessage { content: Array< | ResponsesAPI.OpenAIResponseInputTextParam | ResponsesAPI.OpenAIResponseInputImageParam | ResponsesAPI.OpenAIResponseInputFileParam >; role: 'user' | 'system' | 'developer'; status?: 'in_progress' | 'completed' | 'incomplete'; type?: 'message'; [k: string]: unknown; } /** * An output message from the model. */ export interface ResponseOutputMessageParam { id: string; content: Array< | ResponseOutputMessageParam.ResponseOutputTextParam | ResponseOutputMessageParam.ResponseOutputRefusalParam >; role: 'assistant'; status: 'in_progress' | 'completed' | 'incomplete'; type: 'message'; phase?: 'commentary' | 'final_answer'; [k: string]: unknown; } export namespace ResponseOutputMessageParam { /** * A text output from the model. */ export interface ResponseOutputTextParam { annotations: Array< | ResponseOutputTextParam.AnnotationFileCitation | ResponseOutputTextParam.OpenAITypesResponsesResponseOutputTextParamAnnotationURLCitation | ResponseOutputTextParam.AnnotationContainerFileCitation | ResponseOutputTextParam.AnnotationFilePath >; text: string; type: 'output_text'; logprobs?: Array; [k: string]: unknown; } export namespace ResponseOutputTextParam { /** * A citation to a file. */ export interface AnnotationFileCitation { file_id: string; filename: string; index: number; type: 'file_citation'; [k: string]: unknown; } /** * A citation for a web resource used to generate a model response. */ export interface OpenAITypesResponsesResponseOutputTextParamAnnotationURLCitation { end_index: number; start_index: number; title: string; type: 'url_citation'; url: string; [k: string]: unknown; } /** * A citation for a container file used to generate a model response. */ export interface AnnotationContainerFileCitation { container_id: string; end_index: number; file_id: string; filename: string; start_index: number; type: 'container_file_citation'; [k: string]: unknown; } /** * A path to a file. */ export interface AnnotationFilePath { file_id: string; index: number; type: 'file_path'; [k: string]: unknown; } /** * The log probability of a token. */ export interface Logprob { token: string; bytes: Array; logprob: number; top_logprobs: Array; [k: string]: unknown; } export namespace Logprob { /** * The top log probability of a token. */ export interface TopLogprob { token: string; bytes: Array; logprob: number; [k: string]: unknown; } } } /** * A refusal from the model. */ export interface ResponseOutputRefusalParam { refusal: string; type: 'refusal'; [k: string]: unknown; } } /** * The results of a file search tool call. * * See the * [file search guide](https://platform.openai.com/docs/guides/tools-file-search) * for more information. */ export interface ResponseFileSearchToolCallParam { id: string; queries: Array; status: 'in_progress' | 'searching' | 'completed' | 'incomplete' | 'failed'; type: 'file_search_call'; results?: Array; [k: string]: unknown; } export namespace ResponseFileSearchToolCallParam { export interface Result { attributes?: { [key: string]: string | number | boolean }; file_id?: string; filename?: string; score?: number; text?: string; [k: string]: unknown; } } /** * A tool call to a computer use tool. * * See the * [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) * for more information. */ export interface ResponseComputerToolCallParam { id: string; /** * A click action. */ action: | ResponseComputerToolCallParam.ActionClick | ResponseComputerToolCallParam.ActionDoubleClick | ResponseComputerToolCallParam.ActionDrag | ResponseComputerToolCallParam.ActionKeypress | ResponseComputerToolCallParam.ActionMove | ResponseComputerToolCallParam.ActionScreenshot | ResponseComputerToolCallParam.ActionScroll | ResponseComputerToolCallParam.ActionType | ResponseComputerToolCallParam.ActionWait; call_id: string; pending_safety_checks: Array; status: 'in_progress' | 'completed' | 'incomplete'; type: 'computer_call'; [k: string]: unknown; } export namespace ResponseComputerToolCallParam { /** * A click action. */ export interface ActionClick { button: 'left' | 'right' | 'wheel' | 'back' | 'forward'; type: 'click'; x: number; y: number; [k: string]: unknown; } /** * A double click action. */ export interface ActionDoubleClick { type: 'double_click'; x: number; y: number; [k: string]: unknown; } /** * A drag action. */ export interface ActionDrag { path: Array; type: 'drag'; [k: string]: unknown; } export namespace ActionDrag { /** * An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`. */ export interface Path { x: number; y: number; [k: string]: unknown; } } /** * A collection of keypresses the model would like to perform. */ export interface ActionKeypress { keys: Array; type: 'keypress'; [k: string]: unknown; } /** * A mouse move action. */ export interface ActionMove { type: 'move'; x: number; y: number; [k: string]: unknown; } /** * A screenshot action. */ export interface ActionScreenshot { type: 'screenshot'; [k: string]: unknown; } /** * A scroll action. */ export interface ActionScroll { scroll_x: number; scroll_y: number; type: 'scroll'; x: number; y: number; [k: string]: unknown; } /** * An action to type in text. */ export interface ActionType { text: string; type: 'type'; [k: string]: unknown; } /** * A wait action. */ export interface ActionWait { type: 'wait'; [k: string]: unknown; } /** * A pending safety check for the computer call. */ export interface PendingSafetyCheck { id: string; code?: string; message?: string; [k: string]: unknown; } } /** * The output of a computer tool call. */ export interface OpenAITypesResponsesResponseInputParamComputerCallOutput { call_id: string; /** * A computer screenshot image used with the computer use tool. */ output: OpenAITypesResponsesResponseInputParamComputerCallOutput.Output; type: 'computer_call_output'; id?: string; acknowledged_safety_checks?: Array; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseInputParamComputerCallOutput { /** * A computer screenshot image used with the computer use tool. */ export interface Output { type: 'computer_screenshot'; file_id?: string; image_url?: string; [k: string]: unknown; } /** * A pending safety check for the computer call. */ export interface AcknowledgedSafetyCheck { id: string; code?: string; message?: string; [k: string]: unknown; } } /** * The results of a web search tool call. * * See the * [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for * more information. */ export interface ResponseFunctionWebSearchParam { id: string; /** * Action type "search" - Performs a web search query. */ action: | ResponseFunctionWebSearchParam.OpenAITypesResponsesResponseFunctionWebSearchParamActionSearch | ResponseFunctionWebSearchParam.OpenAITypesResponsesResponseFunctionWebSearchParamActionOpenPage | ResponseFunctionWebSearchParam.ActionFind; status: 'in_progress' | 'searching' | 'completed' | 'failed'; type: 'web_search_call'; [k: string]: unknown; } export namespace ResponseFunctionWebSearchParam { /** * Action type "search" - Performs a web search query. */ export interface OpenAITypesResponsesResponseFunctionWebSearchParamActionSearch { query: string; type: 'search'; queries?: Array; sources?: Array; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseFunctionWebSearchParamActionSearch { /** * A source used in the search. */ export interface Source { type: 'url'; url: string; [k: string]: unknown; } } /** * Action type "open_page" - Opens a specific URL from search results. */ export interface OpenAITypesResponsesResponseFunctionWebSearchParamActionOpenPage { type: 'open_page'; url?: string; [k: string]: unknown; } /** * Action type "find_in_page": Searches for a pattern within a loaded page. */ export interface ActionFind { pattern: string; type: 'find_in_page'; url: string; [k: string]: unknown; } } /** * A tool call to run a function. * * See the * [function calling guide](https://platform.openai.com/docs/guides/function-calling) * for more information. */ export interface ResponseFunctionToolCallParam { arguments: string; call_id: string; name: string; type: 'function_call'; id?: string; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } /** * The output of a function tool call. */ export interface OpenAITypesResponsesResponseInputParamFunctionCallOutput { call_id: string; output: | string | Array< | OpenAITypesResponsesResponseInputParamFunctionCallOutput.ResponseInputTextContentParam | OpenAITypesResponsesResponseInputParamFunctionCallOutput.ResponseInputImageContentParam | OpenAITypesResponsesResponseInputParamFunctionCallOutput.ResponseInputFileContentParam >; type: 'function_call_output'; id?: string; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseInputParamFunctionCallOutput { /** * A text input to the model. */ export interface ResponseInputTextContentParam { text: string; type: 'input_text'; [k: string]: unknown; } /** * An image input to the model. * * Learn about [image inputs](https://platform.openai.com/docs/guides/vision) */ export interface ResponseInputImageContentParam { type: 'input_image'; detail?: 'low' | 'high' | 'auto'; file_id?: string; image_url?: string; [k: string]: unknown; } /** * A file input to the model. */ export interface ResponseInputFileContentParam { type: 'input_file'; file_data?: string; file_id?: string; file_url?: string; filename?: string; [k: string]: unknown; } } /** * 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](https://platform.openai.com/docs/guides/conversation-state). */ export interface ResponseReasoningItemParam { id: string; summary: Array; type: 'reasoning'; content?: Array; encrypted_content?: string; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } export namespace ResponseReasoningItemParam { /** * A summary text from the model. */ export interface Summary { text: string; type: 'summary_text'; [k: string]: unknown; } /** * Reasoning text from the model. */ export interface Content { text: string; type: 'reasoning_text'; [k: string]: unknown; } } /** * A compaction item generated by the * [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact). */ export interface ResponseCompactionItemParamParam { encrypted_content: string; type: 'compaction'; id?: string; [k: string]: unknown; } /** * An image generation request made by the model. */ export interface OpenAITypesResponsesResponseInputParamImageGenerationCall { id: string; result: string | null; status: 'in_progress' | 'completed' | 'generating' | 'failed'; type: 'image_generation_call'; [k: string]: unknown; } /** * A tool call to run code. */ export interface ResponseCodeInterpreterToolCallParam { id: string; code: string | null; container_id: string; outputs: Array< ResponseCodeInterpreterToolCallParam.OutputLogs | ResponseCodeInterpreterToolCallParam.OutputImage > | null; status: 'in_progress' | 'completed' | 'incomplete' | 'interpreting' | 'failed'; type: 'code_interpreter_call'; [k: string]: unknown; } export namespace ResponseCodeInterpreterToolCallParam { /** * The logs output from the code interpreter. */ export interface OutputLogs { logs: string; type: 'logs'; [k: string]: unknown; } /** * The image output from the code interpreter. */ export interface OutputImage { type: 'image'; url: string; [k: string]: unknown; } } /** * A tool call to run a command on the local shell. */ export interface OpenAITypesResponsesResponseInputParamLocalShellCall { id: string; /** * Execute a shell command on the server. */ action: OpenAITypesResponsesResponseInputParamLocalShellCall.Action; call_id: string; status: 'in_progress' | 'completed' | 'incomplete'; type: 'local_shell_call'; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseInputParamLocalShellCall { /** * Execute a shell command on the server. */ export interface Action { command: Array; env: { [key: string]: string }; type: 'exec'; timeout_ms?: number; user?: string; working_directory?: string; [k: string]: unknown; } } /** * The output of a local shell tool call. */ export interface OpenAITypesResponsesResponseInputParamLocalShellCallOutput { id: string; output: string; type: 'local_shell_call_output'; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } /** * A tool representing a request to execute one or more shell commands. */ export interface OpenAITypesResponsesResponseInputParamShellCall { /** * The shell commands and limits that describe how to run the tool call. */ action: OpenAITypesResponsesResponseInputParamShellCall.Action; call_id: string; type: 'shell_call'; id?: string; environment?: ResponsesAPI.LocalEnvironmentParam | ResponsesAPI.ContainerReferenceParam; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseInputParamShellCall { /** * The shell commands and limits that describe how to run the tool call. */ export interface Action { commands: Array; max_output_length?: number; timeout_ms?: number; [k: string]: unknown; } } /** * The streamed output items emitted by a shell tool call. */ export interface OpenAITypesResponsesResponseInputParamShellCallOutput { call_id: string; output: Array; type: 'shell_call_output'; id?: string; max_output_length?: number; status?: 'in_progress' | 'completed' | 'incomplete'; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseInputParamShellCallOutput { /** * Captured stdout and stderr for a portion of a shell tool call output. */ export interface Output { /** * Indicates that the shell call exceeded its configured time limit. */ outcome: Output.OutcomeTimeout | Output.OutcomeExit; stderr: string; stdout: string; [k: string]: unknown; } export namespace Output { /** * Indicates that the shell call exceeded its configured time limit. */ export interface OutcomeTimeout { type: 'timeout'; [k: string]: unknown; } /** * Indicates that the shell commands finished and returned an exit code. */ export interface OutcomeExit { exit_code: number; type: 'exit'; [k: string]: unknown; } } } /** * A tool call representing a request to create, delete, or update files using diff * patches. */ export interface OpenAITypesResponsesResponseInputParamApplyPatchCall { call_id: string; /** * Instruction for creating a new file via the apply_patch tool. */ operation: | OpenAITypesResponsesResponseInputParamApplyPatchCall.ApplyPatchCallOperationCreateFile | OpenAITypesResponsesResponseInputParamApplyPatchCall.ApplyPatchCallOperationDeleteFile | OpenAITypesResponsesResponseInputParamApplyPatchCall.ApplyPatchCallOperationUpdateFile; status: 'in_progress' | 'completed'; type: 'apply_patch_call'; id?: string; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseInputParamApplyPatchCall { /** * Instruction for creating a new file via the apply_patch tool. */ export interface ApplyPatchCallOperationCreateFile { diff: string; path: string; type: 'create_file'; [k: string]: unknown; } /** * Instruction for deleting an existing file via the apply_patch tool. */ export interface ApplyPatchCallOperationDeleteFile { path: string; type: 'delete_file'; [k: string]: unknown; } /** * Instruction for updating an existing file via the apply_patch tool. */ export interface ApplyPatchCallOperationUpdateFile { diff: string; path: string; type: 'update_file'; [k: string]: unknown; } } /** * The streamed output emitted by an apply patch tool call. */ export interface OpenAITypesResponsesResponseInputParamApplyPatchCallOutput { call_id: string; status: 'completed' | 'failed'; type: 'apply_patch_call_output'; id?: string; output?: string; [k: string]: unknown; } /** * A list of tools available on an MCP server. */ export interface OpenAITypesResponsesResponseInputParamMcpListTools { id: string; server_label: string; tools: Array; type: 'mcp_list_tools'; error?: string; [k: string]: unknown; } export namespace OpenAITypesResponsesResponseInputParamMcpListTools { /** * A tool available on an MCP server. */ export interface Tool { input_schema: unknown; name: string; annotations?: unknown; description?: string; [k: string]: unknown; } } /** * A response to an MCP approval request. */ export interface OpenAITypesResponsesResponseInputParamMcpApprovalResponse { approval_request_id: string; approve: boolean; type: 'mcp_approval_response'; id?: string; reason?: string; [k: string]: unknown; } /** * An invocation of a tool on an MCP server. */ export interface OpenAITypesResponsesResponseInputParamMcpCall { id: string; arguments: string; name: string; server_label: string; type: 'mcp_call'; approval_request_id?: string; error?: string; output?: string; status?: 'in_progress' | 'completed' | 'incomplete' | 'calling' | 'failed'; [k: string]: unknown; } /** * The output of a custom tool call from your code, being sent back to the model. */ export interface ResponseCustomToolCallOutputParam { call_id: string; output: | string | Array< | ResponsesAPI.OpenAIResponseInputTextParam | ResponsesAPI.OpenAIResponseInputImageParam | ResponsesAPI.OpenAIResponseInputFileParam >; type: 'custom_tool_call_output'; id?: string; [k: string]: unknown; } /** * A call to a custom tool created by the model. */ export interface ResponseCustomToolCallParam { call_id: string; input: string; name: string; type: 'custom_tool_call'; id?: string; [k: string]: unknown; } /** * An internal identifier for an item to reference. */ export interface OpenAITypesResponsesResponseInputParamItemReference { id: string; type?: 'item_reference'; [k: string]: unknown; } } export declare namespace Responses { export { type ApplyPatchCall as ApplyPatchCall, type ApplyPatchCallOutput as ApplyPatchCallOutput, type ApplyPatchTool as ApplyPatchTool, type ComputerTool as ComputerTool, type ContainerNetworkPolicyAllowlist as ContainerNetworkPolicyAllowlist, type ContainerNetworkPolicyDisabled as ContainerNetworkPolicyDisabled, type ContainerReference as ContainerReference, type ContainerReferenceParam as ContainerReferenceParam, type Conversation as Conversation, type CustomTool as CustomTool, type EasyInputMessage as EasyInputMessage, type FileSearchTool as FileSearchTool, type FunctionShellTool as FunctionShellTool, type FunctionTool as FunctionTool, type IncompleteDetails as IncompleteDetails, type LocalEnvironment as LocalEnvironment, type LocalEnvironmentParam as LocalEnvironmentParam, type McpApprovalRequest as McpApprovalRequest, type OpenAIResponse as OpenAIResponse, type OpenAIResponseCodeInterpreterToolCall as OpenAIResponseCodeInterpreterToolCall, type OpenAIResponseComputerToolCall as OpenAIResponseComputerToolCall, type OpenAIResponseCustomToolCall as OpenAIResponseCustomToolCall, type OpenAIResponseCustomToolCallOutput as OpenAIResponseCustomToolCallOutput, type OpenAIResponseError as OpenAIResponseError, type OpenAIResponseFileSearchToolCall as OpenAIResponseFileSearchToolCall, type OpenAIResponseFunctionToolCall as OpenAIResponseFunctionToolCall, type OpenAIResponseFunctionWebSearch as OpenAIResponseFunctionWebSearch, type OpenAIResponseInputFile as OpenAIResponseInputFile, type OpenAIResponseInputFileParam as OpenAIResponseInputFileParam, type OpenAIResponseInputImage as OpenAIResponseInputImage, type OpenAIResponseInputImageParam as OpenAIResponseInputImageParam, type OpenAIResponseInputText as OpenAIResponseInputText, type OpenAIResponseInputTextParam as OpenAIResponseInputTextParam, type OpenAIResponseOutputMessage as OpenAIResponseOutputMessage, type OpenAIResponseOutputRefusal as OpenAIResponseOutputRefusal, type OpenAIResponseOutputText as OpenAIResponseOutputText, type OpenAIResponsePrompt as OpenAIResponsePrompt, type OpenAIResponseReasoningItem as OpenAIResponseReasoningItem, type OpenAIResponseTextConfig as OpenAIResponseTextConfig, type OpenAIResponseUsage as OpenAIResponseUsage, type OpenAITypesResponsesResponseInputItemComputerCallOutput as OpenAITypesResponsesResponseInputItemComputerCallOutput, type OpenAITypesResponsesResponseInputItemFunctionCallOutput as OpenAITypesResponsesResponseInputItemFunctionCallOutput, type OpenAITypesResponsesResponseInputItemImageGenerationCall as OpenAITypesResponsesResponseInputItemImageGenerationCall, type OpenAITypesResponsesResponseInputItemItemReference as OpenAITypesResponsesResponseInputItemItemReference, type OpenAITypesResponsesResponseInputItemLocalShellCall as OpenAITypesResponsesResponseInputItemLocalShellCall, type OpenAITypesResponsesResponseInputItemLocalShellCallOutput as OpenAITypesResponsesResponseInputItemLocalShellCallOutput, type OpenAITypesResponsesResponseInputItemMcpApprovalResponse as OpenAITypesResponsesResponseInputItemMcpApprovalResponse, type OpenAITypesResponsesResponseInputItemMcpCall as OpenAITypesResponsesResponseInputItemMcpCall, type OpenAITypesResponsesResponseInputItemMcpListTools as OpenAITypesResponsesResponseInputItemMcpListTools, type OpenAITypesResponsesResponseInputItemMessage as OpenAITypesResponsesResponseInputItemMessage, type OpenAITypesResponsesResponseOutputItemImageGenerationCall as OpenAITypesResponsesResponseOutputItemImageGenerationCall, type OpenAITypesResponsesResponseOutputItemLocalShellCall as OpenAITypesResponsesResponseOutputItemLocalShellCall, type OpenAITypesResponsesResponseOutputItemMcpCall as OpenAITypesResponsesResponseOutputItemMcpCall, type OpenAITypesResponsesResponseOutputItemMcpListTools as OpenAITypesResponsesResponseOutputItemMcpListTools, type PartReasoningText as PartReasoningText, type Reasoning as Reasoning, type ResponseApplyPatchToolCall as ResponseApplyPatchToolCall, type ResponseApplyPatchToolCallOutput as ResponseApplyPatchToolCallOutput, type ResponseCompactionItem as ResponseCompactionItem, type ResponseCompactionItemParam as ResponseCompactionItemParam, type ResponseComputerToolCallOutputScreenshot as ResponseComputerToolCallOutputScreenshot, type ResponseFunctionShellToolCall as ResponseFunctionShellToolCall, type ResponseFunctionShellToolCallOutput as ResponseFunctionShellToolCallOutput, type ShellCall as ShellCall, type ShellCallOutput as ShellCallOutput, type ToolChoiceAllowed as ToolChoiceAllowed, type ToolChoiceApplyPatch as ToolChoiceApplyPatch, type ToolChoiceCustom as ToolChoiceCustom, type ToolChoiceFunction as ToolChoiceFunction, type ToolChoiceMcp as ToolChoiceMcp, type ToolChoiceShell as ToolChoiceShell, type ToolChoiceTypes as ToolChoiceTypes, type WebSearchPreviewTool as WebSearchPreviewTool, type WebSearchTool as WebSearchTool, type ResponseCreateResponse as ResponseCreateResponse, type ResponseCreateParams as ResponseCreateParams, }; }