Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.35.0"
".": "2.35.1"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 233
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-578515408e7ee6ac115f3768b358ff2cd4f5699cbfb527fe58b19806e7d1f713.yml
openapi_spec_hash: b2df68d6233a18b475590978f5682c04
config_hash: c6cf65d9b19a16ce4313602a2204d48f
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-84d31411083374ec6cdb4a722f8b8b83c1230741157306b1ca7ba1a3cf246672.yml
openapi_spec_hash: 051fce676f959b8207e2317225ec4bdc
config_hash: a2916f18a94ff65c8116ca2fe3256f10
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 2.35.1 (2026-05-06)

Full Changelog: [v2.35.0...v2.35.1](https://github.com/openai/openai-python/compare/v2.35.0...v2.35.1)

### Bug Fixes

* **api:** fix imagegen `size` enum regression ([4484653](https://github.com/openai/openai-python/commit/44846536bc3b02c393daa5bae70a85de04c7f621))

## 2.35.0 (2026-05-06)

Full Changelog: [v2.34.0...v2.35.0](https://github.com/openai/openai-python/compare/v2.34.0...v2.35.0)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "openai"
version = "2.35.0"
version = "2.35.1"
description = "The official Python library for the openai API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/openai/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "openai"
__version__ = "2.35.0" # x-release-please-version
__version__ = "2.35.1" # x-release-please-version
80 changes: 64 additions & 16 deletions src/openai/resources/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def edit(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[str, Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"], None]
| Omit = omit,
stream: Optional[Literal[False]] | 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.
Expand Down Expand Up @@ -271,7 +272,8 @@ def edit(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[str, Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"], None]
| 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.
Expand Down Expand Up @@ -400,7 +402,8 @@ def edit(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[str, Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"], None]
| 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.
Expand Down Expand Up @@ -528,7 +531,8 @@ def edit(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[str, Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"], None]
| Omit = omit,
stream: Optional[Literal[False]] | Literal[True] | 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.
Expand Down Expand Up @@ -596,7 +600,12 @@ def generate(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "hd", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[
str,
Literal["auto", "1024x1024", "1536x1024", "1024x1536", "256x256", "512x512", "1792x1024", "1024x1792"],
None,
]
| Omit = omit,
stream: Optional[Literal[False]] | Omit = omit,
style: Optional[Literal["vivid", "natural"]] | Omit = omit,
user: str | Omit = omit,
Expand Down Expand Up @@ -718,7 +727,12 @@ def generate(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "hd", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[
str,
Literal["auto", "1024x1024", "1536x1024", "1024x1536", "256x256", "512x512", "1792x1024", "1024x1792"],
None,
]
| Omit = omit,
style: Optional[Literal["vivid", "natural"]] | 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.
Expand Down Expand Up @@ -839,7 +853,12 @@ def generate(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "hd", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[
str,
Literal["auto", "1024x1024", "1536x1024", "1024x1536", "256x256", "512x512", "1792x1024", "1024x1792"],
None,
]
| Omit = omit,
style: Optional[Literal["vivid", "natural"]] | 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.
Expand Down Expand Up @@ -959,7 +978,12 @@ def generate(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "hd", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[
str,
Literal["auto", "1024x1024", "1536x1024", "1024x1536", "256x256", "512x512", "1792x1024", "1024x1792"],
None,
]
| Omit = omit,
stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
style: Optional[Literal["vivid", "natural"]] | Omit = omit,
user: str | Omit = omit,
Expand Down Expand Up @@ -1122,7 +1146,8 @@ async def edit(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[str, Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"], None]
| Omit = omit,
stream: Optional[Literal[False]] | 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.
Expand Down Expand Up @@ -1252,7 +1277,8 @@ async def edit(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[str, Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"], None]
| 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.
Expand Down Expand Up @@ -1381,7 +1407,8 @@ async def edit(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[str, Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"], None]
| 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.
Expand Down Expand Up @@ -1509,7 +1536,8 @@ async def edit(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[str, Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"], None]
| Omit = omit,
stream: Optional[Literal[False]] | Literal[True] | 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.
Expand Down Expand Up @@ -1577,7 +1605,12 @@ async def generate(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "hd", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[
str,
Literal["auto", "1024x1024", "1536x1024", "1024x1536", "256x256", "512x512", "1792x1024", "1024x1792"],
None,
]
| Omit = omit,
stream: Optional[Literal[False]] | Omit = omit,
style: Optional[Literal["vivid", "natural"]] | Omit = omit,
user: str | Omit = omit,
Expand Down Expand Up @@ -1699,7 +1732,12 @@ async def generate(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "hd", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[
str,
Literal["auto", "1024x1024", "1536x1024", "1024x1536", "256x256", "512x512", "1792x1024", "1024x1792"],
None,
]
| Omit = omit,
style: Optional[Literal["vivid", "natural"]] | 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.
Expand Down Expand Up @@ -1820,7 +1858,12 @@ async def generate(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "hd", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[
str,
Literal["auto", "1024x1024", "1536x1024", "1024x1536", "256x256", "512x512", "1792x1024", "1024x1792"],
None,
]
| Omit = omit,
style: Optional[Literal["vivid", "natural"]] | 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.
Expand Down Expand Up @@ -1940,7 +1983,12 @@ async def generate(
partial_images: Optional[int] | Omit = omit,
quality: Optional[Literal["standard", "hd", "low", "medium", "high", "auto"]] | Omit = omit,
response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
size: Optional[str] | Omit = omit,
size: Union[
str,
Literal["auto", "1024x1024", "1536x1024", "1024x1536", "256x256", "512x512", "1792x1024", "1024x1792"],
None,
]
| Omit = omit,
stream: Optional[Literal[False]] | Literal[True] | Omit = omit,
style: Optional[Literal["vivid", "natural"]] | Omit = omit,
user: str | Omit = omit,
Expand Down
2 changes: 1 addition & 1 deletion src/openai/types/image_edit_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class ImageEditParamsBase(TypedDict, total=False):
base64-encoded images.
"""

size: Optional[str]
size: Union[str, Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"], None]
"""The size of the generated images.

For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are
Expand Down
6 changes: 5 additions & 1 deletion src/openai/types/image_generate_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ class ImageGenerateParamsBase(TypedDict, total=False):
models, which always return base64-encoded images.
"""

size: Optional[str]
size: Union[
str,
Literal["auto", "1024x1024", "1536x1024", "1024x1536", "256x256", "512x512", "1792x1024", "1024x1792"],
None,
]
"""The size of the generated images.
For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are
Expand Down
2 changes: 1 addition & 1 deletion src/openai/types/responses/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class ImageGeneration(BaseModel):
One of `low`, `medium`, `high`, or `auto`. Default: `auto`.
"""

size: Optional[str] = None
size: Union[str, Literal["1024x1024", "1024x1536", "1536x1024", "auto"], None] = None
"""The size of the generated images.
For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are
Expand Down
2 changes: 1 addition & 1 deletion src/openai/types/responses/tool_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class ImageGeneration(TypedDict, total=False):
One of `low`, `medium`, `high`, or `auto`. Default: `auto`.
"""

size: str
size: Union[str, Literal["1024x1024", "1024x1536", "1536x1024", "auto"]]
"""The size of the generated images.

For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are
Expand Down
16 changes: 8 additions & 8 deletions tests/api_resources/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_method_edit_with_all_params_overload_1(self, client: OpenAI) -> None:
partial_images=1,
quality="high",
response_format="url",
size="1024x1024",
size="256x256",
stream=False,
user="user-1234",
)
Expand Down Expand Up @@ -140,7 +140,7 @@ def test_method_edit_with_all_params_overload_2(self, client: OpenAI) -> None:
partial_images=1,
quality="high",
response_format="url",
size="1024x1024",
size="256x256",
user="user-1234",
)
image_stream.response.close()
Expand Down Expand Up @@ -192,7 +192,7 @@ def test_method_generate_with_all_params_overload_1(self, client: OpenAI) -> Non
partial_images=1,
quality="medium",
response_format="url",
size="1024x1024",
size="auto",
stream=False,
style="vivid",
user="user-1234",
Expand Down Expand Up @@ -245,7 +245,7 @@ def test_method_generate_with_all_params_overload_2(self, client: OpenAI) -> Non
partial_images=1,
quality="medium",
response_format="url",
size="1024x1024",
size="auto",
style="vivid",
user="user-1234",
)
Expand Down Expand Up @@ -348,7 +348,7 @@ async def test_method_edit_with_all_params_overload_1(self, async_client: AsyncO
partial_images=1,
quality="high",
response_format="url",
size="1024x1024",
size="256x256",
stream=False,
user="user-1234",
)
Expand Down Expand Up @@ -405,7 +405,7 @@ async def test_method_edit_with_all_params_overload_2(self, async_client: AsyncO
partial_images=1,
quality="high",
response_format="url",
size="1024x1024",
size="256x256",
user="user-1234",
)
await image_stream.response.aclose()
Expand Down Expand Up @@ -457,7 +457,7 @@ async def test_method_generate_with_all_params_overload_1(self, async_client: As
partial_images=1,
quality="medium",
response_format="url",
size="1024x1024",
size="auto",
stream=False,
style="vivid",
user="user-1234",
Expand Down Expand Up @@ -510,7 +510,7 @@ async def test_method_generate_with_all_params_overload_2(self, async_client: As
partial_images=1,
quality="medium",
response_format="url",
size="1024x1024",
size="auto",
style="vivid",
user="user-1234",
)
Expand Down
Loading