From f6426b480f07497c19eb3fd6af8e33a7a05e5ba0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 20:58:07 +0000 Subject: [PATCH 1/3] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 201feabd36..d0a34eab82 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 233 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-578515408e7ee6ac115f3768b358ff2cd4f5699cbfb527fe58b19806e7d1f713.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-feda36af0554900ba4ab2b74d82db104f65cfcddf1eef391c55fec82182414f3.yml openapi_spec_hash: b2df68d6233a18b475590978f5682c04 -config_hash: c6cf65d9b19a16ce4313602a2204d48f +config_hash: 632ca30e38686c90bef7622b1a2009ce From 44846536bc3b02c393daa5bae70a85de04c7f621 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 21:26:00 +0000 Subject: [PATCH 2/3] fix(api): fix imagegen `size` enum regression --- .stats.yml | 6 +- src/openai/resources/images.py | 80 ++++++++++++++++++----- src/openai/types/image_edit_params.py | 2 +- src/openai/types/image_generate_params.py | 6 +- src/openai/types/responses/tool.py | 2 +- src/openai/types/responses/tool_param.py | 2 +- tests/api_resources/test_images.py | 16 ++--- 7 files changed, 83 insertions(+), 31 deletions(-) diff --git a/.stats.yml b/.stats.yml index d0a34eab82..f3c3b26134 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 233 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-feda36af0554900ba4ab2b74d82db104f65cfcddf1eef391c55fec82182414f3.yml -openapi_spec_hash: b2df68d6233a18b475590978f5682c04 -config_hash: 632ca30e38686c90bef7622b1a2009ce +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-84d31411083374ec6cdb4a722f8b8b83c1230741157306b1ca7ba1a3cf246672.yml +openapi_spec_hash: 051fce676f959b8207e2317225ec4bdc +config_hash: a2916f18a94ff65c8116ca2fe3256f10 diff --git a/src/openai/resources/images.py b/src/openai/resources/images.py index 6ac622ee1e..8140b5863f 100644 --- a/src/openai/resources/images.py +++ b/src/openai/resources/images.py @@ -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. @@ -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. @@ -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. @@ -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. @@ -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, @@ -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. @@ -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. @@ -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, @@ -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. @@ -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. @@ -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. @@ -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. @@ -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, @@ -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. @@ -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. @@ -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, diff --git a/src/openai/types/image_edit_params.py b/src/openai/types/image_edit_params.py index 3c0e41d572..1bd6dfd320 100644 --- a/src/openai/types/image_edit_params.py +++ b/src/openai/types/image_edit_params.py @@ -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 diff --git a/src/openai/types/image_generate_params.py b/src/openai/types/image_generate_params.py index 4ac573ce61..0c5070b130 100644 --- a/src/openai/types/image_generate_params.py +++ b/src/openai/types/image_generate_params.py @@ -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 diff --git a/src/openai/types/responses/tool.py b/src/openai/types/responses/tool.py index 839ed26ba2..92e6fb29a7 100644 --- a/src/openai/types/responses/tool.py +++ b/src/openai/types/responses/tool.py @@ -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 diff --git a/src/openai/types/responses/tool_param.py b/src/openai/types/responses/tool_param.py index cdbf5bd1ff..7a9a566b16 100644 --- a/src/openai/types/responses/tool_param.py +++ b/src/openai/types/responses/tool_param.py @@ -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 diff --git a/tests/api_resources/test_images.py b/tests/api_resources/test_images.py index 6f6e700517..fa8054c01d 100644 --- a/tests/api_resources/test_images.py +++ b/tests/api_resources/test_images.py @@ -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", ) @@ -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() @@ -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", @@ -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", ) @@ -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", ) @@ -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() @@ -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", @@ -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", ) From e4c90983e6cbd8ada239cebf76b20eecb2eb61f0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 21:26:53 +0000 Subject: [PATCH 3/3] release: 2.35.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/openai/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 517b0cf98a..0c6e1a8623 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.35.0" + ".": "2.35.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index add3d25f2a..5b5e6afda7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/pyproject.toml b/pyproject.toml index 1313a78507..cb8c01191d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/src/openai/_version.py b/src/openai/_version.py index e2c1c47531..7f151cf0cd 100644 --- a/src/openai/_version.py +++ b/src/openai/_version.py @@ -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