openai 0.86.0 → 0.87.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +10 -1
  4. data/examples/audio/record_and_play.rb +19 -0
  5. data/examples/responses/websocket_workflows.rb +159 -0
  6. data/lib/openai/helpers/local_audio/errors.rb +27 -0
  7. data/lib/openai/helpers/local_audio/process.rb +158 -0
  8. data/lib/openai/helpers/local_audio.rb +157 -0
  9. data/lib/openai/helpers/realtime/connection.rb +20 -2
  10. data/lib/openai/helpers/realtime/errors.rb +18 -0
  11. data/lib/openai/helpers/realtime/recovery.rb +489 -0
  12. data/lib/openai/helpers/realtime/resources/realtime_extension.rb +26 -1
  13. data/lib/openai/helpers/realtime.rb +1 -0
  14. data/lib/openai/models/beta/beta_response_input_item.rb +84 -1
  15. data/lib/openai/models/beta/beta_response_item.rb +72 -1
  16. data/lib/openai/models/beta/beta_response_output_item.rb +84 -1
  17. data/lib/openai/models/beta/beta_responses_client_event.rb +3 -0
  18. data/lib/openai/models/beta/beta_tool.rb +69 -37
  19. data/lib/openai/models/beta/response_create_params.rb +3 -0
  20. data/lib/openai/models/conversations/conversation_item.rb +82 -1
  21. data/lib/openai/models/image_edit_completed_event.rb +34 -8
  22. data/lib/openai/models/image_edit_params.rb +64 -44
  23. data/lib/openai/models/image_edit_partial_image_event.rb +34 -8
  24. data/lib/openai/models/image_gen_completed_event.rb +34 -8
  25. data/lib/openai/models/image_gen_partial_image_event.rb +34 -8
  26. data/lib/openai/models/image_generate_params.rb +51 -35
  27. data/lib/openai/models/image_model.rb +4 -0
  28. data/lib/openai/models/images_response.rb +37 -13
  29. data/lib/openai/models/responses/response_create_params.rb +3 -0
  30. data/lib/openai/models/responses/response_input_item.rb +84 -1
  31. data/lib/openai/models/responses/response_item.rb +72 -1
  32. data/lib/openai/models/responses/response_output_item.rb +84 -1
  33. data/lib/openai/models/responses/responses_client_event.rb +3 -0
  34. data/lib/openai/models/responses/tool.rb +69 -37
  35. data/lib/openai/models/webhooks/live_call_incoming_webhook_event.rb +3 -3
  36. data/lib/openai/models/webhooks/realtime_call_incoming_webhook_event.rb +5 -3
  37. data/lib/openai/resources/images.rb +12 -14
  38. data/lib/openai/version.rb +1 -1
  39. data/local-audio.md +146 -0
  40. data/rbi/openai/helpers/local_audio/interface.rbi +110 -0
  41. data/rbi/openai/helpers/realtime/connection.rbi +18 -2
  42. data/rbi/openai/helpers/realtime/extensions.rbi +8 -0
  43. data/rbi/openai/helpers/realtime/recovery.rbi +27 -0
  44. data/rbi/openai/models/beta/beta_response_input_item.rbi +86 -1
  45. data/rbi/openai/models/beta/beta_response_item.rbi +78 -1
  46. data/rbi/openai/models/beta/beta_response_output_item.rbi +84 -1
  47. data/rbi/openai/models/beta/beta_responses_client_event.rbi +6 -0
  48. data/rbi/openai/models/beta/beta_tool.rbi +90 -51
  49. data/rbi/openai/models/beta/response_create_params.rbi +6 -0
  50. data/rbi/openai/models/conversations/conversation_item.rbi +88 -1
  51. data/rbi/openai/models/image_edit_completed_event.rbi +20 -9
  52. data/rbi/openai/models/image_edit_params.rbi +89 -60
  53. data/rbi/openai/models/image_edit_partial_image_event.rbi +20 -9
  54. data/rbi/openai/models/image_gen_completed_event.rbi +20 -9
  55. data/rbi/openai/models/image_gen_partial_image_event.rbi +20 -9
  56. data/rbi/openai/models/image_generate_params.rbi +71 -48
  57. data/rbi/openai/models/image_model.rbi +4 -0
  58. data/rbi/openai/models/images_response.rbi +27 -16
  59. data/rbi/openai/models/responses/response_create_params.rbi +6 -0
  60. data/rbi/openai/models/responses/response_input_item.rbi +88 -1
  61. data/rbi/openai/models/responses/response_item.rbi +80 -1
  62. data/rbi/openai/models/responses/response_output_item.rbi +84 -1
  63. data/rbi/openai/models/responses/responses_client_event.rbi +6 -0
  64. data/rbi/openai/models/responses/tool.rbi +90 -51
  65. data/rbi/openai/models/webhooks/live_call_incoming_webhook_event.rbi +4 -4
  66. data/rbi/openai/models/webhooks/realtime_call_incoming_webhook_event.rbi +8 -4
  67. data/rbi/openai/resources/beta/responses.rbi +6 -2
  68. data/rbi/openai/resources/images.rbi +106 -76
  69. data/rbi/openai/resources/responses.rbi +6 -0
  70. data/realtime.md +101 -0
  71. data/responses-websocket.md +182 -0
  72. data/sig/openai/helpers/local_audio/interface.rbs +62 -0
  73. data/sig/openai/helpers/realtime/connection.rbs +9 -1
  74. data/sig/openai/helpers/realtime/extensions.rbs +4 -0
  75. data/sig/openai/helpers/realtime/recovery.rbs +19 -0
  76. data/sig/openai/models/beta/beta_response_input_item.rbs +39 -2
  77. data/sig/openai/models/beta/beta_response_item.rbs +39 -2
  78. data/sig/openai/models/beta/beta_response_output_item.rbs +39 -2
  79. data/sig/openai/models/beta/beta_tool.rbs +11 -1
  80. data/sig/openai/models/conversations/conversation_item.rbs +39 -2
  81. data/sig/openai/models/image_edit_completed_event.rbs +11 -4
  82. data/sig/openai/models/image_edit_params.rbs +3 -1
  83. data/sig/openai/models/image_edit_partial_image_event.rbs +11 -4
  84. data/sig/openai/models/image_gen_completed_event.rbs +11 -4
  85. data/sig/openai/models/image_gen_partial_image_event.rbs +11 -4
  86. data/sig/openai/models/image_generate_params.rbs +4 -1
  87. data/sig/openai/models/image_model.rbs +8 -0
  88. data/sig/openai/models/images_response.rbs +10 -4
  89. data/sig/openai/models/responses/response_input_item.rbs +39 -2
  90. data/sig/openai/models/responses/response_item.rbs +39 -2
  91. data/sig/openai/models/responses/response_output_item.rbs +39 -2
  92. data/sig/openai/models/responses/tool.rbs +11 -1
  93. metadata +15 -1
@@ -13,9 +13,11 @@ module OpenAI
13
13
  # The image(s) to edit. Must be a supported image file or an array of images.
14
14
  #
15
15
  # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
16
- # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image
17
- # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to
18
- # 16 images.
16
+ # `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
17
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
18
+ # `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`), each image should
19
+ # be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
20
+ # images.
19
21
  #
20
22
  # For `dall-e-2`, you can only provide one image, and it should be a square `png`
21
23
  # file less than 4MB.
@@ -39,9 +41,11 @@ module OpenAI
39
41
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
40
42
  # the model will automatically determine the best background for the image.
41
43
  #
42
- # Transparent backgrounds are available for supported GPT Image models. For
43
- # `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
44
- # using `transparent`, set the output format to `png` or `webp`.
44
+ # `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
45
+ # snapshots, support `opaque` and `transparent` backgrounds. Transparent
46
+ # backgrounds are available for supported GPT Image models. For `gpt-image-2` and
47
+ # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
48
+ # set the output format to `png` or `webp`.
45
49
  #
46
50
  # @return [Symbol, OpenAI::Models::ImageEditParams::Background, nil]
47
51
  optional :background, enum: -> { OpenAI::ImageEditParams::Background }, nil?: true
@@ -71,7 +75,9 @@ module OpenAI
71
75
  # @!attribute model
72
76
  # The model to use for image generation. One of `dall-e-2` or a GPT image model
73
77
  # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
74
- # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to
78
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
79
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
80
+ # `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`). Defaults to
75
81
  # `gpt-image-1.5`.
76
82
  #
77
83
  # @return [String, Symbol, OpenAI::Models::ImageModel, nil]
@@ -111,8 +117,10 @@ module OpenAI
111
117
  optional :partial_images, Integer, nil?: true
112
118
 
113
119
  # @!attribute quality
114
- # The quality of the image that will be generated for GPT image models. Defaults
115
- # to `auto`.
120
+ # The quality of the image that will be generated for GPT image models. The GPT
121
+ # image models support `low`, `medium`, and `high`. `gpt-image-2.5-sunburst` and
122
+ # `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support
123
+ # `xhigh` and `max`. Defaults to `auto`.
116
124
  #
117
125
  # @return [Symbol, OpenAI::Models::ImageEditParams::Quality, nil]
118
126
  optional :quality, enum: -> { OpenAI::ImageEditParams::Quality }, nil?: true
@@ -127,17 +135,18 @@ module OpenAI
127
135
  optional :response_format, enum: -> { OpenAI::ImageEditParams::ResponseFormat }, nil?: true
128
136
 
129
137
  # @!attribute size
130
- # The size of the generated images. For `gpt-image-2` and
131
- # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
132
- # strings, for example `1536x864`. Width and height must both be divisible by 16
133
- # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
134
- # `2560x1440` are experimental, and the maximum supported resolution is
135
- # `3840x2160`. The requested size must also satisfy the model's current pixel and
136
- # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
137
- # supported by the GPT image models; `auto` is supported for models that allow
138
- # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
139
- # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
140
- # `1024x1792`.
138
+ # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
139
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
140
+ # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
141
+ # resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
142
+ # Width and height must both be divisible by 16 and the requested aspect ratio
143
+ # must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
144
+ # the maximum supported resolution is `3840x2160`. The requested size must also
145
+ # satisfy the model's current pixel and edge limits. The standard sizes
146
+ # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
147
+ # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
148
+ # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
149
+ # `1024x1024`, `1792x1024`, or `1024x1792`.
141
150
  #
142
151
  # @return [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil]
143
152
  optional :size, union: -> { OpenAI::ImageEditParams::Size }, nil?: true
@@ -158,7 +167,7 @@ module OpenAI
158
167
  #
159
168
  # @param prompt [String] A text description of the desired image(s). The maximum length is 1000 character
160
169
  #
161
- # @param background [Symbol, OpenAI::Models::ImageEditParams::Background, nil] Allows to set transparency for the background of the generated image(s).
170
+ # @param background [Symbol, OpenAI::Models::ImageEditParams::Background, nil] Allows to set transparency for the background of the generated image(s). Must
162
171
  #
163
172
  # @param input_fidelity [Symbol, OpenAI::Models::ImageEditParams::InputFidelity, nil] Control how much effort the model will exert to match the style and features, es
164
173
  #
@@ -174,11 +183,11 @@ module OpenAI
174
183
  #
175
184
  # @param partial_images [Integer, nil] The number of partial images to generate. This parameter is used for
176
185
  #
177
- # @param quality [Symbol, OpenAI::Models::ImageEditParams::Quality, nil] The quality of the image that will be generated for GPT image models. Defaults t
186
+ # @param quality [Symbol, OpenAI::Models::ImageEditParams::Quality, nil] The quality of the image that will be generated for GPT image models. The GPT im
178
187
  #
179
188
  # @param response_format [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil] The format in which the generated images are returned. Must be one of `url` or `
180
189
  #
181
- # @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`
190
+ # @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil] The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `
182
191
  #
183
192
  # @param user [String] A unique identifier representing your end-user, which can help OpenAI to monitor
184
193
  #
@@ -187,9 +196,11 @@ module OpenAI
187
196
  # The image(s) to edit. Must be a supported image file or an array of images.
188
197
  #
189
198
  # For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`,
190
- # `gpt-image-2`, `gpt-image-2-2026-04-21`, and `chatgpt-image-latest`), each image
191
- # should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to
192
- # 16 images.
199
+ # `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
200
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
201
+ # `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`), each image should
202
+ # be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to 16
203
+ # images.
193
204
  #
194
205
  # For `dall-e-2`, you can only provide one image, and it should be a square `png`
195
206
  # file less than 4MB.
@@ -211,9 +222,11 @@ module OpenAI
211
222
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
212
223
  # the model will automatically determine the best background for the image.
213
224
  #
214
- # Transparent backgrounds are available for supported GPT Image models. For
215
- # `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
216
- # using `transparent`, set the output format to `png` or `webp`.
225
+ # `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
226
+ # snapshots, support `opaque` and `transparent` backgrounds. Transparent
227
+ # backgrounds are available for supported GPT Image models. For `gpt-image-2` and
228
+ # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
229
+ # set the output format to `png` or `webp`.
217
230
  module Background
218
231
  extend OpenAI::Internal::Type::Enum
219
232
 
@@ -241,14 +254,16 @@ module OpenAI
241
254
 
242
255
  # The model to use for image generation. One of `dall-e-2` or a GPT image model
243
256
  # (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
244
- # `gpt-image-2-2026-04-21`, or `chatgpt-image-latest`). Defaults to
257
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
258
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
259
+ # `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`). Defaults to
245
260
  # `gpt-image-1.5`.
246
261
  module Model
247
262
  extend OpenAI::Internal::Type::Union
248
263
 
249
264
  variant String
250
265
 
251
- # 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`.
266
+ # 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`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`). Defaults to `gpt-image-1.5`.
252
267
  variant enum: -> { OpenAI::ImageModel }
253
268
 
254
269
  # @!method self.variants
@@ -269,8 +284,10 @@ module OpenAI
269
284
  # @return [Array<Symbol>]
270
285
  end
271
286
 
272
- # The quality of the image that will be generated for GPT image models. Defaults
273
- # to `auto`.
287
+ # The quality of the image that will be generated for GPT image models. The GPT
288
+ # image models support `low`, `medium`, and `high`. `gpt-image-2.5-sunburst` and
289
+ # `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support
290
+ # `xhigh` and `max`. Defaults to `auto`.
274
291
  module Quality
275
292
  extend OpenAI::Internal::Type::Enum
276
293
 
@@ -278,6 +295,8 @@ module OpenAI
278
295
  LOW = :low
279
296
  MEDIUM = :medium
280
297
  HIGH = :high
298
+ XHIGH = :xhigh
299
+ MAX = :max
281
300
  AUTO = :auto
282
301
 
283
302
  # @!method self.values
@@ -298,17 +317,18 @@ module OpenAI
298
317
  # @return [Array<Symbol>]
299
318
  end
300
319
 
301
- # The size of the generated images. For `gpt-image-2` and
302
- # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
303
- # strings, for example `1536x864`. Width and height must both be divisible by 16
304
- # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
305
- # `2560x1440` are experimental, and the maximum supported resolution is
306
- # `3840x2160`. The requested size must also satisfy the model's current pixel and
307
- # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
308
- # supported by the GPT image models; `auto` is supported for models that allow
309
- # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
310
- # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
311
- # `1024x1792`.
320
+ # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
321
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
322
+ # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
323
+ # resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
324
+ # Width and height must both be divisible by 16 and the requested aspect ratio
325
+ # must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
326
+ # the maximum supported resolution is `3840x2160`. The requested size must also
327
+ # satisfy the model's current pixel and edge limits. The standard sizes
328
+ # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
329
+ # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
330
+ # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
331
+ # `1024x1024`, `1792x1024`, or `1024x1792`.
312
332
  module Size
313
333
  extend OpenAI::Internal::Type::Union
314
334
 
@@ -40,10 +40,10 @@ module OpenAI
40
40
  required :quality, enum: -> { OpenAI::ImageEditPartialImageEvent::Quality }
41
41
 
42
42
  # @!attribute size
43
- # The size of the requested edited image.
43
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
44
44
  #
45
- # @return [Symbol, OpenAI::Models::ImageEditPartialImageEvent::Size]
46
- required :size, enum: -> { OpenAI::ImageEditPartialImageEvent::Size }
45
+ # @return [String, Symbol, OpenAI::Models::ImageEditPartialImageEvent::Size]
46
+ required :size, union: -> { OpenAI::ImageEditPartialImageEvent::Size }
47
47
 
48
48
  # @!attribute type
49
49
  # The type of the event. Always `image_edit.partial_image`.
@@ -69,7 +69,7 @@ module OpenAI
69
69
  #
70
70
  # @param quality [Symbol, OpenAI::Models::ImageEditPartialImageEvent::Quality] The quality setting for the requested edited image.
71
71
  #
72
- # @param size [Symbol, OpenAI::Models::ImageEditPartialImageEvent::Size] The size of the requested edited image.
72
+ # @param size [String, Symbol, OpenAI::Models::ImageEditPartialImageEvent::Size] The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
73
73
  #
74
74
  # @param type [Symbol, :"image_edit.partial_image"] The type of the event. Always `image_edit.partial_image`.
75
75
 
@@ -110,25 +110,51 @@ module OpenAI
110
110
  LOW = :low
111
111
  MEDIUM = :medium
112
112
  HIGH = :high
113
+ XHIGH = :xhigh
114
+ MAX = :max
113
115
  AUTO = :auto
114
116
 
115
117
  # @!method self.values
116
118
  # @return [Array<Symbol>]
117
119
  end
118
120
 
119
- # The size of the requested edited image.
121
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
120
122
  #
121
123
  # @see OpenAI::Models::ImageEditPartialImageEvent#size
122
124
  module Size
123
- extend OpenAI::Internal::Type::Enum
125
+ extend OpenAI::Internal::Type::Union
126
+
127
+ variant const: -> { OpenAI::Models::ImageEditPartialImageEvent::Size::SIZE_1024X1024 }
128
+
129
+ variant const: -> { OpenAI::Models::ImageEditPartialImageEvent::Size::SIZE_1024X1536 }
130
+
131
+ variant const: -> { OpenAI::Models::ImageEditPartialImageEvent::Size::SIZE_1536X1024 }
132
+
133
+ variant const: -> { OpenAI::Models::ImageEditPartialImageEvent::Size::AUTO }
134
+
135
+ # Keep known dimensions as symbols when reading existing API responses.
136
+ variant String
137
+
138
+ # @!method self.variants
139
+ # @return [Array(String, Symbol)]
140
+
141
+ define_sorbet_constant!(:Variants) do
142
+ T.type_alias { T.any(String, OpenAI::ImageEditPartialImageEvent::Size::TaggedSymbol) }
143
+ end
144
+
145
+ # @!group
124
146
 
125
147
  SIZE_1024X1024 = :"1024x1024"
126
148
  SIZE_1024X1536 = :"1024x1536"
127
149
  SIZE_1536X1024 = :"1536x1024"
128
150
  AUTO = :auto
129
151
 
130
- # @!method self.values
131
- # @return [Array<Symbol>]
152
+ # @!endgroup
153
+
154
+ # Preserve the enum helper available before custom dimensions were supported.
155
+ #
156
+ # @return [Array<Symbol>]
157
+ def self.values = [SIZE_1024X1024, SIZE_1024X1536, SIZE_1536X1024, AUTO]
132
158
  end
133
159
  end
134
160
  end
@@ -34,10 +34,10 @@ module OpenAI
34
34
  required :quality, enum: -> { OpenAI::ImageGenCompletedEvent::Quality }
35
35
 
36
36
  # @!attribute size
37
- # The size of the generated image.
37
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
38
38
  #
39
- # @return [Symbol, OpenAI::Models::ImageGenCompletedEvent::Size]
40
- required :size, enum: -> { OpenAI::ImageGenCompletedEvent::Size }
39
+ # @return [String, Symbol, OpenAI::Models::ImageGenCompletedEvent::Size]
40
+ required :size, union: -> { OpenAI::ImageGenCompletedEvent::Size }
41
41
 
42
42
  # @!attribute type
43
43
  # The type of the event. Always `image_generation.completed`.
@@ -68,7 +68,7 @@ module OpenAI
68
68
  #
69
69
  # @param quality [Symbol, OpenAI::Models::ImageGenCompletedEvent::Quality] The quality setting for the generated image.
70
70
  #
71
- # @param size [Symbol, OpenAI::Models::ImageGenCompletedEvent::Size] The size of the generated image.
71
+ # @param size [String, Symbol, OpenAI::Models::ImageGenCompletedEvent::Size] The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
72
72
  #
73
73
  # @param usage [OpenAI::Models::ImageGenCompletedEvent::Usage] For the GPT image models only, the token usage information for the image generat
74
74
  #
@@ -111,25 +111,51 @@ module OpenAI
111
111
  LOW = :low
112
112
  MEDIUM = :medium
113
113
  HIGH = :high
114
+ XHIGH = :xhigh
115
+ MAX = :max
114
116
  AUTO = :auto
115
117
 
116
118
  # @!method self.values
117
119
  # @return [Array<Symbol>]
118
120
  end
119
121
 
120
- # The size of the generated image.
122
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
121
123
  #
122
124
  # @see OpenAI::Models::ImageGenCompletedEvent#size
123
125
  module Size
124
- extend OpenAI::Internal::Type::Enum
126
+ extend OpenAI::Internal::Type::Union
127
+
128
+ variant const: -> { OpenAI::Models::ImageGenCompletedEvent::Size::SIZE_1024X1024 }
129
+
130
+ variant const: -> { OpenAI::Models::ImageGenCompletedEvent::Size::SIZE_1024X1536 }
131
+
132
+ variant const: -> { OpenAI::Models::ImageGenCompletedEvent::Size::SIZE_1536X1024 }
133
+
134
+ variant const: -> { OpenAI::Models::ImageGenCompletedEvent::Size::AUTO }
135
+
136
+ # Keep known dimensions as symbols when reading existing API responses.
137
+ variant String
138
+
139
+ # @!method self.variants
140
+ # @return [Array(String, Symbol)]
141
+
142
+ define_sorbet_constant!(:Variants) do
143
+ T.type_alias { T.any(String, OpenAI::ImageGenCompletedEvent::Size::TaggedSymbol) }
144
+ end
145
+
146
+ # @!group
125
147
 
126
148
  SIZE_1024X1024 = :"1024x1024"
127
149
  SIZE_1024X1536 = :"1024x1536"
128
150
  SIZE_1536X1024 = :"1536x1024"
129
151
  AUTO = :auto
130
152
 
131
- # @!method self.values
132
- # @return [Array<Symbol>]
153
+ # @!endgroup
154
+
155
+ # Preserve the enum helper available before custom dimensions were supported.
156
+ #
157
+ # @return [Array<Symbol>]
158
+ def self.values = [SIZE_1024X1024, SIZE_1024X1536, SIZE_1536X1024, AUTO]
133
159
  end
134
160
 
135
161
  # @see OpenAI::Models::ImageGenCompletedEvent#usage
@@ -40,10 +40,10 @@ module OpenAI
40
40
  required :quality, enum: -> { OpenAI::ImageGenPartialImageEvent::Quality }
41
41
 
42
42
  # @!attribute size
43
- # The size of the requested image.
43
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
44
44
  #
45
- # @return [Symbol, OpenAI::Models::ImageGenPartialImageEvent::Size]
46
- required :size, enum: -> { OpenAI::ImageGenPartialImageEvent::Size }
45
+ # @return [String, Symbol, OpenAI::Models::ImageGenPartialImageEvent::Size]
46
+ required :size, union: -> { OpenAI::ImageGenPartialImageEvent::Size }
47
47
 
48
48
  # @!attribute type
49
49
  # The type of the event. Always `image_generation.partial_image`.
@@ -69,7 +69,7 @@ module OpenAI
69
69
  #
70
70
  # @param quality [Symbol, OpenAI::Models::ImageGenPartialImageEvent::Quality] The quality setting for the requested image.
71
71
  #
72
- # @param size [Symbol, OpenAI::Models::ImageGenPartialImageEvent::Size] The size of the requested image.
72
+ # @param size [String, Symbol, OpenAI::Models::ImageGenPartialImageEvent::Size] The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
73
73
  #
74
74
  # @param type [Symbol, :"image_generation.partial_image"] The type of the event. Always `image_generation.partial_image`.
75
75
 
@@ -110,25 +110,51 @@ module OpenAI
110
110
  LOW = :low
111
111
  MEDIUM = :medium
112
112
  HIGH = :high
113
+ XHIGH = :xhigh
114
+ MAX = :max
113
115
  AUTO = :auto
114
116
 
115
117
  # @!method self.values
116
118
  # @return [Array<Symbol>]
117
119
  end
118
120
 
119
- # The size of the requested image.
121
+ # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
120
122
  #
121
123
  # @see OpenAI::Models::ImageGenPartialImageEvent#size
122
124
  module Size
123
- extend OpenAI::Internal::Type::Enum
125
+ extend OpenAI::Internal::Type::Union
126
+
127
+ variant const: -> { OpenAI::Models::ImageGenPartialImageEvent::Size::SIZE_1024X1024 }
128
+
129
+ variant const: -> { OpenAI::Models::ImageGenPartialImageEvent::Size::SIZE_1024X1536 }
130
+
131
+ variant const: -> { OpenAI::Models::ImageGenPartialImageEvent::Size::SIZE_1536X1024 }
132
+
133
+ variant const: -> { OpenAI::Models::ImageGenPartialImageEvent::Size::AUTO }
134
+
135
+ # Keep known dimensions as symbols when reading existing API responses.
136
+ variant String
137
+
138
+ # @!method self.variants
139
+ # @return [Array(String, Symbol)]
140
+
141
+ define_sorbet_constant!(:Variants) do
142
+ T.type_alias { T.any(String, OpenAI::ImageGenPartialImageEvent::Size::TaggedSymbol) }
143
+ end
144
+
145
+ # @!group
124
146
 
125
147
  SIZE_1024X1024 = :"1024x1024"
126
148
  SIZE_1024X1536 = :"1024x1536"
127
149
  SIZE_1536X1024 = :"1536x1024"
128
150
  AUTO = :auto
129
151
 
130
- # @!method self.values
131
- # @return [Array<Symbol>]
152
+ # @!endgroup
153
+
154
+ # Preserve the enum helper available before custom dimensions were supported.
155
+ #
156
+ # @return [Array<Symbol>]
157
+ def self.values = [SIZE_1024X1024, SIZE_1024X1536, SIZE_1536X1024, AUTO]
132
158
  end
133
159
  end
134
160
  end
@@ -22,9 +22,11 @@ module OpenAI
22
22
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
23
23
  # the model will automatically determine the best background for the image.
24
24
  #
25
- # Transparent backgrounds are available for supported GPT Image models. For
26
- # `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
27
- # using `transparent`, set the output format to `png` or `webp`.
25
+ # `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
26
+ # snapshots, support `opaque` and `transparent` backgrounds. Transparent
27
+ # backgrounds are available for supported GPT Image models. For `gpt-image-2` and
28
+ # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
29
+ # set the output format to `png` or `webp`.
28
30
  #
29
31
  # @return [Symbol, OpenAI::Models::ImageGenerateParams::Background, nil]
30
32
  optional :background, enum: -> { OpenAI::ImageGenerateParams::Background }, nil?: true
@@ -32,8 +34,10 @@ module OpenAI
32
34
  # @!attribute model
33
35
  # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
34
36
  # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
35
- # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific
36
- # to the GPT image models is used.
37
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
38
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
39
+ # `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter
40
+ # specific to the GPT image models is used.
37
41
  #
38
42
  # @return [String, Symbol, OpenAI::Models::ImageModel, nil]
39
43
  optional :model, union: -> { OpenAI::ImageGenerateParams::Model }, nil?: true
@@ -85,6 +89,8 @@ module OpenAI
85
89
  # - `auto` (default value) will automatically select the best quality for the
86
90
  # given model.
87
91
  # - `high`, `medium` and `low` are supported for the GPT image models.
92
+ # - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
93
+ # `2026-09-08` snapshots, also support `xhigh` and `max`.
88
94
  # - `hd` and `standard` are supported for `dall-e-3`.
89
95
  # - `standard` is the only option for `dall-e-2`.
90
96
  #
@@ -101,17 +107,18 @@ module OpenAI
101
107
  optional :response_format, enum: -> { OpenAI::ImageGenerateParams::ResponseFormat }, nil?: true
102
108
 
103
109
  # @!attribute size
104
- # The size of the generated images. For `gpt-image-2` and
105
- # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
106
- # strings, for example `1536x864`. Width and height must both be divisible by 16
107
- # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
108
- # `2560x1440` are experimental, and the maximum supported resolution is
109
- # `3840x2160`. The requested size must also satisfy the model's current pixel and
110
- # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
111
- # supported by the GPT image models; `auto` is supported for models that allow
112
- # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
113
- # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
114
- # `1024x1792`.
110
+ # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
111
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
112
+ # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
113
+ # resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
114
+ # Width and height must both be divisible by 16 and the requested aspect ratio
115
+ # must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
116
+ # the maximum supported resolution is `3840x2160`. The requested size must also
117
+ # satisfy the model's current pixel and edge limits. The standard sizes
118
+ # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
119
+ # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
120
+ # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
121
+ # `1024x1024`, `1792x1024`, or `1024x1792`.
115
122
  #
116
123
  # @return [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil]
117
124
  optional :size, union: -> { OpenAI::ImageGenerateParams::Size }, nil?: true
@@ -139,7 +146,7 @@ module OpenAI
139
146
  #
140
147
  # @param prompt [String] A text description of the desired image(s). The maximum length is 32000 characte
141
148
  #
142
- # @param background [Symbol, OpenAI::Models::ImageGenerateParams::Background, nil] Allows to set transparency for the background of the generated image(s).
149
+ # @param background [Symbol, OpenAI::Models::ImageGenerateParams::Background, nil] Allows to set transparency for the background of the generated image(s). Must
143
150
  #
144
151
  # @param model [String, Symbol, OpenAI::Models::ImageModel, nil] The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT i
145
152
  #
@@ -157,7 +164,7 @@ module OpenAI
157
164
  #
158
165
  # @param response_format [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil] The format in which generated images with `dall-e-2` and `dall-e-3` are returned
159
166
  #
160
- # @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] The size of the generated images. For `gpt-image-2` and `gpt-image-2-2026-04-21`
167
+ # @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil] The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `
161
168
  #
162
169
  # @param style [Symbol, OpenAI::Models::ImageGenerateParams::Style, nil] The style of the generated images. This parameter is only supported for `dall-e-
163
170
  #
@@ -169,9 +176,11 @@ module OpenAI
169
176
  # one of `transparent`, `opaque`, or `auto` (default value). When `auto` is used,
170
177
  # the model will automatically determine the best background for the image.
171
178
  #
172
- # Transparent backgrounds are available for supported GPT Image models. For
173
- # `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
174
- # using `transparent`, set the output format to `png` or `webp`.
179
+ # `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
180
+ # snapshots, support `opaque` and `transparent` backgrounds. Transparent
181
+ # backgrounds are available for supported GPT Image models. For `gpt-image-2` and
182
+ # `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`,
183
+ # set the output format to `png` or `webp`.
175
184
  module Background
176
185
  extend OpenAI::Internal::Type::Enum
177
186
 
@@ -185,14 +194,16 @@ module OpenAI
185
194
 
186
195
  # The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT
187
196
  # image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
188
- # or `gpt-image-2-2026-04-21`). Defaults to `dall-e-2` unless a parameter specific
189
- # to the GPT image models is used.
197
+ # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
198
+ # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
199
+ # `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter
200
+ # specific to the GPT image models is used.
190
201
  module Model
191
202
  extend OpenAI::Internal::Type::Union
192
203
 
193
204
  variant String
194
205
 
195
- # 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`, `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.
206
+ # 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`, `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter specific to the GPT image models is used.
196
207
  variant enum: -> { OpenAI::ImageModel }
197
208
 
198
209
  # @!method self.variants
@@ -230,6 +241,8 @@ module OpenAI
230
241
  # - `auto` (default value) will automatically select the best quality for the
231
242
  # given model.
232
243
  # - `high`, `medium` and `low` are supported for the GPT image models.
244
+ # - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their
245
+ # `2026-09-08` snapshots, also support `xhigh` and `max`.
233
246
  # - `hd` and `standard` are supported for `dall-e-3`.
234
247
  # - `standard` is the only option for `dall-e-2`.
235
248
  module Quality
@@ -240,6 +253,8 @@ module OpenAI
240
253
  LOW = :low
241
254
  MEDIUM = :medium
242
255
  HIGH = :high
256
+ XHIGH = :xhigh
257
+ MAX = :max
243
258
  AUTO = :auto
244
259
 
245
260
  # @!method self.values
@@ -260,17 +275,18 @@ module OpenAI
260
275
  # @return [Array<Symbol>]
261
276
  end
262
277
 
263
- # The size of the generated images. For `gpt-image-2` and
264
- # `gpt-image-2-2026-04-21`, arbitrary resolutions are supported as `WIDTHxHEIGHT`
265
- # strings, for example `1536x864`. Width and height must both be divisible by 16
266
- # and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above
267
- # `2560x1440` are experimental, and the maximum supported resolution is
268
- # `3840x2160`. The requested size must also satisfy the model's current pixel and
269
- # edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are
270
- # supported by the GPT image models; `auto` is supported for models that allow
271
- # automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or
272
- # `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or
273
- # `1024x1792`.
278
+ # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
279
+ # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
280
+ # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
281
+ # resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`.
282
+ # Width and height must both be divisible by 16 and the requested aspect ratio
283
+ # must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and
284
+ # the maximum supported resolution is `3840x2160`. The requested size must also
285
+ # satisfy the model's current pixel and edge limits. The standard sizes
286
+ # `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models;
287
+ # `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use
288
+ # one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of
289
+ # `1024x1024`, `1792x1024`, or `1024x1792`.
274
290
  module Size
275
291
  extend OpenAI::Internal::Type::Union
276
292
 
@@ -9,6 +9,10 @@ module OpenAI
9
9
  GPT_IMAGE_1_MINI = :"gpt-image-1-mini"
10
10
  GPT_IMAGE_2 = :"gpt-image-2"
11
11
  GPT_IMAGE_2_2026_04_21 = :"gpt-image-2-2026-04-21"
12
+ GPT_IMAGE_2_5_SUNBURST = :"gpt-image-2.5-sunburst"
13
+ GPT_IMAGE_2_5_SUNBURST_2026_09_08 = :"gpt-image-2.5-sunburst-2026-09-08"
14
+ GPT_IMAGE_2_5_FLARE = :"gpt-image-2.5-flare"
15
+ GPT_IMAGE_2_5_FLARE_2026_09_08 = :"gpt-image-2.5-flare-2026-09-08"
12
16
  GPT_IMAGE_1_5 = :"gpt-image-1.5"
13
17
  CHATGPT_IMAGE_LATEST = :"chatgpt-image-latest"
14
18
  DALL_E_2 = :"dall-e-2"