Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b8a3720

Browse files
committedMay 2, 2025
feat(api): add image sizes, reasoning encryption
1 parent 4fc5252 commit b8a3720

26 files changed

+182
-86
lines changed
 

‎.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 97
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml
3-
openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03
4-
config_hash: b597cd9a31e9e5ec709e2eefb4c54122
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0ee6b36cf3cc278cef4199a6aec5f7d530a6c1f17a74830037e96d50ca1edc50.yml
3+
openapi_spec_hash: e8ec5f46bc0655b34f292422d58a60f6
4+
config_hash: d9b6b6e6bc85744663e300eebc482067

‎src/openai/resources/audio/speech.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def create(
8585
`wav`, and `pcm`.
8686
8787
speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
88-
the default.
88+
the default. Does not work with `gpt-4o-mini-tts`.
8989
9090
extra_headers: Send extra headers
9191
@@ -176,7 +176,7 @@ async def create(
176176
`wav`, and `pcm`.
177177
178178
speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
179-
the default.
179+
the default. Does not work with `gpt-4o-mini-tts`.
180180
181181
extra_headers: Send extra headers
182182

‎src/openai/resources/images.py

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,14 @@ def edit(
119119
*,
120120
image: Union[FileTypes, List[FileTypes]],
121121
prompt: str,
122+
background: Optional[Literal["transparent", "opaque", "auto"]] | NotGiven = NOT_GIVEN,
122123
mask: FileTypes | NotGiven = NOT_GIVEN,
123124
model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
124125
n: Optional[int] | NotGiven = NOT_GIVEN,
125126
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | NotGiven = NOT_GIVEN,
126127
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
127-
size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN,
128+
size: Optional[Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"]]
129+
| NotGiven = NOT_GIVEN,
128130
user: str | NotGiven = NOT_GIVEN,
129131
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
130132
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -139,14 +141,25 @@ def edit(
139141
This endpoint only supports `gpt-image-1` and `dall-e-2`.
140142
141143
Args:
142-
image: The image(s) to edit. Must be a supported image file or an array of images. For
143-
`gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
144-
25MB. For `dall-e-2`, you can only provide one image, and it should be a square
145-
`png` file less than 4MB.
144+
image: The image(s) to edit. Must be a supported image file or an array of images.
145+
146+
For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
147+
25MB. You can provide up to 16 images.
148+
149+
For `dall-e-2`, you can only provide one image, and it should be a square `png`
150+
file less than 4MB.
146151
147152
prompt: A text description of the desired image(s). The maximum length is 1000
148153
characters for `dall-e-2`, and 32000 characters for `gpt-image-1`.
149154
155+
background: Allows to set transparency for the background of the generated image(s). This
156+
parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
157+
`opaque` or `auto` (default value). When `auto` is used, the model will
158+
automatically determine the best background for the image.
159+
160+
If `transparent`, the output format needs to support transparency, so it should
161+
be set to either `png` (default value) or `webp`.
162+
150163
mask: An additional image whose fully transparent areas (e.g. where alpha is zero)
151164
indicate where `image` should be edited. If there are multiple images provided,
152165
the mask will be applied on the first image. Must be a valid PNG file, less than
@@ -187,6 +200,7 @@ def edit(
187200
{
188201
"image": image,
189202
"prompt": prompt,
203+
"background": background,
190204
"mask": mask,
191205
"model": model,
192206
"n": n,
@@ -429,12 +443,14 @@ async def edit(
429443
*,
430444
image: Union[FileTypes, List[FileTypes]],
431445
prompt: str,
446+
background: Optional[Literal["transparent", "opaque", "auto"]] | NotGiven = NOT_GIVEN,
432447
mask: FileTypes | NotGiven = NOT_GIVEN,
433448
model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
434449
n: Optional[int] | NotGiven = NOT_GIVEN,
435450
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | NotGiven = NOT_GIVEN,
436451
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
437-
size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN,
452+
size: Optional[Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"]]
453+
| NotGiven = NOT_GIVEN,
438454
user: str | NotGiven = NOT_GIVEN,
439455
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
440456
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -449,14 +465,25 @@ async def edit(
449465
This endpoint only supports `gpt-image-1` and `dall-e-2`.
450466
451467
Args:
452-
image: The image(s) to edit. Must be a supported image file or an array of images. For
453-
`gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
454-
25MB. For `dall-e-2`, you can only provide one image, and it should be a square
455-
`png` file less than 4MB.
468+
image: The image(s) to edit. Must be a supported image file or an array of images.
469+
470+
For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
471+
25MB. You can provide up to 16 images.
472+
473+
For `dall-e-2`, you can only provide one image, and it should be a square `png`
474+
file less than 4MB.
456475
457476
prompt: A text description of the desired image(s). The maximum length is 1000
458477
characters for `dall-e-2`, and 32000 characters for `gpt-image-1`.
459478
479+
background: Allows to set transparency for the background of the generated image(s). This
480+
parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
481+
`opaque` or `auto` (default value). When `auto` is used, the model will
482+
automatically determine the best background for the image.
483+
484+
If `transparent`, the output format needs to support transparency, so it should
485+
be set to either `png` (default value) or `webp`.
486+
460487
mask: An additional image whose fully transparent areas (e.g. where alpha is zero)
461488
indicate where `image` should be edited. If there are multiple images provided,
462489
the mask will be applied on the first image. Must be a valid PNG file, less than
@@ -497,6 +524,7 @@ async def edit(
497524
{
498525
"image": image,
499526
"prompt": prompt,
527+
"background": background,
500528
"mask": mask,
501529
"model": model,
502530
"n": n,

‎src/openai/resources/responses/responses.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ def create(
140140
- `message.input_image.image_url`: Include image urls from the input message.
141141
- `computer_call_output.output.image_url`: Include image urls from the computer
142142
call output.
143+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
144+
tokens in reasoning item outputs. This enables reasoning items to be used in
145+
multi-turn conversations when using the Responses API statelessly (like when
146+
the `store` parameter is set to `false`, or when an organization is enrolled
147+
in the zero data retention program).
143148
144149
instructions: Inserts a system (or developer) message as the first item in the model's
145150
context.
@@ -331,6 +336,11 @@ def create(
331336
- `message.input_image.image_url`: Include image urls from the input message.
332337
- `computer_call_output.output.image_url`: Include image urls from the computer
333338
call output.
339+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
340+
tokens in reasoning item outputs. This enables reasoning items to be used in
341+
multi-turn conversations when using the Responses API statelessly (like when
342+
the `store` parameter is set to `false`, or when an organization is enrolled
343+
in the zero data retention program).
334344
335345
instructions: Inserts a system (or developer) message as the first item in the model's
336346
context.
@@ -515,6 +525,11 @@ def create(
515525
- `message.input_image.image_url`: Include image urls from the input message.
516526
- `computer_call_output.output.image_url`: Include image urls from the computer
517527
call output.
528+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
529+
tokens in reasoning item outputs. This enables reasoning items to be used in
530+
multi-turn conversations when using the Responses API statelessly (like when
531+
the `store` parameter is set to `false`, or when an organization is enrolled
532+
in the zero data retention program).
518533
519534
instructions: Inserts a system (or developer) message as the first item in the model's
520535
context.
@@ -1013,6 +1028,11 @@ async def create(
10131028
- `message.input_image.image_url`: Include image urls from the input message.
10141029
- `computer_call_output.output.image_url`: Include image urls from the computer
10151030
call output.
1031+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
1032+
tokens in reasoning item outputs. This enables reasoning items to be used in
1033+
multi-turn conversations when using the Responses API statelessly (like when
1034+
the `store` parameter is set to `false`, or when an organization is enrolled
1035+
in the zero data retention program).
10161036
10171037
instructions: Inserts a system (or developer) message as the first item in the model's
10181038
context.
@@ -1204,6 +1224,11 @@ async def create(
12041224
- `message.input_image.image_url`: Include image urls from the input message.
12051225
- `computer_call_output.output.image_url`: Include image urls from the computer
12061226
call output.
1227+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
1228+
tokens in reasoning item outputs. This enables reasoning items to be used in
1229+
multi-turn conversations when using the Responses API statelessly (like when
1230+
the `store` parameter is set to `false`, or when an organization is enrolled
1231+
in the zero data retention program).
12071232
12081233
instructions: Inserts a system (or developer) message as the first item in the model's
12091234
context.
@@ -1388,6 +1413,11 @@ async def create(
13881413
- `message.input_image.image_url`: Include image urls from the input message.
13891414
- `computer_call_output.output.image_url`: Include image urls from the computer
13901415
call output.
1416+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
1417+
tokens in reasoning item outputs. This enables reasoning items to be used in
1418+
multi-turn conversations when using the Responses API statelessly (like when
1419+
the `store` parameter is set to `false`, or when an organization is enrolled
1420+
in the zero data retention program).
13911421
13921422
instructions: Inserts a system (or developer) message as the first item in the model's
13931423
context.

‎src/openai/types/audio/speech_create_params.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ class SpeechCreateParams(TypedDict, total=False):
4848
speed: float
4949
"""The speed of the generated audio.
5050
51-
Select a value from `0.25` to `4.0`. `1.0` is the default.
51+
Select a value from `0.25` to `4.0`. `1.0` is the default. Does not work with
52+
`gpt-4o-mini-tts`.
5253
"""

‎src/openai/types/image_edit_params.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313

1414
class ImageEditParams(TypedDict, total=False):
1515
image: Required[Union[FileTypes, List[FileTypes]]]
16-
"""The image(s) to edit.
16+
"""The image(s) to edit. Must be a supported image file or an array of images.
1717
18-
Must be a supported image file or an array of images. For `gpt-image-1`, each
19-
image should be a `png`, `webp`, or `jpg` file less than 25MB. For `dall-e-2`,
20-
you can only provide one image, and it should be a square `png` file less than
21-
4MB.
18+
For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
19+
25MB. You can provide up to 16 images.
20+
21+
For `dall-e-2`, you can only provide one image, and it should be a square `png`
22+
file less than 4MB.
2223
"""
2324

2425
prompt: Required[str]
@@ -28,6 +29,17 @@ class ImageEditParams(TypedDict, total=False):
2829
`gpt-image-1`.
2930
"""
3031

32+
background: Optional[Literal["transparent", "opaque", "auto"]]
33+
"""Allows to set transparency for the background of the generated image(s).
34+
35+
This parameter is only supported for `gpt-image-1`. Must be one of
36+
`transparent`, `opaque` or `auto` (default value). When `auto` is used, the
37+
model will automatically determine the best background for the image.
38+
39+
If `transparent`, the output format needs to support transparency, so it should
40+
be set to either `png` (default value) or `webp`.
41+
"""
42+
3143
mask: FileTypes
3244
"""An additional image whose fully transparent areas (e.g.
3345
@@ -61,7 +73,7 @@ class ImageEditParams(TypedDict, total=False):
6173
`gpt-image-1` will always return base64-encoded images.
6274
"""
6375

64-
size: Optional[Literal["256x256", "512x512", "1024x1024"]]
76+
size: Optional[Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"]]
6577
"""The size of the generated images.
6678
6779
Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or

‎src/openai/types/responses/computer_tool.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99

1010
class ComputerTool(BaseModel):
11-
display_height: float
11+
display_height: int
1212
"""The height of the computer display."""
1313

14-
display_width: float
14+
display_width: int
1515
"""The width of the computer display."""
1616

17-
environment: Literal["mac", "windows", "ubuntu", "browser"]
17+
environment: Literal["windows", "mac", "linux", "ubuntu", "browser"]
1818
"""The type of computer environment to control."""
1919

2020
type: Literal["computer_use_preview"]

‎src/openai/types/responses/computer_tool_param.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99

1010
class ComputerToolParam(TypedDict, total=False):
11-
display_height: Required[float]
11+
display_height: Required[int]
1212
"""The height of the computer display."""
1313

14-
display_width: Required[float]
14+
display_width: Required[int]
1515
"""The width of the computer display."""
1616

17-
environment: Required[Literal["mac", "windows", "ubuntu", "browser"]]
17+
environment: Required[Literal["windows", "mac", "linux", "ubuntu", "browser"]]
1818
"""The type of computer environment to control."""
1919

2020
type: Required[Literal["computer_use_preview"]]

‎src/openai/types/responses/file_search_tool.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99

1010
__all__ = ["FileSearchTool", "Filters", "RankingOptions"]
1111

12-
Filters: TypeAlias = Union[ComparisonFilter, CompoundFilter]
12+
Filters: TypeAlias = Union[ComparisonFilter, CompoundFilter, None]
1313

1414

1515
class RankingOptions(BaseModel):
1616
ranker: Optional[Literal["auto", "default-2024-11-15"]] = None
1717
"""The ranker to use for the file search."""
1818

1919
score_threshold: Optional[float] = None
20-
"""
21-
The score threshold for the file search, a number between 0 and 1. Numbers
22-
closer to 1 will attempt to return only the most relevant results, but may
23-
return fewer results.
20+
"""The score threshold for the file search, a number between 0 and 1.
21+
22+
Numbers closer to 1 will attempt to return only the most relevant results, but
23+
may return fewer results.
2424
"""
2525

2626

@@ -32,7 +32,7 @@ class FileSearchTool(BaseModel):
3232
"""The IDs of the vector stores to search."""
3333

3434
filters: Optional[Filters] = None
35-
"""A filter to apply based on file attributes."""
35+
"""A filter to apply."""
3636

3737
max_num_results: Optional[int] = None
3838
"""The maximum number of results to return.

‎src/openai/types/responses/file_search_tool_param.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Union
5+
from typing import List, Union, Optional
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

88
from ..shared_params.compound_filter import CompoundFilter
@@ -18,10 +18,10 @@ class RankingOptions(TypedDict, total=False):
1818
"""The ranker to use for the file search."""
1919

2020
score_threshold: float
21-
"""
22-
The score threshold for the file search, a number between 0 and 1. Numbers
23-
closer to 1 will attempt to return only the most relevant results, but may
24-
return fewer results.
21+
"""The score threshold for the file search, a number between 0 and 1.
22+
23+
Numbers closer to 1 will attempt to return only the most relevant results, but
24+
may return fewer results.
2525
"""
2626

2727

@@ -32,8 +32,8 @@ class FileSearchToolParam(TypedDict, total=False):
3232
vector_store_ids: Required[List[str]]
3333
"""The IDs of the vector stores to search."""
3434

35-
filters: Filters
36-
"""A filter to apply based on file attributes."""
35+
filters: Optional[Filters]
36+
"""A filter to apply."""
3737

3838
max_num_results: int
3939
"""The maximum number of results to return.

‎src/openai/types/responses/function_tool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ class FunctionTool(BaseModel):
1212
name: str
1313
"""The name of the function to call."""
1414

15-
parameters: Dict[str, object]
15+
parameters: Optional[Dict[str, object]] = None
1616
"""A JSON schema object describing the parameters of the function."""
1717

18-
strict: bool
18+
strict: Optional[bool] = None
1919
"""Whether to enforce strict parameter validation. Default `true`."""
2020

2121
type: Literal["function"]

‎src/openai/types/responses/function_tool_param.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ class FunctionToolParam(TypedDict, total=False):
1212
name: Required[str]
1313
"""The name of the function to call."""
1414

15-
parameters: Required[Dict[str, object]]
15+
parameters: Required[Optional[Dict[str, object]]]
1616
"""A JSON schema object describing the parameters of the function."""
1717

18-
strict: Required[bool]
18+
strict: Required[Optional[bool]]
1919
"""Whether to enforce strict parameter validation. Default `true`."""
2020

2121
type: Required[Literal["function"]]

‎src/openai/types/responses/response_create_params.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ class ResponseCreateParamsBase(TypedDict, total=False):
5656
- `message.input_image.image_url`: Include image urls from the input message.
5757
- `computer_call_output.output.image_url`: Include image urls from the computer
5858
call output.
59+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
60+
tokens in reasoning item outputs. This enables reasoning items to be used in
61+
multi-turn conversations when using the Responses API statelessly (like when
62+
the `store` parameter is set to `false`, or when an organization is enrolled
63+
in the zero data retention program).
5964
"""
6065

6166
instructions: Optional[str]

‎src/openai/types/responses/response_includable.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
__all__ = ["ResponseIncludable"]
66

77
ResponseIncludable: TypeAlias = Literal[
8-
"file_search_call.results", "message.input_image.image_url", "computer_call_output.output.image_url"
8+
"file_search_call.results",
9+
"message.input_image.image_url",
10+
"computer_call_output.output.image_url",
11+
"reasoning.encrypted_content",
912
]

‎src/openai/types/responses/response_input_file_param.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
from typing import Optional
56
from typing_extensions import Literal, Required, TypedDict
67

78
__all__ = ["ResponseInputFileParam"]
@@ -14,7 +15,7 @@ class ResponseInputFileParam(TypedDict, total=False):
1415
file_data: str
1516
"""The content of the file to be sent to the model."""
1617

17-
file_id: str
18+
file_id: Optional[str]
1819
"""The ID of the file to be sent to the model."""
1920

2021
filename: str

‎src/openai/types/responses/response_input_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class ResponseInputImage(BaseModel):
12-
detail: Literal["high", "low", "auto"]
12+
detail: Literal["low", "high", "auto"]
1313
"""The detail level of the image to be sent to the model.
1414
1515
One of `high`, `low`, or `auto`. Defaults to `auto`.

‎src/openai/types/responses/response_input_image_param.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class ResponseInputImageParam(TypedDict, total=False):
12-
detail: Required[Literal["high", "low", "auto"]]
12+
detail: Required[Literal["low", "high", "auto"]]
1313
"""The detail level of the image to be sent to the model.
1414
1515
One of `high`, `low`, or `auto`. Defaults to `auto`.

‎src/openai/types/responses/response_input_item_param.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union, Iterable
5+
from typing import Union, Iterable, Optional
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

88
from .easy_input_message_param import EasyInputMessageParam
@@ -50,10 +50,10 @@ class ComputerCallOutputAcknowledgedSafetyCheck(TypedDict, total=False):
5050
id: Required[str]
5151
"""The ID of the pending safety check."""
5252

53-
code: Required[str]
53+
code: Optional[str]
5454
"""The type of the pending safety check."""
5555

56-
message: Required[str]
56+
message: Optional[str]
5757
"""Details about the pending safety check."""
5858

5959

@@ -67,16 +67,16 @@ class ComputerCallOutput(TypedDict, total=False):
6767
type: Required[Literal["computer_call_output"]]
6868
"""The type of the computer tool call output. Always `computer_call_output`."""
6969

70-
id: str
70+
id: Optional[str]
7171
"""The ID of the computer tool call output."""
7272

73-
acknowledged_safety_checks: Iterable[ComputerCallOutputAcknowledgedSafetyCheck]
73+
acknowledged_safety_checks: Optional[Iterable[ComputerCallOutputAcknowledgedSafetyCheck]]
7474
"""
7575
The safety checks reported by the API that have been acknowledged by the
7676
developer.
7777
"""
7878

79-
status: Literal["in_progress", "completed", "incomplete"]
79+
status: Optional[Literal["in_progress", "completed", "incomplete"]]
8080
"""The status of the message input.
8181
8282
One of `in_progress`, `completed`, or `incomplete`. Populated when input items
@@ -94,13 +94,13 @@ class FunctionCallOutput(TypedDict, total=False):
9494
type: Required[Literal["function_call_output"]]
9595
"""The type of the function tool call output. Always `function_call_output`."""
9696

97-
id: str
97+
id: Optional[str]
9898
"""The unique ID of the function tool call output.
9999
100100
Populated when this item is returned via API.
101101
"""
102102

103-
status: Literal["in_progress", "completed", "incomplete"]
103+
status: Optional[Literal["in_progress", "completed", "incomplete"]]
104104
"""The status of the item.
105105
106106
One of `in_progress`, `completed`, or `incomplete`. Populated when items are
@@ -112,7 +112,7 @@ class ItemReference(TypedDict, total=False):
112112
id: Required[str]
113113
"""The ID of the item to reference."""
114114

115-
type: Required[Literal["item_reference"]]
115+
type: Optional[Literal["item_reference"]]
116116
"""The type of item to reference. Always `item_reference`."""
117117

118118

‎src/openai/types/responses/response_input_param.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Union, Iterable
5+
from typing import List, Union, Iterable, Optional
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

88
from .easy_input_message_param import EasyInputMessageParam
@@ -51,10 +51,10 @@ class ComputerCallOutputAcknowledgedSafetyCheck(TypedDict, total=False):
5151
id: Required[str]
5252
"""The ID of the pending safety check."""
5353

54-
code: Required[str]
54+
code: Optional[str]
5555
"""The type of the pending safety check."""
5656

57-
message: Required[str]
57+
message: Optional[str]
5858
"""Details about the pending safety check."""
5959

6060

@@ -68,16 +68,16 @@ class ComputerCallOutput(TypedDict, total=False):
6868
type: Required[Literal["computer_call_output"]]
6969
"""The type of the computer tool call output. Always `computer_call_output`."""
7070

71-
id: str
71+
id: Optional[str]
7272
"""The ID of the computer tool call output."""
7373

74-
acknowledged_safety_checks: Iterable[ComputerCallOutputAcknowledgedSafetyCheck]
74+
acknowledged_safety_checks: Optional[Iterable[ComputerCallOutputAcknowledgedSafetyCheck]]
7575
"""
7676
The safety checks reported by the API that have been acknowledged by the
7777
developer.
7878
"""
7979

80-
status: Literal["in_progress", "completed", "incomplete"]
80+
status: Optional[Literal["in_progress", "completed", "incomplete"]]
8181
"""The status of the message input.
8282
8383
One of `in_progress`, `completed`, or `incomplete`. Populated when input items
@@ -95,13 +95,13 @@ class FunctionCallOutput(TypedDict, total=False):
9595
type: Required[Literal["function_call_output"]]
9696
"""The type of the function tool call output. Always `function_call_output`."""
9797

98-
id: str
98+
id: Optional[str]
9999
"""The unique ID of the function tool call output.
100100
101101
Populated when this item is returned via API.
102102
"""
103103

104-
status: Literal["in_progress", "completed", "incomplete"]
104+
status: Optional[Literal["in_progress", "completed", "incomplete"]]
105105
"""The status of the item.
106106
107107
One of `in_progress`, `completed`, or `incomplete`. Populated when items are
@@ -113,7 +113,7 @@ class ItemReference(TypedDict, total=False):
113113
id: Required[str]
114114
"""The ID of the item to reference."""
115115

116-
type: Required[Literal["item_reference"]]
116+
type: Optional[Literal["item_reference"]]
117117
"""The type of item to reference. Always `item_reference`."""
118118

119119

‎src/openai/types/responses/response_reasoning_item.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ class ResponseReasoningItem(BaseModel):
2828
type: Literal["reasoning"]
2929
"""The type of the object. Always `reasoning`."""
3030

31+
encrypted_content: Optional[str] = None
32+
"""
33+
The encrypted content of the reasoning item - populated when a response is
34+
generated with `reasoning.encrypted_content` in the `include` parameter.
35+
"""
36+
3137
status: Optional[Literal["in_progress", "completed", "incomplete"]] = None
3238
"""The status of the item.
3339

‎src/openai/types/responses/response_reasoning_item_param.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Iterable
5+
from typing import Iterable, Optional
66
from typing_extensions import Literal, Required, TypedDict
77

88
__all__ = ["ResponseReasoningItemParam", "Summary"]
@@ -28,6 +28,12 @@ class ResponseReasoningItemParam(TypedDict, total=False):
2828
type: Required[Literal["reasoning"]]
2929
"""The type of the object. Always `reasoning`."""
3030

31+
encrypted_content: Optional[str]
32+
"""
33+
The encrypted content of the reasoning item - populated when a response is
34+
generated with `reasoning.encrypted_content` in the `include` parameter.
35+
"""
36+
3137
status: Literal["in_progress", "completed", "incomplete"]
3238
"""The status of the item.
3339

‎src/openai/types/responses/tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
__all__ = ["Tool"]
1313

1414
Tool: TypeAlias = Annotated[
15-
Union[FileSearchTool, FunctionTool, ComputerTool, WebSearchTool], PropertyInfo(discriminator="type")
15+
Union[FileSearchTool, FunctionTool, WebSearchTool, ComputerTool], PropertyInfo(discriminator="type")
1616
]

‎src/openai/types/responses/tool_param.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313

1414
__all__ = ["ToolParam"]
1515

16-
ToolParam: TypeAlias = Union[FileSearchToolParam, FunctionToolParam, ComputerToolParam, WebSearchToolParam]
16+
ToolParam: TypeAlias = Union[FileSearchToolParam, FunctionToolParam, WebSearchToolParam, ComputerToolParam]
1717

1818
ParseableToolParam: TypeAlias = Union[ToolParam, ChatCompletionToolParam]

‎src/openai/types/responses/web_search_tool.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ class UserLocation(BaseModel):
3333

3434
class WebSearchTool(BaseModel):
3535
type: Literal["web_search_preview", "web_search_preview_2025_03_11"]
36-
"""The type of the web search tool. One of:
36+
"""The type of the web search tool.
3737
38-
- `web_search_preview`
39-
- `web_search_preview_2025_03_11`
38+
One of `web_search_preview` or `web_search_preview_2025_03_11`.
4039
"""
4140

4241
search_context_size: Optional[Literal["low", "medium", "high"]] = None
43-
"""
44-
High level guidance for the amount of context window space to use for the
45-
search. One of `low`, `medium`, or `high`. `medium` is the default.
42+
"""High level guidance for the amount of context window space to use for the
43+
search.
44+
45+
One of `low`, `medium`, or `high`. `medium` is the default.
4646
"""
4747

4848
user_location: Optional[UserLocation] = None
49+
"""The user's location."""

‎src/openai/types/responses/web_search_tool_param.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ class UserLocation(TypedDict, total=False):
1212
type: Required[Literal["approximate"]]
1313
"""The type of location approximation. Always `approximate`."""
1414

15-
city: str
15+
city: Optional[str]
1616
"""Free text input for the city of the user, e.g. `San Francisco`."""
1717

18-
country: str
18+
country: Optional[str]
1919
"""
2020
The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
2121
the user, e.g. `US`.
2222
"""
2323

24-
region: str
24+
region: Optional[str]
2525
"""Free text input for the region of the user, e.g. `California`."""
2626

27-
timezone: str
27+
timezone: Optional[str]
2828
"""
2929
The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
3030
user, e.g. `America/Los_Angeles`.
@@ -33,16 +33,17 @@ class UserLocation(TypedDict, total=False):
3333

3434
class WebSearchToolParam(TypedDict, total=False):
3535
type: Required[Literal["web_search_preview", "web_search_preview_2025_03_11"]]
36-
"""The type of the web search tool. One of:
36+
"""The type of the web search tool.
3737
38-
- `web_search_preview`
39-
- `web_search_preview_2025_03_11`
38+
One of `web_search_preview` or `web_search_preview_2025_03_11`.
4039
"""
4140

4241
search_context_size: Literal["low", "medium", "high"]
43-
"""
44-
High level guidance for the amount of context window space to use for the
45-
search. One of `low`, `medium`, or `high`. `medium` is the default.
42+
"""High level guidance for the amount of context window space to use for the
43+
search.
44+
45+
One of `low`, `medium`, or `high`. `medium` is the default.
4646
"""
4747

4848
user_location: Optional[UserLocation]
49+
"""The user's location."""

‎tests/api_resources/test_images.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def test_method_edit_with_all_params(self, client: OpenAI) -> None:
7373
image = client.images.edit(
7474
image=b"raw file contents",
7575
prompt="A cute baby sea otter wearing a beret",
76+
background="transparent",
7677
mask=b"raw file contents",
7778
model="string",
7879
n=1,
@@ -218,6 +219,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncOpenAI) -> N
218219
image = await async_client.images.edit(
219220
image=b"raw file contents",
220221
prompt="A cute baby sea otter wearing a beret",
222+
background="transparent",
221223
mask=b"raw file contents",
222224
model="string",
223225
n=1,

0 commit comments

Comments
 (0)
Please sign in to comment.