From a05d925840dddb008c5ffaf62c64228e77652377 Mon Sep 17 00:00:00 2001 From: Test User Date: Fri, 24 Apr 2026 15:09:05 -0500 Subject: [PATCH] types: add gpt-image-2 to ImageModel literal and docstrings - Add 'gpt-image-2' to ImageModel Literal in image_model.py - Update ImageGeneration.model Literal in responses/tool.py and tool_param.py - Update docstrings in image_generate_params.py and image_edit_params.py to mention gpt-image-2 - Update input_fidelity documentation to clarify support for gpt-image-1.5 and later models This resolves issue #3114 where gpt-image-2 (GA'd on 2026-04-21 for Azure) was missing from the SDK's type definitions, causing type-checker errors despite runtime support. --- src/openai/types/image_edit_params.py | 4 ++-- src/openai/types/image_generate_params.py | 2 +- src/openai/types/image_model.py | 2 +- src/openai/types/responses/tool.py | 4 ++-- src/openai/types/responses/tool_param.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/openai/types/image_edit_params.py b/src/openai/types/image_edit_params.py index 05f3401d2d..b423e5c6a0 100644 --- a/src/openai/types/image_edit_params.py +++ b/src/openai/types/image_edit_params.py @@ -15,7 +15,7 @@ class ImageEditParamsBase(TypedDict, total=False): image: Required[Union[FileTypes, SequenceNotStr[FileTypes]]] """The image(s) to edit. Must be a supported image file or an array of images. - For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and + For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-2`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16 images. `chatgpt-image-latest` follows the same input constraints as GPT image models. @@ -46,7 +46,7 @@ class ImageEditParamsBase(TypedDict, total=False): """ Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported - for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for + for `gpt-image-1.5` and later models (including `gpt-image-2`), unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`. """ diff --git a/src/openai/types/image_generate_params.py b/src/openai/types/image_generate_params.py index 7a95b3dd3d..11b1e46a23 100644 --- a/src/openai/types/image_generate_params.py +++ b/src/openai/types/image_generate_params.py @@ -33,7 +33,7 @@ class ImageGenerateParamsBase(TypedDict, total=False): """The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image model (`gpt-image-1`, - `gpt-image-1-mini`, `gpt-image-1.5`). Defaults to `dall-e-2` unless a parameter + `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`). Defaults to `dall-e-2` unless a parameter specific to the GPT image models is used. """ diff --git a/src/openai/types/image_model.py b/src/openai/types/image_model.py index 8ea486fbb6..7094ffe162 100644 --- a/src/openai/types/image_model.py +++ b/src/openai/types/image_model.py @@ -4,4 +4,4 @@ __all__ = ["ImageModel"] -ImageModel: TypeAlias = Literal["gpt-image-1.5", "dall-e-2", "dall-e-3", "gpt-image-1", "gpt-image-1-mini"] +ImageModel: TypeAlias = Literal["gpt-image-1.5", "dall-e-2", "dall-e-3", "gpt-image-1", "gpt-image-1-mini", "gpt-image-2"] diff --git a/src/openai/types/responses/tool.py b/src/openai/types/responses/tool.py index 34120a287e..8e5db851d8 100644 --- a/src/openai/types/responses/tool.py +++ b/src/openai/types/responses/tool.py @@ -257,7 +257,7 @@ class ImageGeneration(BaseModel): """ Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported - for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for + for `gpt-image-1.5` and later models (including `gpt-image-2`), unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`. """ @@ -267,7 +267,7 @@ class ImageGeneration(BaseModel): Contains `image_url` (string, optional) and `file_id` (string, optional). """ - model: Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-1.5"], None] = None + model: Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-1.5", "gpt-image-2"], None] = None """The image generation model to use. Default: `gpt-image-1`.""" moderation: Optional[Literal["auto", "low"]] = None diff --git a/src/openai/types/responses/tool_param.py b/src/openai/types/responses/tool_param.py index c0f33c4513..503d7be912 100644 --- a/src/openai/types/responses/tool_param.py +++ b/src/openai/types/responses/tool_param.py @@ -257,7 +257,7 @@ class ImageGeneration(TypedDict, total=False): """ Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported - for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for + for `gpt-image-1.5` and later models (including `gpt-image-2`), unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`. """ @@ -267,7 +267,7 @@ class ImageGeneration(TypedDict, total=False): Contains `image_url` (string, optional) and `file_id` (string, optional). """ - model: Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-1.5"]] + model: Union[str, Literal["gpt-image-1", "gpt-image-1-mini", "gpt-image-1.5", "gpt-image-2"]] """The image generation model to use. Default: `gpt-image-1`.""" moderation: Literal["auto", "low"]