From dfc0200c53af4c87bb36ac4b61a2b7417153f043 Mon Sep 17 00:00:00 2001 From: dpiet-oai <326640584+dpiet-oai@users.noreply.github.com> Date: Thu, 12 Nov 2026 21:06:55 +0000 Subject: [PATCH] feat(api): expand agent, image, Live, and external key support Castiron-Internal-PR: https://github.com/openai/openai-python-internal/pull/423 Castiron-Source-SHA: 0e62d5116a19bb8f6930aa4f89b483dc2cb03378 Castiron-Public-Base-SHA: f44c1ecd97368bbb842910401e5aaf202d910904 --- .castiron.stats.yml | 12 +- api_reference/openapi.transformed.yml | 1261 +++++++++-------- scripts/castiron/generated-files.json | 106 +- .../admin/organization/external_keys.py | 106 +- .../beta/agents/sessions/sessions.py | 36 +- .../resources/beta/responses/input_tokens.py | 28 +- .../resources/beta/responses/responses.py | 24 +- .../resources/content_provenance_checks.py | 2 + src/openai/resources/images.py | 102 +- .../resources/responses/input_tokens.py | 28 +- src/openai/resources/responses/responses.py | 24 +- src/openai/resources/webhooks/api.md | 1 + .../organization/audit_log_list_response.py | 3 + .../types/admin/organization/external_key.py | 8 + .../external_key_create_params.py | 18 + src/openai/types/beta/agent_session.py | 46 + .../types/beta/agent_session_input_param.py | 30 + .../beta/agents/session_create_params.py | 17 + .../beta/agents/session_update_params.py | 18 +- src/openai/types/beta/agents/sessions/turn.py | 16 +- src/openai/types/beta/beta_response.py | 4 +- ..._response_tool_search_output_item_param.py | 3 +- ...nse_tool_search_output_item_param_param.py | 3 +- .../types/beta/beta_responses_client_event.py | 4 +- .../beta/beta_responses_client_event_param.py | 4 +- src/openai/types/beta/beta_tool.py | 3 +- src/openai/types/beta/beta_tool_param.py | 3 +- .../types/beta/response_create_params.py | 4 +- .../responses/input_token_count_params.py | 8 +- .../content_provenance_check_create_params.py | 5 +- src/openai/types/image_edit_params.py | 39 +- src/openai/types/image_generate_params.py | 7 +- src/openai/types/images_response.py | 15 +- .../types/live/media_session_config_param.py | 6 + .../types/live/session_accept_params.py | 6 + .../responses/input_token_count_params.py | 8 +- src/openai/types/responses/response.py | 4 +- .../types/responses/response_create_params.py | 4 +- .../response_tool_search_output_item_param.py | 3 +- ...nse_tool_search_output_item_param_param.py | 3 +- .../types/responses/responses_client_event.py | 4 +- .../responses/responses_client_event_param.py | 4 +- src/openai/types/responses/tool.py | 3 +- src/openai/types/responses/tool_param.py | 3 +- src/openai/types/video_create_error.py | 7 +- src/openai/types/webhooks/__init__.py | 3 + ...t_session_action_required_webhook_event.py | 2 +- .../live_transport_connected_webhook_event.py | 33 + .../types/webhooks/unwrap_webhook_event.py | 2 + .../admin/organization/test_external_keys.py | 112 ++ .../beta/agents/sessions/test_events.py | 122 +- .../beta/agents/test_sessions.py | 6 + tests/api_resources/live/test_sessions.py | 2 + tests/api_resources/test_images.py | 16 + tests/api_resources/test_live.py | 2 + tests/test_agent_session_response_fields.py | 55 + 56 files changed, 1533 insertions(+), 865 deletions(-) create mode 100644 src/openai/types/webhooks/live_transport_connected_webhook_event.py create mode 100644 tests/test_agent_session_response_fields.py diff --git a/.castiron.stats.yml b/.castiron.stats.yml index 78f16280ef..a89f53e22a 100644 --- a/.castiron.stats.yml +++ b/.castiron.stats.yml @@ -1,7 +1,7 @@ schema_version: 1 -generation_id: a703ecb8-183a-4c22-8e77-18203e398b8f -openapi_spec_hash: 52d15bd95ffcc576831a8ca7e180916c -openapi_transformed_spec_hash: 77b815b67f6981a5aa066591d9dac163 -config_hash: 01f2d28b82141ac460c9d9e8cc45ee74 -codegen_sha: 1b8f9204c450821b2b1348d998e8dff20643c92a -codegen_hash: 0c31d87d7acc6add6f5302e2333d8b49f1bb678b7187c171e8b00dbe8ca2e4ea +generation_id: 728acbb1-0215-430b-b809-3c94b73fb7b8 +openapi_spec_hash: 95b8b142415913b5a7beac665b74dc0e +openapi_transformed_spec_hash: cf6502e7d6d450e285f5c23128167142 +config_hash: 324072e5fd63aac926519c90531b7789 +codegen_sha: 1bfd60377b278b5cfc5951d897167a214956e45f +codegen_hash: 40ffb85d504b3e11a9ed15284f95e25c428d534a5072a5164e5b23cdb1d70cfc diff --git a/api_reference/openapi.transformed.yml b/api_reference/openapi.transformed.yml index 3e1461322c..1e9d9eaf02 100644 --- a/api_reference/openapi.transformed.yml +++ b/api_reference/openapi.transformed.yml @@ -34183,7 +34183,7 @@ paths: post: operationId: updateAgentSession summary: Update an agent session - description: Updates session tools, metadata, model, reasoning effort, or service tier. Model settings apply to subsequent turns. Omitted fields are unchanged. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + description: Updates session tools, metadata, model, reasoning effort, service tier, or the default prompt cache lifetime. Model settings apply to subsequent turns. Omitted fields are unchanged. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). tags: - Agents parameters: @@ -38600,6 +38600,20 @@ webhooks: description: | Return a 200 status code to acknowledge receipt of the event. Non-200 status codes will be retried. + live_transport_connected: + post: + description: Sent when a direct Live WebRTC session is created or an Instant Connect session activates. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/WebhookLiveTransportConnected' + responses: + '200': + description: Acknowledges delivery after the endpoint has recorded the work. + '204': + description: Acknowledges delivery without a response body. live_transport_incoming: post: description: | @@ -39526,6 +39540,9 @@ components: items: type: string description: A list of scopes allowed for the API key, e.g. `["api.model.request"]` + expires_in_seconds: + type: integer + description: Number of seconds from the update request until the API key expires. api_key.deleted: type: object description: The details for events with this `type`. @@ -40796,7 +40813,6 @@ components: - If creating, updating, or getting a specific certificate, the object type is `certificate`. - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. - If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`. - x-stainless-const: true id: type: string description: The identifier, which can be referenced in API endpoints @@ -45061,12 +45077,7 @@ components: description: Legacy response format parameter for retired image models. Unsupported for GPT image models, which always return base64-encoded images. output_format: anyOf: - - type: string - enum: - - png - - jpeg - - webp - - gif + - $ref: '#/components/schemas/ImagesApiOutputFormat' - type: 'null' default: png example: png @@ -45074,6 +45085,12 @@ components: The format in which the generated images are returned. This parameter is only supported for the GPT image models. The default value is `png`. + SVG output requires a supported image model and project access. + svg: + anyOf: + - $ref: '#/components/schemas/SvgParam' + - type: 'null' + description: Selects the author model and reasoning effort for `output_format=svg`. Supply `svg.model` when SVG model selection is enabled. Otherwise, omit this object. SVG output requires `n=1` and cannot use streaming, partial images, or output compression. Use multipart fields such as `svg[model]`. output_compression: type: - integer @@ -45237,13 +45254,7 @@ components: description: Legacy response format parameter for retired image models. Unsupported for GPT image models, which always return base64-encoded images. output_format: anyOf: - - type: string - enum: - - png - - jpeg - - webp - - gif - - svg + - $ref: '#/components/schemas/ImagesApiOutputFormat' - type: 'null' default: png example: png @@ -45363,9 +45374,7 @@ components: anyOf: - type: string - type: string - enum: - - dall-e-2 - x-stainless-const: true + const: dall-e-2 - type: 'null' x-oaiTypeLabel: string description: The legacy model used by the retired image variations endpoint. This endpoint no longer accepts requests. @@ -45906,6 +45915,8 @@ components: - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. + On some models, trimming can begin earlier because the API subtracts the model's + maximum output allowance from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. enum: @@ -47674,16 +47685,16 @@ components: description: 'Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or empty. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).' output_format: anyOf: - - type: string - enum: - - png - - jpeg - - webp - - gif + - $ref: '#/components/schemas/ImagesApiOutputFormat' - type: 'null' default: png example: png - description: Output image format. Supported for GPT image models. + description: Output image format. Supported for GPT image models. SVG output requires a supported image model and project access. + svg: + anyOf: + - $ref: '#/components/schemas/SvgParam' + - type: 'null' + description: Selects the author model and reasoning effort for `output_format=svg`. Supply `svg.model` when SVG model selection is enabled. Otherwise, omit this object. SVG output requires `n=1` and cannot use streaming, partial images, or output compression. output_compression: anyOf: - type: integer @@ -51374,11 +51385,11 @@ components: `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`, `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: - `gpt-image-2`. + `gpt-image-2.6-sunburst`. `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead. - default: gpt-image-2 + default: gpt-image-2.6-sunburst complexity: type: string enum: @@ -51553,26 +51564,6 @@ components: title: Image generation response description: The response from the image generation endpoint. properties: - svg_usage: - type: object - description: Token usage for the model that authored the SVG, separate from image rendering usage. - properties: - model: - type: string - input_tokens: - type: integer - output_tokens: - type: integer - total_tokens: - type: integer - reasoning_tokens: - type: integer - required: - - model - - input_tokens - - output_tokens - - total_tokens - - reasoning_tokens safety_identifier: type: - string @@ -51594,14 +51585,8 @@ components: - transparent - opaque output_format: - type: string - description: The output format of the generated image. - enum: - - png - - webp - - jpeg - - gif - - svg + $ref: '#/components/schemas/ImagesApiOutputFormat' + description: The output format of the generated or edited image. size: anyOf: - type: string @@ -51623,6 +51608,9 @@ components: - max usage: $ref: '#/components/schemas/ImageGenUsage' + svg_usage: + $ref: '#/components/schemas/SvgUsage' + description: Token usage for SVG authoring, separate from image rendering usage. required: - created x-oaiMeta: @@ -52544,6 +52532,8 @@ components: $ref: '#/components/schemas/ModelIdsLive' description: The Live model to use for the accepted call. minLength: 1 + safety_identifier: + $ref: '#/components/schemas/safety_identifier' instructions: $ref: '#/components/schemas/instructions' audio: @@ -52712,6 +52702,8 @@ components: properties: model: $ref: '#/components/schemas/ModelIdsLive' + safety_identifier: + $ref: '#/components/schemas/safety_identifier' instructions: $ref: '#/components/schemas/instructions' audio: @@ -56297,7 +56289,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `conversation.item.create`. const: conversation.item.create previous_item_id: @@ -56334,7 +56325,6 @@ components: type: string description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `conversation.item.delete`. const: conversation.item.delete item_id: @@ -56360,7 +56350,6 @@ components: type: string description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `conversation.item.retrieve`. const: conversation.item.retrieve item_id: @@ -56386,7 +56375,6 @@ components: type: string description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `conversation.item.truncate`. const: conversation.item.truncate item_id: @@ -56422,7 +56410,6 @@ components: type: string description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.append`. const: input_audio_buffer.append audio: @@ -56448,7 +56435,6 @@ components: type: string description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.clear`. const: input_audio_buffer.clear required: @@ -56469,7 +56455,6 @@ components: type: string description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.commit`. const: input_audio_buffer.commit required: @@ -56495,7 +56480,6 @@ components: type: string description: The unique ID of the client event used for error handling. type: - x-stainless-const: true description: The event type, must be `output_audio_buffer.clear`. const: output_audio_buffer.clear required: @@ -56516,7 +56500,6 @@ components: type: string description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `response.cancel`. const: response.cancel response_id: @@ -56540,7 +56523,6 @@ components: type: string description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `response.create`. const: response.create response: @@ -56600,7 +56582,6 @@ components: type: string description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `session.update`. const: session.update session: @@ -56655,7 +56636,6 @@ components: type: string description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `transcription_session.update`. const: transcription_session.update session: @@ -56699,7 +56679,6 @@ components: type: string description: The unique ID of the response. object: - x-stainless-const: true description: The object type, must be `realtime.response`. const: realtime.response status: @@ -56849,9 +56828,7 @@ components: anyOf: - type: integer - type: string - enum: - - inf - x-stainless-const: true + const: inf RealtimeBetaResponseCreateParams: type: object description: Create a new Realtime response with these parameters @@ -56894,10 +56871,8 @@ components: properties: type: type: string - enum: - - function + const: function description: The type of the tool, i.e. `function`. - x-stainless-const: true name: type: string description: The name of the function. @@ -56929,9 +56904,7 @@ components: anyOf: - type: integer - type: string - enum: - - inf - x-stainless-const: true + const: inf conversation: description: "Controls which conversation the response is added to. Currently supports\n`auto` and `none`, with `auto` as the default value. The `auto` value\nmeans that the contents of the response will be added to the default\nconversation. Set this to `none` to create an out-of-band response which \nwill not add items to default conversation.\n" anyOf: @@ -56971,7 +56944,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.created`. const: conversation.item.created previous_item_id: @@ -57013,7 +56985,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.deleted`. const: conversation.item.deleted item_id: @@ -57051,12 +57022,10 @@ components: description: The unique ID of the server event. type: type: string - enum: - - conversation.item.input_audio_transcription.completed + const: conversation.item.input_audio_transcription.completed description: | The event type, must be `conversation.item.input_audio_transcription.completed`. - x-stainless-const: true item_id: type: string description: The ID of the user message item containing the audio. @@ -57124,7 +57093,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.input_audio_transcription.delta`. const: conversation.item.input_audio_transcription.delta item_id: @@ -57167,12 +57135,10 @@ components: description: The unique ID of the server event. type: type: string - enum: - - conversation.item.input_audio_transcription.failed + const: conversation.item.input_audio_transcription.failed description: | The event type, must be `conversation.item.input_audio_transcription.failed`. - x-stainless-const: true item_id: type: string description: The ID of the user message item. @@ -57225,7 +57191,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.input_audio_transcription.segment`. const: conversation.item.input_audio_transcription.segment item_id: @@ -57285,7 +57250,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.retrieved`. const: conversation.item.retrieved item: @@ -57325,7 +57289,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.truncated`. const: conversation.item.truncated item_id: @@ -57366,7 +57329,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `error`. const: error error: @@ -57426,7 +57388,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.cleared`. const: input_audio_buffer.cleared required: @@ -57452,7 +57413,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.committed`. const: input_audio_buffer.committed previous_item_id: @@ -57487,7 +57447,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.speech_started`. const: input_audio_buffer.speech_started audio_start_ms: @@ -57520,7 +57479,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.speech_stopped`. const: input_audio_buffer.speech_stopped audio_end_ms: @@ -57552,7 +57510,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `mcp_list_tools.completed`. const: mcp_list_tools.completed item_id: @@ -57579,7 +57536,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `mcp_list_tools.failed`. const: mcp_list_tools.failed item_id: @@ -57606,7 +57562,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `mcp_list_tools.in_progress`. const: mcp_list_tools.in_progress item_id: @@ -57633,7 +57588,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `rate_limits.updated`. const: rate_limits.updated rate_limits: @@ -57692,7 +57646,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_audio.delta`. const: response.output_audio.delta response_id: @@ -57741,7 +57694,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_audio.done`. const: response.output_audio.done response_id: @@ -57784,7 +57736,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_audio_transcript.delta`. const: response.output_audio_transcript.delta response_id: @@ -57834,7 +57785,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_audio_transcript.done`. const: response.output_audio_transcript.done response_id: @@ -57883,7 +57833,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.content_part.added`. const: response.content_part.added response_id: @@ -57951,7 +57900,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.content_part.done`. const: response.content_part.done response_id: @@ -58019,7 +57967,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.created`. const: response.created response: @@ -58068,7 +58015,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.done`. const: response.done response: @@ -58133,7 +58079,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: | The event type, must be `response.function_call_arguments.delta`. const: response.function_call_arguments.delta @@ -58183,7 +58128,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: | The event type, must be `response.function_call_arguments.done`. const: response.function_call_arguments.done @@ -58236,7 +58180,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.mcp_call_arguments.delta`. const: response.mcp_call_arguments.delta response_id: @@ -58283,7 +58226,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.mcp_call_arguments.done`. const: response.mcp_call_arguments.done response_id: @@ -58325,7 +58267,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.mcp_call.completed`. const: response.mcp_call.completed output_index: @@ -58357,7 +58298,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.mcp_call.failed`. const: response.mcp_call.failed output_index: @@ -58389,7 +58329,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.mcp_call.in_progress`. const: response.mcp_call.in_progress output_index: @@ -58421,7 +58360,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_item.added`. const: response.output_item.added response_id: @@ -58464,7 +58402,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_item.done`. const: response.output_item.done response_id: @@ -58512,7 +58449,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_text.delta`. const: response.output_text.delta response_id: @@ -58561,7 +58497,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_text.done`. const: response.output_text.done response_id: @@ -58611,7 +58546,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `session.created`. const: session.created session: @@ -58667,7 +58601,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `session.updated`. const: session.updated session: @@ -58713,7 +58646,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `transcription_session.created`. const: transcription_session.created session: @@ -58758,7 +58690,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `transcription_session.updated`. const: transcription_session.updated session: @@ -58875,7 +58806,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `conversation.item.create`. const: conversation.item.create previous_item_id: @@ -58917,7 +58847,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `conversation.item.delete`. const: conversation.item.delete item_id: @@ -58944,7 +58873,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `conversation.item.retrieve`. const: conversation.item.retrieve item_id: @@ -58971,7 +58899,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `conversation.item.truncate`. const: conversation.item.truncate item_id: @@ -59008,7 +58935,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.append`. const: input_audio_buffer.append audio: @@ -59035,7 +58961,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.clear`. const: input_audio_buffer.clear required: @@ -59060,7 +58985,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.commit`. const: input_audio_buffer.commit required: @@ -59086,7 +59010,6 @@ components: type: string description: The unique ID of the client event used for error handling. type: - x-stainless-const: true description: The event type, must be `output_audio_buffer.clear`. const: output_audio_buffer.clear required: @@ -59108,7 +59031,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `response.cancel`. const: response.cancel response_id: @@ -59133,7 +59055,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `response.create`. const: response.create response: @@ -59205,7 +59126,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. This is an arbitrary string that a client may assign. It will be passed back if there is an error with the event, but the corresponding `session.updated` event will not include it. type: - x-stainless-const: true description: The event type, must be `session.update`. const: session.update session: @@ -59268,7 +59188,6 @@ components: type: string description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `transcription_session.update`. const: transcription_session.update session: @@ -59350,16 +59269,12 @@ components: description: The unique ID of the item. This may be provided by the client or generated by the server. object: type: string - enum: - - realtime.item + const: realtime.item description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string - enum: - - function_call + const: function_call description: The type of the item. Always `function_call`. - x-stainless-const: true status: type: string enum: @@ -59390,16 +59305,12 @@ components: description: The unique ID of the item. This may be provided by the client or generated by the server. object: type: string - enum: - - realtime.item + const: realtime.item description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string - enum: - - function_call_output + const: function_call_output description: The type of the item. Always `function_call_output`. - x-stainless-const: true status: type: string enum: @@ -59427,16 +59338,12 @@ components: description: The unique ID of the item. This may be provided by the client or generated by the server. object: type: string - enum: - - realtime.item + const: realtime.item description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string - enum: - - message + const: message description: The type of the item. Always `message`. - x-stainless-const: true status: type: string enum: @@ -59446,10 +59353,8 @@ components: description: The status of the item. Has no effect on the conversation. role: type: string - enum: - - assistant + const: assistant description: The role of the message sender. Always `assistant`. - x-stainless-const: true content: type: array description: The content of the message. @@ -59485,16 +59390,12 @@ components: description: The unique ID of the item. This may be provided by the client or generated by the server. object: type: string - enum: - - realtime.item + const: realtime.item description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string - enum: - - message + const: message description: The type of the item. Always `message`. - x-stainless-const: true status: type: string enum: @@ -59504,10 +59405,8 @@ components: description: The status of the item. Has no effect on the conversation. role: type: string - enum: - - system + const: system description: The role of the message sender. Always `system`. - x-stainless-const: true content: type: array description: The content of the message. @@ -59516,10 +59415,8 @@ components: properties: type: type: string - enum: - - input_text + const: input_text description: The content type. Always `input_text` for system messages. - x-stainless-const: true text: type: string description: The text content. @@ -59537,16 +59434,12 @@ components: description: The unique ID of the item. This may be provided by the client or generated by the server. object: type: string - enum: - - realtime.item + const: realtime.item description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string - enum: - - message + const: message description: The type of the item. Always `message`. - x-stainless-const: true status: type: string enum: @@ -59556,10 +59449,8 @@ components: description: The status of the item. Has no effect on the conversation. role: type: string - enum: - - user + const: user description: The role of the message sender. Always `user`. - x-stainless-const: true content: type: array description: The content of the message. @@ -59622,11 +59513,9 @@ components: The type of the item (`message`, `function_call`, `function_call_output`, `item_reference`). object: type: string - enum: - - realtime.item + const: realtime.item description: | Identifier for the API object being returned - always `realtime.item`. - x-stainless-const: true status: type: string enum: @@ -59708,12 +59597,10 @@ components: properties: anchor: type: string - enum: - - created_at + const: created_at description: | The anchor point for the client secret expiration, meaning that `seconds` will be added to the `created_at` time of the client secret to produce an expiration timestamp. Only `created_at` is currently supported. default: created_at - x-stainless-const: true seconds: type: integer format: int64 @@ -59820,10 +59707,8 @@ components: properties: type: type: string - enum: - - function + const: function description: The type of the tool, i.e. `function`. - x-stainless-const: true name: type: string description: The name of the function. @@ -59844,10 +59729,8 @@ components: properties: type: type: string - enum: - - mcp_approval_request + const: mcp_approval_request description: The type of the item. Always `mcp_approval_request`. - x-stainless-const: true id: type: string description: The unique ID of the approval request. @@ -59874,10 +59757,8 @@ components: properties: type: type: string - enum: - - mcp_approval_response + const: mcp_approval_response description: The type of the item. Always `mcp_approval_response`. - x-stainless-const: true id: type: string description: The unique ID of the approval response. @@ -59903,9 +59784,7 @@ components: properties: type: type: string - enum: - - http_error - x-stainless-const: true + const: http_error code: type: integer message: @@ -59922,10 +59801,8 @@ components: properties: type: type: string - enum: - - mcp_list_tools + const: mcp_list_tools description: The type of the item. Always `mcp_list_tools`. - x-stainless-const: true id: type: string description: The unique ID of the list. @@ -59947,9 +59824,7 @@ components: properties: type: type: string - enum: - - protocol_error - x-stainless-const: true + const: protocol_error code: type: integer message: @@ -59966,10 +59841,8 @@ components: properties: type: type: string - enum: - - mcp_call + const: mcp_call description: The type of the item. Always `mcp_call`. - x-stainless-const: true id: type: string description: The unique ID of the tool call. @@ -60014,9 +59887,7 @@ components: properties: type: type: string - enum: - - tool_execution_error - x-stainless-const: true + const: tool_execution_error message: type: string required: @@ -60059,7 +59930,6 @@ components: type: string description: The unique ID of the response, will look like `resp_1234`. object: - x-stainless-const: true description: The object type, must be `realtime.response`. const: realtime.response status: @@ -60210,9 +60080,7 @@ components: anyOf: - type: integer - type: string - enum: - - inf - x-stainless-const: true + const: inf RealtimeResponseCreateParams: type: object description: Create a new Realtime response with these parameters @@ -60286,9 +60154,7 @@ components: anyOf: - type: integer - type: string - enum: - - inf - x-stainless-const: true + const: inf conversation: description: | Controls which conversation the response is added to. Currently supports @@ -60493,7 +60359,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `response.create`. const: response.create response: @@ -60611,9 +60476,7 @@ components: anyOf: - type: integer - type: string - enum: - - inf - x-stainless-const: true + const: inf conversation: description: | Controls which conversation the response is added to. Currently supports @@ -60917,9 +60780,7 @@ components: properties: type: type: string - enum: - - item_reference - x-stainless-const: true + const: item_reference description: The type of this item. Always `item_reference`. id: type: string @@ -60991,7 +60852,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.created`. const: conversation.created conversation: @@ -61034,7 +60894,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.added`. const: conversation.item.added previous_item_id: @@ -61088,7 +60947,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.created`. const: conversation.item.created previous_item_id: @@ -61130,7 +60988,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.deleted`. const: conversation.item.deleted item_id: @@ -61160,7 +61017,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.done`. const: conversation.item.done previous_item_id: @@ -61216,12 +61072,10 @@ components: description: The unique ID of the server event. type: type: string - enum: - - conversation.item.input_audio_transcription.completed + const: conversation.item.input_audio_transcription.completed description: | The event type, must be `conversation.item.input_audio_transcription.completed`. - x-stainless-const: true item_id: type: string description: The ID of the item containing the audio that is being transcribed. @@ -61289,7 +61143,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.input_audio_transcription.delta`. const: conversation.item.input_audio_transcription.delta item_id: @@ -61333,12 +61186,10 @@ components: description: The unique ID of the server event. type: type: string - enum: - - conversation.item.input_audio_transcription.failed + const: conversation.item.input_audio_transcription.failed description: | The event type, must be `conversation.item.input_audio_transcription.failed`. - x-stainless-const: true item_id: type: string description: The ID of the user message item. @@ -61391,7 +61242,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.input_audio_transcription.segment`. const: conversation.item.input_audio_transcription.segment item_id: @@ -61451,7 +61301,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.retrieved`. const: conversation.item.retrieved item: @@ -61490,7 +61339,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `conversation.item.truncated`. const: conversation.item.truncated item_id: @@ -61531,7 +61379,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `error`. const: error error: @@ -61591,7 +61438,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.cleared`. const: input_audio_buffer.cleared required: @@ -61617,7 +61463,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.committed`. const: input_audio_buffer.committed previous_item_id: @@ -61653,7 +61498,6 @@ components: that the server received the event. properties: type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.dtmf_event_received`. const: input_audio_buffer.dtmf_event_received event: @@ -61684,7 +61528,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.speech_started`. const: input_audio_buffer.speech_started audio_start_ms: @@ -61717,7 +61560,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.speech_stopped`. const: input_audio_buffer.speech_stopped audio_end_ms: @@ -61762,7 +61604,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `input_audio_buffer.timeout_triggered`. const: input_audio_buffer.timeout_triggered audio_start_ms: @@ -61799,7 +61640,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `mcp_list_tools.completed`. const: mcp_list_tools.completed item_id: @@ -61826,7 +61666,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `mcp_list_tools.failed`. const: mcp_list_tools.failed item_id: @@ -61853,7 +61692,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `mcp_list_tools.in_progress`. const: mcp_list_tools.in_progress item_id: @@ -61885,7 +61723,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `output_audio_buffer.cleared`. const: output_audio_buffer.cleared response_id: @@ -61916,7 +61753,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `output_audio_buffer.started`. const: output_audio_buffer.started response_id: @@ -61947,7 +61783,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `output_audio_buffer.stopped`. const: output_audio_buffer.stopped response_id: @@ -61974,7 +61809,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `rate_limits.updated`. const: rate_limits.updated rate_limits: @@ -62033,7 +61867,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_audio.delta`. const: response.output_audio.delta response_id: @@ -62082,7 +61915,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_audio.done`. const: response.output_audio.done response_id: @@ -62125,7 +61957,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_audio_transcript.delta`. const: response.output_audio_transcript.delta response_id: @@ -62175,7 +62006,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_audio_transcript.done`. const: response.output_audio_transcript.done response_id: @@ -62224,7 +62054,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.content_part.added`. const: response.content_part.added response_id: @@ -62292,7 +62121,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.content_part.done`. const: response.content_part.done response_id: @@ -62360,7 +62188,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.created`. const: response.created response: @@ -62408,7 +62235,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.done`. const: response.done response: @@ -62489,7 +62315,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: | The event type, must be `response.function_call_arguments.delta`. const: response.function_call_arguments.delta @@ -62539,7 +62364,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: | The event type, must be `response.function_call_arguments.done`. const: response.function_call_arguments.done @@ -62592,7 +62416,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.mcp_call_arguments.delta`. const: response.mcp_call_arguments.delta response_id: @@ -62639,7 +62462,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.mcp_call_arguments.done`. const: response.mcp_call_arguments.done response_id: @@ -62681,7 +62503,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.mcp_call.completed`. const: response.mcp_call.completed output_index: @@ -62713,7 +62534,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.mcp_call.failed`. const: response.mcp_call.failed output_index: @@ -62745,7 +62565,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.mcp_call.in_progress`. const: response.mcp_call.in_progress output_index: @@ -62777,7 +62596,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_item.added`. const: response.output_item.added response_id: @@ -62820,7 +62638,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_item.done`. const: response.output_item.done response_id: @@ -62868,7 +62685,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_text.delta`. const: response.output_text.delta response_id: @@ -62917,7 +62733,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `response.output_text.done`. const: response.output_text.done response_id: @@ -62967,7 +62782,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `session.created`. const: session.created session: @@ -63041,7 +62855,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `session.updated`. const: session.updated session: @@ -63141,7 +62954,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `transcription_session.updated`. const: transcription_session.updated session: @@ -63331,9 +63143,7 @@ components: default: auto description: | Default tracing mode for the session. - enum: - - auto - x-stainless-const: true + const: auto - type: object title: Tracing Configuration description: | @@ -63380,9 +63190,7 @@ components: anyOf: - type: integer - type: string - enum: - - inf - x-stainless-const: true + const: inf expires_at: type: integer format: unixtime @@ -63494,9 +63302,7 @@ components: default: auto description: | Default tracing mode for the session. - enum: - - auto - x-stainless-const: true + const: auto - type: object title: Tracing Configuration description: | @@ -63553,10 +63359,8 @@ components: properties: type: type: string - enum: - - function + const: function description: The type of the tool, i.e. `function`. - x-stainless-const: true name: type: string description: The name of the function. @@ -63587,9 +63391,7 @@ components: anyOf: - type: integer - type: string - enum: - - inf - x-stainless-const: true + const: inf truncation: $ref: '#/components/schemas/RealtimeTruncation' prompt: @@ -63635,9 +63437,7 @@ components: type: string description: | The type of session to create. Always `realtime` for the Realtime API. - enum: - - realtime - x-stainless-const: true + const: realtime output_modalities: type: array description: | @@ -63785,9 +63585,7 @@ components: default: auto description: | Enables tracing and sets default values for tracing configuration options. Always `auto`. - enum: - - auto - x-stainless-const: true + const: auto - type: object title: Tracing Configuration description: | @@ -63843,9 +63641,7 @@ components: anyOf: - type: integer - type: string - enum: - - inf - x-stainless-const: true + const: inf truncation: $ref: '#/components/schemas/RealtimeTruncation' prompt: @@ -63961,9 +63757,7 @@ components: default: auto description: | Default tracing mode for the session. - enum: - - auto - x-stainless-const: true + const: auto - type: object title: Tracing Configuration description: | @@ -64031,9 +63825,7 @@ components: anyOf: - type: integer - type: string - enum: - - inf - x-stainless-const: true + const: inf x-oaiMeta: name: The session object group: realtime @@ -64081,9 +63873,7 @@ components: type: string description: | The type of session to create. Always `realtime` for the Realtime API. - enum: - - realtime - x-stainless-const: true + const: realtime id: type: string description: | @@ -64091,9 +63881,7 @@ components: object: type: string description: The object type. Always `realtime.session`. - enum: - - realtime.session - x-stainless-const: true + const: realtime.session expires_at: type: integer format: unixtime @@ -64227,9 +64015,7 @@ components: default: auto description: | Enables tracing and sets default values for tracing configuration options. Always `auto`. - enum: - - auto - x-stainless-const: true + const: auto - type: object title: Tracing Configuration description: | @@ -64284,9 +64070,7 @@ components: anyOf: - type: integer - type: string - enum: - - inf - x-stainless-const: true + const: inf truncation: $ref: '#/components/schemas/RealtimeTruncation' prompt: @@ -64378,9 +64162,7 @@ components: type: string description: | The type of session to create. Always `transcription` for transcription sessions. - enum: - - transcription - x-stainless-const: true + const: transcription audio: type: object description: | @@ -64536,9 +64318,7 @@ components: type: string description: | The type of session. Always `transcription` for transcription sessions. - enum: - - transcription - x-stainless-const: true + const: transcription id: type: string description: | @@ -64677,7 +64457,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `session.input_audio_buffer.append`. const: session.input_audio_buffer.append audio: @@ -64707,7 +64486,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `session.close`. const: session.close required: @@ -64732,7 +64510,6 @@ components: maxLength: 512 description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true description: The event type, must be `session.update`. const: session.update session: @@ -64780,12 +64557,10 @@ components: properties: anchor: type: string - enum: - - created_at + const: created_at description: | The anchor point for the client secret expiration, meaning that `seconds` will be added to the `created_at` time of the client secret to produce an expiration timestamp. Only `created_at` is currently supported. default: created_at - x-stainless-const: true seconds: type: integer format: int64 @@ -64870,7 +64645,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `session.closed`. const: session.closed required: @@ -64895,7 +64669,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `session.created`. const: session.created session: @@ -64946,7 +64719,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `session.input_transcript.delta`. const: session.input_transcript.delta delta: @@ -64986,7 +64758,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `session.output_audio.delta`. const: session.output_audio.delta delta: @@ -65002,10 +64773,8 @@ components: default: 1 format: type: string - enum: - - pcm16 + const: pcm16 description: Audio encoding for `delta`. - x-stainless-const: true elapsed_ms: anyOf: - type: integer @@ -65043,7 +64812,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `session.output_transcript.delta`. const: session.output_transcript.delta delta: @@ -65082,7 +64850,6 @@ components: type: string description: The unique ID of the server event. type: - x-stainless-const: true description: The event type, must be `session.updated`. const: session.updated session: @@ -65133,11 +64900,9 @@ components: Unique identifier for the session that looks like `sess_1234567890abcdef`. type: type: string - enum: - - translation + const: translation description: | The session type. Always `translation` for Realtime translation sessions. - x-stainless-const: true expires_at: type: integer format: unixtime @@ -65342,10 +65107,8 @@ components: properties: type: type: string - enum: - - retention_ratio + const: retention_ratio description: Use retention ratio truncation. - x-stainless-const: true retention_ratio: type: number description: | @@ -65613,39 +65376,6 @@ components: - id - summary - type - InputRemovalReason: - type: string - enum: - - organization_mismatch - - end_user_mismatch - - model_mismatch - - prefix_mismatch - - turn_boundary - ReasoningInputTransformation: - properties: - type: - type: string - enum: - - reasoning - default: reasoning - x-stainless-const: true - id: - type: string - description: The original reasoning item ID. - action: - type: string - enum: - - removed - default: removed - x-stainless-const: true - reason: - $ref: '#/components/schemas/InputRemovalReason' - type: object - required: - - type - - id - - action - - reason Response: title: The response object allOf: @@ -65665,6 +65395,8 @@ components: - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. + On some models, trimming can begin earlier because the API subtracts the model's + maximum output allowance from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. enum: @@ -73927,9 +73659,7 @@ components: object: description: The object type, which is always `vector_store.file_batch`. type: string - enum: - - vector_store.files_batch - x-stainless-const: true + const: vector_store.files_batch created_at: description: The Unix timestamp (in seconds) for when the vector store files batch was created. type: integer @@ -75779,6 +75509,59 @@ components: ] } } + WebhookLiveTransportConnected: + type: object + title: live.transport.connected + description: Sent when a direct Live WebRTC session is created or an Instant Connect session activates. Use its session ID to attach a sideband observer. + required: + - id + - object + - created_at + - type + - data + properties: + id: + type: string + description: The webhook event ID. + object: + type: string + enum: + - event + x-stainless-const: true + created_at: + type: integer + format: unixtime + description: Unix time in seconds when the event was created. + type: + type: string + enum: + - live.transport.connected + x-stainless-const: true + data: + type: object + required: + - session_id + - type + properties: + type: + type: string + enum: + - webrtc + description: The session transport. + session_id: + type: string + description: The Live session ID to use with the sideband attach endpoint. + x-oaiMeta: + name: live.transport.connected + group: webhook-events + example: | + { + "id": "evt_abc123", + "object": "event", + "created_at": 1793815201, + "type": "live.transport.connected", + "data": {"session_id": "live_u0_abc123", "type": "webrtc"} + } WebhookLiveTransportIncoming: type: object title: live.transport.incoming @@ -77365,6 +77148,25 @@ components: - jpeg - gif - svg + SvgUsage: + properties: + model: + type: string + input_tokens: + type: integer + output_tokens: + type: integer + total_tokens: + type: integer + reasoning_tokens: + type: integer + type: object + required: + - model + - input_tokens + - output_tokens + - total_tokens + - reasoning_tokens ImageGenToolCall: properties: type: @@ -77974,6 +77776,37 @@ components: type: object required: - type + ReasoningEffortEnum: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + - max + SvgReasoningParam: + properties: + effort: + anyOf: + - $ref: '#/components/schemas/ReasoningEffortEnum' + description: Controls how much effort the model should spend on reasoning for this request. + type: object + required: [] + description: Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses. + SvgParam: + properties: + model: + type: string + minLength: 1 + reasoning: + anyOf: + - $ref: '#/components/schemas/SvgReasoningParam' + description: Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses. + - type: 'null' + type: object + required: [] InputFidelity: type: string enum: @@ -79283,7 +79116,7 @@ components: namespace: anyOf: - type: string - maxLength: 64 + maxLength: 128 minLength: 1 pattern: ^[a-zA-Z0-9_-]+$ description: The namespace of the tool that produced the output. @@ -80114,10 +79947,41 @@ components: - object - metadata - created_at + frame_count: + type: + - integer + - 'null' + minimum: 2 + maximum: 16 + description: Number of frames for GIF output. Accepts integers from 2 through 16. Defaults to 9 when omitted. Only supported with output_format=gif. The requested size must satisfy the selected model's GIF size limits. GIF output does not support streaming, partial images, masks, or custom output compression. Requires access to the GIF preview for the selected model. + frame_duration_ms: + type: + - integer + - 'null' + minimum: 20 + description: Requested delay per GIF frame, in milliseconds. Defaults to 200 when omitted. GIF output rounds to the nearest 10 ms and caps the encoded delay at 655,350 ms per frame. Only supported with output_format=gif. + complexity: + type: + - string + - 'null' + enum: + - low + - medium + - high + - null + description: Computation spent planning the image, independently of rendering quality. Uses the image model's configured default when omitted. For SVG output, controls the reference image, independently of the SVG author's reasoning. markup: type: string format: binary description: A transparent PNG overlaid on the first image to guide the edit. Must match that image's dimensions after orientation and contain transparent pixels. Supports GPT Image 2.5 and 2.6. Cannot be combined with mask. + ImagesApiOutputFormat: + type: string + enum: + - png + - webp + - jpeg + - gif + - svg ImageGenOutputTokensDetails: properties: image_tokens: @@ -80168,7 +80032,36 @@ components: - output_tokens - input_tokens_details title: Image generation usage - description: For `gpt-image-1` only, the token usage information for the image generation. + description: Token usage information for image generation with GPT Image models. + svg: + type: + - object + - 'null' + description: Selects the model and reasoning effort used to author SVG output. Requires output_format=svg and access to SVG model selection. When model selection is enabled, supply svg.model. When model selection is disabled, omit this object. The top-level model selects the image model that creates the reference image. SVG generation requires n=1 and does not support streaming, partial images, prompt_rewriter, or output_compression. + properties: + model: + type: string + minLength: 1 + description: Model used to author the SVG. Required when SVG model selection is enabled. + reasoning: + type: + - object + - 'null' + description: Reasoning settings for the SVG author, independent of image complexity. Omitted or null effort uses the author model's default. Supported efforts depend on the selected author model. + properties: + effort: + anyOf: + - $ref: '#/components/schemas/ReasoningEffortEnum' + - type: 'null' + description: Controls how much effort the SVG author spends on reasoning. Uses the author model's default when omitted or null. + required: + - model + safety_identifier: + anyOf: + - description: A stable identifier for your end user, used for safety monitoring and abuse detection. + type: string + maxLength: 128 + - type: 'null' instructions: anyOf: - description: Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); put business rules and tool workflows in a separate [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup. @@ -81943,6 +81836,39 @@ components: type: object required: - cyber + InputRemovalReason: + type: string + enum: + - organization_mismatch + - end_user_mismatch + - model_mismatch + - prefix_mismatch + - turn_boundary + ReasoningInputTransformation: + properties: + type: + type: string + enum: + - reasoning + default: reasoning + x-stainless-const: true + id: + type: string + description: The original reasoning item ID. + action: + type: string + enum: + - removed + default: removed + x-stainless-const: true + reason: + $ref: '#/components/schemas/InputRemovalReason' + type: object + required: + - type + - id + - action + - reason CacheWriteTokensDetails: properties: ttl_30m_tokens: @@ -82563,6 +82489,14 @@ components: type: string kms_key_version: type: string + region: + type: string + vault_ocid: + type: string + key_ocid: + type: string + key_version_ocid: + type: string tenant_id: type: string vault_uri: @@ -82731,6 +82665,46 @@ components: - tenant_id - vault_uri - key_name + OciExternalKeyParams: + properties: + name: + type: string + description: A friendly name to identify this config + type: + type: string + enum: + - oci + default: oci + x-stainless-const: true + region: + type: string + maxLength: 64 + minLength: 1 + description: The OCI region containing the vault + vault_ocid: + type: string + maxLength: 512 + minLength: 1 + description: The customer OCI Vault OCID + key_ocid: + type: string + maxLength: 512 + minLength: 1 + description: The OCI Vault key OCID + purpose: + $ref: '#/components/schemas/ExternalKeyPurpose' + key_version_ocid: + type: string + maxLength: 512 + minLength: 1 + description: The exact OCI key version OCID for PSP decryption. + type: object + required: + - name + - type + - region + - vault_ocid + - key_ocid V1OrganizationExternalKeysPostRequest: discriminator: propertyName: type @@ -82738,6 +82712,7 @@ components: - $ref: '#/components/schemas/AwsExternalKeyParams' - $ref: '#/components/schemas/GcpExternalKeyParams' - $ref: '#/components/schemas/AzureExternalKeyParams' + - $ref: '#/components/schemas/OciExternalKeyParams' ValidateExternalKeyResource: properties: status: @@ -83943,7 +83918,7 @@ components: file: type: string format: binary - description: The image or audio file to check for supported OpenAI provenance signals. + description: The image or audio file to check for supported OpenAI provenance signals. Supported image formats are PNG, JPEG, WebP, and GIF (including animated GIFs). type: object required: - file @@ -84101,9 +84076,9 @@ components: headers: additionalProperties: type: string - description: The retry header value. + description: The header value. type: object - description: The Retry-After and Retry-After-Ms headers returned with the original error, if any. + description: Headers returned with the original error. These can include Retry-After, Retry-After-Ms, and, on opted-in deployments, x-openai-inference-capacity-reason. x-oaiTypeLabel: map misalignment: $ref: '#/components/schemas/MisalignmentErrorDetailsResource' @@ -84516,7 +84491,10 @@ components: - type: 'null' truncation: $ref: '#/components/schemas/TruncationEnum' - description: 'The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model''s context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.' + description: |- + The truncation strategy to use for the model response. + - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. On some models, trimming can begin earlier because the API subtracts the model's maximum output allowance from its input limit before counting tokens. + - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. deprecated: true instructions: anyOf: @@ -84604,6 +84582,7 @@ components: description: |- A system (or developer) message inserted into the model's context. When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses. + deprecated: true - type: 'null' image: $ref: '#/components/schemas/ImageOptionsParam' @@ -86333,7 +86312,7 @@ components: - string - 'null' minLength: 1 - maxLength: 64 + maxLength: 128 pattern: ^[a-zA-Z0-9_-]+$ name: type: string @@ -91872,6 +91851,19 @@ components: - has_more additionalProperties: false description: A page of messages, reasoning, and tool calls from a session's item history. + PromptCacheTtlResource: + type: string + enum: + - 30m + - 12h + PromptCacheOptionsResource: + type: object + properties: + ttl: + $ref: '#/components/schemas/PromptCacheTtlResource' + required: + - ttl + additionalProperties: false TurnObjectResource: type: string enum: @@ -92018,6 +92010,11 @@ components: TurnResource: type: object properties: + prompt_cache_options: + anyOf: + - $ref: '#/components/schemas/PromptCacheOptionsResource' + - type: 'null' + description: Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded. id: type: string minLength: 0 @@ -93434,6 +93431,77 @@ components: - The session is waiting for one or more required actions. - The session failed. description: The current status of a session. + McpApprovalRequestResourceMcpToolCall: + type: object + properties: + type: + type: string + enum: + - mcp_tool_call + default: mcp_tool_call + x-stainless-const: true + description: The type of the object. Always `mcp_tool_call`. + server_label: + type: string + minLength: 0 + name: + type: + - string + - 'null' + minLength: 0 + description: The tool name, or null when CCA does not provide it. + arguments: + anyOf: + - {} + - type: 'null' + description: The tool arguments as JSON, or null when CCA does not provide them. + message: + type: string + minLength: 0 + required: + - type + - server_label + - name + - arguments + - message + additionalProperties: false + McpApprovalRequestResource: + description: Information for presenting an MCP approval. + discriminator: + propertyName: type + mapping: + mcp_tool_call: '#/components/schemas/McpApprovalRequestResourceMcpToolCall' + x-oai-discriminator-values: + - mcp_tool_call + anyOf: + - $ref: '#/components/schemas/McpApprovalRequestResourceMcpToolCall' + SessionRequiredActionResourceMcpApprovalRequest: + type: object + properties: + type: + type: string + enum: + - mcp_approval_request + default: mcp_approval_request + x-stainless-const: true + description: The type of the object. Always `mcp_approval_request`. + turn_id: + type: string + minLength: 0 + description: The turn that requested approval. + request_id: + type: string + minLength: 0 + description: The opaque approval ID to echo when responding. + request: + $ref: '#/components/schemas/McpApprovalRequestResource' + required: + - type + - turn_id + - request_id + - request + additionalProperties: false + description: Respond to an MCP tool-call approval request. ComputerUseApprovalRequestKindResourceBrowserAuthentication: type: object properties: @@ -93600,14 +93668,17 @@ components: discriminator: propertyName: type mapping: + mcp_approval_request: '#/components/schemas/SessionRequiredActionResourceMcpApprovalRequest' computer_use_approval_request: '#/components/schemas/SessionRequiredActionResourceComputerUseApprovalRequest' function_call: '#/components/schemas/SessionRequiredActionResourceFunctionCall' environment_connection: '#/components/schemas/SessionRequiredActionResourceEnvironmentConnection' x-oai-discriminator-values: + - mcp_approval_request - computer_use_approval_request - function_call - environment_connection anyOf: + - $ref: '#/components/schemas/SessionRequiredActionResourceMcpApprovalRequest' - $ref: '#/components/schemas/SessionRequiredActionResourceComputerUseApprovalRequest' - $ref: '#/components/schemas/SessionRequiredActionResourceFunctionCall' - $ref: '#/components/schemas/SessionRequiredActionResourceEnvironmentConnection' @@ -93812,6 +93883,11 @@ components: SessionResource: type: object properties: + prompt_cache_options: + anyOf: + - $ref: '#/components/schemas/PromptCacheOptionsResource' + - type: 'null' + description: Default prompt cache lifetime for turns in this session, when configured. review: $ref: '#/components/schemas/SessionReviewResource' description: Review applied to eligible actions in this session. Omitted when review is none and automatic review is not enabled. Omission means none. @@ -93957,9 +94033,35 @@ components: $ref: '#/components/schemas/InputMessageParam' minItems: 0 maxItems: 16384 + PromptCacheTtlParam: + type: string + enum: + - 30m + - 12h + description: Minimum lifetime for prompt cache entries written during the turn. + PromptCacheOptionsParam-2: + type: object + properties: + ttl: + $ref: '#/components/schemas/PromptCacheTtlParam' + default: 30m + description: Minimum lifetime for new prompt cache entries. Defaults to 30 minutes. + additionalProperties: false + SessionStreamOptionsParam: + type: object + properties: + include_obfuscation: + type: boolean + default: true + description: Whether to include obfuscation padding in events on this connection. Defaults to `true`. + additionalProperties: false + description: Options for a Managed Agents session event stream. CreateAgentSessionParams: type: object properties: + environment: + $ref: '#/components/schemas/EnvironmentParam' + description: An inline execution environment or a reference to an environment template. review: $ref: '#/components/schemas/SessionReviewParam' description: Action review mode. Omit to use none. @@ -93986,9 +94088,6 @@ components: minLength: 0 maxLength: 64 description: The ID of a saved reusable agent. Omit `agent` to use its configuration unchanged. - environment: - $ref: '#/components/schemas/EnvironmentParam' - description: An inline execution environment or a reference to an environment template. vault_ids: type: - array @@ -94005,6 +94104,11 @@ components: - $ref: '#/components/schemas/CreateSessionInputParam' - type: 'null' description: Initial input to submit when the session is created. A string is shorthand for a single user message. Required when `environment.type` is `none`, or when `stream` is `true` for an environment that is not `self_hosted`; optional for self-hosted and non-streaming execution environments. + prompt_cache_options: + anyOf: + - $ref: '#/components/schemas/PromptCacheOptionsParam-2' + - type: 'null' + description: Default prompt cache lifetime for turns in this session. Omit to use the model default. stream: type: boolean default: false @@ -95768,6 +95872,11 @@ components: UpdateAgentSessionParams: type: object properties: + prompt_cache_options: + anyOf: + - $ref: '#/components/schemas/PromptCacheOptionsParam-2' + - type: 'null' + description: Default prompt cache lifetime for future turns. Send null to clear the session default. review: $ref: '#/components/schemas/SessionReviewParam' description: Default action review for new root turns. Existing turns and their subagents keep their review mode. @@ -95932,6 +96041,62 @@ components: - deleted additionalProperties: false description: Confirmation that an immutable session artifact was deleted. + McpApprovalDecisionParam: + type: string + enum: + - approve + - deny + - cancel + McpApprovalResponseParamMcpToolCall: + type: object + properties: + type: + type: string + enum: + - mcp_tool_call + default: mcp_tool_call + x-stainless-const: true + description: The type of the object. Always `mcp_tool_call`. + decision: + $ref: '#/components/schemas/McpApprovalDecisionParam' + description: Cancel dismisses this request without cancelling the session or turn. + required: + - type + - decision + additionalProperties: false + McpApprovalResponseParam: + description: The user's decision for a pending MCP tool call. + discriminator: + propertyName: type + mapping: + mcp_tool_call: '#/components/schemas/McpApprovalResponseParamMcpToolCall' + x-oai-discriminator-values: + - mcp_tool_call + anyOf: + - $ref: '#/components/schemas/McpApprovalResponseParamMcpToolCall' + SessionInputParamAgentSessionInputMcpApprovalRequestResult: + type: object + properties: + type: + type: string + enum: + - agent.session.input.mcp_approval_request_result + default: agent.session.input.mcp_approval_request_result + x-stainless-const: true + description: The type of the object. Always `agent.session.input.mcp_approval_request_result`. + request_id: + type: string + minLength: 0 + maxLength: 1048576 + description: The opaque approval ID from the required action. + response: + $ref: '#/components/schemas/McpApprovalResponseParam' + required: + - type + - request_id + - response + additionalProperties: false + description: Responds to a pending MCP tool-call approval request. BrowserAuthenticationFieldValueParam: type: object properties: @@ -96179,16 +96344,19 @@ components: discriminator: propertyName: type mapping: + agent.session.input.mcp_approval_request_result: '#/components/schemas/SessionInputParamAgentSessionInputMcpApprovalRequestResult' agent.session.input.computer_use_approval_request_result: '#/components/schemas/SessionInputParamAgentSessionInputComputerUseApprovalRequestResult' agent.session.input.message: '#/components/schemas/SessionInputParamAgentSessionInputMessage' agent.session.input.cancel: '#/components/schemas/SessionInputParamAgentSessionInputCancel' agent.session.input.tool_result: '#/components/schemas/SessionInputParamAgentSessionInputToolResult' x-oai-discriminator-values: + - agent.session.input.mcp_approval_request_result - agent.session.input.computer_use_approval_request_result - agent.session.input.message - agent.session.input.cancel - agent.session.input.tool_result anyOf: + - $ref: '#/components/schemas/SessionInputParamAgentSessionInputMcpApprovalRequestResult' - $ref: '#/components/schemas/SessionInputParamAgentSessionInputComputerUseApprovalRequestResult' - $ref: '#/components/schemas/SessionInputParamAgentSessionInputMessage' - $ref: '#/components/schemas/SessionInputParamAgentSessionInputCancel' @@ -97305,11 +97473,9 @@ components: description: The unique ID of the webhook endpoint. object: type: string - enum: - - webhook_endpoint + const: webhook_endpoint description: The object type, which is always webhook_endpoint. default: webhook_endpoint - x-stainless-const: true created_at: type: integer format: unixtime @@ -97347,11 +97513,9 @@ components: properties: object: type: string - enum: - - list + const: list description: The object type, which is always list. default: list - x-stainless-const: true data: items: $ref: '#/components/schemas/WebhookEndpointBody' @@ -97437,11 +97601,9 @@ components: description: The unique ID of the webhook endpoint. object: type: string - enum: - - webhook_endpoint + const: webhook_endpoint description: The object type, which is always webhook_endpoint. default: webhook_endpoint - x-stainless-const: true created_at: type: integer format: unixtime @@ -97507,11 +97669,9 @@ components: description: The ID of the deleted webhook endpoint. object: type: string - enum: - - webhook_endpoint.deleted + const: webhook_endpoint.deleted description: The object type, which is always webhook_endpoint.deleted. default: webhook_endpoint.deleted - x-stainless-const: true deleted: type: boolean description: Whether the endpoint was deleted. @@ -97539,11 +97699,9 @@ components: properties: object: type: string - enum: - - webhook_endpoint.test + const: webhook_endpoint.test description: The object type, which is always webhook_endpoint.test. default: webhook_endpoint.test - x-stainless-const: true webhook_endpoint_id: type: string description: The ID of the webhook endpoint that received the test. @@ -97555,11 +97713,9 @@ components: description: The HTTP status code returned by the endpoint. success: type: boolean - enum: - - true + const: true description: Whether the test request completed. Always true for returned results; use status_code to determine the endpoint response. default: true - x-stainless-const: true type: object required: - object @@ -97571,11 +97727,9 @@ components: properties: object: type: string - enum: - - list + const: list description: The object type, which is always list. default: list - x-stainless-const: true data: items: type: string @@ -97600,6 +97754,7 @@ components: type: string enum: - computer_use_approval_request + - mcp_approval_request - function_call - environment_connection AgentSessionRequiredActionPayloadResource: @@ -98482,7 +98637,7 @@ components: - description: The namespace of the function to call. type: string minLength: 1 - maxLength: 64 + maxLength: 128 pattern: ^[a-zA-Z0-9_-]+$ - type: 'null' arguments: @@ -99810,7 +99965,7 @@ components: - description: The namespace of the function to call. type: string minLength: 1 - maxLength: 64 + maxLength: 128 pattern: ^[a-zA-Z0-9_-]+$ - type: 'null' arguments: @@ -100753,7 +100908,10 @@ components: - type: 'null' truncation: $ref: '#/components/schemas/BetaTruncationEnum' - description: 'The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model''s context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.' + description: |- + The truncation strategy to use for the model response. + - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. On some models, trimming can begin earlier because the API subtracts the model's maximum output allowance from its input limit before counting tokens. + - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. deprecated: true instructions: anyOf: @@ -101878,11 +102036,11 @@ components: `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`, `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: - `gpt-image-2`. + `gpt-image-2.6-sunburst`. `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead. - default: gpt-image-2 + default: gpt-image-2.6-sunburst complexity: type: string enum: @@ -102038,6 +102196,37 @@ components: - high - low description: Control how much effort the model will exert to match the style and features, especially facial features, of input images. Supports `high` and `low` on `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit this parameter. Defaults to `low` on supported models. + BetaSvgParam: + properties: + model: + type: string + minLength: 1 + reasoning: + anyOf: + - $ref: '#/components/schemas/BetaSvgReasoningParam' + description: Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses. + - type: 'null' + type: object + required: [] + BetaSvgReasoningParam: + properties: + effort: + anyOf: + - $ref: '#/components/schemas/BetaReasoningEffortEnum' + description: Controls how much effort the model should spend on reasoning for this request. + type: object + required: [] + description: Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses. + BetaReasoningEffortEnum: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + - max BetaProgrammaticToolCallingParam: properties: type: @@ -104078,6 +104267,25 @@ components: - result title: Image generation call description: An image generation request made by the model. + BetaSvgUsage: + properties: + model: + type: string + input_tokens: + type: integer + output_tokens: + type: integer + total_tokens: + type: integer + reasoning_tokens: + type: integer + type: object + required: + - model + - input_tokens + - output_tokens + - total_tokens + - reasoning_tokens BetaImageOutputFormat: type: string enum: @@ -104969,7 +105177,7 @@ components: namespace: anyOf: - type: string - maxLength: 64 + maxLength: 128 minLength: 1 pattern: ^[a-zA-Z0-9_-]+$ description: The namespace of the tool that produced the output. @@ -106168,6 +106376,7 @@ components: description: |- A system (or developer) message inserted into the model's context. When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses. + deprecated: true - type: 'null' image: $ref: '#/components/schemas/BetaImageOptionsParam' @@ -107958,39 +108167,6 @@ components: }, "sequence_number": 1 } - BetaReasoningInputTransformation: - properties: - type: - type: string - enum: - - reasoning - default: reasoning - x-stainless-const: true - id: - type: string - description: The original reasoning item ID. - action: - type: string - enum: - - removed - default: removed - x-stainless-const: true - reason: - $ref: '#/components/schemas/BetaInputRemovalReason' - type: object - required: - - type - - id - - action - - reason - BetaInputRemovalReason: - type: string - enum: - - organization_mismatch - - end_user_mismatch - - model_mismatch - - prefix_mismatch - - turn_boundary BetaResponse: title: The response object allOf: @@ -108010,6 +108186,8 @@ components: - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. + On some models, trimming can begin earlier because the API subtracts the model's + maximum output allowance from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. enum: @@ -108517,6 +108695,39 @@ components: - $ref: '#/components/schemas/BetaMCPApprovalResponseResource' - $ref: '#/components/schemas/BetaCustomToolCall' - $ref: '#/components/schemas/BetaCustomToolCallOutputResource' + BetaReasoningInputTransformation: + properties: + type: + type: string + enum: + - reasoning + default: reasoning + x-stainless-const: true + id: + type: string + description: The original reasoning item ID. + action: + type: string + enum: + - removed + default: removed + x-stainless-const: true + reason: + $ref: '#/components/schemas/BetaInputRemovalReason' + type: object + required: + - type + - id + - action + - reason + BetaInputRemovalReason: + type: string + enum: + - organization_mismatch + - end_user_mismatch + - model_mismatch + - prefix_mismatch + - turn_boundary BetaResponseError: anyOf: - type: object @@ -113384,6 +113595,8 @@ components: - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. + On some models, trimming can begin earlier because the API subtracts the model's + maximum output allowance from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. enum: @@ -113690,161 +113903,6 @@ components: - $ref: '#/components/schemas/BetaResponseCustomToolCallInputDoneEvent' discriminator: propertyName: type - SvgUsage: - properties: - model: - type: string - input_tokens: - type: integer - output_tokens: - type: integer - total_tokens: - type: integer - reasoning_tokens: - type: integer - type: object - required: - - model - - input_tokens - - output_tokens - - total_tokens - - reasoning_tokens - ReasoningEffortEnum: - type: string - enum: - - none - - minimal - - low - - medium - - high - - xhigh - - max - SvgReasoningParam: - properties: - effort: - anyOf: - - $ref: '#/components/schemas/ReasoningEffortEnum' - description: Controls how much effort the model should spend on reasoning for this request. - type: object - required: [] - description: Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses. - SvgParam: - properties: - model: - type: string - minLength: 1 - reasoning: - anyOf: - - $ref: '#/components/schemas/SvgReasoningParam' - description: Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses. - - type: 'null' - type: object - required: [] - frame_count: - type: - - integer - - 'null' - minimum: 2 - maximum: 16 - description: Number of frames for GIF output. Accepts integers from 2 through 16. Defaults to 9 when omitted. Only supported with output_format=gif. The requested size must satisfy the selected model's GIF size limits. GIF output does not support streaming, partial images, masks, or custom output compression. Requires access to the GIF preview for the selected model. - frame_duration_ms: - type: - - integer - - 'null' - minimum: 20 - description: Requested delay per GIF frame, in milliseconds. Defaults to 200 when omitted. GIF output rounds to the nearest 10 ms and caps the encoded delay at 655,350 ms per frame. Only supported with output_format=gif. - complexity: - type: - - string - - 'null' - enum: - - low - - medium - - high - - null - description: Computation spent planning the image, independently of rendering quality. Uses the image model's configured default when omitted. For SVG output, controls the reference image, independently of the SVG author's reasoning. - svg: - type: - - object - - 'null' - description: Selects the model and reasoning effort used to author SVG output. Requires output_format=svg and access to SVG model selection. When model selection is enabled, supply svg.model. When model selection is disabled, omit this object. The top-level model selects the image model that creates the reference image. SVG generation requires n=1 and does not support streaming, partial images, prompt_rewriter, or output_compression. SVG edits are not supported. - properties: - model: - type: string - minLength: 1 - description: Model used to author the SVG. Required when SVG model selection is enabled. - reasoning: - type: - - object - - 'null' - description: Reasoning settings for the SVG author, independent of image complexity. Omitted or null effort uses the author model's default. Supported efforts depend on the selected author model. - properties: - effort: - anyOf: - - $ref: '#/components/schemas/ReasoningEffortEnum' - - type: 'null' - description: Controls how much effort the SVG author spends on reasoning. Uses the author model's default when omitted or null. - required: - - model - BetaSvgParam: - properties: - model: - type: string - minLength: 1 - reasoning: - anyOf: - - $ref: '#/components/schemas/BetaSvgReasoningParam' - description: Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses. - - type: 'null' - type: object - required: [] - BetaSvgReasoningParam: - properties: - effort: - anyOf: - - $ref: '#/components/schemas/BetaReasoningEffortEnum' - description: Controls how much effort the model should spend on reasoning for this request. - type: object - required: [] - description: Reasoning effort for SVG authoring. When omitted, uses the author model's default in both Images and Responses. - BetaReasoningEffortEnum: - type: string - enum: - - none - - minimal - - low - - medium - - high - - xhigh - - max - BetaSvgUsage: - properties: - model: - type: string - input_tokens: - type: integer - output_tokens: - type: integer - total_tokens: - type: integer - reasoning_tokens: - type: integer - type: object - required: - - model - - input_tokens - - output_tokens - - total_tokens - - reasoning_tokens - SessionStreamOptionsParam: - type: object - properties: - include_obfuscation: - type: boolean - default: true - description: Whether to include obfuscation padding in events on this connection. Defaults to `true`. - additionalProperties: false - description: Options for a Managed Agents session event stream. SessionSpendControlResource: type: object properties: @@ -114823,6 +114881,9 @@ x-oaiMeta: - type: object key: WebhookLiveTransportIncoming path: + - type: object + key: WebhookLiveTransportConnected + path: - type: object key: WebhookSafetyWarningIssued path: diff --git a/scripts/castiron/generated-files.json b/scripts/castiron/generated-files.json index 4b4043942e..7b8e6d58a4 100644 --- a/scripts/castiron/generated-files.json +++ b/scripts/castiron/generated-files.json @@ -59,7 +59,7 @@ }, "src/openai/resources/admin/organization/external_keys.py": { "mode": "100644", - "sha256": "e1288655d595633c904b060833d7ebf0d9cfd0f285f10d0f8d08035d2f61e7be" + "sha256": "b3210a38cbc90e9f903d1e5a869fd603efa0007ceee0be56eb0ad0a3b75a17db" }, "src/openai/resources/admin/organization/external_storage.py": { "mode": "100644", @@ -303,7 +303,7 @@ }, "src/openai/resources/beta/agents/sessions/sessions.py": { "mode": "100644", - "sha256": "297acd58f5b8f58f438e81536ac9e1971fa22eaf5a4a27e288c65335800b5bc0" + "sha256": "079e0f1b7acab644ce59afb2cba3553d2127c280ddafd0f17337f5f9b133a2cf" }, "src/openai/resources/beta/agents/sessions/subagents/__init__.py": { "mode": "100644", @@ -391,11 +391,11 @@ }, "src/openai/resources/beta/responses/input_tokens.py": { "mode": "100644", - "sha256": "a904d4781f1efedc4870d988c86861240af32621f10c54dd84bb262b4b8c4c48" + "sha256": "52ca1b591ad162c62d6157e7e89fd3893bbfe76766f6006e92431d78c1a19255" }, "src/openai/resources/beta/responses/responses.py": { "mode": "100644", - "sha256": "ef7100bba37dbf3bbbe079c0f8783ec33e2e261f8237dfded84cac7ac77754f9" + "sha256": "3ca690f58cfcf7d9d801d6c44c3d95ed1328365435f75a1f280135dcb910c656" }, "src/openai/resources/beta/threads/__init__.py": { "mode": "100644", @@ -467,7 +467,7 @@ }, "src/openai/resources/content_provenance_checks.py": { "mode": "100644", - "sha256": "7ccd365b6763eb188325adc35a0817a1076f21d49f494afcc5c4a4c35db873fd" + "sha256": "21470efee33ed6cde6e5db281e5e7b008d3489a315e604b115f1a5e88d446ca3" }, "src/openai/resources/conversations/__init__.py": { "mode": "100644", @@ -563,7 +563,7 @@ }, "src/openai/resources/images.py": { "mode": "100644", - "sha256": "f7ca65d7cae85affbd64a5e3d2465e5e958601e537a7302d597b4d5bff332d77" + "sha256": "17f8c993540298c8d13ffd593e53982b55680c638399001398e2cb745e3ffb76" }, "src/openai/resources/live/__init__.py": { "mode": "100644", @@ -643,11 +643,11 @@ }, "src/openai/resources/responses/input_tokens.py": { "mode": "100644", - "sha256": "8b204e262a86d66be7cfd847a1d8fad720f92616bf9012d94b75629e0d81a06f" + "sha256": "23f8187ecbb6f31346e1a2eedbbc306d13a337606f5f0d074ad7e3e1bb926ae9" }, "src/openai/resources/responses/responses.py": { "mode": "100644", - "sha256": "7d07b28ee2c270b70b24778069d6fce511197f2a96c703309a22af5d7166e000" + "sha256": "508a3888f6602cc9cb9836ef8be3894ab60d49cca7d236c93ad2d887ea50a48b" }, "src/openai/resources/safety/__init__.py": { "mode": "100644", @@ -727,7 +727,7 @@ }, "src/openai/resources/webhooks/api.md": { "mode": "100644", - "sha256": "c9525180e201503bb8a958a2768a08b26655106c716569e8f40bb9f15349c365" + "sha256": "28439bfcdeaf9b2f33a184d0cc4c088d9e917dba515826523544942aef2c9b3b" }, "src/openai/resources/webhooks/event_types.py": { "mode": "100644", @@ -775,7 +775,7 @@ }, "src/openai/types/admin/organization/audit_log_list_response.py": { "mode": "100644", - "sha256": "629f8d8ea29a6eb34af08a10461bd788c3dffc7859b3e53981a24f415db82cdd" + "sha256": "61e57c6bade271caa6fd544488263835e242d81dcdb68ad2d3d6c2a235d4f93e" }, "src/openai/types/admin/organization/aws_external_storage_provider.py": { "mode": "100644", @@ -839,11 +839,11 @@ }, "src/openai/types/admin/organization/external_key.py": { "mode": "100644", - "sha256": "1dd59d578a766b90bd5b28852915627b1e4cd7e47374ac7d9fa5dcf16e0591fc" + "sha256": "4430df57e700ec944ce3fe48791385b1898afb5fdb98779d65a5ea2407dc470e" }, "src/openai/types/admin/organization/external_key_create_params.py": { "mode": "100644", - "sha256": "b72cf37b3d75ab44fe26db1892dc04e372da3126500221d87a385449e425e4c5" + "sha256": "f62e4f9dd9961f57933d4224767d4b438bb6f9611b222e4bbec416561e7cd27b" }, "src/openai/types/admin/organization/external_key_list_params.py": { "mode": "100644", @@ -1775,7 +1775,7 @@ }, "src/openai/types/beta/agent_session.py": { "mode": "100644", - "sha256": "c3563e065a7d80a1ee1676d31cd4b835a2363a691db2ac778f8a0c13f265e37b" + "sha256": "e36dac685c1f63dfbb4e796967d604418f201280d51cdc74b552372bc63a8768" }, "src/openai/types/beta/agent_session_assistant_message.py": { "mode": "100644", @@ -1851,7 +1851,7 @@ }, "src/openai/types/beta/agent_session_input_param.py": { "mode": "100644", - "sha256": "1b82f05609c7997c5ec440774bb6eb19c70a7148b4500a660dc0fff163984992" + "sha256": "ac3e21387dc29f210abb62f643a81db99b27cfb8711da3a7fde534efe5856158" }, "src/openai/types/beta/agent_session_item.py": { "mode": "100644", @@ -2091,7 +2091,7 @@ }, "src/openai/types/beta/agents/session_create_params.py": { "mode": "100644", - "sha256": "2338dcd48c6c6cd77ea1f011937c8d6eeb7f97b9d07a4ed9b4892b7bfafba92a" + "sha256": "f30394767e5d8b4d73145c80bfb46318586b17cb14b2ae8719d7151eaeabb98b" }, "src/openai/types/beta/agents/session_list_params.py": { "mode": "100644", @@ -2099,7 +2099,7 @@ }, "src/openai/types/beta/agents/session_update_params.py": { "mode": "100644", - "sha256": "595ab57453c5678034088224417b1946dc37f4dd11e28c7f6df49d75d7dd3dd0" + "sha256": "22f0f47d3b8158bb9aa9a588bec6944171432cddbb757aaeaf8c0602a2b232a6" }, "src/openai/types/beta/agents/sessions/__init__.py": { "mode": "100644", @@ -2163,7 +2163,7 @@ }, "src/openai/types/beta/agents/sessions/turn.py": { "mode": "100644", - "sha256": "6ecbf60f75c2b0550396a4396da0c9aac12ffaa63f5b13389e30783e5fdb3615" + "sha256": "761ca9a889e858764e75aa56d624a329a9cc5bf6c4ff877bc5d232d827460357" }, "src/openai/types/beta/agents/sessions/turn_list_params.py": { "mode": "100644", @@ -2503,7 +2503,7 @@ }, "src/openai/types/beta/beta_response.py": { "mode": "100644", - "sha256": "860132575fca6b8f5e1a11f56ee733657e3ddc4754c6bafa0f1d86b0ac204563" + "sha256": "ca4b70c5c0c340260e3985e9427aed0f922112e3fa1644f5ef3e4263ed1e9139" }, "src/openai/types/beta/beta_response_apply_patch_tool_call.py": { "mode": "100644", @@ -3139,11 +3139,11 @@ }, "src/openai/types/beta/beta_response_tool_search_output_item_param.py": { "mode": "100644", - "sha256": "c24eab06b91c1bb82b01b0c0a8bd379073efd5416c27bf76845d2623c93ba5d4" + "sha256": "dcf27539527b830cddfbdafaf7ab05bb01e93bc2a378cb2dc88dc4332856413b" }, "src/openai/types/beta/beta_response_tool_search_output_item_param_param.py": { "mode": "100644", - "sha256": "b9725bc626c3100913700f74dfc0f7aff9347261f4e6c6f630ed773f18ef82d7" + "sha256": "76d086d12c2dad9943231c2617cf94e446717176b28db500850e29794a02d007" }, "src/openai/types/beta/beta_response_usage.py": { "mode": "100644", @@ -3163,11 +3163,11 @@ }, "src/openai/types/beta/beta_responses_client_event.py": { "mode": "100644", - "sha256": "b011abfacaf7d9267b5982f75a8b725c54be37f48ad6fbe358492714a609ab2f" + "sha256": "c88c3effd89aed552f7b9e66bd13c5f0ddff22999244533a96bb95bae6cabfc8" }, "src/openai/types/beta/beta_responses_client_event_param.py": { "mode": "100644", - "sha256": "194e1eca6bb06f112b5b637fde1f47026bf1b28ff513715349848ee105ca697b" + "sha256": "f0d05677cb719e2e35ed007b8c7f555bda7654542843a0de764fdf7b00ae1b16" }, "src/openai/types/beta/beta_responses_server_event.py": { "mode": "100644", @@ -3187,7 +3187,7 @@ }, "src/openai/types/beta/beta_tool.py": { "mode": "100644", - "sha256": "a508a6b61e224c88be1158c8157e658c1af8bf55927417ae42a015eec87283a0" + "sha256": "38205162816642d425ef03858f63afc12f1bece792216f8f92679db2b2205b16" }, "src/openai/types/beta/beta_tool_choice_allowed.py": { "mode": "100644", @@ -3251,7 +3251,7 @@ }, "src/openai/types/beta/beta_tool_param.py": { "mode": "100644", - "sha256": "2840854d36296fdc2e7bfcf4c319350bb6208e3acfd997cf1e706fd77a603510" + "sha256": "8d3e8219a0839fe4fddb9c4bbb77b362365180bbf9b4deaa9c9938e181a1ab7d" }, "src/openai/types/beta/beta_tool_search_output_namespace_tool.py": { "mode": "100644", @@ -3499,7 +3499,7 @@ }, "src/openai/types/beta/response_create_params.py": { "mode": "100644", - "sha256": "46aebfd33331c3e9f4461eaaed98076152a07d8e0830ec18ba4229dd5840ccf0" + "sha256": "01c129a2f63462dbee93c25fc715ca77723e7e446c27a2edebfda0b3f50967fb" }, "src/openai/types/beta/response_retrieve_params.py": { "mode": "100644", @@ -3519,7 +3519,7 @@ }, "src/openai/types/beta/responses/input_token_count_params.py": { "mode": "100644", - "sha256": "1a699bfbc24a215d00f1b7e8fcb0cc90e5f5f61b287a5218fbea6aa6d47a0afe" + "sha256": "d34cf0524b021b0b548373ed8f9e03dd8bdcfd70fccabbf079adcb03c710f3d2" }, "src/openai/types/beta/responses/input_token_count_response.py": { "mode": "100644", @@ -4111,7 +4111,7 @@ }, "src/openai/types/content_provenance_check_create_params.py": { "mode": "100644", - "sha256": "043fed8fa84b8ec976cde58968f3a982fd321e9c6f584fdbb4d619c490073cee" + "sha256": "6105682e609ab4298ac9247bd8e6b94c27149b2e3d153da42d36e73f2f9d09cc" }, "src/openai/types/conversations/__init__.py": { "mode": "100644", @@ -4619,7 +4619,7 @@ }, "src/openai/types/image_edit_params.py": { "mode": "100644", - "sha256": "28448e4fa02b9b316919b224d303d594aee4fa0a77c7c1f905f670b49468d407" + "sha256": "2eea0ef98d3bd6724fce6009bb3776db6e5f5901660bbd2061da7fd30114bead" }, "src/openai/types/image_edit_partial_image_event.py": { "mode": "100644", @@ -4643,7 +4643,7 @@ }, "src/openai/types/image_generate_params.py": { "mode": "100644", - "sha256": "0ea1ac2adb57e8fdf00fc53bcb3bd1ba14086921ca898faacf7ddf5f626071a6" + "sha256": "5f9010b2c8397583cd6e991d9cd70550964f82d4bb969560f0a470b2719884ce" }, "src/openai/types/image_input_reference_param.py": { "mode": "100644", @@ -4655,7 +4655,7 @@ }, "src/openai/types/images_response.py": { "mode": "100644", - "sha256": "ffcd5b0d269a07be36fcc34507797658da5ca1c304dcd23c4fb2d8a82ef6c54c" + "sha256": "0b57fbf433972c685ab6a712fe2d8d5fc78d90bf21c710c9b807f18497a324e4" }, "src/openai/types/live/__init__.py": { "mode": "100644", @@ -4995,7 +4995,7 @@ }, "src/openai/types/live/media_session_config_param.py": { "mode": "100644", - "sha256": "b4fa9ca230634515061076183d049fc2a46611a8ad80127b5c30212a2a56d92c" + "sha256": "c6940de94cd32900ae7e4f9d5f580b0904d2943732ac9b25abdf15c9bcfacdfd" }, "src/openai/types/live/media_session_fork_config_param.py": { "mode": "100644", @@ -5075,7 +5075,7 @@ }, "src/openai/types/live/session_accept_params.py": { "mode": "100644", - "sha256": "fd82bf7d2963e62e7d4b6ca55684a02e38536d0a8132083a52a9e7f12bd2afc9" + "sha256": "9390bd9cd37c88bd7273ae6074068a817c93b51ff0d18c640c0e1a42f0f291c2" }, "src/openai/types/live/session_close_event.py": { "mode": "100644", @@ -6103,7 +6103,7 @@ }, "src/openai/types/responses/input_token_count_params.py": { "mode": "100644", - "sha256": "626df4320a03c436281354c0c0e8d636d7c7008ebab0d265bfaf82ec446b55cb" + "sha256": "358d91a346e032df6aa2166635a2f4b3391e8337fd190b2614dd76d2d727f3e3" }, "src/openai/types/responses/input_token_count_response.py": { "mode": "100644", @@ -6143,7 +6143,7 @@ }, "src/openai/types/responses/response.py": { "mode": "100644", - "sha256": "9937ed8b5c0f63c842a83d7e7871327e607da852dae0dbe146468e654f2b1d8a" + "sha256": "2cb58867f09783cdd0d892d968f4103d4e23d573e427112c575abcd390da7bb5" }, "src/openai/types/responses/response_apply_patch_tool_call.py": { "mode": "100644", @@ -6275,7 +6275,7 @@ }, "src/openai/types/responses/response_create_params.py": { "mode": "100644", - "sha256": "dbce54c51a1d1b3764616fe5d723acf4af219a3ca3f3c8199abec60b3d59b4b7" + "sha256": "911df8c84f284e0e3ba8f8b007cc2c3248bd96238cfca4c4e3e8f7339f463bd9" }, "src/openai/types/responses/response_created_event.py": { "mode": "100644", @@ -6787,11 +6787,11 @@ }, "src/openai/types/responses/response_tool_search_output_item_param.py": { "mode": "100644", - "sha256": "5b071255662a22f7dda4e612a18bad12739031b36e3c14c6d8436c1f4b4a15fd" + "sha256": "bc091192087a5a40c92567678335fa2108b95013ed0aa23da9e36d496ff83349" }, "src/openai/types/responses/response_tool_search_output_item_param_param.py": { "mode": "100644", - "sha256": "9533571b1de5cb9150dda56cca2ad85596cb6540c5c852100683acbb61299114" + "sha256": "bf0a63978a8585cd8c9af714283f119759ffe96129017c1cddd442583cc7ff0b" }, "src/openai/types/responses/response_usage.py": { "mode": "100644", @@ -6811,11 +6811,11 @@ }, "src/openai/types/responses/responses_client_event.py": { "mode": "100644", - "sha256": "dab9b90e4fff3755490a2e9f06aaff058a8322dae67864c6f652e1f269ffb193" + "sha256": "619ddcf2822511d9d3b581de537681a453f6e14c1fede2f84a5d6b262f5771d9" }, "src/openai/types/responses/responses_client_event_param.py": { "mode": "100644", - "sha256": "3fce24cf579d22db3e8a3b52e412e31b4d8bcbfdda44d4104a1d74ebb6e27a8b" + "sha256": "fda364d9750062dbd6848fcd5a2a5f97a9814681a0a3ff2a742fdd31306fc815" }, "src/openai/types/responses/responses_server_event.py": { "mode": "100644", @@ -6835,7 +6835,7 @@ }, "src/openai/types/responses/tool.py": { "mode": "100644", - "sha256": "243e4fa1d18234476475e94b2b0725acacf872a35c5c7bd7d940f5b8fc495b7a" + "sha256": "a6959654062233367e4238a90bd9652dbc690f09d1664a5046e4c2775cd085f1" }, "src/openai/types/responses/tool_choice_allowed.py": { "mode": "100644", @@ -6899,7 +6899,7 @@ }, "src/openai/types/responses/tool_param.py": { "mode": "100644", - "sha256": "8b5ddf4bf72fa3704808626189c91969dce7d2039967e30036dc46d698455af8" + "sha256": "90235862a11c412a9c269080974554130138e2b187b84c59fee8ebc06284183e" }, "src/openai/types/responses/tool_search_output_namespace_tool.py": { "mode": "100644", @@ -7283,7 +7283,7 @@ }, "src/openai/types/video_create_error.py": { "mode": "100644", - "sha256": "44a84ffd55469b22db1cf59ad73531d0fd4100883d21b1d0e6241ad6bd3c7e22" + "sha256": "50e3db5805cc39517be046b8b5330eb340f2eba07b30e13e85759e1fa4ed4318" }, "src/openai/types/video_create_params.py": { "mode": "100644", @@ -7335,7 +7335,7 @@ }, "src/openai/types/webhooks/__init__.py": { "mode": "100644", - "sha256": "6cd86f449fccb260a2e03c56defd59fbf890063734171c8a9fc0405cf9bb2b7d" + "sha256": "56158d2987a58b2253ab1197eb7f26bd92d0c1449392b966707a5d0eae1c5b2a" }, "src/openai/types/webhooks/agent_environment_expired_webhook_event.py": { "mode": "100644", @@ -7355,7 +7355,7 @@ }, "src/openai/types/webhooks/agent_session_action_required_webhook_event.py": { "mode": "100644", - "sha256": "cbab5c0562b450e371fe18a434b502b37c62f967b93e710032bf5a11fa12b4ca" + "sha256": "311b44a59838e17f3bddbe8188b9425dcfb6ed95d8fb12206558ee8b4eb9a7ad" }, "src/openai/types/webhooks/agent_session_created_webhook_event.py": { "mode": "100644", @@ -7421,6 +7421,10 @@ "mode": "100644", "sha256": "98c0194038495649ea8f61edad0fffe95e1ce9b100ce6303b96a2ca37e7fab98" }, + "src/openai/types/webhooks/live_transport_connected_webhook_event.py": { + "mode": "100644", + "sha256": "45bfe3b63c871926becd97d6d560a0b5f47aa4990daad5f683e77fab46c6abfe" + }, "src/openai/types/webhooks/live_transport_incoming_webhook_event.py": { "mode": "100644", "sha256": "fd9511b4e5da3e41c11ea3f840b6ca05bb65793e5b4b2b1f0f10811c7a743e21" @@ -7463,7 +7467,7 @@ }, "src/openai/types/webhooks/unwrap_webhook_event.py": { "mode": "100644", - "sha256": "ab0f7c3a5b26ee9df72b53f7084da93dd86e7e38ce25efe13fbcfe9dfcbe4c69" + "sha256": "4fb92b2c9df327486a7e2c496dd2f5663a3e5097ea6e9c05cb4757841153bb3c" }, "src/openai/types/webhooks/webhook_create_params.py": { "mode": "100644", @@ -7631,7 +7635,7 @@ }, "tests/api_resources/admin/organization/test_external_keys.py": { "mode": "100644", - "sha256": "cfde4ad29b5baf45b96dfb63fe8a096f3491c19c91120efa4618e5b13b99b7a8" + "sha256": "ae37cc238608a75ccb9b22e48cfaac4eb9b2ed5b52149a31db3cd0ff6140d368" }, "tests/api_resources/admin/organization/test_external_storage.py": { "mode": "100644", @@ -7771,7 +7775,7 @@ }, "tests/api_resources/beta/agents/sessions/test_events.py": { "mode": "100644", - "sha256": "89d6722608a8fc2c27c3409e94a6e88b8c5ba51d939b7a3ca3b40727e97bc182" + "sha256": "f1d10f70c142f1c71acb4db67bc1a7902a250c27b29a6d5e8c10212b8d50c54d" }, "tests/api_resources/beta/agents/sessions/test_items.py": { "mode": "100644", @@ -7807,7 +7811,7 @@ }, "tests/api_resources/beta/agents/test_sessions.py": { "mode": "100644", - "sha256": "eda3b15034c7e46e8fe0c4428143b35abd4aed76db58ff0d374625369591ad66" + "sha256": "8f3c9a080fa915a1febed855312d597184431105e4227c1f4acfd24a42dd8ee9" }, "tests/api_resources/beta/agents/test_vaults.py": { "mode": "100644", @@ -7979,7 +7983,7 @@ }, "tests/api_resources/live/test_sessions.py": { "mode": "100644", - "sha256": "61139451d9ad16406b15d3085aaf82f2b9fe8fcd5bd253796e4d6f628a39be30" + "sha256": "b4aac37868dc6101dc1c5cd447367859f4991547accc23918e4cec9619b2fa3b" }, "tests/api_resources/live/test_sideband.py": { "mode": "100644", @@ -8091,11 +8095,11 @@ }, "tests/api_resources/test_images.py": { "mode": "100644", - "sha256": "e6431fc58d123b60a736a2f7c8c5931b23afb9bda4a5b0f066a08b84e1c73afe" + "sha256": "e236f539394d26f4d9eb6ceef7bed9321eeac0c2e4a8fdc621fa1b588fc520c1" }, "tests/api_resources/test_live.py": { "mode": "100644", - "sha256": "6af26be731b0ae49024e5ad21169396a1cc9b05d94e14f3a061bf377d407d7ca" + "sha256": "6a93473ee16d56120c43b366be9085f315ba8518b5633cf0680b16956f92f79d" }, "tests/api_resources/test_models.py": { "mode": "100644", diff --git a/src/openai/resources/admin/organization/external_keys.py b/src/openai/resources/admin/organization/external_keys.py index c8684a5776..3af057809f 100644 --- a/src/openai/resources/admin/organization/external_keys.py +++ b/src/openai/resources/admin/organization/external_keys.py @@ -187,6 +187,48 @@ def create( """ ... + @overload + def create( + self, + *, + key_ocid: str, + name: str, + region: str, + type: Literal["oci"], + vault_ocid: str, + key_version_ocid: str | Omit = omit, + purpose: Union[Literal["ekm"], Literal["psp_decryption"]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx2.Timeout | None | NotGiven = not_given, + ) -> ExternalKey: + """ + Add an external key config for an organization + + Args: + key_ocid: The OCI Vault key OCID + + name: A friendly name to identify this config + + region: The OCI region containing the vault + + vault_ocid: The customer OCI Vault OCID + + key_version_ocid: The exact OCI key version OCID for PSP decryption. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + @required_args( ["external_id", "kms_arn", "name", "role_arn", "type"], [ @@ -202,6 +244,7 @@ def create( "workload_identity_provider_id", ], ["key_name", "name", "tenant_id", "type", "vault_uri"], + ["key_ocid", "name", "region", "type", "vault_ocid"], ) def create( self, @@ -210,7 +253,7 @@ def create( kms_arn: str | Omit = omit, name: str, role_arn: str | Omit = omit, - type: Literal["aws"] | Literal["gcp"] | Literal["azure"], + type: Literal["aws"] | Literal["gcp"] | Literal["azure"] | Literal["oci"], purpose: Union[Literal["ekm"], Literal["psp_decryption"]] | Omit = omit, audience: str | Omit = omit, kms_key_location: str | Omit = omit, @@ -225,6 +268,10 @@ def create( tenant_id: str | Omit = omit, vault_uri: str | Omit = omit, key_version: str | Omit = omit, + key_ocid: str | Omit = omit, + region: str | Omit = omit, + vault_ocid: str | Omit = omit, + key_version_ocid: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -255,6 +302,10 @@ def create( "tenant_id": tenant_id, "vault_uri": vault_uri, "key_version": key_version, + "key_ocid": key_ocid, + "region": region, + "vault_ocid": vault_ocid, + "key_version_ocid": key_version_ocid, }, external_key_create_params.ExternalKeyCreateParams, ), @@ -595,6 +646,48 @@ async def create( """ ... + @overload + async def create( + self, + *, + key_ocid: str, + name: str, + region: str, + type: Literal["oci"], + vault_ocid: str, + key_version_ocid: str | Omit = omit, + purpose: Union[Literal["ekm"], Literal["psp_decryption"]] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx2.Timeout | None | NotGiven = not_given, + ) -> ExternalKey: + """ + Add an external key config for an organization + + Args: + key_ocid: The OCI Vault key OCID + + name: A friendly name to identify this config + + region: The OCI region containing the vault + + vault_ocid: The customer OCI Vault OCID + + key_version_ocid: The exact OCI key version OCID for PSP decryption. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + @required_args( ["external_id", "kms_arn", "name", "role_arn", "type"], [ @@ -610,6 +703,7 @@ async def create( "workload_identity_provider_id", ], ["key_name", "name", "tenant_id", "type", "vault_uri"], + ["key_ocid", "name", "region", "type", "vault_ocid"], ) async def create( self, @@ -618,7 +712,7 @@ async def create( kms_arn: str | Omit = omit, name: str, role_arn: str | Omit = omit, - type: Literal["aws"] | Literal["gcp"] | Literal["azure"], + type: Literal["aws"] | Literal["gcp"] | Literal["azure"] | Literal["oci"], purpose: Union[Literal["ekm"], Literal["psp_decryption"]] | Omit = omit, audience: str | Omit = omit, kms_key_location: str | Omit = omit, @@ -633,6 +727,10 @@ async def create( tenant_id: str | Omit = omit, vault_uri: str | Omit = omit, key_version: str | Omit = omit, + key_ocid: str | Omit = omit, + region: str | Omit = omit, + vault_ocid: str | Omit = omit, + key_version_ocid: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -663,6 +761,10 @@ async def create( "tenant_id": tenant_id, "vault_uri": vault_uri, "key_version": key_version, + "key_ocid": key_ocid, + "region": region, + "vault_ocid": vault_ocid, + "key_version_ocid": key_version_ocid, }, external_key_create_params.ExternalKeyCreateParams, ), diff --git a/src/openai/resources/beta/agents/sessions/sessions.py b/src/openai/resources/beta/agents/sessions/sessions.py index 14ecd511c9..f0a6a79531 100644 --- a/src/openai/resources/beta/agents/sessions/sessions.py +++ b/src/openai/resources/beta/agents/sessions/sessions.py @@ -164,6 +164,7 @@ def create( agent_id: str | Omit = omit, input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit, metadata: Optional[Dict[str, str]] | Omit = omit, + prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit, review: Literal["none", "auto_review"] | Omit = omit, spend_control: Optional[session_create_params.SpendControl] | Omit = omit, stream: Literal[False] | Omit = omit, @@ -187,6 +188,7 @@ def create( agent_id: str | Omit = omit, input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit, metadata: Optional[Dict[str, str]] | Omit = omit, + prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit, review: Literal["none", "auto_review"] | Omit = omit, spend_control: Optional[session_create_params.SpendControl] | Omit = omit, stream_options: session_create_params.StreamOptions | Omit = omit, @@ -209,6 +211,7 @@ def create( agent_id: str | Omit = omit, input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit, metadata: Optional[Dict[str, str]] | Omit = omit, + prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit, review: Literal["none", "auto_review"] | Omit = omit, spend_control: Optional[session_create_params.SpendControl] | Omit = omit, stream_options: session_create_params.StreamOptions | Omit = omit, @@ -230,6 +233,7 @@ def create( agent_id: str | Omit = omit, input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit, metadata: Optional[Dict[str, str]] | Omit = omit, + prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit, review: Literal["none", "auto_review"] | Omit = omit, spend_control: Optional[session_create_params.SpendControl] | Omit = omit, stream: Literal[False] | Literal[True] | Omit = omit, @@ -250,6 +254,7 @@ def create( "agent_id": agent_id, "input": input, "metadata": metadata, + "prompt_cache_options": prompt_cache_options, "review": review, "spend_control": spend_control, "stream_options": stream_options, @@ -328,6 +333,7 @@ def update( *, agent: session_update_params.Agent | Omit = omit, metadata: Optional[Dict[str, str]] | Omit = omit, + prompt_cache_options: Optional[session_update_params.PromptCacheOptions] | Omit = omit, review: Literal["none", "auto_review"] | Omit = omit, spend_control: Optional[session_update_params.SpendControl] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -337,10 +343,10 @@ def update( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> AgentSession: - """Updates session tools, metadata, model, reasoning effort, or service tier. - - Model - settings apply to subsequent turns. Omitted fields are unchanged. See + """ + Updates session tools, metadata, model, reasoning effort, service tier, or the + default prompt cache lifetime. Model settings apply to subsequent turns. Omitted + fields are unchanged. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). Args: @@ -350,6 +356,9 @@ def update( Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. + prompt_cache_options: Default prompt cache lifetime for future turns. Send null to clear the session + default. + review: Default action review for new root turns. Existing turns and their subagents keep their review mode. @@ -377,6 +386,7 @@ def update( { "agent": agent, "metadata": metadata, + "prompt_cache_options": prompt_cache_options, "review": review, "spend_control": spend_control, }, @@ -592,6 +602,7 @@ async def create( agent_id: str | Omit = omit, input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit, metadata: Optional[Dict[str, str]] | Omit = omit, + prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit, review: Literal["none", "auto_review"] | Omit = omit, spend_control: Optional[session_create_params.SpendControl] | Omit = omit, stream: Literal[False] | Omit = omit, @@ -615,6 +626,7 @@ async def create( agent_id: str | Omit = omit, input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit, metadata: Optional[Dict[str, str]] | Omit = omit, + prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit, review: Literal["none", "auto_review"] | Omit = omit, spend_control: Optional[session_create_params.SpendControl] | Omit = omit, stream_options: session_create_params.StreamOptions | Omit = omit, @@ -637,6 +649,7 @@ async def create( agent_id: str | Omit = omit, input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit, metadata: Optional[Dict[str, str]] | Omit = omit, + prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit, review: Literal["none", "auto_review"] | Omit = omit, spend_control: Optional[session_create_params.SpendControl] | Omit = omit, stream_options: session_create_params.StreamOptions | Omit = omit, @@ -658,6 +671,7 @@ async def create( agent_id: str | Omit = omit, input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit, metadata: Optional[Dict[str, str]] | Omit = omit, + prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit, review: Literal["none", "auto_review"] | Omit = omit, spend_control: Optional[session_create_params.SpendControl] | Omit = omit, stream: Literal[False] | Literal[True] | Omit = omit, @@ -678,6 +692,7 @@ async def create( "agent_id": agent_id, "input": input, "metadata": metadata, + "prompt_cache_options": prompt_cache_options, "review": review, "spend_control": spend_control, "stream_options": stream_options, @@ -756,6 +771,7 @@ async def update( *, agent: session_update_params.Agent | Omit = omit, metadata: Optional[Dict[str, str]] | Omit = omit, + prompt_cache_options: Optional[session_update_params.PromptCacheOptions] | Omit = omit, review: Literal["none", "auto_review"] | Omit = omit, spend_control: Optional[session_update_params.SpendControl] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -765,10 +781,10 @@ async def update( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> AgentSession: - """Updates session tools, metadata, model, reasoning effort, or service tier. - - Model - settings apply to subsequent turns. Omitted fields are unchanged. See + """ + Updates session tools, metadata, model, reasoning effort, service tier, or the + default prompt cache lifetime. Model settings apply to subsequent turns. Omitted + fields are unchanged. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). Args: @@ -778,6 +794,9 @@ async def update( Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. + prompt_cache_options: Default prompt cache lifetime for future turns. Send null to clear the session + default. + review: Default action review for new root turns. Existing turns and their subagents keep their review mode. @@ -805,6 +824,7 @@ async def update( { "agent": agent, "metadata": metadata, + "prompt_cache_options": prompt_cache_options, "review": review, "spend_control": spend_control, }, diff --git a/src/openai/resources/beta/responses/input_tokens.py b/src/openai/resources/beta/responses/input_tokens.py index 21b01a9b75..579cb6bf37 100644 --- a/src/openai/resources/beta/responses/input_tokens.py +++ b/src/openai/resources/beta/responses/input_tokens.py @@ -117,11 +117,15 @@ def count( tools: An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter. - truncation: The truncation strategy to use for the model response. - `auto`: If the input to - this Response exceeds the model's context window size, the model will truncate - the response to fit the context window by dropping items from the beginning of - the conversation. - `disabled` (default): If the input size will exceed the - context window size for a model, the request will fail with a 400 error. + truncation: The truncation strategy to use for the model response. + + - `auto`: If the input to this Response exceeds the model's context window size, + the model will truncate the response to fit the context window by dropping + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit before counting tokens. + - `disabled` (default): If the input size will exceed the context window size + for a model, the request will fail with a 400 error. extra_headers: Send extra headers @@ -260,11 +264,15 @@ async def count( tools: An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter. - truncation: The truncation strategy to use for the model response. - `auto`: If the input to - this Response exceeds the model's context window size, the model will truncate - the response to fit the context window by dropping items from the beginning of - the conversation. - `disabled` (default): If the input size will exceed the - context window size for a model, the request will fail with a 400 error. + truncation: The truncation strategy to use for the model response. + + - `auto`: If the input to this Response exceeds the model's context window size, + the model will truncate the response to fit the context window by dropping + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit before counting tokens. + - `disabled` (default): If the input size will exceed the context window size + for a model, the request will fail with a 400 error. extra_headers: Send extra headers diff --git a/src/openai/resources/beta/responses/responses.py b/src/openai/resources/beta/responses/responses.py index cfecf797f8..67d4a12835 100644 --- a/src/openai/resources/beta/responses/responses.py +++ b/src/openai/resources/beta/responses/responses.py @@ -590,7 +590,9 @@ def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. @@ -1083,7 +1085,9 @@ def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. @@ -1576,7 +1580,9 @@ def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. @@ -2946,7 +2952,9 @@ async def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. @@ -3439,7 +3447,9 @@ async def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. @@ -3932,7 +3942,9 @@ async def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. diff --git a/src/openai/resources/content_provenance_checks.py b/src/openai/resources/content_provenance_checks.py index 93c35c17ae..9043d66c5d 100644 --- a/src/openai/resources/content_provenance_checks.py +++ b/src/openai/resources/content_provenance_checks.py @@ -64,6 +64,7 @@ def create( Args: file: The image or audio file to check for supported OpenAI provenance signals. + Supported image formats are PNG, JPEG, WebP, and GIF (including animated GIFs). extra_headers: Send extra headers @@ -138,6 +139,7 @@ async def create( Args: file: The image or audio file to check for supported OpenAI provenance signals. + Supported image formats are PNG, JPEG, WebP, and GIF (including animated GIFs). extra_headers: Send extra headers diff --git a/src/openai/resources/images.py b/src/openai/resources/images.py index c9849c226c..98946e98a0 100644 --- a/src/openai/resources/images.py +++ b/src/openai/resources/images.py @@ -152,7 +152,7 @@ def edit( model: Union[str, ImageModel, None] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, @@ -160,6 +160,7 @@ def edit( size: Union[str, Literal["1024x1024", "1536x1024", "1024x1536", "auto", "256x256", "512x512"], None] | Omit = omit, stream: Optional[Literal[False]] | Omit = omit, + svg: Optional[image_edit_params.Svg] | Omit = omit, user: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -247,7 +248,8 @@ def edit( defaults to 100. output_format: The format in which the generated images are returned. This parameter is only - supported for the GPT image models. The default value is `png`. + supported for the GPT image models. The default value is `png`. SVG output + requires a supported image model and project access. partial_images: The number of partial images to generate. This parameter is used for streaming responses that return partial images. Value must be between 0 and 3. When set to @@ -297,6 +299,11 @@ def edit( [Image generation guide](https://developers.openai.com/api/docs/guides/image-generation) for more information. + svg: Selects the author model and reasoning effort for `output_format=svg`. Supply + `svg.model` when SVG model selection is enabled. Otherwise, omit this object. + SVG output requires `n=1` and cannot use streaming, partial images, or output + compression. Use multipart fields such as `svg[model]`. + user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or empty. @@ -329,13 +336,14 @@ def edit( model: Union[str, ImageModel, None] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, safety_identifier: Optional[str] | Omit = omit, size: Union[str, Literal["1024x1024", "1536x1024", "1024x1536", "auto", "256x256", "512x512"], None] | Omit = omit, + svg: Optional[image_edit_params.Svg] | Omit = omit, user: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -427,7 +435,8 @@ def edit( defaults to 100. output_format: The format in which the generated images are returned. This parameter is only - supported for the GPT image models. The default value is `png`. + supported for the GPT image models. The default value is `png`. SVG output + requires a supported image model and project access. partial_images: The number of partial images to generate. This parameter is used for streaming responses that return partial images. Value must be between 0 and 3. When set to @@ -473,6 +482,11 @@ def edit( - "256x256", "512x512": This legacy size suggestion is retained for SDK compatibility. Check the selected GPT image model's supported sizes. + svg: Selects the author model and reasoning effort for `output_format=svg`. Supply + `svg.model` when SVG model selection is enabled. Otherwise, omit this object. + SVG output requires `n=1` and cannot use streaming, partial images, or output + compression. Use multipart fields such as `svg[model]`. + user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or empty. @@ -505,13 +519,14 @@ def edit( model: Union[str, ImageModel, None] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, safety_identifier: Optional[str] | Omit = omit, size: Union[str, Literal["1024x1024", "1536x1024", "1024x1536", "auto", "256x256", "512x512"], None] | Omit = omit, + svg: Optional[image_edit_params.Svg] | Omit = omit, user: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -603,7 +618,8 @@ def edit( defaults to 100. output_format: The format in which the generated images are returned. This parameter is only - supported for the GPT image models. The default value is `png`. + supported for the GPT image models. The default value is `png`. SVG output + requires a supported image model and project access. partial_images: The number of partial images to generate. This parameter is used for streaming responses that return partial images. Value must be between 0 and 3. When set to @@ -649,6 +665,11 @@ def edit( - "256x256", "512x512": This legacy size suggestion is retained for SDK compatibility. Check the selected GPT image model's supported sizes. + svg: Selects the author model and reasoning effort for `output_format=svg`. Supply + `svg.model` when SVG model selection is enabled. Otherwise, omit this object. + SVG output requires `n=1` and cannot use streaming, partial images, or output + compression. Use multipart fields such as `svg[model]`. + user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or empty. @@ -680,7 +701,7 @@ def edit( model: Union[str, ImageModel, None] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, @@ -688,6 +709,7 @@ def edit( size: Union[str, Literal["1024x1024", "1536x1024", "1024x1536", "auto", "256x256", "512x512"], None] | Omit = omit, stream: Optional[Literal[False]] | Literal[True] | Omit = omit, + svg: Optional[image_edit_params.Svg] | Omit = omit, user: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -717,6 +739,7 @@ def edit( "safety_identifier": safety_identifier, "size": size, "stream": stream, + "svg": svg, "user": user, }, [["image"], ["image", ""], ["markup"], ["mask"]], @@ -760,7 +783,7 @@ def generate( moderation: Optional[Literal["low", "auto"]] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif", "svg"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard", "hd"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, @@ -903,7 +926,7 @@ def generate( enabled, supply svg.model. When model selection is disabled, omit this object. The top-level model selects the image model that creates the reference image. SVG generation requires n=1 and does not support streaming, partial images, - prompt_rewriter, or output_compression. SVG edits are not supported. + prompt_rewriter, or output_compression. user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or @@ -934,7 +957,7 @@ def generate( moderation: Optional[Literal["low", "auto"]] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif", "svg"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard", "hd"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, @@ -1076,7 +1099,7 @@ def generate( enabled, supply svg.model. When model selection is disabled, omit this object. The top-level model selects the image model that creates the reference image. SVG generation requires n=1 and does not support streaming, partial images, - prompt_rewriter, or output_compression. SVG edits are not supported. + prompt_rewriter, or output_compression. user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or @@ -1107,7 +1130,7 @@ def generate( moderation: Optional[Literal["low", "auto"]] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif", "svg"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard", "hd"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, @@ -1249,7 +1272,7 @@ def generate( enabled, supply svg.model. When model selection is disabled, omit this object. The top-level model selects the image model that creates the reference image. SVG generation requires n=1 and does not support streaming, partial images, - prompt_rewriter, or output_compression. SVG edits are not supported. + prompt_rewriter, or output_compression. user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or @@ -1279,7 +1302,7 @@ def generate( moderation: Optional[Literal["low", "auto"]] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif", "svg"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard", "hd"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, @@ -1468,7 +1491,7 @@ async def edit( model: Union[str, ImageModel, None] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, @@ -1476,6 +1499,7 @@ async def edit( size: Union[str, Literal["1024x1024", "1536x1024", "1024x1536", "auto", "256x256", "512x512"], None] | Omit = omit, stream: Optional[Literal[False]] | Omit = omit, + svg: Optional[image_edit_params.Svg] | Omit = omit, user: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -1563,7 +1587,8 @@ async def edit( defaults to 100. output_format: The format in which the generated images are returned. This parameter is only - supported for the GPT image models. The default value is `png`. + supported for the GPT image models. The default value is `png`. SVG output + requires a supported image model and project access. partial_images: The number of partial images to generate. This parameter is used for streaming responses that return partial images. Value must be between 0 and 3. When set to @@ -1613,6 +1638,11 @@ async def edit( [Image generation guide](https://developers.openai.com/api/docs/guides/image-generation) for more information. + svg: Selects the author model and reasoning effort for `output_format=svg`. Supply + `svg.model` when SVG model selection is enabled. Otherwise, omit this object. + SVG output requires `n=1` and cannot use streaming, partial images, or output + compression. Use multipart fields such as `svg[model]`. + user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or empty. @@ -1645,13 +1675,14 @@ async def edit( model: Union[str, ImageModel, None] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, safety_identifier: Optional[str] | Omit = omit, size: Union[str, Literal["1024x1024", "1536x1024", "1024x1536", "auto", "256x256", "512x512"], None] | Omit = omit, + svg: Optional[image_edit_params.Svg] | Omit = omit, user: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -1743,7 +1774,8 @@ async def edit( defaults to 100. output_format: The format in which the generated images are returned. This parameter is only - supported for the GPT image models. The default value is `png`. + supported for the GPT image models. The default value is `png`. SVG output + requires a supported image model and project access. partial_images: The number of partial images to generate. This parameter is used for streaming responses that return partial images. Value must be between 0 and 3. When set to @@ -1789,6 +1821,11 @@ async def edit( - "256x256", "512x512": This legacy size suggestion is retained for SDK compatibility. Check the selected GPT image model's supported sizes. + svg: Selects the author model and reasoning effort for `output_format=svg`. Supply + `svg.model` when SVG model selection is enabled. Otherwise, omit this object. + SVG output requires `n=1` and cannot use streaming, partial images, or output + compression. Use multipart fields such as `svg[model]`. + user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or empty. @@ -1821,13 +1858,14 @@ async def edit( model: Union[str, ImageModel, None] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, safety_identifier: Optional[str] | Omit = omit, size: Union[str, Literal["1024x1024", "1536x1024", "1024x1536", "auto", "256x256", "512x512"], None] | Omit = omit, + svg: Optional[image_edit_params.Svg] | Omit = omit, user: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -1919,7 +1957,8 @@ async def edit( defaults to 100. output_format: The format in which the generated images are returned. This parameter is only - supported for the GPT image models. The default value is `png`. + supported for the GPT image models. The default value is `png`. SVG output + requires a supported image model and project access. partial_images: The number of partial images to generate. This parameter is used for streaming responses that return partial images. Value must be between 0 and 3. When set to @@ -1965,6 +2004,11 @@ async def edit( - "256x256", "512x512": This legacy size suggestion is retained for SDK compatibility. Check the selected GPT image model's supported sizes. + svg: Selects the author model and reasoning effort for `output_format=svg`. Supply + `svg.model` when SVG model selection is enabled. Otherwise, omit this object. + SVG output requires `n=1` and cannot use streaming, partial images, or output + compression. Use multipart fields such as `svg[model]`. + user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or empty. @@ -1996,7 +2040,7 @@ async def edit( model: Union[str, ImageModel, None] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, @@ -2004,6 +2048,7 @@ async def edit( size: Union[str, Literal["1024x1024", "1536x1024", "1024x1536", "auto", "256x256", "512x512"], None] | Omit = omit, stream: Optional[Literal[False]] | Literal[True] | Omit = omit, + svg: Optional[image_edit_params.Svg] | Omit = omit, user: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -2033,6 +2078,7 @@ async def edit( "safety_identifier": safety_identifier, "size": size, "stream": stream, + "svg": svg, "user": user, }, [["image"], ["image", ""], ["markup"], ["mask"]], @@ -2076,7 +2122,7 @@ async def generate( moderation: Optional[Literal["low", "auto"]] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif", "svg"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard", "hd"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, @@ -2219,7 +2265,7 @@ async def generate( enabled, supply svg.model. When model selection is disabled, omit this object. The top-level model selects the image model that creates the reference image. SVG generation requires n=1 and does not support streaming, partial images, - prompt_rewriter, or output_compression. SVG edits are not supported. + prompt_rewriter, or output_compression. user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or @@ -2250,7 +2296,7 @@ async def generate( moderation: Optional[Literal["low", "auto"]] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif", "svg"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard", "hd"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, @@ -2392,7 +2438,7 @@ async def generate( enabled, supply svg.model. When model selection is disabled, omit this object. The top-level model selects the image model that creates the reference image. SVG generation requires n=1 and does not support streaming, partial images, - prompt_rewriter, or output_compression. SVG edits are not supported. + prompt_rewriter, or output_compression. user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or @@ -2423,7 +2469,7 @@ async def generate( moderation: Optional[Literal["low", "auto"]] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif", "svg"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard", "hd"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, @@ -2565,7 +2611,7 @@ async def generate( enabled, supply svg.model. When model selection is disabled, omit this object. The top-level model selects the image model that creates the reference image. SVG generation requires n=1 and does not support streaming, partial images, - prompt_rewriter, or output_compression. SVG edits are not supported. + prompt_rewriter, or output_compression. user: Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward compatibility and is used when `safety_identifier` is omitted, null, or @@ -2595,7 +2641,7 @@ async def generate( moderation: Optional[Literal["low", "auto"]] | Omit = omit, n: Optional[int] | Omit = omit, output_compression: Optional[int] | Omit = omit, - output_format: Optional[Literal["png", "jpeg", "webp", "gif", "svg"]] | Omit = omit, + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] | Omit = omit, partial_images: Optional[int] | Omit = omit, quality: Optional[Literal["low", "medium", "high", "xhigh", "max", "auto", "standard", "hd"]] | Omit = omit, response_format: Optional[Literal["url", "b64_json"]] | Omit = omit, diff --git a/src/openai/resources/responses/input_tokens.py b/src/openai/resources/responses/input_tokens.py index bd3f209a5b..2db4765937 100644 --- a/src/openai/resources/responses/input_tokens.py +++ b/src/openai/resources/responses/input_tokens.py @@ -117,11 +117,15 @@ def count( tools: An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter. - truncation: The truncation strategy to use for the model response. - `auto`: If the input to - this Response exceeds the model's context window size, the model will truncate - the response to fit the context window by dropping items from the beginning of - the conversation. - `disabled` (default): If the input size will exceed the - context window size for a model, the request will fail with a 400 error. + truncation: The truncation strategy to use for the model response. + + - `auto`: If the input to this Response exceeds the model's context window size, + the model will truncate the response to fit the context window by dropping + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit before counting tokens. + - `disabled` (default): If the input size will exceed the context window size + for a model, the request will fail with a 400 error. extra_headers: Send extra headers @@ -255,11 +259,15 @@ async def count( tools: An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter. - truncation: The truncation strategy to use for the model response. - `auto`: If the input to - this Response exceeds the model's context window size, the model will truncate - the response to fit the context window by dropping items from the beginning of - the conversation. - `disabled` (default): If the input size will exceed the - context window size for a model, the request will fail with a 400 error. + truncation: The truncation strategy to use for the model response. + + - `auto`: If the input to this Response exceeds the model's context window size, + the model will truncate the response to fit the context window by dropping + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit before counting tokens. + - `disabled` (default): If the input size will exceed the context window size + for a model, the request will fail with a 400 error. extra_headers: Send extra headers diff --git a/src/openai/resources/responses/responses.py b/src/openai/resources/responses/responses.py index aab32b5650..a16a71a444 100644 --- a/src/openai/resources/responses/responses.py +++ b/src/openai/resources/responses/responses.py @@ -726,7 +726,9 @@ def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. @@ -1021,7 +1023,9 @@ def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. @@ -1316,7 +1320,9 @@ def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. @@ -2668,7 +2674,9 @@ async def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. @@ -2963,7 +2971,9 @@ async def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. @@ -3258,7 +3268,9 @@ async def create( - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. diff --git a/src/openai/resources/webhooks/api.md b/src/openai/resources/webhooks/api.md index 0a2870cd1e..5f41e480e6 100644 --- a/src/openai/resources/webhooks/api.md +++ b/src/openai/resources/webhooks/api.md @@ -25,6 +25,7 @@ from openai.types.webhooks import ( FineTuningJobFailedWebhookEvent, FineTuningJobSucceededWebhookEvent, LiveCallIncomingWebhookEvent, + LiveTransportConnectedWebhookEvent, LiveTransportIncomingWebhookEvent, RealtimeCallIncomingWebhookEvent, ResponseCancelledWebhookEvent, diff --git a/src/openai/types/admin/organization/audit_log_list_response.py b/src/openai/types/admin/organization/audit_log_list_response.py index e902df0179..d5e3c97920 100644 --- a/src/openai/types/admin/organization/audit_log_list_response.py +++ b/src/openai/types/admin/organization/audit_log_list_response.py @@ -193,6 +193,9 @@ class APIKeyDeleted(BaseModel): class APIKeyUpdatedChangesRequested(BaseModel): """The payload used to update the API key.""" + expires_in_seconds: Optional[int] = None + """Number of seconds from the update request until the API key expires.""" + scopes: Optional[List[str]] = None """A list of scopes allowed for the API key, e.g. `["api.model.request"]`""" diff --git a/src/openai/types/admin/organization/external_key.py b/src/openai/types/admin/organization/external_key.py index 105c25b106..999d09baff 100644 --- a/src/openai/types/admin/organization/external_key.py +++ b/src/openai/types/admin/organization/external_key.py @@ -29,8 +29,12 @@ class ExternalKey(BaseModel): key_name: Optional[str] = None + key_ocid: Optional[str] = None + key_version: Optional[str] = None + key_version_ocid: Optional[str] = None + kms_arn: Optional[str] = None kms_key_location: Optional[str] = None @@ -45,10 +49,14 @@ class ExternalKey(BaseModel): purpose: Optional[Literal["ekm", "psp_decryption"]] = None + region: Optional[str] = None + role_arn: Optional[str] = None tenant_id: Optional[str] = None + vault_ocid: Optional[str] = None + vault_uri: Optional[str] = None workload_identity_pool_id: Optional[str] = None diff --git a/src/openai/types/admin/organization/external_key_create_params.py b/src/openai/types/admin/organization/external_key_create_params.py index c8d0c971c1..8f3a12845b 100644 --- a/src/openai/types/admin/organization/external_key_create_params.py +++ b/src/openai/types/admin/organization/external_key_create_params.py @@ -10,6 +10,7 @@ "V1OrganizationExternalKeysPostRequestAws", "V1OrganizationExternalKeysPostRequestGcp", "V1OrganizationExternalKeysPostRequestAzure", + "V1OrganizationExternalKeysPostRequestOci", ] @@ -69,8 +70,25 @@ class V1OrganizationExternalKeysPostRequestAzure(TypedDict, total=False): purpose: Union[Literal["ekm"], Literal["psp_decryption"]] +class V1OrganizationExternalKeysPostRequestOci(TypedDict, total=False): + key_ocid: Required[str] + + name: Required[str] + + region: Required[str] + + type: Required[Literal["oci"]] + + vault_ocid: Required[str] + + key_version_ocid: str + + purpose: Union[Literal["ekm"], Literal["psp_decryption"]] + + ExternalKeyCreateParams: TypeAlias = Union[ V1OrganizationExternalKeysPostRequestAws, V1OrganizationExternalKeysPostRequestGcp, V1OrganizationExternalKeysPostRequestAzure, + V1OrganizationExternalKeysPostRequestOci, ] diff --git a/src/openai/types/beta/agent_session.py b/src/openai/types/beta/agent_session.py index 70ea0abd52..38c5842fd9 100644 --- a/src/openai/types/beta/agent_session.py +++ b/src/openai/types/beta/agent_session.py @@ -20,6 +20,8 @@ "AgentCompaction", "AgentExperimental", "RequiredAction", + "RequiredActionSessionRequiredActionResourceMcpApprovalRequest", + "RequiredActionSessionRequiredActionResourceMcpApprovalRequestRequest", "RequiredActionSessionRequiredActionResourceComputerUseApprovalRequest", "RequiredActionSessionRequiredActionResourceComputerUseApprovalRequestRequest", "RequiredActionSessionRequiredActionResourceComputerUseApprovalRequestRequestComputerUseApprovalRequestKindResourceBrowserAuthentication", @@ -28,6 +30,7 @@ "RequiredActionSessionRequiredActionResourceComputerUseApprovalRequestRequestComputerUseApprovalRequestKindResourceBrowserOriginAccess", "RequiredActionSessionRequiredActionResourceFunctionCall", "RequiredActionSessionRequiredActionResourceEnvironmentConnection", + "PromptCacheOptions", "SpendControl", ] @@ -86,6 +89,39 @@ class Agent(BaseModel): """The effective experimental settings for the agent.""" +class RequiredActionSessionRequiredActionResourceMcpApprovalRequestRequest(BaseModel): + """Information for presenting an MCP approval.""" + + arguments: object + """The tool arguments as JSON, or null when CCA does not provide them.""" + + message: str + + name: Optional[str] = None + """The tool name, or null when CCA does not provide it.""" + + server_label: str + + type: Literal["mcp_tool_call"] + """The type of the object. Always `mcp_tool_call`.""" + + +class RequiredActionSessionRequiredActionResourceMcpApprovalRequest(BaseModel): + """Respond to an MCP tool-call approval request.""" + + request: RequiredActionSessionRequiredActionResourceMcpApprovalRequestRequest + """Information for presenting an MCP approval.""" + + request_id: str + """The opaque approval ID to echo when responding.""" + + turn_id: str + """The turn that requested approval.""" + + type: Literal["mcp_approval_request"] + """The type of the object. Always `mcp_approval_request`.""" + + class RequiredActionSessionRequiredActionResourceComputerUseApprovalRequestRequestComputerUseApprovalRequestKindResourceBrowserAuthenticationField( BaseModel ): @@ -215,6 +251,7 @@ class RequiredActionSessionRequiredActionResourceEnvironmentConnection(BaseModel RequiredAction: TypeAlias = Annotated[ Union[ + RequiredActionSessionRequiredActionResourceMcpApprovalRequest, RequiredActionSessionRequiredActionResourceComputerUseApprovalRequest, RequiredActionSessionRequiredActionResourceFunctionCall, RequiredActionSessionRequiredActionResourceEnvironmentConnection, @@ -223,6 +260,12 @@ class RequiredActionSessionRequiredActionResourceEnvironmentConnection(BaseModel ] +class PromptCacheOptions(BaseModel): + """Default prompt cache lifetime for turns in this session, when configured.""" + + ttl: Literal["30m", "12h"] + + class SpendControl(BaseModel): """Configured spending limit and best-effort consumption, in USD cents. @@ -287,6 +330,9 @@ class AgentSession(BaseModel): vault_ids: List[str] """The IDs of vaults made available to the session.""" + prompt_cache_options: Optional[PromptCacheOptions] = None + """Default prompt cache lifetime for turns in this session, when configured.""" + review: Optional[Literal["none", "auto_review"]] = None """Review applied to eligible actions in this session. diff --git a/src/openai/types/beta/agent_session_input_param.py b/src/openai/types/beta/agent_session_input_param.py index c75f549be0..f20d53b194 100644 --- a/src/openai/types/beta/agent_session_input_param.py +++ b/src/openai/types/beta/agent_session_input_param.py @@ -13,6 +13,8 @@ __all__ = [ "AgentSessionInputParam", + "SessionInputParamAgentSessionInputMcpApprovalRequestResult", + "SessionInputParamAgentSessionInputMcpApprovalRequestResultResponse", "SessionInputParamAgentSessionInputComputerUseApprovalRequestResult", "SessionInputParamAgentSessionInputComputerUseApprovalRequestResultResponse", "SessionInputParamAgentSessionInputMessage", @@ -20,6 +22,33 @@ "SessionInputParamAgentSessionInputToolResult", ] + +class SessionInputParamAgentSessionInputMcpApprovalRequestResultResponse(TypedDict, total=False): + """The user's decision for a pending MCP tool call.""" + + decision: Required[Literal["approve", "deny", "cancel"]] + """Cancel dismisses this request without cancelling the session or turn.""" + + type: Required[Literal["mcp_tool_call"]] + """The type of the object. Always `mcp_tool_call`.""" + + +class SessionInputParamAgentSessionInputMcpApprovalRequestResult(TypedDict, total=False): + """Responds to a pending MCP tool-call approval request.""" + + request_id: Required[str] + """The opaque approval ID from the required action.""" + + response: Required[SessionInputParamAgentSessionInputMcpApprovalRequestResultResponse] + """The user's decision for a pending MCP tool call.""" + + type: Required[Literal["agent.session.input.mcp_approval_request_result"]] + """The type of the object. + + Always `agent.session.input.mcp_approval_request_result`. + """ + + SessionInputParamAgentSessionInputComputerUseApprovalRequestResultResponse: TypeAlias = Union[ AgentBrowserAuthenticationSubmitParamParam, AgentBrowserAuthenticationCancelParamParam, @@ -83,6 +112,7 @@ class SessionInputParamAgentSessionInputToolResult(TypedDict, total=False): AgentSessionInputParam: TypeAlias = Union[ + SessionInputParamAgentSessionInputMcpApprovalRequestResult, SessionInputParamAgentSessionInputComputerUseApprovalRequestResult, SessionInputParamAgentSessionInputMessage, SessionInputParamAgentSessionInputCancel, diff --git a/src/openai/types/beta/agents/session_create_params.py b/src/openai/types/beta/agents/session_create_params.py index e944a7d4a4..5d7c0b51a5 100644 --- a/src/openai/types/beta/agents/session_create_params.py +++ b/src/openai/types/beta/agents/session_create_params.py @@ -19,6 +19,7 @@ "Agent", "AgentCompaction", "AgentExperimental", + "PromptCacheOptions", "SpendControl", "StreamOptions", "SessionCreateParamsNonStreaming", @@ -58,6 +59,12 @@ class SessionCreateParamsBase(TypedDict, total=False): characters. Omission or null defaults to an empty map. """ + prompt_cache_options: Optional[PromptCacheOptions] + """Default prompt cache lifetime for turns in this session. + + Omit to use the model default. + """ + review: Literal["none", "auto_review"] """Action review mode. Omit to use none. @@ -166,6 +173,16 @@ class Agent(TypedDict, total=False): """ +class PromptCacheOptions(TypedDict, total=False): + """Default prompt cache lifetime for turns in this session. + + Omit to use the model default. + """ + + ttl: Literal["30m", "12h"] + """Minimum lifetime for new prompt cache entries. Defaults to 30 minutes.""" + + class SpendControl(TypedDict, total=False): """Optional spending limit in USD cents. diff --git a/src/openai/types/beta/agents/session_update_params.py b/src/openai/types/beta/agents/session_update_params.py index 843382c9d5..fd73196694 100644 --- a/src/openai/types/beta/agents/session_update_params.py +++ b/src/openai/types/beta/agents/session_update_params.py @@ -7,7 +7,7 @@ from ..agent_tool_param import AgentToolParam -__all__ = ["SessionUpdateParams", "Agent", "AgentReasoning", "SpendControl"] +__all__ = ["SessionUpdateParams", "Agent", "AgentReasoning", "PromptCacheOptions", "SpendControl"] class SessionUpdateParams(TypedDict, total=False): @@ -21,6 +21,12 @@ class SessionUpdateParams(TypedDict, total=False): key-value pairs, with keys up to 64 and values up to 512 characters. """ + prompt_cache_options: Optional[PromptCacheOptions] + """Default prompt cache lifetime for future turns. + + Send null to clear the session default. + """ + review: Literal["none", "auto_review"] """Default action review for new root turns. @@ -74,6 +80,16 @@ class Agent(TypedDict, total=False): """ +class PromptCacheOptions(TypedDict, total=False): + """Default prompt cache lifetime for future turns. + + Send null to clear the session default. + """ + + ttl: Literal["30m", "12h"] + """Minimum lifetime for new prompt cache entries. Defaults to 30 minutes.""" + + class SpendControl(TypedDict, total=False): """ Omit to retain the limit; null or a null limit removes it without resetting spend. diff --git a/src/openai/types/beta/agents/sessions/turn.py b/src/openai/types/beta/agents/sessions/turn.py index 29e119e802..d79d0be317 100644 --- a/src/openai/types/beta/agents/sessions/turn.py +++ b/src/openai/types/beta/agents/sessions/turn.py @@ -7,7 +7,15 @@ from ...token_usage import TokenUsage from ...session_turn_error import SessionTurnError -__all__ = ["Turn"] +__all__ = ["Turn", "PromptCacheOptions"] + + +class PromptCacheOptions(BaseModel): + """ + Prompt cache lifetime selected when this turn started, including an inherited session TTL. Null when the turn used the model default or no TTL was recorded. + """ + + ttl: Literal["30m", "12h"] class Turn(BaseModel): @@ -60,3 +68,9 @@ class Turn(BaseModel): Recorded usage may change. """ + + prompt_cache_options: Optional[PromptCacheOptions] = None + """ + Prompt cache lifetime selected when this turn started, including an inherited + session TTL. Null when the turn used the model default or no TTL was recorded. + """ diff --git a/src/openai/types/beta/beta_response.py b/src/openai/types/beta/beta_response.py index 1d399d8e85..3744c12aef 100644 --- a/src/openai/types/beta/beta_response.py +++ b/src/openai/types/beta/beta_response.py @@ -900,7 +900,9 @@ class BetaResponse(BaseModel): - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. """ diff --git a/src/openai/types/beta/beta_response_tool_search_output_item_param.py b/src/openai/types/beta/beta_response_tool_search_output_item_param.py index ab79aebe41..431ad9e8aa 100644 --- a/src/openai/types/beta/beta_response_tool_search_output_item_param.py +++ b/src/openai/types/beta/beta_response_tool_search_output_item_param.py @@ -366,7 +366,8 @@ class ToolImageGeneration(BaseModel): `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`, - `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: `gpt-image-2`. + `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: + `gpt-image-2.6-sunburst`. `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead. diff --git a/src/openai/types/beta/beta_response_tool_search_output_item_param_param.py b/src/openai/types/beta/beta_response_tool_search_output_item_param_param.py index 4258d96700..c7aab34a14 100644 --- a/src/openai/types/beta/beta_response_tool_search_output_item_param_param.py +++ b/src/openai/types/beta/beta_response_tool_search_output_item_param_param.py @@ -364,7 +364,8 @@ class ToolImageGeneration(TypedDict, total=False): `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`, - `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: `gpt-image-2`. + `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: + `gpt-image-2.6-sunburst`. `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead. diff --git a/src/openai/types/beta/beta_responses_client_event.py b/src/openai/types/beta/beta_responses_client_event.py index 380da51cd0..a3e315bec4 100644 --- a/src/openai/types/beta/beta_responses_client_event.py +++ b/src/openai/types/beta/beta_responses_client_event.py @@ -784,7 +784,9 @@ class ResponseCreate(BaseModel): - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. """ diff --git a/src/openai/types/beta/beta_responses_client_event_param.py b/src/openai/types/beta/beta_responses_client_event_param.py index 90bbe38ea0..8abb1369f8 100644 --- a/src/openai/types/beta/beta_responses_client_event_param.py +++ b/src/openai/types/beta/beta_responses_client_event_param.py @@ -783,7 +783,9 @@ class ResponseCreate(TypedDict, total=False): - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. """ diff --git a/src/openai/types/beta/beta_tool.py b/src/openai/types/beta/beta_tool.py index 8e7d765bb4..6d977498f9 100644 --- a/src/openai/types/beta/beta_tool.py +++ b/src/openai/types/beta/beta_tool.py @@ -364,7 +364,8 @@ class ImageGeneration(BaseModel): `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`, - `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: `gpt-image-2`. + `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: + `gpt-image-2.6-sunburst`. `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead. diff --git a/src/openai/types/beta/beta_tool_param.py b/src/openai/types/beta/beta_tool_param.py index 6432b67a1e..1174d0edf2 100644 --- a/src/openai/types/beta/beta_tool_param.py +++ b/src/openai/types/beta/beta_tool_param.py @@ -362,7 +362,8 @@ class ImageGeneration(TypedDict, total=False): `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`, - `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: `gpt-image-2`. + `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: + `gpt-image-2.6-sunburst`. `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead. diff --git a/src/openai/types/beta/response_create_params.py b/src/openai/types/beta/response_create_params.py index dc18198710..7b9642d352 100644 --- a/src/openai/types/beta/response_create_params.py +++ b/src/openai/types/beta/response_create_params.py @@ -525,7 +525,9 @@ class ResponseCreateParamsBase(TypedDict, total=False): - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. """ diff --git a/src/openai/types/beta/responses/input_token_count_params.py b/src/openai/types/beta/responses/input_token_count_params.py index e4c2d3f32a..9ee0d7e333 100644 --- a/src/openai/types/beta/responses/input_token_count_params.py +++ b/src/openai/types/beta/responses/input_token_count_params.py @@ -105,9 +105,11 @@ class InputTokenCountParams(TypedDict, total=False): - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. - `disabled` (default): If the - input size will exceed the context window size for a model, the request will - fail with a 400 error. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit before counting tokens. + - `disabled` (default): If the input size will exceed the context window size + for a model, the request will fail with a 400 error. """ betas: Annotated[List[Literal["responses_multi_agent=v1"]], PropertyInfo(alias="openai-beta")] diff --git a/src/openai/types/content_provenance_check_create_params.py b/src/openai/types/content_provenance_check_create_params.py index a012ce02a5..fbac2ccfd5 100644 --- a/src/openai/types/content_provenance_check_create_params.py +++ b/src/openai/types/content_provenance_check_create_params.py @@ -11,4 +11,7 @@ class ContentProvenanceCheckCreateParams(TypedDict, total=False): file: Required[FileTypes] - """The image or audio file to check for supported OpenAI provenance signals.""" + """The image or audio file to check for supported OpenAI provenance signals. + + Supported image formats are PNG, JPEG, WebP, and GIF (including animated GIFs). + """ diff --git a/src/openai/types/image_edit_params.py b/src/openai/types/image_edit_params.py index 6253468f7a..15df8820e0 100644 --- a/src/openai/types/image_edit_params.py +++ b/src/openai/types/image_edit_params.py @@ -8,7 +8,7 @@ from .._types import FileTypes, SequenceNotStr from .image_model import ImageModel -__all__ = ["ImageEditParamsBase", "ImageEditParamsNonStreaming", "ImageEditParamsStreaming"] +__all__ = ["ImageEditParamsBase", "Svg", "SvgReasoning", "ImageEditParamsNonStreaming", "ImageEditParamsStreaming"] class ImageEditParamsBase(TypedDict, total=False): @@ -120,11 +120,11 @@ class ImageEditParamsBase(TypedDict, total=False): `jpeg` output formats, and defaults to 100. """ - output_format: Optional[Literal["png", "jpeg", "webp", "gif"]] + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] """The format in which the generated images are returned. This parameter is only supported for the GPT image models. The default value is - `png`. + `png`. SVG output requires a supported image model and project access. """ partial_images: Optional[int] @@ -187,6 +187,14 @@ class ImageEditParamsBase(TypedDict, total=False): compatibility. Check the selected GPT image model's supported sizes. """ + svg: Optional[Svg] + """Selects the author model and reasoning effort for `output_format=svg`. + + Supply `svg.model` when SVG model selection is enabled. Otherwise, omit this + object. SVG output requires `n=1` and cannot use streaming, partial images, or + output compression. Use multipart fields such as `svg[model]`. + """ + user: str """Deprecated: use `safety_identifier` instead. @@ -196,6 +204,31 @@ class ImageEditParamsBase(TypedDict, total=False): """ +class SvgReasoning(TypedDict, total=False): + """Reasoning effort for SVG authoring. + + When omitted, uses the author model's default in both Images and Responses. + """ + + effort: Literal["none", "minimal", "low", "medium", "high", "xhigh", "max"] + """Controls how much effort the model should spend on reasoning for this request.""" + + +class Svg(TypedDict, total=False): + """Selects the author model and reasoning effort for `output_format=svg`. + + Supply `svg.model` when SVG model selection is enabled. Otherwise, omit this object. SVG output requires `n=1` and cannot use streaming, partial images, or output compression. Use multipart fields such as `svg[model]`. + """ + + model: str + + reasoning: Optional[SvgReasoning] + """Reasoning effort for SVG authoring. + + When omitted, uses the author model's default in both Images and Responses. + """ + + class ImageEditParamsNonStreaming(ImageEditParamsBase, total=False): stream: Optional[Literal[False]] """Edit the image in streaming mode. diff --git a/src/openai/types/image_generate_params.py b/src/openai/types/image_generate_params.py index cc9557582b..a5308bb559 100644 --- a/src/openai/types/image_generate_params.py +++ b/src/openai/types/image_generate_params.py @@ -99,7 +99,7 @@ class ImageGenerateParamsBase(TypedDict, total=False): `jpeg` output formats, and defaults to 100. """ - output_format: Optional[Literal["png", "jpeg", "webp", "gif", "svg"]] + output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] """The format in which the generated images are returned. This parameter is only supported for the GPT image models. @@ -186,8 +186,7 @@ class ImageGenerateParamsBase(TypedDict, total=False): selection is enabled, supply svg.model. When model selection is disabled, omit this object. The top-level model selects the image model that creates the reference image. SVG generation requires n=1 and does not support streaming, - partial images, prompt_rewriter, or output_compression. SVG edits are not - supported. + partial images, prompt_rewriter, or output_compression. """ user: str @@ -215,7 +214,7 @@ class SvgReasoning(TypedDict, total=False): class Svg(TypedDict, total=False): """Selects the model and reasoning effort used to author SVG output. - Requires output_format=svg and access to SVG model selection. When model selection is enabled, supply svg.model. When model selection is disabled, omit this object. The top-level model selects the image model that creates the reference image. SVG generation requires n=1 and does not support streaming, partial images, prompt_rewriter, or output_compression. SVG edits are not supported. + Requires output_format=svg and access to SVG model selection. When model selection is enabled, supply svg.model. When model selection is disabled, omit this object. The top-level model selects the image model that creates the reference image. SVG generation requires n=1 and does not support streaming, partial images, prompt_rewriter, or output_compression. """ model: Required[str] diff --git a/src/openai/types/images_response.py b/src/openai/types/images_response.py index 3b4bd8dae0..18c33f5eb9 100644 --- a/src/openai/types/images_response.py +++ b/src/openai/types/images_response.py @@ -10,9 +10,7 @@ class SvgUsage(BaseModel): - """ - Token usage for the model that authored the SVG, separate from image rendering usage. - """ + """Token usage for SVG authoring, separate from image rendering usage.""" input_tokens: int @@ -46,7 +44,7 @@ class UsageOutputTokensDetails(BaseModel): class Usage(BaseModel): - """For `gpt-image-1` only, the token usage information for the image generation.""" + """Token usage information for image generation with GPT Image models.""" input_tokens: int """The number of tokens (images and text) in the input prompt.""" @@ -80,7 +78,7 @@ class ImagesResponse(BaseModel): """The list of generated images.""" output_format: Optional[Literal["png", "webp", "jpeg", "gif", "svg"]] = None - """The output format of the generated image.""" + """The output format of the generated or edited image.""" quality: Optional[Literal["low", "medium", "high", "xhigh", "max"]] = None """The quality of the image generated. @@ -99,10 +97,7 @@ class ImagesResponse(BaseModel): """The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.""" svg_usage: Optional[SvgUsage] = None - """ - Token usage for the model that authored the SVG, separate from image rendering - usage. - """ + """Token usage for SVG authoring, separate from image rendering usage.""" usage: Optional[Usage] = None - """For `gpt-image-1` only, the token usage information for the image generation.""" + """Token usage information for image generation with GPT Image models.""" diff --git a/src/openai/types/live/media_session_config_param.py b/src/openai/types/live/media_session_config_param.py index 4c1dbf3899..285fdccc7c 100644 --- a/src/openai/types/live/media_session_config_param.py +++ b/src/openai/types/live/media_session_config_param.py @@ -147,6 +147,12 @@ class MediaSessionConfigParam(TypedDict, total=False): server defaults. Immutable after startup. """ + safety_identifier: Optional[str] + """ + A stable identifier for your end user, used for safety monitoring and abuse + detection. + """ + store: bool """Whether to store the session for later forking and recording download. diff --git a/src/openai/types/live/session_accept_params.py b/src/openai/types/live/session_accept_params.py index e024b92f71..c002ba790e 100644 --- a/src/openai/types/live/session_accept_params.py +++ b/src/openai/types/live/session_accept_params.py @@ -149,6 +149,12 @@ class Session(TypedDict, total=False): server defaults. Immutable after startup. """ + safety_identifier: Optional[str] + """ + A stable identifier for your end user, used for safety monitoring and abuse + detection. + """ + store: bool """Whether to store the session for later forking and recording download. diff --git a/src/openai/types/responses/input_token_count_params.py b/src/openai/types/responses/input_token_count_params.py index a0f0963444..0ec6551531 100644 --- a/src/openai/types/responses/input_token_count_params.py +++ b/src/openai/types/responses/input_token_count_params.py @@ -104,9 +104,11 @@ class InputTokenCountParams(TypedDict, total=False): - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. - `disabled` (default): If the - input size will exceed the context window size for a model, the request will - fail with a 400 error. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit before counting tokens. + - `disabled` (default): If the input size will exceed the context window size + for a model, the request will fail with a 400 error. """ diff --git a/src/openai/types/responses/response.py b/src/openai/types/responses/response.py index cc81e97c72..24f3575659 100644 --- a/src/openai/types/responses/response.py +++ b/src/openai/types/responses/response.py @@ -657,7 +657,9 @@ class Response(BaseModel): - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. """ diff --git a/src/openai/types/responses/response_create_params.py b/src/openai/types/responses/response_create_params.py index 77542e0de2..8a12413859 100644 --- a/src/openai/types/responses/response_create_params.py +++ b/src/openai/types/responses/response_create_params.py @@ -329,7 +329,9 @@ class ResponseCreateParamsBase(TypedDict, total=False): - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. """ diff --git a/src/openai/types/responses/response_tool_search_output_item_param.py b/src/openai/types/responses/response_tool_search_output_item_param.py index 72348fc433..e9dd4e7296 100644 --- a/src/openai/types/responses/response_tool_search_output_item_param.py +++ b/src/openai/types/responses/response_tool_search_output_item_param.py @@ -365,7 +365,8 @@ class ToolImageGeneration(BaseModel): `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`, - `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: `gpt-image-2`. + `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: + `gpt-image-2.6-sunburst`. `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead. diff --git a/src/openai/types/responses/response_tool_search_output_item_param_param.py b/src/openai/types/responses/response_tool_search_output_item_param_param.py index e52d43d9e0..1135d5a819 100644 --- a/src/openai/types/responses/response_tool_search_output_item_param_param.py +++ b/src/openai/types/responses/response_tool_search_output_item_param_param.py @@ -363,7 +363,8 @@ class ToolImageGeneration(TypedDict, total=False): `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`, - `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: `gpt-image-2`. + `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: + `gpt-image-2.6-sunburst`. `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead. diff --git a/src/openai/types/responses/responses_client_event.py b/src/openai/types/responses/responses_client_event.py index 73c0b58c1b..7a6f52a890 100644 --- a/src/openai/types/responses/responses_client_event.py +++ b/src/openai/types/responses/responses_client_event.py @@ -528,7 +528,9 @@ class ResponseCreate(BaseModel): - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. """ diff --git a/src/openai/types/responses/responses_client_event_param.py b/src/openai/types/responses/responses_client_event_param.py index f0ddcf6150..49d5f7cfef 100644 --- a/src/openai/types/responses/responses_client_event_param.py +++ b/src/openai/types/responses/responses_client_event_param.py @@ -528,7 +528,9 @@ class ResponseCreate(TypedDict, total=False): - `auto`: If the input to this Response exceeds the model's context window size, the model will truncate the response to fit the context window by dropping - items from the beginning of the conversation. + items from the beginning of the conversation. On some models, trimming can + begin earlier because the API subtracts the model's maximum output allowance + from its input limit, even if you set a lower `max_output_tokens`. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error. """ diff --git a/src/openai/types/responses/tool.py b/src/openai/types/responses/tool.py index 6dd44688ad..7b366a6bc5 100644 --- a/src/openai/types/responses/tool.py +++ b/src/openai/types/responses/tool.py @@ -369,7 +369,8 @@ class ImageGeneration(BaseModel): `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`, - `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: `gpt-image-2`. + `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: + `gpt-image-2.6-sunburst`. `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead. diff --git a/src/openai/types/responses/tool_param.py b/src/openai/types/responses/tool_param.py index 8038a04365..1c15142fee 100644 --- a/src/openai/types/responses/tool_param.py +++ b/src/openai/types/responses/tool_param.py @@ -368,7 +368,8 @@ class ImageGeneration(TypedDict, total=False): `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, `gpt-image-2.6-sunburst`, - `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: `gpt-image-2`. + `gpt-image-2.6-flare`, or `chatgpt-image-latest`. Default: + `gpt-image-2.6-sunburst`. `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead. diff --git a/src/openai/types/video_create_error.py b/src/openai/types/video_create_error.py index c250d40d1e..3deb85b6ce 100644 --- a/src/openai/types/video_create_error.py +++ b/src/openai/types/video_create_error.py @@ -51,9 +51,10 @@ class VideoCreateError(BaseModel): """A human-readable description of the error that was returned.""" headers: Optional[Dict[str, str]] = None - """ - The Retry-After and Retry-After-Ms headers returned with the original error, if - any. + """Headers returned with the original error. + + These can include Retry-After, Retry-After-Ms, and, on opted-in deployments, + x-openai-inference-capacity-reason. """ misalignment: Optional[Misalignment] = None diff --git a/src/openai/types/webhooks/__init__.py b/src/openai/types/webhooks/__init__.py index 08b79df9ad..8aba6916da 100644 --- a/src/openai/types/webhooks/__init__.py +++ b/src/openai/types/webhooks/__init__.py @@ -42,6 +42,9 @@ from .agent_environment_failed_webhook_event import ( AgentEnvironmentFailedWebhookEvent as AgentEnvironmentFailedWebhookEvent, ) +from .live_transport_connected_webhook_event import ( + LiveTransportConnectedWebhookEvent as LiveTransportConnectedWebhookEvent, +) from .safety_org_alert_created_webhook_event import ( SafetyOrgAlertCreatedWebhookEvent as SafetyOrgAlertCreatedWebhookEvent, ) diff --git a/src/openai/types/webhooks/agent_session_action_required_webhook_event.py b/src/openai/types/webhooks/agent_session_action_required_webhook_event.py index 103454a602..d5a87cdeb5 100644 --- a/src/openai/types/webhooks/agent_session_action_required_webhook_event.py +++ b/src/openai/types/webhooks/agent_session_action_required_webhook_event.py @@ -10,7 +10,7 @@ class DataRequiredAction(BaseModel): """The action type. Retrieve the session for action details.""" - type: Literal["computer_use_approval_request", "function_call", "environment_connection"] + type: Literal["computer_use_approval_request", "mcp_approval_request", "function_call", "environment_connection"] class Data(BaseModel): diff --git a/src/openai/types/webhooks/live_transport_connected_webhook_event.py b/src/openai/types/webhooks/live_transport_connected_webhook_event.py new file mode 100644 index 0000000000..5b155d9472 --- /dev/null +++ b/src/openai/types/webhooks/live_transport_connected_webhook_event.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Castiron. See CONTRIBUTING.md for details. + +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["LiveTransportConnectedWebhookEvent", "Data"] + + +class Data(BaseModel): + session_id: str + """The Live session ID to use with the sideband attach endpoint.""" + + type: Literal["webrtc"] + """The session transport.""" + + +class LiveTransportConnectedWebhookEvent(BaseModel): + """ + Sent when a direct Live WebRTC session is created or an Instant Connect session activates. Use its session ID to attach a sideband observer. + """ + + id: str + """The webhook event ID.""" + + created_at: int + """Unix time in seconds when the event was created.""" + + data: Data + + object: Literal["event"] + + type: Literal["live.transport.connected"] diff --git a/src/openai/types/webhooks/unwrap_webhook_event.py b/src/openai/types/webhooks/unwrap_webhook_event.py index 4cddc1e477..8ec2480c76 100644 --- a/src/openai/types/webhooks/unwrap_webhook_event.py +++ b/src/openai/types/webhooks/unwrap_webhook_event.py @@ -26,6 +26,7 @@ from .agent_environment_ready_webhook_event import AgentEnvironmentReadyWebhookEvent from .live_transport_incoming_webhook_event import LiveTransportIncomingWebhookEvent from .agent_environment_failed_webhook_event import AgentEnvironmentFailedWebhookEvent +from .live_transport_connected_webhook_event import LiveTransportConnectedWebhookEvent from .safety_org_alert_created_webhook_event import SafetyOrgAlertCreatedWebhookEvent from .agent_environment_expired_webhook_event import AgentEnvironmentExpiredWebhookEvent from .agent_session_in_progress_webhook_event import AgentSessionInProgressWebhookEvent @@ -59,6 +60,7 @@ FineTuningJobFailedWebhookEvent, FineTuningJobSucceededWebhookEvent, LiveCallIncomingWebhookEvent, + LiveTransportConnectedWebhookEvent, LiveTransportIncomingWebhookEvent, RealtimeCallIncomingWebhookEvent, ResponseCancelledWebhookEvent, diff --git a/tests/api_resources/admin/organization/test_external_keys.py b/tests/api_resources/admin/organization/test_external_keys.py index 8d49cb0aac..64a21518b0 100644 --- a/tests/api_resources/admin/organization/test_external_keys.py +++ b/tests/api_resources/admin/organization/test_external_keys.py @@ -208,6 +208,62 @@ def test_streaming_response_create_overload_3(self, client: OpenAI) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_create_overload_4(self, client: OpenAI) -> None: + external_key = client.admin.organization.external_keys.create( + key_ocid="key_ocid", + name="name", + region="region", + type="oci", + vault_ocid="vault_ocid", + ) + assert_matches_type(ExternalKey, external_key, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_4(self, client: OpenAI) -> None: + external_key = client.admin.organization.external_keys.create( + key_ocid="key_ocid", + name="name", + region="region", + type="oci", + vault_ocid="vault_ocid", + key_version_ocid="key_version_ocid", + purpose="ekm", + ) + assert_matches_type(ExternalKey, external_key, path=["response"]) + + @parametrize + def test_raw_response_create_overload_4(self, client: OpenAI) -> None: + response = client.admin.organization.external_keys.with_raw_response.create( + key_ocid="key_ocid", + name="name", + region="region", + type="oci", + vault_ocid="vault_ocid", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + external_key = response.parse() + assert_matches_type(ExternalKey, external_key, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_4(self, client: OpenAI) -> None: + with client.admin.organization.external_keys.with_streaming_response.create( + key_ocid="key_ocid", + name="name", + region="region", + type="oci", + vault_ocid="vault_ocid", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + external_key = response.parse() + assert_matches_type(ExternalKey, external_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_retrieve(self, client: OpenAI) -> None: external_key = client.admin.organization.external_keys.retrieve( @@ -550,6 +606,62 @@ async def test_streaming_response_create_overload_3(self, async_client: AsyncOpe assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_create_overload_4(self, async_client: AsyncOpenAI) -> None: + external_key = await async_client.admin.organization.external_keys.create( + key_ocid="key_ocid", + name="name", + region="region", + type="oci", + vault_ocid="vault_ocid", + ) + assert_matches_type(ExternalKey, external_key, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_4(self, async_client: AsyncOpenAI) -> None: + external_key = await async_client.admin.organization.external_keys.create( + key_ocid="key_ocid", + name="name", + region="region", + type="oci", + vault_ocid="vault_ocid", + key_version_ocid="key_version_ocid", + purpose="ekm", + ) + assert_matches_type(ExternalKey, external_key, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_4(self, async_client: AsyncOpenAI) -> None: + response = await async_client.admin.organization.external_keys.with_raw_response.create( + key_ocid="key_ocid", + name="name", + region="region", + type="oci", + vault_ocid="vault_ocid", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + external_key = response.parse() + assert_matches_type(ExternalKey, external_key, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_4(self, async_client: AsyncOpenAI) -> None: + async with async_client.admin.organization.external_keys.with_streaming_response.create( + key_ocid="key_ocid", + name="name", + region="region", + type="oci", + vault_ocid="vault_ocid", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + external_key = await response.parse() + assert_matches_type(ExternalKey, external_key, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_retrieve(self, async_client: AsyncOpenAI) -> None: external_key = await async_client.admin.organization.external_keys.retrieve( diff --git a/tests/api_resources/beta/agents/sessions/test_events.py b/tests/api_resources/beta/agents/sessions/test_events.py index 2f336b8dbf..502d6ea685 100644 --- a/tests/api_resources/beta/agents/sessions/test_events.py +++ b/tests/api_resources/beta/agents/sessions/test_events.py @@ -23,16 +23,10 @@ def test_method_create(self, client: OpenAI) -> None: { "request_id": "request_id", "response": { - "action": "submit", - "fields": [ - { - "field_id": "field_id", - "value": "value", - } - ], - "type": "browser_authentication", + "decision": "approve", + "type": "mcp_tool_call", }, - "type": "agent.session.input.computer_use_approval_request_result", + "type": "agent.session.input.mcp_approval_request_result", } ], ) @@ -46,17 +40,10 @@ def test_method_create_with_all_params(self, client: OpenAI) -> None: { "request_id": "request_id", "response": { - "action": "submit", - "fields": [ - { - "field_id": "field_id", - "value": "value", - } - ], - "type": "browser_authentication", - "selected_option": "selected_option", + "decision": "approve", + "type": "mcp_tool_call", }, - "type": "agent.session.input.computer_use_approval_request_result", + "type": "agent.session.input.mcp_approval_request_result", } ], idempotency_key="x", @@ -71,16 +58,10 @@ def test_raw_response_create(self, client: OpenAI) -> None: { "request_id": "request_id", "response": { - "action": "submit", - "fields": [ - { - "field_id": "field_id", - "value": "value", - } - ], - "type": "browser_authentication", + "decision": "approve", + "type": "mcp_tool_call", }, - "type": "agent.session.input.computer_use_approval_request_result", + "type": "agent.session.input.mcp_approval_request_result", } ], ) @@ -98,16 +79,10 @@ def test_streaming_response_create(self, client: OpenAI) -> None: { "request_id": "request_id", "response": { - "action": "submit", - "fields": [ - { - "field_id": "field_id", - "value": "value", - } - ], - "type": "browser_authentication", + "decision": "approve", + "type": "mcp_tool_call", }, - "type": "agent.session.input.computer_use_approval_request_result", + "type": "agent.session.input.mcp_approval_request_result", } ], ) as response: @@ -128,16 +103,10 @@ def test_path_params_create(self, client: OpenAI) -> None: { "request_id": "request_id", "response": { - "action": "submit", - "fields": [ - { - "field_id": "field_id", - "value": "value", - } - ], - "type": "browser_authentication", + "decision": "approve", + "type": "mcp_tool_call", }, - "type": "agent.session.input.computer_use_approval_request_result", + "type": "agent.session.input.mcp_approval_request_result", } ], ) @@ -203,16 +172,10 @@ async def test_method_create(self, async_client: AsyncOpenAI) -> None: { "request_id": "request_id", "response": { - "action": "submit", - "fields": [ - { - "field_id": "field_id", - "value": "value", - } - ], - "type": "browser_authentication", + "decision": "approve", + "type": "mcp_tool_call", }, - "type": "agent.session.input.computer_use_approval_request_result", + "type": "agent.session.input.mcp_approval_request_result", } ], ) @@ -226,17 +189,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) -> { "request_id": "request_id", "response": { - "action": "submit", - "fields": [ - { - "field_id": "field_id", - "value": "value", - } - ], - "type": "browser_authentication", - "selected_option": "selected_option", + "decision": "approve", + "type": "mcp_tool_call", }, - "type": "agent.session.input.computer_use_approval_request_result", + "type": "agent.session.input.mcp_approval_request_result", } ], idempotency_key="x", @@ -251,16 +207,10 @@ async def test_raw_response_create(self, async_client: AsyncOpenAI) -> None: { "request_id": "request_id", "response": { - "action": "submit", - "fields": [ - { - "field_id": "field_id", - "value": "value", - } - ], - "type": "browser_authentication", + "decision": "approve", + "type": "mcp_tool_call", }, - "type": "agent.session.input.computer_use_approval_request_result", + "type": "agent.session.input.mcp_approval_request_result", } ], ) @@ -278,16 +228,10 @@ async def test_streaming_response_create(self, async_client: AsyncOpenAI) -> Non { "request_id": "request_id", "response": { - "action": "submit", - "fields": [ - { - "field_id": "field_id", - "value": "value", - } - ], - "type": "browser_authentication", + "decision": "approve", + "type": "mcp_tool_call", }, - "type": "agent.session.input.computer_use_approval_request_result", + "type": "agent.session.input.mcp_approval_request_result", } ], ) as response: @@ -308,16 +252,10 @@ async def test_path_params_create(self, async_client: AsyncOpenAI) -> None: { "request_id": "request_id", "response": { - "action": "submit", - "fields": [ - { - "field_id": "field_id", - "value": "value", - } - ], - "type": "browser_authentication", + "decision": "approve", + "type": "mcp_tool_call", }, - "type": "agent.session.input.computer_use_approval_request_result", + "type": "agent.session.input.mcp_approval_request_result", } ], ) diff --git a/tests/api_resources/beta/agents/test_sessions.py b/tests/api_resources/beta/agents/test_sessions.py index 1a1dcb0f01..5bd876c048 100644 --- a/tests/api_resources/beta/agents/test_sessions.py +++ b/tests/api_resources/beta/agents/test_sessions.py @@ -61,6 +61,7 @@ def test_method_create_with_all_params_overload_1(self, client: OpenAI) -> None: agent_id="agent_id", input="x", metadata={"foo": "string"}, + prompt_cache_options={"ttl": "30m"}, review="none", spend_control={"limit": 1}, stream=False, @@ -138,6 +139,7 @@ def test_method_create_with_all_params_overload_2(self, client: OpenAI) -> None: agent_id="agent_id", input="x", metadata={"foo": "string"}, + prompt_cache_options={"ttl": "30m"}, review="none", spend_control={"limit": 1}, stream_options={"include_obfuscation": True}, @@ -237,6 +239,7 @@ def test_method_update_with_all_params(self, client: OpenAI) -> None: ], }, metadata={"foo": "string"}, + prompt_cache_options={"ttl": "30m"}, review="none", spend_control={"limit": 1}, ) @@ -396,6 +399,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn agent_id="agent_id", input="x", metadata={"foo": "string"}, + prompt_cache_options={"ttl": "30m"}, review="none", spend_control={"limit": 1}, stream=False, @@ -473,6 +477,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn agent_id="agent_id", input="x", metadata={"foo": "string"}, + prompt_cache_options={"ttl": "30m"}, review="none", spend_control={"limit": 1}, stream_options={"include_obfuscation": True}, @@ -572,6 +577,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncOpenAI) -> ], }, metadata={"foo": "string"}, + prompt_cache_options={"ttl": "30m"}, review="none", spend_control={"limit": 1}, ) diff --git a/tests/api_resources/live/test_sessions.py b/tests/api_resources/live/test_sessions.py index 5ac33a027d..1d66ff1783 100644 --- a/tests/api_resources/live/test_sessions.py +++ b/tests/api_resources/live/test_sessions.py @@ -60,6 +60,7 @@ def test_method_accept_with_all_params(self, client: OpenAI) -> None: } ], "instructions": "instructions", + "safety_identifier": "safety_identifier", "store": True, "triggers": [ { @@ -446,6 +447,7 @@ async def test_method_accept_with_all_params(self, async_client: AsyncOpenAI) -> } ], "instructions": "instructions", + "safety_identifier": "safety_identifier", "store": True, "triggers": [ { diff --git a/tests/api_resources/test_images.py b/tests/api_resources/test_images.py index b38d840635..6054a06d27 100644 --- a/tests/api_resources/test_images.py +++ b/tests/api_resources/test_images.py @@ -96,6 +96,10 @@ def test_method_edit_with_all_params_overload_1(self, client: OpenAI) -> None: safety_identifier="user-1234", size="1024x1024", stream=False, + svg={ + "model": "x", + "reasoning": {"effort": "none"}, + }, user="user-1234", ) assert_matches_type(ImagesResponse, image, path=["response"]) @@ -157,6 +161,10 @@ def test_method_edit_with_all_params_overload_2(self, client: OpenAI) -> None: response_format="url", safety_identifier="user-1234", size="1024x1024", + svg={ + "model": "x", + "reasoning": {"effort": "none"}, + }, user="user-1234", ) image_stream.response.close() @@ -397,6 +405,10 @@ async def test_method_edit_with_all_params_overload_1(self, async_client: AsyncO safety_identifier="user-1234", size="1024x1024", stream=False, + svg={ + "model": "x", + "reasoning": {"effort": "none"}, + }, user="user-1234", ) assert_matches_type(ImagesResponse, image, path=["response"]) @@ -458,6 +470,10 @@ async def test_method_edit_with_all_params_overload_2(self, async_client: AsyncO response_format="url", safety_identifier="user-1234", size="1024x1024", + svg={ + "model": "x", + "reasoning": {"effort": "none"}, + }, user="user-1234", ) await image_stream.response.aclose() diff --git a/tests/api_resources/test_live.py b/tests/api_resources/test_live.py index ccf47eb930..8575ea82f0 100644 --- a/tests/api_resources/test_live.py +++ b/tests/api_resources/test_live.py @@ -59,6 +59,7 @@ def test_method_create_with_all_params(self, client: OpenAI) -> None: } ], "instructions": "instructions", + "safety_identifier": "safety_identifier", "store": True, "triggers": [ { @@ -173,6 +174,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) -> } ], "instructions": "instructions", + "safety_identifier": "safety_identifier", "store": True, "triggers": [ { diff --git a/tests/test_agent_session_response_fields.py b/tests/test_agent_session_response_fields.py new file mode 100644 index 0000000000..d82f5586e0 --- /dev/null +++ b/tests/test_agent_session_response_fields.py @@ -0,0 +1,55 @@ +from __future__ import annotations + +import httpx2 +import pytest + +from openai import OpenAI +from openai.types.beta.agent_session import RequiredActionSessionRequiredActionResourceMcpApprovalRequest + + +@pytest.mark.parametrize("mode", ["value", "null", "omitted"]) +def test_agent_session_response_fields(mode: str) -> None: + request = { + "type": "mcp_tool_call", + "server_label": "synthetic-server", + "name": "synthetic-tool" if mode == "value" else None, + "arguments": {"query": "synthetic-query"} if mode == "value" else None, + "message": "Synthetic approval", + } + session: dict[str, object] = { + "id": "session_test", + "object": "agent.session", + "required_actions": [ + {"type": "mcp_approval_request", "request_id": "request_test", "turn_id": "turn_test", "request": request} + ], + } + turn: dict[str, object] = {"id": "turn_test", "object": "agent.session.turn"} + if mode != "omitted": + session["prompt_cache_options"] = {"ttl": "12h"} if mode == "value" else None + turn["prompt_cache_options"] = {"ttl": "30m"} if mode == "value" else None + paths: list[str] = [] + + def respond(http_request: httpx2.Request) -> httpx2.Response: + paths.append(http_request.url.path) + return httpx2.Response(200, json=turn if http_request.url.path.endswith("/turns/turn_test") else session) + + with OpenAI( + api_key="fake-test-key", + base_url="https://example.test", + max_retries=0, + http_client=httpx2.Client(transport=httpx2.MockTransport(respond), trust_env=False), + ) as client: + actual_session = client.beta.agents.sessions.retrieve("session_test") + actual_turn = client.beta.agents.sessions.turns.retrieve("turn_test", session_id="session_test") + + assert paths == ["/agents/sessions/session_test", "/agents/sessions/session_test/turns/turn_test"] + action = actual_session.required_actions[0] + assert isinstance(action, RequiredActionSessionRequiredActionResourceMcpApprovalRequest) + assert action.request.name == ("synthetic-tool" if mode == "value" else None) + assert action.request.arguments == ({"query": "synthetic-query"} if mode == "value" else None) + if mode == "value": + assert (actual_session.prompt_cache_options.ttl if actual_session.prompt_cache_options else None) == "12h" + assert (actual_turn.prompt_cache_options.ttl if actual_turn.prompt_cache_options else None) == "30m" + else: + assert actual_session.prompt_cache_options is None + assert actual_turn.prompt_cache_options is None