Skip to content
Open
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.34.0"
".": "2.35.0"
}
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-21ecab7aeb61612b9da5e52ea4c0cb75a33d443d975022934b9305e97d1a7d62.yml
openapi_spec_hash: cfc868a0bb3567183510c9b5629c510f
config_hash: dd484e2cc01206d26516338d0f4596b0
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-5002c7ce1688cf372f6c268507494c5e6396f38db8d85d79029d949b7bb06fe3.yml
openapi_spec_hash: 92713b0825f6b8760836778e6d27e837
config_hash: c6cf65d9b19a16ce4313602a2204d48f
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 2.35.0 (2026-05-05)

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

### Features

* **api:** launch realtime translate + update image 2 ([0ba55d7](https://github.com/openai/openai-python/commit/0ba55d7569565045426e1587906a70d5682a4bba))
* **api:** manual updates ([72bf67a](https://github.com/openai/openai-python/commit/72bf67acbc9f030c20db3d5a1a74ea6d67d55f51))

## 2.34.0 (2026-05-04)

Full Changelog: [v2.33.0...v2.34.0](https://github.com/openai/openai-python/compare/v2.33.0...v2.34.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.34.0"
version = "2.35.0"
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.34.0" # x-release-please-version
__version__ = "2.35.0" # x-release-please-version
470 changes: 310 additions & 160 deletions src/openai/resources/images.py

Large diffs are not rendered by default.

41 changes: 29 additions & 12 deletions src/openai/types/image_edit_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ 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
`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.
For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
`gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image
should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to
16 images.

For `dall-e-2`, you can only provide one image, and it should be a square `png`
file less than 4MB.
Expand All @@ -34,9 +34,14 @@ class ImageEditParamsBase(TypedDict, total=False):
background: Optional[Literal["transparent", "opaque", "auto"]]
"""
Allows to set transparency for the background of the generated image(s). This
parameter is only supported for the GPT image models. Must be one of
`transparent`, `opaque` or `auto` (default value). When `auto` is used, the
model will automatically determine the best background for the image.
parameter is only supported for GPT image models that support transparent
backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
When `auto` is used, the model will automatically determine the best background
for the image.

`gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
backgrounds. Requests with `background` set to `transparent` will return an
error for these models; use `opaque` or `auto` instead.

If `transparent`, the output format needs to support transparency, so it should
be set to either `png` (default value) or `webp`.
Expand All @@ -59,7 +64,12 @@ class ImageEditParamsBase(TypedDict, total=False):
"""

model: Union[str, ImageModel, None]
"""The model to use for image generation. Defaults to `gpt-image-1.5`."""
"""The model to use for image generation.

One of `dall-e-2` or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`,
`gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`, or
`chatgpt-image-latest`). Defaults to `gpt-image-1.5`.
"""

n: Optional[int]
"""The number of images to generate. Must be between 1 and 10."""
Expand Down Expand Up @@ -104,12 +114,19 @@ class ImageEditParamsBase(TypedDict, total=False):
base64-encoded images.
"""

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

Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or
`auto` (default value) for the GPT image models, and one of `256x256`,
`512x512`, or `1024x1024` for `dall-e-2`.
For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are
supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height
must both be divisible by 16 and the requested aspect ratio must be between 1:3
and 3:1. Resolutions above `2560x1440` are experimental, and the maximum
supported resolution is `3840x2160`. The requested size must also satisfy the
model's current pixel and edge limits. The standard sizes `1024x1024`,
`1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is
supported for models that allow automatic sizing. For `dall-e-2`, use one of
`256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`,
`1792x1024`, or `1024x1792`.
"""

user: str
Expand Down
34 changes: 22 additions & 12 deletions src/openai/types/image_generate_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ class ImageGenerateParamsBase(TypedDict, total=False):
background: Optional[Literal["transparent", "opaque", "auto"]]
"""
Allows to set transparency for the background of the generated image(s). This
parameter is only supported for the GPT image models. Must be one of
`transparent`, `opaque` or `auto` (default value). When `auto` is used, the
model will automatically determine the best background for the image.
parameter is only supported for GPT image models that support transparent
backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
When `auto` is used, the model will automatically determine the best background
for the image.

`gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
backgrounds. Requests with `background` set to `transparent` will return an
error for these models; use `opaque` or `auto` instead.

If `transparent`, the output format needs to support transparency, so it should
be set to either `png` (default value) or `webp`.
Expand All @@ -33,8 +38,9 @@ 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
specific to the GPT image models is used.
`gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, or
`gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific to
the GPT image models is used.
"""

moderation: Optional[Literal["low", "auto"]]
Expand Down Expand Up @@ -94,15 +100,19 @@ class ImageGenerateParamsBase(TypedDict, total=False):
models, which always return base64-encoded images.
"""

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

Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or
`auto` (default value) for the GPT image models, one of `256x256`, `512x512`, or
`1024x1024` for `dall-e-2`, and one of `1024x1024`, `1792x1024`, or `1024x1792`
for `dall-e-3`.
For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are
supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height
must both be divisible by 16 and the requested aspect ratio must be between 1:3
and 3:1. Resolutions above `2560x1440` are experimental, and the maximum
supported resolution is `3840x2160`. The requested size must also satisfy the
model's current pixel and edge limits. The standard sizes `1024x1024`,
`1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is
supported for models that allow automatic sizing. For `dall-e-2`, use one of
`256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`,
`1792x1024`, or `1024x1792`.
"""

style: Optional[Literal["vivid", "natural"]]
Expand Down
11 changes: 10 additions & 1 deletion src/openai/types/image_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@

__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",
"gpt-image-1-mini",
"gpt-image-2",
"gpt-image-2-2026-04-21",
"gpt-image-1.5",
"chatgpt-image-latest",
"dall-e-2",
"dall-e-3",
]
46 changes: 38 additions & 8 deletions src/openai/types/responses/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,19 @@ class ImageGeneration(BaseModel):
"""Whether to generate a new image or edit an existing image. Default: `auto`."""

background: Optional[Literal["transparent", "opaque", "auto"]] = None
"""Background type for the generated image.

One of `transparent`, `opaque`, or `auto`. Default: `auto`.
"""
Allows to set transparency for the background of the generated image(s). This
parameter is only supported for GPT image models that support transparent
backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
When `auto` is used, the model will automatically determine the best background
for the image.

`gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
backgrounds. Requests with `background` set to `transparent` will return an
error for these models; use `opaque` or `auto` instead.

If `transparent`, the output format needs to support transparency, so it should
be set to either `png` (default value) or `webp`.
"""

input_fidelity: Optional[Literal["high", "low"]] = None
Expand All @@ -267,7 +277,18 @@ 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-2",
"gpt-image-2-2026-04-21",
"gpt-image-1.5",
"chatgpt-image-latest",
],
None,
] = None
"""The image generation model to use. Default: `gpt-image-1`."""

moderation: Optional[Literal["auto", "low"]] = None
Expand All @@ -294,10 +315,19 @@ class ImageGeneration(BaseModel):
One of `low`, `medium`, `high`, or `auto`. Default: `auto`.
"""

size: Optional[Literal["1024x1024", "1024x1536", "1536x1024", "auto"]] = None
"""The size of the generated image.

One of `1024x1024`, `1024x1536`, `1536x1024`, or `auto`. Default: `auto`.
size: Optional[str] = None
"""The size of the generated images.

For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are
supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height
must both be divisible by 16 and the requested aspect ratio must be between 1:3
and 3:1. Resolutions above `2560x1440` are experimental, and the maximum
supported resolution is `3840x2160`. The requested size must also satisfy the
model's current pixel and edge limits. The standard sizes `1024x1024`,
`1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is
supported for models that allow automatic sizing. For `dall-e-2`, use one of
`256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`,
`1792x1024`, or `1024x1792`.
"""


Expand Down
45 changes: 37 additions & 8 deletions src/openai/types/responses/tool_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,19 @@ class ImageGeneration(TypedDict, total=False):
"""Whether to generate a new image or edit an existing image. Default: `auto`."""

background: Literal["transparent", "opaque", "auto"]
"""Background type for the generated image.

One of `transparent`, `opaque`, or `auto`. Default: `auto`.
"""
Allows to set transparency for the background of the generated image(s). This
parameter is only supported for GPT image models that support transparent
backgrounds. Must be one of `transparent`, `opaque`, or `auto` (default value).
When `auto` is used, the model will automatically determine the best background
for the image.

`gpt-image-2` and `gpt-image-2-2026-04-21` do not support transparent
backgrounds. Requests with `background` set to `transparent` will return an
error for these models; use `opaque` or `auto` instead.

If `transparent`, the output format needs to support transparency, so it should
be set to either `png` (default value) or `webp`.
"""

input_fidelity: Optional[Literal["high", "low"]]
Expand All @@ -267,7 +277,17 @@ 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-2",
"gpt-image-2-2026-04-21",
"gpt-image-1.5",
"chatgpt-image-latest",
],
]
"""The image generation model to use. Default: `gpt-image-1`."""

moderation: Literal["auto", "low"]
Expand All @@ -294,10 +314,19 @@ class ImageGeneration(TypedDict, total=False):
One of `low`, `medium`, `high`, or `auto`. Default: `auto`.
"""

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

One of `1024x1024`, `1024x1536`, `1536x1024`, or `auto`. Default: `auto`.
size: str
"""The size of the generated images.

For `gpt-image-2` and `gpt-image-2-2026-04-21`, arbitrary resolutions are
supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height
must both be divisible by 16 and the requested aspect ratio must be between 1:3
and 3:1. Resolutions above `2560x1440` are experimental, and the maximum
supported resolution is `3840x2160`. The requested size must also satisfy the
model's current pixel and edge limits. The standard sizes `1024x1024`,
`1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is
supported for models that allow automatic sizing. For `dall-e-2`, use one of
`256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`,
`1792x1024`, or `1024x1792`.
"""


Expand Down
Loading
Loading