openai 0.104.0 → 0.105.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e16df42bfa691e5400644594e19849234985cf11213fd204361a9c7d8599205b
4
- data.tar.gz: c6d3594da881c17292a1c4466604aa0af3cf2f92f369cbe640c9b2f2384f0d36
3
+ metadata.gz: 3cf6a76c197d61e6798bc42692ee2d650c264346d4f94845644bb44930769970
4
+ data.tar.gz: 3bc493a3d8be33ce44a76f98662641f835523703fec8cd9932e6de926403583d
5
5
  SHA512:
6
- metadata.gz: 5127ae2d7c23c25e87b7ac3d10088b4cf8fd07a5f68a4dcf135956d1b72036e50af83f551991101f79b0c10d99ac2532a11e1e269ee8a9fed03fe2c2a6670c54
7
- data.tar.gz: e09a526ec3a8eb15fef050fc5c15b6c4425022fd399ed982a8231170a18e390f140bef6ea29d04e15d9e241065bd05c8053060b81476e30cab849d0f61a38ca1
6
+ metadata.gz: a37404e98840aa8015d0d882e7e88ae0470611198d8327b691e061be71c08a456c3c9878c70ac2734ba30f74ec3ee9e122ab1633e627895ef05e0a5771001e6f
7
+ data.tar.gz: df0f1aef627413e41101cc122aa6bc6b8f0dbac8933f92fea715fc79cf11ca15e45e1a6dfb77f789fcbe16a3fea63e177e9970bc72058206846239e90a4f75cd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.105.0](https://github.com/openai/openai-ruby/compare/v0.104.0...v0.105.0) (2026-10-16)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** add safety identifiers to image requests and responses ([#894](https://github.com/openai/openai-ruby/issues/894)) ([d74e0d5](https://github.com/openai/openai-ruby/commit/d74e0d5737c34a2201780ceb961ac0f7302621cc))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **api:** omit nil safety identifiers from image edits ([#896](https://github.com/openai/openai-ruby/issues/896)) ([a4dbd91](https://github.com/openai/openai-ruby/commit/a4dbd91cbc38ae66a641353c9cc042956cd46bdf))
14
+
15
+
16
+ ### Chores
17
+
18
+ * **api:** maintain webhook verification compatibility ([#893](https://github.com/openai/openai-ruby/issues/893)) ([adbde58](https://github.com/openai/openai-ruby/commit/adbde58c45c1241a49a89c03bdb1e350c0ea0ddb))
19
+
3
20
  ## [0.104.0](https://github.com/openai/openai-ruby/compare/v0.103.0...v0.104.0) (2026-10-16)
4
21
 
5
22
 
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "openai", "~> 0.104.0"
18
+ gem "openai", "~> 0.105.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -52,7 +52,15 @@ module OpenAI
52
52
  # @return [OpenAI::Models::ImageEditCompletedEvent::Usage]
53
53
  required :usage, -> { OpenAI::ImageEditCompletedEvent::Usage }
54
54
 
55
- # @!method initialize(b64_json:, background:, created_at:, output_format:, quality:, size:, usage:, type: :"image_edit.completed")
55
+ # @!attribute safety_identifier
56
+ # The effective safety identifier used for safety monitoring and abuse detection.
57
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
58
+ # `user` value when `safety_identifier` is omitted, null, or empty.
59
+ #
60
+ # @return [String, nil]
61
+ optional :safety_identifier, String, nil?: true
62
+
63
+ # @!method initialize(b64_json:, background:, created_at:, output_format:, quality:, size:, usage:, safety_identifier: nil, type: :"image_edit.completed")
56
64
  # Emitted when image editing has completed and the final image is available.
57
65
  #
58
66
  # @param b64_json [String]
@@ -77,6 +85,11 @@ module OpenAI
77
85
  # For the GPT image models only, the token usage information for the image
78
86
  # generation.
79
87
  #
88
+ # @param safety_identifier [String, nil]
89
+ # The effective safety identifier used for safety monitoring and abuse detection.
90
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
91
+ # `user` value when `safety_identifier` is omitted, null, or empty.
92
+ #
80
93
  # @param type [Symbol, :"image_edit.completed"]
81
94
  # The type of the event. Always `image_edit.completed`.
82
95
 
@@ -130,6 +130,17 @@ module OpenAI
130
130
  # @return [Symbol, OpenAI::Models::ImageEditParams::ResponseFormat, nil]
131
131
  optional :response_format, enum: -> { OpenAI::ImageEditParams::ResponseFormat }, nil?: true
132
132
 
133
+ # @!attribute safety_identifier
134
+ # A stable identifier for an end user in your organization, used for safety
135
+ # monitoring and abuse detection. Hash a username or email address to avoid
136
+ # sending identifying information. A non-empty value takes precedence over the
137
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
138
+ # when available.
139
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
140
+ #
141
+ # @return [String, nil]
142
+ optional :safety_identifier, String, nil?: true
143
+
133
144
  # @!attribute size
134
145
  # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
135
146
  # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
@@ -147,14 +158,17 @@ module OpenAI
147
158
  optional :size, union: -> { OpenAI::ImageEditParams::Size }, nil?: true
148
159
 
149
160
  # @!attribute user
150
- # A unique identifier representing your end-user, which can help OpenAI to monitor
151
- # and detect abuse.
161
+ # @deprecated
162
+ #
163
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
164
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
165
+ # empty.
152
166
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
153
167
  #
154
168
  # @return [String, nil]
155
169
  optional :user, String
156
170
 
157
- # @!method initialize(image:, prompt:, background: nil, input_fidelity: nil, mask: nil, model: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, user: nil, request_options: {})
171
+ # @!method initialize(image:, prompt:, background: nil, input_fidelity: nil, mask: nil, model: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, safety_identifier: nil, size: nil, user: nil, request_options: {})
158
172
  # @param image [Pathname, StringIO, IO, String, OpenAI::FilePart, Array<Pathname, StringIO, IO, String, OpenAI::FilePart>]
159
173
  # The image(s) to edit. Must be a supported image file or an array of images.
160
174
  #
@@ -238,6 +252,14 @@ module OpenAI
238
252
  # Legacy response format parameter for retired image models. Unsupported for GPT
239
253
  # image models, which always return base64-encoded images.
240
254
  #
255
+ # @param safety_identifier [String, nil]
256
+ # A stable identifier for an end user in your organization, used for safety
257
+ # monitoring and abuse detection. Hash a username or email address to avoid
258
+ # sending identifying information. A non-empty value takes precedence over the
259
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
260
+ # when available.
261
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
262
+ #
241
263
  # @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil]
242
264
  # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
243
265
  # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
@@ -252,8 +274,9 @@ module OpenAI
252
274
  # models that allow automatic sizing.
253
275
  #
254
276
  # @param user [String]
255
- # A unique identifier representing your end-user, which can help OpenAI to monitor
256
- # and detect abuse.
277
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
278
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
279
+ # empty.
257
280
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
258
281
  #
259
282
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
@@ -52,7 +52,15 @@ module OpenAI
52
52
  # @return [OpenAI::Models::ImageGenCompletedEvent::Usage]
53
53
  required :usage, -> { OpenAI::ImageGenCompletedEvent::Usage }
54
54
 
55
- # @!method initialize(b64_json:, background:, created_at:, output_format:, quality:, size:, usage:, type: :"image_generation.completed")
55
+ # @!attribute safety_identifier
56
+ # The effective safety identifier used for safety monitoring and abuse detection.
57
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
58
+ # `user` value when `safety_identifier` is omitted, null, or empty.
59
+ #
60
+ # @return [String, nil]
61
+ optional :safety_identifier, String, nil?: true
62
+
63
+ # @!method initialize(b64_json:, background:, created_at:, output_format:, quality:, size:, usage:, safety_identifier: nil, type: :"image_generation.completed")
56
64
  # Emitted when image generation has completed and the final image is available.
57
65
  #
58
66
  # @param b64_json [String]
@@ -77,6 +85,11 @@ module OpenAI
77
85
  # For the GPT image models only, the token usage information for the image
78
86
  # generation.
79
87
  #
88
+ # @param safety_identifier [String, nil]
89
+ # The effective safety identifier used for safety monitoring and abuse detection.
90
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
91
+ # `user` value when `safety_identifier` is omitted, null, or empty.
92
+ #
80
93
  # @param type [Symbol, :"image_generation.completed"]
81
94
  # The type of the event. Always `image_generation.completed`.
82
95
 
@@ -101,6 +101,17 @@ module OpenAI
101
101
  # @return [Symbol, OpenAI::Models::ImageGenerateParams::ResponseFormat, nil]
102
102
  optional :response_format, enum: -> { OpenAI::ImageGenerateParams::ResponseFormat }, nil?: true
103
103
 
104
+ # @!attribute safety_identifier
105
+ # A stable identifier for an end user in your organization, used for safety
106
+ # monitoring and abuse detection. Hash a username or email address to avoid
107
+ # sending identifying information. A non-empty value takes precedence over the
108
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
109
+ # when available.
110
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
111
+ #
112
+ # @return [String, nil]
113
+ optional :safety_identifier, String, nil?: true
114
+
104
115
  # @!attribute size
105
116
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
106
117
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
@@ -126,14 +137,17 @@ module OpenAI
126
137
  optional :style, enum: -> { OpenAI::ImageGenerateParams::Style }, nil?: true
127
138
 
128
139
  # @!attribute user
129
- # A unique identifier representing your end-user, which can help OpenAI to monitor
130
- # and detect abuse.
140
+ # @deprecated
141
+ #
142
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
143
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
144
+ # empty.
131
145
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
132
146
  #
133
147
  # @return [String, nil]
134
148
  optional :user, String
135
149
 
136
- # @!method initialize(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, style: nil, user: nil, request_options: {})
150
+ # @!method initialize(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, safety_identifier: nil, size: nil, style: nil, user: nil, request_options: {})
137
151
  # @param prompt [String]
138
152
  # A text description of the desired image(s). The maximum length is 32000
139
153
  # characters.
@@ -194,6 +208,14 @@ module OpenAI
194
208
  # Legacy response format parameter for retired image models. Unsupported for GPT
195
209
  # image models, which always return base64-encoded images.
196
210
  #
211
+ # @param safety_identifier [String, nil]
212
+ # A stable identifier for an end user in your organization, used for safety
213
+ # monitoring and abuse detection. Hash a username or email address to avoid
214
+ # sending identifying information. A non-empty value takes precedence over the
215
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
216
+ # when available.
217
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
218
+ #
197
219
  # @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil]
198
220
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
199
221
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
@@ -211,8 +233,9 @@ module OpenAI
211
233
  # models; describe the desired style in the prompt instead.
212
234
  #
213
235
  # @param user [String]
214
- # A unique identifier representing your end-user, which can help OpenAI to monitor
215
- # and detect abuse.
236
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
237
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
238
+ # empty.
216
239
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
217
240
  #
218
241
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
@@ -36,6 +36,14 @@ module OpenAI
36
36
  # @return [Symbol, OpenAI::Models::ImagesResponse::Quality, nil]
37
37
  optional :quality, enum: -> { OpenAI::ImagesResponse::Quality }
38
38
 
39
+ # @!attribute safety_identifier
40
+ # The effective safety identifier used for safety monitoring and abuse detection.
41
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
42
+ # `user` value when `safety_identifier` is omitted, null, or empty.
43
+ #
44
+ # @return [String, nil]
45
+ optional :safety_identifier, String, nil?: true
46
+
39
47
  # @!attribute size
40
48
  # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
41
49
  #
@@ -48,7 +56,7 @@ module OpenAI
48
56
  # @return [OpenAI::Models::ImagesResponse::Usage, nil]
49
57
  optional :usage, -> { OpenAI::ImagesResponse::Usage }
50
58
 
51
- # @!method initialize(created:, background: nil, data: nil, output_format: nil, quality: nil, size: nil, usage: nil)
59
+ # @!method initialize(created:, background: nil, data: nil, output_format: nil, quality: nil, safety_identifier: nil, size: nil, usage: nil)
52
60
  # The response from the image generation endpoint.
53
61
  #
54
62
  # @param created [Integer]
@@ -68,6 +76,11 @@ module OpenAI
68
76
  # The quality of the image generated. One of `low`, `medium`, `high`, `xhigh`, or
69
77
  # `max`.
70
78
  #
79
+ # @param safety_identifier [String, nil]
80
+ # The effective safety identifier used for safety monitoring and abuse detection.
81
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
82
+ # `user` value when `safety_identifier` is omitted, null, or empty.
83
+ #
71
84
  # @param size [String, Symbol, OpenAI::Models::ImagesResponse::Size]
72
85
  # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
73
86
  #
@@ -72,7 +72,7 @@ module OpenAI
72
72
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
73
73
  # content type.
74
74
  #
75
- # @overload edit(image:, prompt:, background: nil, input_fidelity: nil, mask: nil, model: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, user: nil, request_options: {})
75
+ # @overload edit(image:, prompt:, background: nil, input_fidelity: nil, mask: nil, model: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, safety_identifier: nil, size: nil, user: nil, request_options: {})
76
76
  #
77
77
  # @param image [Pathname, StringIO, IO, String, OpenAI::FilePart, Array<Pathname, StringIO, IO, String, OpenAI::FilePart>]
78
78
  # The image(s) to edit. Must be a supported image file or an array of images.
@@ -157,6 +157,14 @@ module OpenAI
157
157
  # Legacy response format parameter for retired image models. Unsupported for GPT
158
158
  # image models, which always return base64-encoded images.
159
159
  #
160
+ # @param safety_identifier [String, nil]
161
+ # A stable identifier for an end user in your organization, used for safety
162
+ # monitoring and abuse detection. Hash a username or email address to avoid
163
+ # sending identifying information. A non-empty value takes precedence over the
164
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
165
+ # when available.
166
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
167
+ #
160
168
  # @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil]
161
169
  # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
162
170
  # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
@@ -171,8 +179,9 @@ module OpenAI
171
179
  # models that allow automatic sizing.
172
180
  #
173
181
  # @param user [String]
174
- # A unique identifier representing your end-user, which can help OpenAI to monitor
175
- # and detect abuse.
182
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
183
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
184
+ # empty.
176
185
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
177
186
  #
178
187
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -187,6 +196,7 @@ module OpenAI
187
196
  raise ArgumentError.new(message)
188
197
  end
189
198
 
199
+ parsed.delete(:safety_identifier) if parsed[:safety_identifier].nil?
190
200
  @client.request(
191
201
  method: :post,
192
202
  path: "images/edits",
@@ -207,7 +217,7 @@ module OpenAI
207
217
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
208
218
  # content type.
209
219
  #
210
- # @overload edit_stream_raw(image:, prompt:, background: nil, input_fidelity: nil, mask: nil, model: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, user: nil, request_options: {})
220
+ # @overload edit_stream_raw(image:, prompt:, background: nil, input_fidelity: nil, mask: nil, model: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, safety_identifier: nil, size: nil, user: nil, request_options: {})
211
221
  #
212
222
  # @param image [Pathname, StringIO, IO, String, OpenAI::FilePart, Array<Pathname, StringIO, IO, String, OpenAI::FilePart>]
213
223
  # The image(s) to edit. Must be a supported image file or an array of images.
@@ -292,6 +302,14 @@ module OpenAI
292
302
  # Legacy response format parameter for retired image models. Unsupported for GPT
293
303
  # image models, which always return base64-encoded images.
294
304
  #
305
+ # @param safety_identifier [String, nil]
306
+ # A stable identifier for an end user in your organization, used for safety
307
+ # monitoring and abuse detection. Hash a username or email address to avoid
308
+ # sending identifying information. A non-empty value takes precedence over the
309
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
310
+ # when available.
311
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
312
+ #
295
313
  # @param size [String, Symbol, OpenAI::Models::ImageEditParams::Size, nil]
296
314
  # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
297
315
  # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
@@ -306,8 +324,9 @@ module OpenAI
306
324
  # models that allow automatic sizing.
307
325
  #
308
326
  # @param user [String]
309
- # A unique identifier representing your end-user, which can help OpenAI to monitor
310
- # and detect abuse.
327
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
328
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
329
+ # empty.
311
330
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
312
331
  #
313
332
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -323,6 +342,7 @@ module OpenAI
323
342
  end
324
343
 
325
344
  parsed.store(:stream, true)
345
+ parsed.delete(:safety_identifier) if parsed[:safety_identifier].nil?
326
346
  @client.request(
327
347
  method: :post,
328
348
  path: "images/edits",
@@ -344,7 +364,7 @@ module OpenAI
344
364
  # Creates an image given a prompt using a GPT Image model.
345
365
  # [Learn more](https://developers.openai.com/api/docs/guides/images-vision).
346
366
  #
347
- # @overload generate(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, style: nil, user: nil, request_options: {})
367
+ # @overload generate(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, safety_identifier: nil, size: nil, style: nil, user: nil, request_options: {})
348
368
  #
349
369
  # @param prompt [String]
350
370
  # A text description of the desired image(s). The maximum length is 32000
@@ -406,6 +426,14 @@ module OpenAI
406
426
  # Legacy response format parameter for retired image models. Unsupported for GPT
407
427
  # image models, which always return base64-encoded images.
408
428
  #
429
+ # @param safety_identifier [String, nil]
430
+ # A stable identifier for an end user in your organization, used for safety
431
+ # monitoring and abuse detection. Hash a username or email address to avoid
432
+ # sending identifying information. A non-empty value takes precedence over the
433
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
434
+ # when available.
435
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
436
+ #
409
437
  # @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil]
410
438
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
411
439
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
@@ -423,8 +451,9 @@ module OpenAI
423
451
  # models; describe the desired style in the prompt instead.
424
452
  #
425
453
  # @param user [String]
426
- # A unique identifier representing your end-user, which can help OpenAI to monitor
427
- # and detect abuse.
454
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
455
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
456
+ # empty.
428
457
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
429
458
  #
430
459
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -454,7 +483,7 @@ module OpenAI
454
483
  # Creates an image given a prompt using a GPT Image model.
455
484
  # [Learn more](https://developers.openai.com/api/docs/guides/images-vision).
456
485
  #
457
- # @overload generate_stream_raw(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, size: nil, style: nil, user: nil, request_options: {})
486
+ # @overload generate_stream_raw(prompt:, background: nil, model: nil, moderation: nil, n: nil, output_compression: nil, output_format: nil, partial_images: nil, quality: nil, response_format: nil, safety_identifier: nil, size: nil, style: nil, user: nil, request_options: {})
458
487
  #
459
488
  # @param prompt [String]
460
489
  # A text description of the desired image(s). The maximum length is 32000
@@ -516,6 +545,14 @@ module OpenAI
516
545
  # Legacy response format parameter for retired image models. Unsupported for GPT
517
546
  # image models, which always return base64-encoded images.
518
547
  #
548
+ # @param safety_identifier [String, nil]
549
+ # A stable identifier for an end user in your organization, used for safety
550
+ # monitoring and abuse detection. Hash a username or email address to avoid
551
+ # sending identifying information. A non-empty value takes precedence over the
552
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
553
+ # when available.
554
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
555
+ #
519
556
  # @param size [String, Symbol, OpenAI::Models::ImageGenerateParams::Size, nil]
520
557
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
521
558
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
@@ -533,8 +570,9 @@ module OpenAI
533
570
  # models; describe the desired style in the prompt instead.
534
571
  #
535
572
  # @param user [String]
536
- # A unique identifier representing your end-user, which can help OpenAI to monitor
537
- # and detect abuse.
573
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
574
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
575
+ # empty.
538
576
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
539
577
  #
540
578
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.104.0"
4
+ VERSION = "0.105.0"
5
5
  end
@@ -48,6 +48,12 @@ module OpenAI
48
48
  sig { params(usage: OpenAI::ImageEditCompletedEvent::Usage::OrHash).void }
49
49
  attr_writer :usage
50
50
 
51
+ # The effective safety identifier used for safety monitoring and abuse detection.
52
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
53
+ # `user` value when `safety_identifier` is omitted, null, or empty.
54
+ sig { returns(T.nilable(String)) }
55
+ attr_accessor :safety_identifier
56
+
51
57
  # Emitted when image editing has completed and the final image is available.
52
58
  sig do
53
59
  params(
@@ -66,6 +72,8 @@ module OpenAI
66
72
 
67
73
  usage: OpenAI::ImageEditCompletedEvent::Usage::OrHash,
68
74
 
75
+ safety_identifier: T.nilable(String),
76
+
69
77
  type: Symbol
70
78
  )
71
79
  .returns(T.attached_class)
@@ -94,6 +102,11 @@ module OpenAI
94
102
  # generation.
95
103
  usage:,
96
104
 
105
+ # The effective safety identifier used for safety monitoring and abuse detection.
106
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
107
+ # `user` value when `safety_identifier` is omitted, null, or empty.
108
+ safety_identifier: nil,
109
+
97
110
  # The type of the event. Always `image_edit.completed`.
98
111
 
99
112
  type: :"image_edit.completed"
@@ -110,7 +123,8 @@ module OpenAI
110
123
  quality: OpenAI::ImageEditCompletedEvent::Quality::TaggedSymbol,
111
124
  size: OpenAI::ImageEditCompletedEvent::Size::Variants,
112
125
  type: Symbol,
113
- usage: OpenAI::ImageEditCompletedEvent::Usage
126
+ usage: OpenAI::ImageEditCompletedEvent::Usage,
127
+ safety_identifier: T.nilable(String)
114
128
  }
115
129
  )
116
130
  end
@@ -113,6 +113,15 @@ module OpenAI
113
113
  sig { returns(T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol)) }
114
114
  attr_accessor :response_format
115
115
 
116
+ # A stable identifier for an end user in your organization, used for safety
117
+ # monitoring and abuse detection. Hash a username or email address to avoid
118
+ # sending identifying information. A non-empty value takes precedence over the
119
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
120
+ # when available.
121
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
122
+ sig { returns(T.nilable(String)) }
123
+ attr_accessor :safety_identifier
124
+
116
125
  # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
117
126
  # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
118
127
  # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
@@ -127,8 +136,9 @@ module OpenAI
127
136
  sig { returns(T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol))) }
128
137
  attr_accessor :size
129
138
 
130
- # A unique identifier representing your end-user, which can help OpenAI to monitor
131
- # and detect abuse.
139
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
140
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
141
+ # empty.
132
142
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
133
143
  sig { returns(T.nilable(String)) }
134
144
  attr_reader :user
@@ -163,6 +173,8 @@ module OpenAI
163
173
 
164
174
  response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol),
165
175
 
176
+ safety_identifier: T.nilable(String),
177
+
166
178
  size: T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)),
167
179
 
168
180
  user: String,
@@ -256,6 +268,14 @@ module OpenAI
256
268
  # image models, which always return base64-encoded images.
257
269
  response_format: nil,
258
270
 
271
+ # A stable identifier for an end user in your organization, used for safety
272
+ # monitoring and abuse detection. Hash a username or email address to avoid
273
+ # sending identifying information. A non-empty value takes precedence over the
274
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
275
+ # when available.
276
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
277
+ safety_identifier: nil,
278
+
259
279
  # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
260
280
  # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
261
281
  # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
@@ -269,8 +289,9 @@ module OpenAI
269
289
  # models that allow automatic sizing.
270
290
  size: nil,
271
291
 
272
- # A unique identifier representing your end-user, which can help OpenAI to monitor
273
- # and detect abuse.
292
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
293
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
294
+ # empty.
274
295
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
275
296
  user: nil,
276
297
 
@@ -293,6 +314,7 @@ module OpenAI
293
314
  partial_images: T.nilable(Integer),
294
315
  quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol),
295
316
  response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol),
317
+ safety_identifier: T.nilable(String),
296
318
  size: T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)),
297
319
  user: String,
298
320
  request_options: OpenAI::RequestOptions
@@ -48,6 +48,12 @@ module OpenAI
48
48
  sig { params(usage: OpenAI::ImageGenCompletedEvent::Usage::OrHash).void }
49
49
  attr_writer :usage
50
50
 
51
+ # The effective safety identifier used for safety monitoring and abuse detection.
52
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
53
+ # `user` value when `safety_identifier` is omitted, null, or empty.
54
+ sig { returns(T.nilable(String)) }
55
+ attr_accessor :safety_identifier
56
+
51
57
  # Emitted when image generation has completed and the final image is available.
52
58
  sig do
53
59
  params(
@@ -66,6 +72,8 @@ module OpenAI
66
72
 
67
73
  usage: OpenAI::ImageGenCompletedEvent::Usage::OrHash,
68
74
 
75
+ safety_identifier: T.nilable(String),
76
+
69
77
  type: Symbol
70
78
  )
71
79
  .returns(T.attached_class)
@@ -94,6 +102,11 @@ module OpenAI
94
102
  # generation.
95
103
  usage:,
96
104
 
105
+ # The effective safety identifier used for safety monitoring and abuse detection.
106
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
107
+ # `user` value when `safety_identifier` is omitted, null, or empty.
108
+ safety_identifier: nil,
109
+
97
110
  # The type of the event. Always `image_generation.completed`.
98
111
 
99
112
  type: :"image_generation.completed"
@@ -110,7 +123,8 @@ module OpenAI
110
123
  quality: OpenAI::ImageGenCompletedEvent::Quality::TaggedSymbol,
111
124
  size: OpenAI::ImageGenCompletedEvent::Size::Variants,
112
125
  type: Symbol,
113
- usage: OpenAI::ImageGenCompletedEvent::Usage
126
+ usage: OpenAI::ImageGenCompletedEvent::Usage,
127
+ safety_identifier: T.nilable(String)
114
128
  }
115
129
  )
116
130
  end
@@ -85,6 +85,15 @@ module OpenAI
85
85
  sig { returns(T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol)) }
86
86
  attr_accessor :response_format
87
87
 
88
+ # A stable identifier for an end user in your organization, used for safety
89
+ # monitoring and abuse detection. Hash a username or email address to avoid
90
+ # sending identifying information. A non-empty value takes precedence over the
91
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
92
+ # when available.
93
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
94
+ sig { returns(T.nilable(String)) }
95
+ attr_accessor :safety_identifier
96
+
88
97
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
89
98
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
90
99
  # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
@@ -103,8 +112,9 @@ module OpenAI
103
112
  sig { returns(T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol)) }
104
113
  attr_accessor :style
105
114
 
106
- # A unique identifier representing your end-user, which can help OpenAI to monitor
107
- # and detect abuse.
115
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
116
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
117
+ # empty.
108
118
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
109
119
  sig { returns(T.nilable(String)) }
110
120
  attr_reader :user
@@ -135,6 +145,8 @@ module OpenAI
135
145
 
136
146
  response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol),
137
147
 
148
+ safety_identifier: T.nilable(String),
149
+
138
150
  size: T.nilable(T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol)),
139
151
 
140
152
  style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol),
@@ -207,6 +219,14 @@ module OpenAI
207
219
  # image models, which always return base64-encoded images.
208
220
  response_format: nil,
209
221
 
222
+ # A stable identifier for an end user in your organization, used for safety
223
+ # monitoring and abuse detection. Hash a username or email address to avoid
224
+ # sending identifying information. A non-empty value takes precedence over the
225
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
226
+ # when available.
227
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
228
+ safety_identifier: nil,
229
+
210
230
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
211
231
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
212
232
  # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
@@ -223,8 +243,9 @@ module OpenAI
223
243
  # models; describe the desired style in the prompt instead.
224
244
  style: nil,
225
245
 
226
- # A unique identifier representing your end-user, which can help OpenAI to monitor
227
- # and detect abuse.
246
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
247
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
248
+ # empty.
228
249
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
229
250
  user: nil,
230
251
 
@@ -245,6 +266,7 @@ module OpenAI
245
266
  partial_images: T.nilable(Integer),
246
267
  quality: T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol),
247
268
  response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol),
269
+ safety_identifier: T.nilable(String),
248
270
  size: T.nilable(T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol)),
249
271
  style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol),
250
272
  user: String,
@@ -46,6 +46,12 @@ module OpenAI
46
46
  sig { params(quality: OpenAI::ImagesResponse::Quality::OrSymbol).void }
47
47
  attr_writer :quality
48
48
 
49
+ # The effective safety identifier used for safety monitoring and abuse detection.
50
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
51
+ # `user` value when `safety_identifier` is omitted, null, or empty.
52
+ sig { returns(T.nilable(String)) }
53
+ attr_accessor :safety_identifier
54
+
49
55
  # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
50
56
  sig { returns(T.nilable(OpenAI::ImagesResponse::Size::Variants)) }
51
57
  attr_reader :size
@@ -74,6 +80,8 @@ module OpenAI
74
80
 
75
81
  quality: OpenAI::ImagesResponse::Quality::OrSymbol,
76
82
 
83
+ safety_identifier: T.nilable(String),
84
+
77
85
  size: T.any(String, OpenAI::ImagesResponse::Size::OrSymbol),
78
86
 
79
87
  usage: OpenAI::ImagesResponse::Usage::OrHash
@@ -99,6 +107,11 @@ module OpenAI
99
107
  # `max`.
100
108
  quality: nil,
101
109
 
110
+ # The effective safety identifier used for safety monitoring and abuse detection.
111
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
112
+ # `user` value when `safety_identifier` is omitted, null, or empty.
113
+ safety_identifier: nil,
114
+
102
115
  # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
103
116
  size: nil,
104
117
 
@@ -116,6 +129,7 @@ module OpenAI
116
129
  data: T::Array[OpenAI::Image],
117
130
  output_format: OpenAI::ImagesResponse::OutputFormat::TaggedSymbol,
118
131
  quality: OpenAI::ImagesResponse::Quality::TaggedSymbol,
132
+ safety_identifier: T.nilable(String),
119
133
  size: OpenAI::ImagesResponse::Size::Variants,
120
134
  usage: OpenAI::ImagesResponse::Usage
121
135
  }
@@ -67,6 +67,7 @@ module OpenAI
67
67
  partial_images: T.nilable(Integer),
68
68
  quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol),
69
69
  response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol),
70
+ safety_identifier: T.nilable(String),
70
71
  size: T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)),
71
72
  user: String,
72
73
  stream: T.noreturn,
@@ -146,6 +147,13 @@ module OpenAI
146
147
  # Legacy response format parameter for retired image models. Unsupported for GPT
147
148
  # image models, which always return base64-encoded images.
148
149
  response_format: nil,
150
+ # A stable identifier for an end user in your organization, used for safety
151
+ # monitoring and abuse detection. Hash a username or email address to avoid
152
+ # sending identifying information. A non-empty value takes precedence over the
153
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
154
+ # when available.
155
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
156
+ safety_identifier: nil,
149
157
  # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
150
158
  # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
151
159
  # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
@@ -158,8 +166,9 @@ module OpenAI
158
166
  # `1024x1536` are supported by the GPT image models; `auto` is supported for
159
167
  # models that allow automatic sizing.
160
168
  size: nil,
161
- # A unique identifier representing your end-user, which can help OpenAI to monitor
162
- # and detect abuse.
169
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
170
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
171
+ # empty.
163
172
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
164
173
  user: nil,
165
174
  # There is no need to provide `stream:`. Instead, use `#edit_stream_raw` or
@@ -187,6 +196,7 @@ module OpenAI
187
196
  partial_images: T.nilable(Integer),
188
197
  quality: T.nilable(OpenAI::ImageEditParams::Quality::OrSymbol),
189
198
  response_format: T.nilable(OpenAI::ImageEditParams::ResponseFormat::OrSymbol),
199
+ safety_identifier: T.nilable(String),
190
200
  size: T.nilable(T.any(String, OpenAI::ImageEditParams::Size::OrSymbol)),
191
201
  user: String,
192
202
  stream: T.noreturn,
@@ -266,6 +276,13 @@ module OpenAI
266
276
  # Legacy response format parameter for retired image models. Unsupported for GPT
267
277
  # image models, which always return base64-encoded images.
268
278
  response_format: nil,
279
+ # A stable identifier for an end user in your organization, used for safety
280
+ # monitoring and abuse detection. Hash a username or email address to avoid
281
+ # sending identifying information. A non-empty value takes precedence over the
282
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
283
+ # when available.
284
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
285
+ safety_identifier: nil,
269
286
  # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
270
287
  # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
271
288
  # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
@@ -278,8 +295,9 @@ module OpenAI
278
295
  # `1024x1536` are supported by the GPT image models; `auto` is supported for
279
296
  # models that allow automatic sizing.
280
297
  size: nil,
281
- # A unique identifier representing your end-user, which can help OpenAI to monitor
282
- # and detect abuse.
298
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
299
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
300
+ # empty.
283
301
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
284
302
  user: nil,
285
303
  # There is no need to provide `stream:`. Instead, use `#edit_stream_raw` or
@@ -305,6 +323,7 @@ module OpenAI
305
323
  partial_images: T.nilable(Integer),
306
324
  quality: T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol),
307
325
  response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol),
326
+ safety_identifier: T.nilable(String),
308
327
  size: T.nilable(T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol)),
309
328
  style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol),
310
329
  user: String,
@@ -364,6 +383,13 @@ module OpenAI
364
383
  # Legacy response format parameter for retired image models. Unsupported for GPT
365
384
  # image models, which always return base64-encoded images.
366
385
  response_format: nil,
386
+ # A stable identifier for an end user in your organization, used for safety
387
+ # monitoring and abuse detection. Hash a username or email address to avoid
388
+ # sending identifying information. A non-empty value takes precedence over the
389
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
390
+ # when available.
391
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
392
+ safety_identifier: nil,
367
393
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
368
394
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
369
395
  # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
@@ -378,8 +404,9 @@ module OpenAI
378
404
  # Legacy style parameter for retired image models. Unsupported for GPT image
379
405
  # models; describe the desired style in the prompt instead.
380
406
  style: nil,
381
- # A unique identifier representing your end-user, which can help OpenAI to monitor
382
- # and detect abuse.
407
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
408
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
409
+ # empty.
383
410
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
384
411
  user: nil,
385
412
  # There is no need to provide `stream:`. Instead, use `#generate_stream_raw` or
@@ -405,6 +432,7 @@ module OpenAI
405
432
  partial_images: T.nilable(Integer),
406
433
  quality: T.nilable(OpenAI::ImageGenerateParams::Quality::OrSymbol),
407
434
  response_format: T.nilable(OpenAI::ImageGenerateParams::ResponseFormat::OrSymbol),
435
+ safety_identifier: T.nilable(String),
408
436
  size: T.nilable(T.any(String, OpenAI::ImageGenerateParams::Size::OrSymbol)),
409
437
  style: T.nilable(OpenAI::ImageGenerateParams::Style::OrSymbol),
410
438
  user: String,
@@ -464,6 +492,13 @@ module OpenAI
464
492
  # Legacy response format parameter for retired image models. Unsupported for GPT
465
493
  # image models, which always return base64-encoded images.
466
494
  response_format: nil,
495
+ # A stable identifier for an end user in your organization, used for safety
496
+ # monitoring and abuse detection. Hash a username or email address to avoid
497
+ # sending identifying information. A non-empty value takes precedence over the
498
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
499
+ # when available.
500
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
501
+ safety_identifier: nil,
467
502
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
468
503
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
469
504
  # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
@@ -478,8 +513,9 @@ module OpenAI
478
513
  # Legacy style parameter for retired image models. Unsupported for GPT image
479
514
  # models; describe the desired style in the prompt instead.
480
515
  style: nil,
481
- # A unique identifier representing your end-user, which can help OpenAI to monitor
482
- # and detect abuse.
516
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
517
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
518
+ # empty.
483
519
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
484
520
  user: nil,
485
521
  # There is no need to provide `stream:`. Instead, use `#generate_stream_raw` or
@@ -9,7 +9,8 @@ module OpenAI
9
9
  quality: OpenAI::Models::ImageEditCompletedEvent::quality,
10
10
  size: OpenAI::Models::ImageEditCompletedEvent::size,
11
11
  ?type: :"image_edit.completed",
12
- usage: OpenAI::ImageEditCompletedEvent::Usage
12
+ usage: OpenAI::ImageEditCompletedEvent::Usage,
13
+ ?safety_identifier: String?
13
14
  }
14
15
 
15
16
  class ImageEditCompletedEvent < OpenAI::Internal::Type::BaseModel
@@ -38,6 +39,11 @@ module OpenAI
38
39
  # generation.
39
40
  attr_accessor usage: OpenAI::ImageEditCompletedEvent::Usage
40
41
 
42
+ # The effective safety identifier used for safety monitoring and abuse detection.
43
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
44
+ # `user` value when `safety_identifier` is omitted, null, or empty.
45
+ attr_accessor safety_identifier: String?
46
+
41
47
  # @param b64_json
42
48
  # Base64-encoded final edited image data, suitable for rendering as an image.
43
49
  # @param background
@@ -53,6 +59,10 @@ module OpenAI
53
59
  # @param usage
54
60
  # For the GPT image models only, the token usage information for the image
55
61
  # generation.
62
+ # @param safety_identifier
63
+ # The effective safety identifier used for safety monitoring and abuse detection.
64
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
65
+ # `user` value when `safety_identifier` is omitted, null, or empty.
56
66
  # @param type
57
67
  # The type of the event. Always `image_edit.completed`.
58
68
  def initialize: (
@@ -63,6 +73,7 @@ module OpenAI
63
73
  quality: OpenAI::Models::ImageEditCompletedEvent::quality,
64
74
  size: OpenAI::Models::ImageEditCompletedEvent::size,
65
75
  usage: OpenAI::ImageEditCompletedEvent::Usage,
76
+ ?safety_identifier: String?,
66
77
  ?type: :"image_edit.completed"
67
78
  ) -> void
68
79
 
@@ -74,7 +85,8 @@ module OpenAI
74
85
  quality: OpenAI::Models::ImageEditCompletedEvent::quality,
75
86
  size: OpenAI::Models::ImageEditCompletedEvent::size,
76
87
  ?type: :"image_edit.completed",
77
- usage: OpenAI::ImageEditCompletedEvent::Usage
88
+ usage: OpenAI::ImageEditCompletedEvent::Usage,
89
+ ?safety_identifier: String?
78
90
  }
79
91
 
80
92
  type background = :transparent | :opaque | :auto
@@ -14,6 +14,7 @@ module OpenAI
14
14
  ?partial_images: Integer?,
15
15
  ?quality: OpenAI::Models::ImageEditParams::quality?,
16
16
  ?response_format: OpenAI::Models::ImageEditParams::response_format?,
17
+ ?safety_identifier: String?,
17
18
  ?size: OpenAI::Models::ImageEditParams::size?,
18
19
  ?user: String,
19
20
  ?request_options: OpenAI::request_opts
@@ -116,6 +117,14 @@ module OpenAI
116
117
  # image models, which always return base64-encoded images.
117
118
  attr_accessor response_format: OpenAI::Models::ImageEditParams::response_format?
118
119
 
120
+ # A stable identifier for an end user in your organization, used for safety
121
+ # monitoring and abuse detection. Hash a username or email address to avoid
122
+ # sending identifying information. A non-empty value takes precedence over the
123
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
124
+ # when available.
125
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
126
+ attr_accessor safety_identifier: String?
127
+
119
128
  # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
120
129
  # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
121
130
  # `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
@@ -129,13 +138,15 @@ module OpenAI
129
138
  # models that allow automatic sizing.
130
139
  attr_accessor size: OpenAI::Models::ImageEditParams::size?
131
140
 
132
- # A unique identifier representing your end-user, which can help OpenAI to monitor
133
- # and detect abuse.
141
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
142
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
143
+ # empty.
134
144
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
135
145
  attr_reader user: String?
136
146
 
137
- # A unique identifier representing your end-user, which can help OpenAI to monitor
138
- # and detect abuse.
147
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
148
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
149
+ # empty.
139
150
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
140
151
  def user=: (String) -> String
141
152
 
@@ -210,6 +221,13 @@ module OpenAI
210
221
  # @param response_format
211
222
  # Legacy response format parameter for retired image models. Unsupported for GPT
212
223
  # image models, which always return base64-encoded images.
224
+ # @param safety_identifier
225
+ # A stable identifier for an end user in your organization, used for safety
226
+ # monitoring and abuse detection. Hash a username or email address to avoid
227
+ # sending identifying information. A non-empty value takes precedence over the
228
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
229
+ # when available.
230
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
213
231
  # @param size
214
232
  # The size of the generated images. Defaults to `auto`. For `gpt-image-2`,
215
233
  # `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
@@ -223,8 +241,9 @@ module OpenAI
223
241
  # `1024x1536` are supported by the GPT image models; `auto` is supported for
224
242
  # models that allow automatic sizing.
225
243
  # @param user
226
- # A unique identifier representing your end-user, which can help OpenAI to monitor
227
- # and detect abuse.
244
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
245
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
246
+ # empty.
228
247
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
229
248
  def initialize: (
230
249
  image: OpenAI::Models::ImageEditParams::image,
@@ -239,6 +258,7 @@ module OpenAI
239
258
  ?partial_images: Integer?,
240
259
  ?quality: OpenAI::Models::ImageEditParams::quality?,
241
260
  ?response_format: OpenAI::Models::ImageEditParams::response_format?,
261
+ ?safety_identifier: String?,
242
262
  ?size: OpenAI::Models::ImageEditParams::size?,
243
263
  ?user: String,
244
264
  ?request_options: OpenAI::request_opts
@@ -257,6 +277,7 @@ module OpenAI
257
277
  ?partial_images: Integer?,
258
278
  ?quality: OpenAI::Models::ImageEditParams::quality?,
259
279
  ?response_format: OpenAI::Models::ImageEditParams::response_format?,
280
+ ?safety_identifier: String?,
260
281
  ?size: OpenAI::Models::ImageEditParams::size?,
261
282
  ?user: String,
262
283
  ?request_options: OpenAI::RequestOptions
@@ -9,7 +9,8 @@ module OpenAI
9
9
  quality: OpenAI::Models::ImageGenCompletedEvent::quality,
10
10
  size: OpenAI::Models::ImageGenCompletedEvent::size,
11
11
  ?type: :"image_generation.completed",
12
- usage: OpenAI::ImageGenCompletedEvent::Usage
12
+ usage: OpenAI::ImageGenCompletedEvent::Usage,
13
+ ?safety_identifier: String?
13
14
  }
14
15
 
15
16
  class ImageGenCompletedEvent < OpenAI::Internal::Type::BaseModel
@@ -38,6 +39,11 @@ module OpenAI
38
39
  # generation.
39
40
  attr_accessor usage: OpenAI::ImageGenCompletedEvent::Usage
40
41
 
42
+ # The effective safety identifier used for safety monitoring and abuse detection.
43
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
44
+ # `user` value when `safety_identifier` is omitted, null, or empty.
45
+ attr_accessor safety_identifier: String?
46
+
41
47
  # @param b64_json
42
48
  # Base64-encoded image data, suitable for rendering as an image.
43
49
  # @param background
@@ -53,6 +59,10 @@ module OpenAI
53
59
  # @param usage
54
60
  # For the GPT image models only, the token usage information for the image
55
61
  # generation.
62
+ # @param safety_identifier
63
+ # The effective safety identifier used for safety monitoring and abuse detection.
64
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
65
+ # `user` value when `safety_identifier` is omitted, null, or empty.
56
66
  # @param type
57
67
  # The type of the event. Always `image_generation.completed`.
58
68
  def initialize: (
@@ -63,6 +73,7 @@ module OpenAI
63
73
  quality: OpenAI::Models::ImageGenCompletedEvent::quality,
64
74
  size: OpenAI::Models::ImageGenCompletedEvent::size,
65
75
  usage: OpenAI::ImageGenCompletedEvent::Usage,
76
+ ?safety_identifier: String?,
66
77
  ?type: :"image_generation.completed"
67
78
  ) -> void
68
79
 
@@ -74,7 +85,8 @@ module OpenAI
74
85
  quality: OpenAI::Models::ImageGenCompletedEvent::quality,
75
86
  size: OpenAI::Models::ImageGenCompletedEvent::size,
76
87
  ?type: :"image_generation.completed",
77
- usage: OpenAI::ImageGenCompletedEvent::Usage
88
+ usage: OpenAI::ImageGenCompletedEvent::Usage,
89
+ ?safety_identifier: String?
78
90
  }
79
91
 
80
92
  type background = :transparent | :opaque | :auto
@@ -12,6 +12,7 @@ module OpenAI
12
12
  ?partial_images: Integer?,
13
13
  ?quality: OpenAI::Models::ImageGenerateParams::quality?,
14
14
  ?response_format: OpenAI::Models::ImageGenerateParams::response_format?,
15
+ ?safety_identifier: String?,
15
16
  ?size: OpenAI::Models::ImageGenerateParams::size?,
16
17
  ?style: OpenAI::Models::ImageGenerateParams::style?,
17
18
  ?user: String,
@@ -82,6 +83,14 @@ module OpenAI
82
83
  # image models, which always return base64-encoded images.
83
84
  attr_accessor response_format: OpenAI::Models::ImageGenerateParams::response_format?
84
85
 
86
+ # A stable identifier for an end user in your organization, used for safety
87
+ # monitoring and abuse detection. Hash a username or email address to avoid
88
+ # sending identifying information. A non-empty value takes precedence over the
89
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
90
+ # when available.
91
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
92
+ attr_accessor safety_identifier: String?
93
+
85
94
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
86
95
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
87
96
  # `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary
@@ -98,13 +107,15 @@ module OpenAI
98
107
  # models; describe the desired style in the prompt instead.
99
108
  attr_accessor style: OpenAI::Models::ImageGenerateParams::style?
100
109
 
101
- # A unique identifier representing your end-user, which can help OpenAI to monitor
102
- # and detect abuse.
110
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
111
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
112
+ # empty.
103
113
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
104
114
  attr_reader user: String?
105
115
 
106
- # A unique identifier representing your end-user, which can help OpenAI to monitor
107
- # and detect abuse.
116
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
117
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
118
+ # empty.
108
119
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
109
120
  def user=: (String) -> String
110
121
 
@@ -158,6 +169,13 @@ module OpenAI
158
169
  # @param response_format
159
170
  # Legacy response format parameter for retired image models. Unsupported for GPT
160
171
  # image models, which always return base64-encoded images.
172
+ # @param safety_identifier
173
+ # A stable identifier for an end user in your organization, used for safety
174
+ # monitoring and abuse detection. Hash a username or email address to avoid
175
+ # sending identifying information. A non-empty value takes precedence over the
176
+ # deprecated `user` parameter. If omitted, null, or empty, the API uses `user`
177
+ # when available.
178
+ # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
161
179
  # @param size
162
180
  # The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
163
181
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
@@ -173,8 +191,9 @@ module OpenAI
173
191
  # Legacy style parameter for retired image models. Unsupported for GPT image
174
192
  # models; describe the desired style in the prompt instead.
175
193
  # @param user
176
- # A unique identifier representing your end-user, which can help OpenAI to monitor
177
- # and detect abuse.
194
+ # Deprecated: use `safety_identifier` instead. This parameter remains accepted for
195
+ # backward compatibility and is used when `safety_identifier` is omitted, null, or
196
+ # empty.
178
197
  # [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
179
198
  def initialize: (
180
199
  prompt: String,
@@ -187,6 +206,7 @@ module OpenAI
187
206
  ?partial_images: Integer?,
188
207
  ?quality: OpenAI::Models::ImageGenerateParams::quality?,
189
208
  ?response_format: OpenAI::Models::ImageGenerateParams::response_format?,
209
+ ?safety_identifier: String?,
190
210
  ?size: OpenAI::Models::ImageGenerateParams::size?,
191
211
  ?style: OpenAI::Models::ImageGenerateParams::style?,
192
212
  ?user: String,
@@ -204,6 +224,7 @@ module OpenAI
204
224
  ?partial_images: Integer?,
205
225
  ?quality: OpenAI::Models::ImageGenerateParams::quality?,
206
226
  ?response_format: OpenAI::Models::ImageGenerateParams::response_format?,
227
+ ?safety_identifier: String?,
207
228
  ?size: OpenAI::Models::ImageGenerateParams::size?,
208
229
  ?style: OpenAI::Models::ImageGenerateParams::style?,
209
230
  ?user: String,
@@ -7,6 +7,7 @@ module OpenAI
7
7
  ?data: ::Array[OpenAI::Image],
8
8
  ?output_format: OpenAI::Models::ImagesResponse::output_format,
9
9
  ?quality: OpenAI::Models::ImagesResponse::quality,
10
+ ?safety_identifier: String?,
10
11
  ?size: OpenAI::Models::ImagesResponse::size,
11
12
  ?usage: OpenAI::ImagesResponse::Usage
12
13
  }
@@ -49,6 +50,11 @@ module OpenAI
49
50
  OpenAI::Models::ImagesResponse::quality
50
51
  ) -> OpenAI::Models::ImagesResponse::quality
51
52
 
53
+ # The effective safety identifier used for safety monitoring and abuse detection.
54
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
55
+ # `user` value when `safety_identifier` is omitted, null, or empty.
56
+ attr_accessor safety_identifier: String?
57
+
52
58
  # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
53
59
  attr_reader size: OpenAI::Models::ImagesResponse::size?
54
60
 
@@ -77,6 +83,10 @@ module OpenAI
77
83
  # @param quality
78
84
  # The quality of the image generated. One of `low`, `medium`, `high`, `xhigh`, or
79
85
  # `max`.
86
+ # @param safety_identifier
87
+ # The effective safety identifier used for safety monitoring and abuse detection.
88
+ # This is the non-empty `safety_identifier` from the request, or the deprecated
89
+ # `user` value when `safety_identifier` is omitted, null, or empty.
80
90
  # @param size
81
91
  # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
82
92
  # @param usage
@@ -87,6 +97,7 @@ module OpenAI
87
97
  ?data: ::Array[OpenAI::Image],
88
98
  ?output_format: OpenAI::Models::ImagesResponse::output_format,
89
99
  ?quality: OpenAI::Models::ImagesResponse::quality,
100
+ ?safety_identifier: String?,
90
101
  ?size: OpenAI::Models::ImagesResponse::size,
91
102
  ?usage: OpenAI::ImagesResponse::Usage
92
103
  ) -> void
@@ -97,6 +108,7 @@ module OpenAI
97
108
  ?data: ::Array[OpenAI::Image],
98
109
  ?output_format: OpenAI::Models::ImagesResponse::output_format,
99
110
  ?quality: OpenAI::Models::ImagesResponse::quality,
111
+ ?safety_identifier: String?,
100
112
  ?size: OpenAI::Models::ImagesResponse::size,
101
113
  ?usage: OpenAI::ImagesResponse::Usage
102
114
  }
@@ -24,6 +24,7 @@ module OpenAI
24
24
  ?partial_images: Integer?,
25
25
  ?quality: OpenAI::Models::ImageEditParams::quality?,
26
26
  ?response_format: OpenAI::Models::ImageEditParams::response_format?,
27
+ ?safety_identifier: String?,
27
28
  ?size: OpenAI::Models::ImageEditParams::size?,
28
29
  ?user: String,
29
30
  ?request_options: OpenAI::request_opts
@@ -42,6 +43,7 @@ module OpenAI
42
43
  ?partial_images: Integer?,
43
44
  ?quality: OpenAI::Models::ImageEditParams::quality?,
44
45
  ?response_format: OpenAI::Models::ImageEditParams::response_format?,
46
+ ?safety_identifier: String?,
45
47
  ?size: OpenAI::Models::ImageEditParams::size?,
46
48
  ?user: String,
47
49
  ?request_options: OpenAI::request_opts
@@ -58,6 +60,7 @@ module OpenAI
58
60
  ?partial_images: Integer?,
59
61
  ?quality: OpenAI::Models::ImageGenerateParams::quality?,
60
62
  ?response_format: OpenAI::Models::ImageGenerateParams::response_format?,
63
+ ?safety_identifier: String?,
61
64
  ?size: OpenAI::Models::ImageGenerateParams::size?,
62
65
  ?style: OpenAI::Models::ImageGenerateParams::style?,
63
66
  ?user: String,
@@ -75,6 +78,7 @@ module OpenAI
75
78
  ?partial_images: Integer?,
76
79
  ?quality: OpenAI::Models::ImageGenerateParams::quality?,
77
80
  ?response_format: OpenAI::Models::ImageGenerateParams::response_format?,
81
+ ?safety_identifier: String?,
78
82
  ?size: OpenAI::Models::ImageGenerateParams::size?,
79
83
  ?style: OpenAI::Models::ImageGenerateParams::style?,
80
84
  ?user: String,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.104.0
4
+ version: 0.105.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAI