Skip to content

Commit 1d8a9a9

Browse files
feat(api): gpt-image-1.5
1 parent dd0b43f commit 1d8a9a9

22 files changed

+482
-305
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 136
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fe8e67bdc351a518b113ab48e775750190e207807903d6b03ab22c438c38a588.yml
3-
openapi_spec_hash: 8af972190647ffb9dcec516e19d8761a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-cded37ac004364c2110ebdacf922ef611b3c51258790c72ca479dcfad4df66aa.yml
3+
openapi_spec_hash: 6e615d34cf8c6bc76e0c6933fc8569af
44
config_hash: d013f4fdd4dd59c6f376a9ca482b7f9e

lib/openai/models/image.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ module OpenAI
44
module Models
55
class Image < OpenAI::Internal::Type::BaseModel
66
# @!attribute b64_json
7-
# The base64-encoded JSON of the generated image. Default value for `gpt-image-1`,
8-
# and only present if `response_format` is set to `b64_json` for `dall-e-2` and
9-
# `dall-e-3`.
7+
# The base64-encoded JSON of the generated image. Returned by default for the GPT
8+
# image models, and only present if `response_format` is set to `b64_json` for
9+
# `dall-e-2` and `dall-e-3`.
1010
#
1111
# @return [String, nil]
1212
optional :b64_json, String
@@ -19,8 +19,8 @@ class Image < OpenAI::Internal::Type::BaseModel
1919

2020
# @!attribute url
2121
# When using `dall-e-2` or `dall-e-3`, the URL of the generated image if
22-
# `response_format` is set to `url` (default value). Unsupported for
23-
# `gpt-image-1`.
22+
# `response_format` is set to `url` (default value). Unsupported for the GPT image
23+
# models.
2424
#
2525
# @return [String, nil]
2626
optional :url, String
@@ -31,7 +31,7 @@ class Image < OpenAI::Internal::Type::BaseModel
3131
#
3232
# Represents the content or the URL of an image generated by the OpenAI API.
3333
#
34-
# @param b64_json [String] The base64-encoded JSON of the generated image. Default value for `gpt-image-1`,
34+
# @param b64_json [String] The base64-encoded JSON of the generated image. Returned by default for the GPT
3535
#
3636
# @param revised_prompt [String] For `dall-e-3` only, the revised prompt that was used to generate the image.
3737
#

lib/openai/models/image_edit_completed_event.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class ImageEditCompletedEvent < OpenAI::Internal::Type::BaseModel
4646
required :type, const: :"image_edit.completed"
4747

4848
# @!attribute usage
49-
# For `gpt-image-1` only, the token usage information for the image generation.
49+
# For the GPT image models only, the token usage information for the image
50+
# generation.
5051
#
5152
# @return [OpenAI::Models::ImageEditCompletedEvent::Usage]
5253
required :usage, -> { OpenAI::ImageEditCompletedEvent::Usage }
@@ -69,7 +70,7 @@ class ImageEditCompletedEvent < OpenAI::Internal::Type::BaseModel
6970
#
7071
# @param size [Symbol, OpenAI::Models::ImageEditCompletedEvent::Size] The size of the edited image.
7172
#
72-
# @param usage [OpenAI::Models::ImageEditCompletedEvent::Usage] For `gpt-image-1` only, the token usage information for the image generation.
73+
# @param usage [OpenAI::Models::ImageEditCompletedEvent::Usage] For the GPT image models only, the token usage information for the image generat
7374
#
7475
# @param type [Symbol, :"image_edit.completed"] The type of the event. Always `image_edit.completed`.
7576

@@ -161,7 +162,8 @@ class Usage < OpenAI::Internal::Type::BaseModel
161162
# Some parameter documentations has been truncated, see
162163
# {OpenAI::Models::ImageEditCompletedEvent::Usage} for more details.
163164
#
164-
# For `gpt-image-1` only, the token usage information for the image generation.
165+
# For the GPT image models only, the token usage information for the image
166+
# generation.
165167
#
166168
# @param input_tokens [Integer] The number of tokens (images and text) in the input prompt.
167169
#

lib/openai/models/image_edit_params.rb

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel
1212
# @!attribute image
1313
# The image(s) to edit. Must be a supported image file or an array of images.
1414
#
15-
# For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
15+
# For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and
16+
# `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than
1617
# 50MB. You can provide up to 16 images.
1718
#
1819
# For `dall-e-2`, you can only provide one image, and it should be a square `png`
@@ -23,16 +24,16 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel
2324

2425
# @!attribute prompt
2526
# A text description of the desired image(s). The maximum length is 1000
26-
# characters for `dall-e-2`, and 32000 characters for `gpt-image-1`.
27+
# characters for `dall-e-2`, and 32000 characters for the GPT image models.
2728
#
2829
# @return [String]
2930
required :prompt, String
3031

3132
# @!attribute background
3233
# Allows to set transparency for the background of the generated image(s). This
33-
# parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
34-
# `opaque` or `auto` (default value). When `auto` is used, the model will
35-
# automatically determine the best background for the image.
34+
# parameter is only supported for the GPT image models. Must be one of
35+
# `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
36+
# model will automatically determine the best background for the image.
3637
#
3738
# If `transparent`, the output format needs to support transparency, so it should
3839
# be set to either `png` (default value) or `webp`.
@@ -59,9 +60,9 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel
5960
optional :mask, OpenAI::Internal::Type::FileInput
6061

6162
# @!attribute model
62-
# The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are
63-
# supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1`
64-
# is used.
63+
# The model to use for image generation. Only `dall-e-2` and the GPT image models
64+
# are supported. Defaults to `dall-e-2` unless a parameter specific to the GPT
65+
# image models is used.
6566
#
6667
# @return [String, Symbol, OpenAI::Models::ImageModel, nil]
6768
optional :model, union: -> { OpenAI::ImageEditParams::Model }, nil?: true
@@ -74,15 +75,15 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel
7475

7576
# @!attribute output_compression
7677
# The compression level (0-100%) for the generated images. This parameter is only
77-
# supported for `gpt-image-1` with the `webp` or `jpeg` output formats, and
78+
# supported for the GPT image models with the `webp` or `jpeg` output formats, and
7879
# defaults to 100.
7980
#
8081
# @return [Integer, nil]
8182
optional :output_compression, Integer, nil?: true
8283

8384
# @!attribute output_format
8485
# The format in which the generated images are returned. This parameter is only
85-
# supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. The
86+
# supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. The
8687
# default value is `png`.
8788
#
8889
# @return [Symbol, OpenAI::Models::ImageEditParams::OutputFormat, nil]
@@ -101,25 +102,25 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel
101102

102103
# @!attribute quality
103104
# The quality of the image that will be generated. `high`, `medium` and `low` are
104-
# only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
105-
# Defaults to `auto`.
105+
# only supported for the GPT image models. `dall-e-2` only supports `standard`
106+
# quality. Defaults to `auto`.
106107
#
107108
# @return [Symbol, OpenAI::Models::ImageEditParams::Quality, nil]
108109
optional :quality, enum: -> { OpenAI::ImageEditParams::Quality }, nil?: true
109110

110111
# @!attribute response_format
111112
# The format in which the generated images are returned. Must be one of `url` or
112113
# `b64_json`. URLs are only valid for 60 minutes after the image has been
113-
# generated. This parameter is only supported for `dall-e-2`, as `gpt-image-1`
114-
# will always return base64-encoded images.
114+
# generated. This parameter is only supported for `dall-e-2`, as the GPT image
115+
# models always return base64-encoded images.
115116
#
116117
# @return [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil]
117118
optional :response_format, enum: -> { OpenAI::ImageEditParams::ResponseFormat }, nil?: true
118119

119120
# @!attribute size
120121
# The size of the generated images. Must be one of `1024x1024`, `1536x1024`
121-
# (landscape), `1024x1536` (portrait), or `auto` (default value) for
122-
# `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
122+
# (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
123+
# models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
123124
#
124125
# @return [Symbol, OpenAI::Models::ImageEditParams::Size, nil]
125126
optional :size, enum: -> { OpenAI::ImageEditParams::Size }, nil?: true
@@ -146,7 +147,7 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel
146147
#
147148
# @param mask [Pathname, StringIO, IO, String, OpenAI::FilePart] An additional image whose fully transparent areas (e.g. where alpha is zero) ind
148149
#
149-
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are sup
150+
# @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. Only `dall-e-2` and the GPT image models
150151
#
151152
# @param n [Integer, nil] The number of images to generate. Must be between 1 and 10.
152153
#
@@ -168,7 +169,8 @@ class ImageEditParams < OpenAI::Internal::Type::BaseModel
168169

169170
# The image(s) to edit. Must be a supported image file or an array of images.
170171
#
171-
# For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
172+
# For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and
173+
# `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg` file less than
172174
# 50MB. You can provide up to 16 images.
173175
#
174176
# For `dall-e-2`, you can only provide one image, and it should be a square `png`
@@ -188,9 +190,9 @@ module Image
188190
end
189191

190192
# Allows to set transparency for the background of the generated image(s). This
191-
# parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
192-
# `opaque` or `auto` (default value). When `auto` is used, the model will
193-
# automatically determine the best background for the image.
193+
# parameter is only supported for the GPT image models. Must be one of
194+
# `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
195+
# model will automatically determine the best background for the image.
194196
#
195197
# If `transparent`, the output format needs to support transparency, so it should
196198
# be set to either `png` (default value) or `webp`.
@@ -219,23 +221,23 @@ module InputFidelity
219221
# @return [Array<Symbol>]
220222
end
221223

222-
# The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are
223-
# supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1`
224-
# is used.
224+
# The model to use for image generation. Only `dall-e-2` and the GPT image models
225+
# are supported. Defaults to `dall-e-2` unless a parameter specific to the GPT
226+
# image models is used.
225227
module Model
226228
extend OpenAI::Internal::Type::Union
227229

228230
variant String
229231

230-
# The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1` is used.
232+
# The model to use for image generation. Only `dall-e-2` and the GPT image models are supported. Defaults to `dall-e-2` unless a parameter specific to the GPT image models is used.
231233
variant enum: -> { OpenAI::ImageModel }
232234

233235
# @!method self.variants
234236
# @return [Array(String, Symbol, OpenAI::Models::ImageModel)]
235237
end
236238

237239
# The format in which the generated images are returned. This parameter is only
238-
# supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. The
240+
# supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. The
239241
# default value is `png`.
240242
module OutputFormat
241243
extend OpenAI::Internal::Type::Enum
@@ -249,8 +251,8 @@ module OutputFormat
249251
end
250252

251253
# The quality of the image that will be generated. `high`, `medium` and `low` are
252-
# only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
253-
# Defaults to `auto`.
254+
# only supported for the GPT image models. `dall-e-2` only supports `standard`
255+
# quality. Defaults to `auto`.
254256
module Quality
255257
extend OpenAI::Internal::Type::Enum
256258

@@ -266,8 +268,8 @@ module Quality
266268

267269
# The format in which the generated images are returned. Must be one of `url` or
268270
# `b64_json`. URLs are only valid for 60 minutes after the image has been
269-
# generated. This parameter is only supported for `dall-e-2`, as `gpt-image-1`
270-
# will always return base64-encoded images.
271+
# generated. This parameter is only supported for `dall-e-2`, as the GPT image
272+
# models always return base64-encoded images.
271273
module ResponseFormat
272274
extend OpenAI::Internal::Type::Enum
273275

@@ -279,8 +281,8 @@ module ResponseFormat
279281
end
280282

281283
# The size of the generated images. Must be one of `1024x1024`, `1536x1024`
282-
# (landscape), `1024x1536` (portrait), or `auto` (default value) for
283-
# `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
284+
# (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image
285+
# models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
284286
module Size
285287
extend OpenAI::Internal::Type::Enum
286288

lib/openai/models/image_gen_completed_event.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class ImageGenCompletedEvent < OpenAI::Internal::Type::BaseModel
4646
required :type, const: :"image_generation.completed"
4747

4848
# @!attribute usage
49-
# For `gpt-image-1` only, the token usage information for the image generation.
49+
# For the GPT image models only, the token usage information for the image
50+
# generation.
5051
#
5152
# @return [OpenAI::Models::ImageGenCompletedEvent::Usage]
5253
required :usage, -> { OpenAI::ImageGenCompletedEvent::Usage }
@@ -69,7 +70,7 @@ class ImageGenCompletedEvent < OpenAI::Internal::Type::BaseModel
6970
#
7071
# @param size [Symbol, OpenAI::Models::ImageGenCompletedEvent::Size] The size of the generated image.
7172
#
72-
# @param usage [OpenAI::Models::ImageGenCompletedEvent::Usage] For `gpt-image-1` only, the token usage information for the image generation.
73+
# @param usage [OpenAI::Models::ImageGenCompletedEvent::Usage] For the GPT image models only, the token usage information for the image generat
7374
#
7475
# @param type [Symbol, :"image_generation.completed"] The type of the event. Always `image_generation.completed`.
7576

@@ -161,7 +162,8 @@ class Usage < OpenAI::Internal::Type::BaseModel
161162
# Some parameter documentations has been truncated, see
162163
# {OpenAI::Models::ImageGenCompletedEvent::Usage} for more details.
163164
#
164-
# For `gpt-image-1` only, the token usage information for the image generation.
165+
# For the GPT image models only, the token usage information for the image
166+
# generation.
165167
#
166168
# @param input_tokens [Integer] The number of tokens (images and text) in the input prompt.
167169
#

0 commit comments

Comments
 (0)