diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 989bed91e..514215a1e 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.100.0"
+ ".": "4.101.0"
}
diff --git a/.stats.yml b/.stats.yml
index afa33d93b..4b4f19c91 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 101
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-262e171d0a8150ea1192474d16ba3afdf9a054b399f1a49a9c9b697a3073c136.yml
-openapi_spec_hash: 33e00a48df8f94c94f46290c489f132b
-config_hash: d8d5fda350f6db77c784f35429741a2e
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a5651cb97f86d1e2531af6aef8c5230f1ea350560fbae790ca2e481b30a6c217.yml
+openapi_spec_hash: 66a5104fd3bb43383cf919225df7a6fd
+config_hash: bb657c3fed232a56930035de3aaed936
diff --git a/CHANGELOG.md b/CHANGELOG.md
index adda41e52..1e427d912 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,19 @@
# Changelog
+## 4.101.0 (2025-05-21)
+
+Full Changelog: [v4.100.0...v4.101.0](https://github.com/openai/openai-node/compare/v4.100.0...v4.101.0)
+
+### Features
+
+* **api:** new API tools ([fb4014f](https://github.com/openai/openai-node/commit/fb4014ffac7b220d37bd03c94fa745386b010bf0))
+
+
+### Chores
+
+* **docs:** grammar improvements ([7761cfb](https://github.com/openai/openai-node/commit/7761cfb0a8a56d056a73c046a6a613f66ada4abe))
+* **internal:** version bump ([b40e830](https://github.com/openai/openai-node/commit/b40e8302ec11683b6a360a050236ad1284afc760))
+
## 4.100.0 (2025-05-16)
Full Changelog: [v4.99.0...v4.100.0](https://github.com/openai/openai-node/compare/v4.99.0...v4.100.0)
diff --git a/SECURITY.md b/SECURITY.md
index 3b3bd8a66..4adb0c54f 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -16,13 +16,13 @@ before making any information public.
## Reporting Non-SDK Related Security Issues
If you encounter security issues that are not directly related to SDKs but pertain to the services
-or products provided by OpenAI please follow the respective company's security reporting guidelines.
+or products provided by OpenAI, please follow the respective company's security reporting guidelines.
### OpenAI Terms and Policies
Our Security Policy can be found at [Security Policy URL](https://openai.com/policies/coordinated-vulnerability-disclosure-policy).
-Please contact disclosure@openai.com for any questions or concerns regarding security of our services.
+Please contact disclosure@openai.com for any questions or concerns regarding the security of our services.
---
diff --git a/api.md b/api.md
index cad696e7e..f7fb47e3e 100644
--- a/api.md
+++ b/api.md
@@ -645,6 +645,10 @@ Types:
- ResponseFunctionToolCallItem
- ResponseFunctionToolCallOutputItem
- ResponseFunctionWebSearch
+- ResponseImageGenCallCompletedEvent
+- ResponseImageGenCallGeneratingEvent
+- ResponseImageGenCallInProgressEvent
+- ResponseImageGenCallPartialImageEvent
- ResponseInProgressEvent
- ResponseIncludable
- ResponseIncompleteEvent
@@ -658,6 +662,14 @@ Types:
- ResponseInputMessageItem
- ResponseInputText
- ResponseItem
+- ResponseMcpCallArgumentsDeltaEvent
+- ResponseMcpCallArgumentsDoneEvent
+- ResponseMcpCallCompletedEvent
+- ResponseMcpCallFailedEvent
+- ResponseMcpCallInProgressEvent
+- ResponseMcpListToolsCompletedEvent
+- ResponseMcpListToolsFailedEvent
+- ResponseMcpListToolsInProgressEvent
- ResponseOutputAudio
- ResponseOutputItem
- ResponseOutputItemAddedEvent
@@ -665,7 +677,13 @@ Types:
- ResponseOutputMessage
- ResponseOutputRefusal
- ResponseOutputText
+- ResponseOutputTextAnnotationAddedEvent
+- ResponseQueuedEvent
+- ResponseReasoningDeltaEvent
+- ResponseReasoningDoneEvent
- ResponseReasoningItem
+- ResponseReasoningSummaryDeltaEvent
+- ResponseReasoningSummaryDoneEvent
- ResponseReasoningSummaryPartAddedEvent
- ResponseReasoningSummaryPartDoneEvent
- ResponseReasoningSummaryTextDeltaEvent
diff --git a/jsr.json b/jsr.json
index 3c2d41b0f..42bf0a235 100644
--- a/jsr.json
+++ b/jsr.json
@@ -1,6 +1,6 @@
{
"name": "@openai/openai",
- "version": "4.100.0",
+ "version": "4.101.0",
"exports": {
".": "./index.ts",
"./helpers/zod": "./helpers/zod.ts",
diff --git a/package.json b/package.json
index 23205e569..e8cd7277c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "openai",
- "version": "4.100.0",
+ "version": "4.101.0",
"description": "The official TypeScript library for the OpenAI API",
"author": "OpenAI ",
"types": "dist/index.d.ts",
diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts
index 1440e865e..fdf51f224 100644
--- a/src/resources/responses/responses.ts
+++ b/src/resources/responses/responses.ts
@@ -37,7 +37,13 @@ export type ParsedResponseOutputItem =
| ResponseFileSearchToolCall
| ResponseFunctionWebSearch
| ResponseComputerToolCall
- | ResponseReasoningItem;
+ | ResponseReasoningItem
+ | ResponseOutputItem.ImageGenerationCall
+ | ResponseCodeInterpreterToolCall
+ | ResponseOutputItem.LocalShellCall
+ | ResponseOutputItem.McpCall
+ | ResponseOutputItem.McpListTools
+ | ResponseOutputItem.McpApprovalRequest;
export interface ParsedResponse extends Response {
output: Array>;
@@ -414,6 +420,12 @@ export interface Response {
*/
top_p: number | null;
+ /**
+ * Whether to run the model response in the background.
+ * [Learn more](https://platform.openai.com/docs/guides/background).
+ */
+ background?: boolean | null;
+
/**
* An upper bound for the number of tokens that can be generated for a response,
* including visible output tokens and
@@ -459,7 +471,7 @@ export interface Response {
/**
* The status of the response generation. One of `completed`, `failed`,
- * `in_progress`, or `incomplete`.
+ * `in_progress`, `cancelled`, `queued`, or `incomplete`.
*/
status?: ResponseStatus;
@@ -687,6 +699,11 @@ export interface ResponseCodeInterpreterToolCall {
* The type of the code interpreter tool call. Always `code_interpreter_call`.
*/
type: 'code_interpreter_call';
+
+ /**
+ * The ID of the container used to run the code.
+ */
+ container_id?: string;
}
export namespace ResponseCodeInterpreterToolCall {
@@ -1579,6 +1596,114 @@ export interface ResponseFunctionWebSearch {
type: 'web_search_call';
}
+/**
+ * Emitted when an image generation tool call has completed and the final image is
+ * available.
+ */
+export interface ResponseImageGenCallCompletedEvent {
+ /**
+ * The unique identifier of the image generation item being processed.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * The type of the event. Always 'response.image_generation_call.completed'.
+ */
+ type: 'response.image_generation_call.completed';
+}
+
+/**
+ * Emitted when an image generation tool call is actively generating an image
+ * (intermediate state).
+ */
+export interface ResponseImageGenCallGeneratingEvent {
+ /**
+ * The unique identifier of the image generation item being processed.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * The type of the event. Always 'response.image_generation_call.generating'.
+ */
+ type: 'response.image_generation_call.generating';
+
+ /**
+ * The sequence number of the image generation item being processed.
+ */
+ sequence_number?: number;
+}
+
+/**
+ * Emitted when an image generation tool call is in progress.
+ */
+export interface ResponseImageGenCallInProgressEvent {
+ /**
+ * The unique identifier of the image generation item being processed.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * The sequence number of the image generation item being processed.
+ */
+ sequence_number: number;
+
+ /**
+ * The type of the event. Always 'response.image_generation_call.in_progress'.
+ */
+ type: 'response.image_generation_call.in_progress';
+}
+
+/**
+ * Emitted when a partial image is available during image generation streaming.
+ */
+export interface ResponseImageGenCallPartialImageEvent {
+ /**
+ * The unique identifier of the image generation item being processed.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * Base64-encoded partial image data, suitable for rendering as an image.
+ */
+ partial_image_b64: string;
+
+ /**
+ * 0-based index for the partial image (backend is 1-based, but this is 0-based for
+ * the user).
+ */
+ partial_image_index: number;
+
+ /**
+ * The sequence number of the image generation item being processed.
+ */
+ sequence_number: number;
+
+ /**
+ * The type of the event. Always 'response.image_generation_call.partial_image'.
+ */
+ type: 'response.image_generation_call.partial_image';
+}
+
/**
* Emitted when the response is in progress.
*/
@@ -1732,6 +1857,14 @@ export type ResponseInputItem =
| ResponseFunctionToolCall
| ResponseInputItem.FunctionCallOutput
| ResponseReasoningItem
+ | ResponseInputItem.ImageGenerationCall
+ | ResponseCodeInterpreterToolCall
+ | ResponseInputItem.LocalShellCall
+ | ResponseInputItem.LocalShellCallOutput
+ | ResponseInputItem.McpListTools
+ | ResponseInputItem.McpApprovalRequest
+ | ResponseInputItem.McpApprovalResponse
+ | ResponseInputItem.McpCall
| ResponseInputItem.ItemReference;
export namespace ResponseInputItem {
@@ -1855,6 +1988,280 @@ export namespace ResponseInputItem {
status?: 'in_progress' | 'completed' | 'incomplete' | null;
}
+ /**
+ * An image generation request made by the model.
+ */
+ export interface ImageGenerationCall {
+ /**
+ * The unique ID of the image generation call.
+ */
+ id: string;
+
+ /**
+ * The generated image encoded in base64.
+ */
+ result: string | null;
+
+ /**
+ * The status of the image generation call.
+ */
+ status: 'in_progress' | 'completed' | 'generating' | 'failed';
+
+ /**
+ * The type of the image generation call. Always `image_generation_call`.
+ */
+ type: 'image_generation_call';
+ }
+
+ /**
+ * A tool call to run a command on the local shell.
+ */
+ export interface LocalShellCall {
+ /**
+ * The unique ID of the local shell call.
+ */
+ id: string;
+
+ /**
+ * Execute a shell command on the server.
+ */
+ action: LocalShellCall.Action;
+
+ /**
+ * The unique ID of the local shell tool call generated by the model.
+ */
+ call_id: string;
+
+ /**
+ * The status of the local shell call.
+ */
+ status: 'in_progress' | 'completed' | 'incomplete';
+
+ /**
+ * The type of the local shell call. Always `local_shell_call`.
+ */
+ type: 'local_shell_call';
+ }
+
+ export namespace LocalShellCall {
+ /**
+ * Execute a shell command on the server.
+ */
+ export interface Action {
+ /**
+ * The command to run.
+ */
+ command: Array;
+
+ /**
+ * Environment variables to set for the command.
+ */
+ env: Record;
+
+ /**
+ * The type of the local shell action. Always `exec`.
+ */
+ type: 'exec';
+
+ /**
+ * Optional timeout in milliseconds for the command.
+ */
+ timeout_ms?: number | null;
+
+ /**
+ * Optional user to run the command as.
+ */
+ user?: string | null;
+
+ /**
+ * Optional working directory to run the command in.
+ */
+ working_directory?: string | null;
+ }
+ }
+
+ /**
+ * The output of a local shell tool call.
+ */
+ export interface LocalShellCallOutput {
+ /**
+ * The unique ID of the local shell tool call generated by the model.
+ */
+ id: string;
+
+ /**
+ * A JSON string of the output of the local shell tool call.
+ */
+ output: string;
+
+ /**
+ * The type of the local shell tool call output. Always `local_shell_call_output`.
+ */
+ type: 'local_shell_call_output';
+
+ /**
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ */
+ status?: 'in_progress' | 'completed' | 'incomplete' | null;
+ }
+
+ /**
+ * A list of tools available on an MCP server.
+ */
+ export interface McpListTools {
+ /**
+ * The unique ID of the list.
+ */
+ id: string;
+
+ /**
+ * The label of the MCP server.
+ */
+ server_label: string;
+
+ /**
+ * The tools available on the server.
+ */
+ tools: Array;
+
+ /**
+ * The type of the item. Always `mcp_list_tools`.
+ */
+ type: 'mcp_list_tools';
+
+ /**
+ * Error message if the server could not list tools.
+ */
+ error?: string | null;
+ }
+
+ export namespace McpListTools {
+ /**
+ * A tool available on an MCP server.
+ */
+ export interface Tool {
+ /**
+ * The JSON schema describing the tool's input.
+ */
+ input_schema: unknown;
+
+ /**
+ * The name of the tool.
+ */
+ name: string;
+
+ /**
+ * Additional annotations about the tool.
+ */
+ annotations?: unknown | null;
+
+ /**
+ * The description of the tool.
+ */
+ description?: string | null;
+ }
+ }
+
+ /**
+ * A request for human approval of a tool invocation.
+ */
+ export interface McpApprovalRequest {
+ /**
+ * The unique ID of the approval request.
+ */
+ id: string;
+
+ /**
+ * A JSON string of arguments for the tool.
+ */
+ arguments: string;
+
+ /**
+ * The name of the tool to run.
+ */
+ name: string;
+
+ /**
+ * The label of the MCP server making the request.
+ */
+ server_label: string;
+
+ /**
+ * The type of the item. Always `mcp_approval_request`.
+ */
+ type: 'mcp_approval_request';
+ }
+
+ /**
+ * A response to an MCP approval request.
+ */
+ export interface McpApprovalResponse {
+ /**
+ * The ID of the approval request being answered.
+ */
+ approval_request_id: string;
+
+ /**
+ * Whether the request was approved.
+ */
+ approve: boolean;
+
+ /**
+ * The type of the item. Always `mcp_approval_response`.
+ */
+ type: 'mcp_approval_response';
+
+ /**
+ * The unique ID of the approval response
+ */
+ id?: string | null;
+
+ /**
+ * Optional reason for the decision.
+ */
+ reason?: string | null;
+ }
+
+ /**
+ * An invocation of a tool on an MCP server.
+ */
+ export interface McpCall {
+ /**
+ * The unique ID of the tool call.
+ */
+ id: string;
+
+ /**
+ * A JSON string of the arguments passed to the tool.
+ */
+ arguments: string;
+
+ /**
+ * The name of the tool that was run.
+ */
+ name: string;
+
+ /**
+ * The label of the MCP server running the tool.
+ */
+ server_label: string;
+
+ /**
+ * The type of the item. Always `mcp_call`.
+ */
+ type: 'mcp_call';
+
+ /**
+ * The error from the tool call, if any.
+ */
+ error?: string | null;
+
+ /**
+ * The output from the tool call.
+ */
+ output?: string | null;
+ }
+
/**
* An internal identifier for an item to reference.
*/
@@ -1932,11 +2339,417 @@ export type ResponseItem =
| ResponseComputerToolCallOutputItem
| ResponseFunctionWebSearch
| ResponseFunctionToolCallItem
- | ResponseFunctionToolCallOutputItem;
+ | ResponseFunctionToolCallOutputItem
+ | ResponseItem.ImageGenerationCall
+ | ResponseCodeInterpreterToolCall
+ | ResponseItem.LocalShellCall
+ | ResponseItem.LocalShellCallOutput
+ | ResponseItem.McpListTools
+ | ResponseItem.McpApprovalRequest
+ | ResponseItem.McpApprovalResponse
+ | ResponseItem.McpCall;
-/**
- * An audio output from the model.
- */
+export namespace ResponseItem {
+ /**
+ * An image generation request made by the model.
+ */
+ export interface ImageGenerationCall {
+ /**
+ * The unique ID of the image generation call.
+ */
+ id: string;
+
+ /**
+ * The generated image encoded in base64.
+ */
+ result: string | null;
+
+ /**
+ * The status of the image generation call.
+ */
+ status: 'in_progress' | 'completed' | 'generating' | 'failed';
+
+ /**
+ * The type of the image generation call. Always `image_generation_call`.
+ */
+ type: 'image_generation_call';
+ }
+
+ /**
+ * A tool call to run a command on the local shell.
+ */
+ export interface LocalShellCall {
+ /**
+ * The unique ID of the local shell call.
+ */
+ id: string;
+
+ /**
+ * Execute a shell command on the server.
+ */
+ action: LocalShellCall.Action;
+
+ /**
+ * The unique ID of the local shell tool call generated by the model.
+ */
+ call_id: string;
+
+ /**
+ * The status of the local shell call.
+ */
+ status: 'in_progress' | 'completed' | 'incomplete';
+
+ /**
+ * The type of the local shell call. Always `local_shell_call`.
+ */
+ type: 'local_shell_call';
+ }
+
+ export namespace LocalShellCall {
+ /**
+ * Execute a shell command on the server.
+ */
+ export interface Action {
+ /**
+ * The command to run.
+ */
+ command: Array;
+
+ /**
+ * Environment variables to set for the command.
+ */
+ env: Record;
+
+ /**
+ * The type of the local shell action. Always `exec`.
+ */
+ type: 'exec';
+
+ /**
+ * Optional timeout in milliseconds for the command.
+ */
+ timeout_ms?: number | null;
+
+ /**
+ * Optional user to run the command as.
+ */
+ user?: string | null;
+
+ /**
+ * Optional working directory to run the command in.
+ */
+ working_directory?: string | null;
+ }
+ }
+
+ /**
+ * The output of a local shell tool call.
+ */
+ export interface LocalShellCallOutput {
+ /**
+ * The unique ID of the local shell tool call generated by the model.
+ */
+ id: string;
+
+ /**
+ * A JSON string of the output of the local shell tool call.
+ */
+ output: string;
+
+ /**
+ * The type of the local shell tool call output. Always `local_shell_call_output`.
+ */
+ type: 'local_shell_call_output';
+
+ /**
+ * The status of the item. One of `in_progress`, `completed`, or `incomplete`.
+ */
+ status?: 'in_progress' | 'completed' | 'incomplete' | null;
+ }
+
+ /**
+ * A list of tools available on an MCP server.
+ */
+ export interface McpListTools {
+ /**
+ * The unique ID of the list.
+ */
+ id: string;
+
+ /**
+ * The label of the MCP server.
+ */
+ server_label: string;
+
+ /**
+ * The tools available on the server.
+ */
+ tools: Array;
+
+ /**
+ * The type of the item. Always `mcp_list_tools`.
+ */
+ type: 'mcp_list_tools';
+
+ /**
+ * Error message if the server could not list tools.
+ */
+ error?: string | null;
+ }
+
+ export namespace McpListTools {
+ /**
+ * A tool available on an MCP server.
+ */
+ export interface Tool {
+ /**
+ * The JSON schema describing the tool's input.
+ */
+ input_schema: unknown;
+
+ /**
+ * The name of the tool.
+ */
+ name: string;
+
+ /**
+ * Additional annotations about the tool.
+ */
+ annotations?: unknown | null;
+
+ /**
+ * The description of the tool.
+ */
+ description?: string | null;
+ }
+ }
+
+ /**
+ * A request for human approval of a tool invocation.
+ */
+ export interface McpApprovalRequest {
+ /**
+ * The unique ID of the approval request.
+ */
+ id: string;
+
+ /**
+ * A JSON string of arguments for the tool.
+ */
+ arguments: string;
+
+ /**
+ * The name of the tool to run.
+ */
+ name: string;
+
+ /**
+ * The label of the MCP server making the request.
+ */
+ server_label: string;
+
+ /**
+ * The type of the item. Always `mcp_approval_request`.
+ */
+ type: 'mcp_approval_request';
+ }
+
+ /**
+ * A response to an MCP approval request.
+ */
+ export interface McpApprovalResponse {
+ /**
+ * The unique ID of the approval response
+ */
+ id: string;
+
+ /**
+ * The ID of the approval request being answered.
+ */
+ approval_request_id: string;
+
+ /**
+ * Whether the request was approved.
+ */
+ approve: boolean;
+
+ /**
+ * The type of the item. Always `mcp_approval_response`.
+ */
+ type: 'mcp_approval_response';
+
+ /**
+ * Optional reason for the decision.
+ */
+ reason?: string | null;
+ }
+
+ /**
+ * An invocation of a tool on an MCP server.
+ */
+ export interface McpCall {
+ /**
+ * The unique ID of the tool call.
+ */
+ id: string;
+
+ /**
+ * A JSON string of the arguments passed to the tool.
+ */
+ arguments: string;
+
+ /**
+ * The name of the tool that was run.
+ */
+ name: string;
+
+ /**
+ * The label of the MCP server running the tool.
+ */
+ server_label: string;
+
+ /**
+ * The type of the item. Always `mcp_call`.
+ */
+ type: 'mcp_call';
+
+ /**
+ * The error from the tool call, if any.
+ */
+ error?: string | null;
+
+ /**
+ * The output from the tool call.
+ */
+ output?: string | null;
+ }
+}
+
+/**
+ * Emitted when there is a delta (partial update) to the arguments of an MCP tool
+ * call.
+ */
+export interface ResponseMcpCallArgumentsDeltaEvent {
+ /**
+ * The partial update to the arguments for the MCP tool call.
+ */
+ delta: unknown;
+
+ /**
+ * The unique identifier of the MCP tool call item being processed.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * The type of the event. Always 'response.mcp_call.arguments_delta'.
+ */
+ type: 'response.mcp_call.arguments_delta';
+}
+
+/**
+ * Emitted when the arguments for an MCP tool call are finalized.
+ */
+export interface ResponseMcpCallArgumentsDoneEvent {
+ /**
+ * The finalized arguments for the MCP tool call.
+ */
+ arguments: unknown;
+
+ /**
+ * The unique identifier of the MCP tool call item being processed.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * The type of the event. Always 'response.mcp_call.arguments_done'.
+ */
+ type: 'response.mcp_call.arguments_done';
+}
+
+/**
+ * Emitted when an MCP tool call has completed successfully.
+ */
+export interface ResponseMcpCallCompletedEvent {
+ /**
+ * The type of the event. Always 'response.mcp_call.completed'.
+ */
+ type: 'response.mcp_call.completed';
+}
+
+/**
+ * Emitted when an MCP tool call has failed.
+ */
+export interface ResponseMcpCallFailedEvent {
+ /**
+ * The type of the event. Always 'response.mcp_call.failed'.
+ */
+ type: 'response.mcp_call.failed';
+}
+
+/**
+ * Emitted when an MCP tool call is in progress.
+ */
+export interface ResponseMcpCallInProgressEvent {
+ /**
+ * The unique identifier of the MCP tool call item being processed.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * The type of the event. Always 'response.mcp_call.in_progress'.
+ */
+ type: 'response.mcp_call.in_progress';
+}
+
+/**
+ * Emitted when the list of available MCP tools has been successfully retrieved.
+ */
+export interface ResponseMcpListToolsCompletedEvent {
+ /**
+ * The type of the event. Always 'response.mcp_list_tools.completed'.
+ */
+ type: 'response.mcp_list_tools.completed';
+}
+
+/**
+ * Emitted when the attempt to list available MCP tools has failed.
+ */
+export interface ResponseMcpListToolsFailedEvent {
+ /**
+ * The type of the event. Always 'response.mcp_list_tools.failed'.
+ */
+ type: 'response.mcp_list_tools.failed';
+}
+
+/**
+ * Emitted when the system is in the process of retrieving the list of available
+ * MCP tools.
+ */
+export interface ResponseMcpListToolsInProgressEvent {
+ /**
+ * The type of the event. Always 'response.mcp_list_tools.in_progress'.
+ */
+ type: 'response.mcp_list_tools.in_progress';
+}
+
+/**
+ * An audio output from the model.
+ */
export interface ResponseOutputAudio {
/**
* Base64-encoded audio data from the model.
@@ -1948,23 +2761,250 @@ export interface ResponseOutputAudio {
*/
transcript: string;
- /**
- * The type of the output audio. Always `output_audio`.
- */
- type: 'output_audio';
+ /**
+ * The type of the output audio. Always `output_audio`.
+ */
+ type: 'output_audio';
+}
+
+/**
+ * An output message from the model.
+ */
+export type ResponseOutputItem =
+ | ResponseOutputMessage
+ | ResponseFileSearchToolCall
+ | ResponseFunctionToolCall
+ | ResponseFunctionWebSearch
+ | ResponseComputerToolCall
+ | ResponseReasoningItem
+ | ResponseOutputItem.ImageGenerationCall
+ | ResponseCodeInterpreterToolCall
+ | ResponseOutputItem.LocalShellCall
+ | ResponseOutputItem.McpCall
+ | ResponseOutputItem.McpListTools
+ | ResponseOutputItem.McpApprovalRequest;
+
+export namespace ResponseOutputItem {
+ /**
+ * An image generation request made by the model.
+ */
+ export interface ImageGenerationCall {
+ /**
+ * The unique ID of the image generation call.
+ */
+ id: string;
+
+ /**
+ * The generated image encoded in base64.
+ */
+ result: string | null;
+
+ /**
+ * The status of the image generation call.
+ */
+ status: 'in_progress' | 'completed' | 'generating' | 'failed';
+
+ /**
+ * The type of the image generation call. Always `image_generation_call`.
+ */
+ type: 'image_generation_call';
+ }
+
+ /**
+ * A tool call to run a command on the local shell.
+ */
+ export interface LocalShellCall {
+ /**
+ * The unique ID of the local shell call.
+ */
+ id: string;
+
+ /**
+ * Execute a shell command on the server.
+ */
+ action: LocalShellCall.Action;
+
+ /**
+ * The unique ID of the local shell tool call generated by the model.
+ */
+ call_id: string;
+
+ /**
+ * The status of the local shell call.
+ */
+ status: 'in_progress' | 'completed' | 'incomplete';
+
+ /**
+ * The type of the local shell call. Always `local_shell_call`.
+ */
+ type: 'local_shell_call';
+ }
+
+ export namespace LocalShellCall {
+ /**
+ * Execute a shell command on the server.
+ */
+ export interface Action {
+ /**
+ * The command to run.
+ */
+ command: Array;
+
+ /**
+ * Environment variables to set for the command.
+ */
+ env: Record;
+
+ /**
+ * The type of the local shell action. Always `exec`.
+ */
+ type: 'exec';
+
+ /**
+ * Optional timeout in milliseconds for the command.
+ */
+ timeout_ms?: number | null;
+
+ /**
+ * Optional user to run the command as.
+ */
+ user?: string | null;
+
+ /**
+ * Optional working directory to run the command in.
+ */
+ working_directory?: string | null;
+ }
+ }
+
+ /**
+ * An invocation of a tool on an MCP server.
+ */
+ export interface McpCall {
+ /**
+ * The unique ID of the tool call.
+ */
+ id: string;
+
+ /**
+ * A JSON string of the arguments passed to the tool.
+ */
+ arguments: string;
+
+ /**
+ * The name of the tool that was run.
+ */
+ name: string;
+
+ /**
+ * The label of the MCP server running the tool.
+ */
+ server_label: string;
+
+ /**
+ * The type of the item. Always `mcp_call`.
+ */
+ type: 'mcp_call';
+
+ /**
+ * The error from the tool call, if any.
+ */
+ error?: string | null;
+
+ /**
+ * The output from the tool call.
+ */
+ output?: string | null;
+ }
+
+ /**
+ * A list of tools available on an MCP server.
+ */
+ export interface McpListTools {
+ /**
+ * The unique ID of the list.
+ */
+ id: string;
+
+ /**
+ * The label of the MCP server.
+ */
+ server_label: string;
+
+ /**
+ * The tools available on the server.
+ */
+ tools: Array;
+
+ /**
+ * The type of the item. Always `mcp_list_tools`.
+ */
+ type: 'mcp_list_tools';
+
+ /**
+ * Error message if the server could not list tools.
+ */
+ error?: string | null;
+ }
+
+ export namespace McpListTools {
+ /**
+ * A tool available on an MCP server.
+ */
+ export interface Tool {
+ /**
+ * The JSON schema describing the tool's input.
+ */
+ input_schema: unknown;
+
+ /**
+ * The name of the tool.
+ */
+ name: string;
+
+ /**
+ * Additional annotations about the tool.
+ */
+ annotations?: unknown | null;
+
+ /**
+ * The description of the tool.
+ */
+ description?: string | null;
+ }
+ }
+
+ /**
+ * A request for human approval of a tool invocation.
+ */
+ export interface McpApprovalRequest {
+ /**
+ * The unique ID of the approval request.
+ */
+ id: string;
+
+ /**
+ * A JSON string of arguments for the tool.
+ */
+ arguments: string;
+
+ /**
+ * The name of the tool to run.
+ */
+ name: string;
+
+ /**
+ * The label of the MCP server making the request.
+ */
+ server_label: string;
+
+ /**
+ * The type of the item. Always `mcp_approval_request`.
+ */
+ type: 'mcp_approval_request';
+ }
}
-/**
- * An output message from the model.
- */
-export type ResponseOutputItem =
- | ResponseOutputMessage
- | ResponseFileSearchToolCall
- | ResponseFunctionToolCall
- | ResponseFunctionWebSearch
- | ResponseComputerToolCall
- | ResponseReasoningItem;
-
/**
* Emitted when a new output item is added.
*/
@@ -2145,6 +3185,116 @@ export namespace ResponseOutputText {
}
}
+/**
+ * Emitted when an annotation is added to output text content.
+ */
+export interface ResponseOutputTextAnnotationAddedEvent {
+ /**
+ * The annotation object being added. (See annotation schema for details.)
+ */
+ annotation: unknown;
+
+ /**
+ * The index of the annotation within the content part.
+ */
+ annotation_index: number;
+
+ /**
+ * The index of the content part within the output item.
+ */
+ content_index: number;
+
+ /**
+ * The unique identifier of the item to which the annotation is being added.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * The type of the event. Always 'response.output_text_annotation.added'.
+ */
+ type: 'response.output_text_annotation.added';
+}
+
+/**
+ * Emitted when a response is queued and waiting to be processed.
+ */
+export interface ResponseQueuedEvent {
+ /**
+ * The full response object that is queued.
+ */
+ response: Response;
+
+ /**
+ * The type of the event. Always 'response.queued'.
+ */
+ type: 'response.queued';
+}
+
+/**
+ * Emitted when there is a delta (partial update) to the reasoning content.
+ */
+export interface ResponseReasoningDeltaEvent {
+ /**
+ * The index of the reasoning content part within the output item.
+ */
+ content_index: number;
+
+ /**
+ * The partial update to the reasoning content.
+ */
+ delta: unknown;
+
+ /**
+ * The unique identifier of the item for which reasoning is being updated.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * The type of the event. Always 'response.reasoning.delta'.
+ */
+ type: 'response.reasoning.delta';
+}
+
+/**
+ * Emitted when the reasoning content is finalized for an item.
+ */
+export interface ResponseReasoningDoneEvent {
+ /**
+ * The index of the reasoning content part within the output item.
+ */
+ content_index: number;
+
+ /**
+ * The unique identifier of the item for which reasoning is finalized.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * The finalized reasoning text.
+ */
+ text: string;
+
+ /**
+ * The type of the event. Always 'response.reasoning.done'.
+ */
+ type: 'response.reasoning.done';
+}
+
/**
* 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
@@ -2194,6 +3344,67 @@ export namespace ResponseReasoningItem {
}
}
+/**
+ * Emitted when there is a delta (partial update) to the reasoning summary content.
+ */
+export interface ResponseReasoningSummaryDeltaEvent {
+ /**
+ * The partial update to the reasoning summary content.
+ */
+ delta: unknown;
+
+ /**
+ * The unique identifier of the item for which the reasoning summary is being
+ * updated.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * The index of the summary part within the output item.
+ */
+ summary_index: number;
+
+ /**
+ * The type of the event. Always 'response.reasoning_summary.delta'.
+ */
+ type: 'response.reasoning_summary.delta';
+}
+
+/**
+ * Emitted when the reasoning summary content is finalized for an item.
+ */
+export interface ResponseReasoningSummaryDoneEvent {
+ /**
+ * The unique identifier of the item for which the reasoning summary is finalized.
+ */
+ item_id: string;
+
+ /**
+ * The index of the output item in the response's output array.
+ */
+ output_index: number;
+
+ /**
+ * The index of the summary part within the output item.
+ */
+ summary_index: number;
+
+ /**
+ * The finalized reasoning summary text.
+ */
+ text: string;
+
+ /**
+ * The type of the event. Always 'response.reasoning_summary.done'.
+ */
+ type: 'response.reasoning_summary.done';
+}
+
/**
* Emitted when a new reasoning summary part is added.
*/
@@ -2410,9 +3621,9 @@ export interface ResponseRefusalDoneEvent {
/**
* The status of the response generation. One of `completed`, `failed`,
- * `in_progress`, or `incomplete`.
+ * `in_progress`, `cancelled`, `queued`, or `incomplete`.
*/
-export type ResponseStatus = 'completed' | 'failed' | 'in_progress' | 'incomplete';
+export type ResponseStatus = 'completed' | 'failed' | 'in_progress' | 'cancelled' | 'queued' | 'incomplete';
/**
* Emitted when there is a partial audio response.
@@ -2453,7 +3664,25 @@ export type ResponseStreamEvent =
| ResponseTextDoneEvent
| ResponseWebSearchCallCompletedEvent
| ResponseWebSearchCallInProgressEvent
- | ResponseWebSearchCallSearchingEvent;
+ | ResponseWebSearchCallSearchingEvent
+ | ResponseImageGenCallCompletedEvent
+ | ResponseImageGenCallGeneratingEvent
+ | ResponseImageGenCallInProgressEvent
+ | ResponseImageGenCallPartialImageEvent
+ | ResponseMcpCallArgumentsDeltaEvent
+ | ResponseMcpCallArgumentsDoneEvent
+ | ResponseMcpCallCompletedEvent
+ | ResponseMcpCallFailedEvent
+ | ResponseMcpCallInProgressEvent
+ | ResponseMcpListToolsCompletedEvent
+ | ResponseMcpListToolsFailedEvent
+ | ResponseMcpListToolsInProgressEvent
+ | ResponseOutputTextAnnotationAddedEvent
+ | ResponseQueuedEvent
+ | ResponseReasoningDeltaEvent
+ | ResponseReasoningDoneEvent
+ | ResponseReasoningSummaryDeltaEvent
+ | ResponseReasoningSummaryDoneEvent;
/**
* Emitted when a text annotation is added.
@@ -2768,7 +3997,229 @@ export interface ResponseWebSearchCallSearchingEvent {
/**
* A tool that can be used to generate a response.
*/
-export type Tool = FileSearchTool | FunctionTool | WebSearchTool | ComputerTool;
+export type Tool =
+ | FunctionTool
+ | FileSearchTool
+ | WebSearchTool
+ | ComputerTool
+ | Tool.Mcp
+ | Tool.CodeInterpreter
+ | Tool.ImageGeneration
+ | Tool.LocalShell;
+
+export namespace Tool {
+ /**
+ * 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 {
+ /**
+ * A label for this MCP server, used to identify it in tool calls.
+ */
+ server_label: string;
+
+ /**
+ * The URL for the MCP server.
+ */
+ server_url: string;
+
+ /**
+ * The type of the MCP tool. Always `mcp`.
+ */
+ type: 'mcp';
+
+ /**
+ * List of allowed tool names or a filter object.
+ */
+ allowed_tools?: Array | Mcp.McpAllowedToolsFilter | null;
+
+ /**
+ * Optional HTTP headers to send to the MCP server. Use for authentication or other
+ * purposes.
+ */
+ headers?: Record | null;
+
+ /**
+ * Specify which of the MCP server's tools require approval.
+ */
+ require_approval?: Mcp.McpToolApprovalFilter | 'always' | 'never' | null;
+ }
+
+ export namespace Mcp {
+ /**
+ * A filter object to specify which tools are allowed.
+ */
+ export interface McpAllowedToolsFilter {
+ /**
+ * List of allowed tool names.
+ */
+ tool_names?: Array;
+ }
+
+ export interface McpToolApprovalFilter {
+ /**
+ * A list of tools that always require approval.
+ */
+ always?: McpToolApprovalFilter.Always;
+
+ /**
+ * A list of tools that never require approval.
+ */
+ never?: McpToolApprovalFilter.Never;
+
+ /**
+ * List of allowed tool names.
+ */
+ tool_names?: Array;
+ }
+
+ export namespace McpToolApprovalFilter {
+ /**
+ * A list of tools that always require approval.
+ */
+ export interface Always {
+ /**
+ * List of tools that require approval.
+ */
+ tool_names?: Array;
+ }
+
+ /**
+ * A list of tools that never require approval.
+ */
+ export interface Never {
+ /**
+ * List of tools that do not require approval.
+ */
+ tool_names?: Array;
+ }
+ }
+ }
+
+ /**
+ * A tool that runs Python code to help generate a response to a prompt.
+ */
+ export interface CodeInterpreter {
+ /**
+ * The code interpreter container. Can be a container ID or an object that
+ * specifies uploaded file IDs to make available to your code.
+ */
+ container: string | CodeInterpreter.CodeInterpreterToolAuto;
+
+ /**
+ * The type of the code interpreter tool. Always `code_interpreter`.
+ */
+ type: 'code_interpreter';
+ }
+
+ export namespace CodeInterpreter {
+ /**
+ * Configuration for a code interpreter container. Optionally specify the IDs of
+ * the files to run the code on.
+ */
+ export interface CodeInterpreterToolAuto {
+ /**
+ * Always `auto`.
+ */
+ type: 'auto';
+
+ /**
+ * An optional list of uploaded files to make available to your code.
+ */
+ file_ids?: Array;
+ }
+ }
+
+ /**
+ * A tool that generates images using a model like `gpt-image-1`.
+ */
+ export interface ImageGeneration {
+ /**
+ * The type of the image generation tool. Always `image_generation`.
+ */
+ type: 'image_generation';
+
+ /**
+ * Background type for the generated image. One of `transparent`, `opaque`, or
+ * `auto`. Default: `auto`.
+ */
+ background?: 'transparent' | 'opaque' | 'auto';
+
+ /**
+ * Optional mask for inpainting. Contains `image_url` (string, optional) and
+ * `file_id` (string, optional).
+ */
+ input_image_mask?: ImageGeneration.InputImageMask;
+
+ /**
+ * The image generation model to use. Default: `gpt-image-1`.
+ */
+ model?: 'gpt-image-1';
+
+ /**
+ * Moderation level for the generated image. Default: `auto`.
+ */
+ moderation?: 'auto' | 'low';
+
+ /**
+ * Compression level for the output image. Default: 100.
+ */
+ output_compression?: number;
+
+ /**
+ * The output format of the generated image. One of `png`, `webp`, or `jpeg`.
+ * Default: `png`.
+ */
+ output_format?: 'png' | 'webp' | 'jpeg';
+
+ /**
+ * Number of partial images to generate in streaming mode, from 0 (default value)
+ * to 3.
+ */
+ partial_images?: number;
+
+ /**
+ * The quality of the generated image. One of `low`, `medium`, `high`, or `auto`.
+ * Default: `auto`.
+ */
+ quality?: 'low' | 'medium' | 'high' | 'auto';
+
+ /**
+ * The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`,
+ * or `auto`. Default: `auto`.
+ */
+ size?: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
+ }
+
+ export namespace ImageGeneration {
+ /**
+ * Optional mask for inpainting. Contains `image_url` (string, optional) and
+ * `file_id` (string, optional).
+ */
+ export interface InputImageMask {
+ /**
+ * File ID for the mask image.
+ */
+ file_id?: string;
+
+ /**
+ * Base64-encoded mask image.
+ */
+ image_url?: string;
+ }
+ }
+
+ /**
+ * A tool that allows the model to execute shell commands in a local environment.
+ */
+ export interface LocalShell {
+ /**
+ * The type of the local shell tool. Always `local_shell`.
+ */
+ type: 'local_shell';
+ }
+}
/**
* Use this option to force the model to call a specific function.
@@ -2811,8 +4262,18 @@ export interface ToolChoiceTypes {
* - `file_search`
* - `web_search_preview`
* - `computer_use_preview`
- */
- type: 'file_search' | 'web_search_preview' | 'computer_use_preview' | 'web_search_preview_2025_03_11';
+ * - `code_interpreter`
+ * - `mcp`
+ * - `image_generation`
+ */
+ type:
+ | 'file_search'
+ | 'web_search_preview'
+ | 'computer_use_preview'
+ | 'web_search_preview_2025_03_11'
+ | 'image_generation'
+ | 'code_interpreter'
+ | 'mcp';
}
/**
@@ -2898,6 +4359,12 @@ export interface ResponseCreateParamsBase {
*/
model: Shared.ResponsesModel;
+ /**
+ * Whether to run the model response in the background.
+ * [Learn more](https://platform.openai.com/docs/guides/background).
+ */
+ background?: boolean | null;
+
/**
* Specify additional output data to include in the model response. Currently
* supported values are:
@@ -3147,6 +4614,10 @@ export declare namespace Responses {
type ResponseFunctionToolCallItem as ResponseFunctionToolCallItem,
type ResponseFunctionToolCallOutputItem as ResponseFunctionToolCallOutputItem,
type ResponseFunctionWebSearch as ResponseFunctionWebSearch,
+ type ResponseImageGenCallCompletedEvent as ResponseImageGenCallCompletedEvent,
+ type ResponseImageGenCallGeneratingEvent as ResponseImageGenCallGeneratingEvent,
+ type ResponseImageGenCallInProgressEvent as ResponseImageGenCallInProgressEvent,
+ type ResponseImageGenCallPartialImageEvent as ResponseImageGenCallPartialImageEvent,
type ResponseInProgressEvent as ResponseInProgressEvent,
type ResponseIncludable as ResponseIncludable,
type ResponseIncompleteEvent as ResponseIncompleteEvent,
@@ -3160,6 +4631,14 @@ export declare namespace Responses {
type ResponseInputMessageItem as ResponseInputMessageItem,
type ResponseInputText as ResponseInputText,
type ResponseItem as ResponseItem,
+ type ResponseMcpCallArgumentsDeltaEvent as ResponseMcpCallArgumentsDeltaEvent,
+ type ResponseMcpCallArgumentsDoneEvent as ResponseMcpCallArgumentsDoneEvent,
+ type ResponseMcpCallCompletedEvent as ResponseMcpCallCompletedEvent,
+ type ResponseMcpCallFailedEvent as ResponseMcpCallFailedEvent,
+ type ResponseMcpCallInProgressEvent as ResponseMcpCallInProgressEvent,
+ type ResponseMcpListToolsCompletedEvent as ResponseMcpListToolsCompletedEvent,
+ type ResponseMcpListToolsFailedEvent as ResponseMcpListToolsFailedEvent,
+ type ResponseMcpListToolsInProgressEvent as ResponseMcpListToolsInProgressEvent,
type ResponseOutputAudio as ResponseOutputAudio,
type ResponseOutputItem as ResponseOutputItem,
type ResponseOutputItemAddedEvent as ResponseOutputItemAddedEvent,
@@ -3167,7 +4646,13 @@ export declare namespace Responses {
type ResponseOutputMessage as ResponseOutputMessage,
type ResponseOutputRefusal as ResponseOutputRefusal,
type ResponseOutputText as ResponseOutputText,
+ type ResponseOutputTextAnnotationAddedEvent as ResponseOutputTextAnnotationAddedEvent,
+ type ResponseQueuedEvent as ResponseQueuedEvent,
+ type ResponseReasoningDeltaEvent as ResponseReasoningDeltaEvent,
+ type ResponseReasoningDoneEvent as ResponseReasoningDoneEvent,
type ResponseReasoningItem as ResponseReasoningItem,
+ type ResponseReasoningSummaryDeltaEvent as ResponseReasoningSummaryDeltaEvent,
+ type ResponseReasoningSummaryDoneEvent as ResponseReasoningSummaryDoneEvent,
type ResponseReasoningSummaryPartAddedEvent as ResponseReasoningSummaryPartAddedEvent,
type ResponseReasoningSummaryPartDoneEvent as ResponseReasoningSummaryPartDoneEvent,
type ResponseReasoningSummaryTextDeltaEvent as ResponseReasoningSummaryTextDeltaEvent,
diff --git a/src/version.ts b/src/version.ts
index 62b43ffce..ff06c96c3 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '4.100.0'; // x-release-please-version
+export const VERSION = '4.101.0'; // x-release-please-version
diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts
index cf7e9cf3c..1b2cf7fc4 100644
--- a/tests/api-resources/responses/responses.test.ts
+++ b/tests/api-resources/responses/responses.test.ts
@@ -24,6 +24,7 @@ describe('resource responses', () => {
const response = await client.responses.create({
input: 'string',
model: 'gpt-4o',
+ background: true,
include: ['file_search_call.results'],
instructions: 'instructions',
max_output_tokens: 0,
@@ -39,11 +40,11 @@ describe('resource responses', () => {
tool_choice: 'none',
tools: [
{
- type: 'file_search',
- vector_store_ids: ['string'],
- filters: { key: 'key', type: 'eq', value: 'string' },
- max_num_results: 0,
- ranking_options: { ranker: 'auto', score_threshold: 0 },
+ name: 'name',
+ parameters: { foo: 'bar' },
+ strict: true,
+ type: 'function',
+ description: 'description',
},
],
top_p: 1,