openai 0.104.0 → 0.106.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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/README.md +1 -1
  4. data/lib/openai/models/admin/organization/external_storage_configuration.rb +1 -0
  5. data/lib/openai/models/beta/agent_create_params.rb +3 -0
  6. data/lib/openai/models/beta/agent_update_params.rb +3 -0
  7. data/lib/openai/models/beta/agents/session_create_params.rb +3 -0
  8. data/lib/openai/models/beta/agents/session_update_params.rb +3 -0
  9. data/lib/openai/models/beta/assistant_update_params.rb +12 -0
  10. data/lib/openai/models/beta/beta_response.rb +12 -0
  11. data/lib/openai/models/beta/beta_responses_client_event.rb +12 -0
  12. data/lib/openai/models/beta/response_compact_params.rb +12 -0
  13. data/lib/openai/models/beta/response_create_params.rb +12 -0
  14. data/lib/openai/models/chat_model.rb +12 -0
  15. data/lib/openai/models/decision_create_params.rb +112 -1
  16. data/lib/openai/models/decision_input_image.rb +14 -1
  17. data/lib/openai/models/decision_input_text.rb +15 -1
  18. data/lib/openai/models/decision_prompt_cache_breakpoint.rb +21 -0
  19. data/lib/openai/models/image_edit_completed_event.rb +14 -1
  20. data/lib/openai/models/image_edit_params.rb +28 -5
  21. data/lib/openai/models/image_gen_completed_event.rb +14 -1
  22. data/lib/openai/models/image_generate_params.rb +28 -5
  23. data/lib/openai/models/images_response.rb +14 -1
  24. data/lib/openai/models/live/sideband_server_event.rb +243 -3
  25. data/lib/openai/models/responses/response_compact_params.rb +12 -0
  26. data/lib/openai/models.rb +2 -0
  27. data/lib/openai/resources/beta/responses.rb +19 -0
  28. data/lib/openai/resources/decisions.rb +15 -1
  29. data/lib/openai/resources/images.rb +50 -12
  30. data/lib/openai/version.rb +1 -1
  31. data/lib/openai.rb +1 -0
  32. data/rbi/openai/models/admin/organization/external_storage_configuration.rbi +1 -0
  33. data/rbi/openai/models/beta/agent_create_params.rbi +3 -0
  34. data/rbi/openai/models/beta/agent_update_params.rbi +3 -0
  35. data/rbi/openai/models/beta/agents/session_create_params.rbi +3 -0
  36. data/rbi/openai/models/beta/agents/session_update_params.rbi +3 -0
  37. data/rbi/openai/models/decision_create_params.rbi +146 -0
  38. data/rbi/openai/models/decision_input_image.rbi +22 -1
  39. data/rbi/openai/models/decision_input_text.rbi +21 -1
  40. data/rbi/openai/models/decision_prompt_cache_breakpoint.rbi +48 -0
  41. data/rbi/openai/models/image_edit_completed_event.rbi +15 -1
  42. data/rbi/openai/models/image_edit_params.rbi +26 -4
  43. data/rbi/openai/models/image_gen_completed_event.rbi +15 -1
  44. data/rbi/openai/models/image_generate_params.rbi +26 -4
  45. data/rbi/openai/models/images_response.rbi +14 -0
  46. data/rbi/openai/models/live/output_audio_delta_event.rbi +1 -1
  47. data/rbi/openai/models/live/sideband_server_event.rbi +406 -3
  48. data/rbi/openai/models.rbi +2 -0
  49. data/rbi/openai/resources/beta/responses.rbi +17 -0
  50. data/rbi/openai/resources/decisions.rbi +14 -0
  51. data/rbi/openai/resources/images.rbi +44 -8
  52. data/sig/openai/models/admin/organization/external_storage_configuration.rbs +2 -1
  53. data/sig/openai/models/beta/agent_create_params.rbs +5 -1
  54. data/sig/openai/models/beta/agent_update_params.rbs +5 -1
  55. data/sig/openai/models/beta/agents/session_create_params.rbs +5 -1
  56. data/sig/openai/models/beta/agents/session_update_params.rbs +5 -1
  57. data/sig/openai/models/decision_create_params.rbs +106 -0
  58. data/sig/openai/models/decision_input_image.rbs +18 -2
  59. data/sig/openai/models/decision_input_text.rbs +29 -3
  60. data/sig/openai/models/decision_prompt_cache_breakpoint.rbs +16 -0
  61. data/sig/openai/models/image_edit_completed_event.rbs +14 -2
  62. data/sig/openai/models/image_edit_params.rbs +27 -6
  63. data/sig/openai/models/image_gen_completed_event.rbs +14 -2
  64. data/sig/openai/models/image_generate_params.rbs +27 -6
  65. data/sig/openai/models/images_response.rbs +12 -0
  66. data/sig/openai/models/live/sideband_server_event.rbs +225 -0
  67. data/sig/openai/models.rbs +2 -0
  68. data/sig/openai/resources/beta/responses.rbs +7 -0
  69. data/sig/openai/resources/decisions.rbs +3 -0
  70. data/sig/openai/resources/images.rbs +4 -0
  71. metadata +4 -1
@@ -177,7 +177,8 @@ module OpenAI
177
177
  ?tools: ::Array[OpenAI::Models::Beta::agent_tool_param]?
178
178
  }
179
179
 
180
- type service_tier = :auto | :default | :flex | :priority | :fast
180
+ type service_tier =
181
+ :auto | :default | :flex | :priority | :fast | :ultrafast
181
182
 
182
183
  module ServiceTier
183
184
  extend OpenAI::Internal::Type::Enum
@@ -197,6 +198,9 @@ module OpenAI
197
198
  # Uses the fast service tier.
198
199
  FAST: :fast
199
200
 
201
+ # Uses the ultrafast service tier.
202
+ ULTRAFAST: :ultrafast
203
+
200
204
  def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::SessionCreateParams::Agent::service_tier]
201
205
  end
202
206
  end
@@ -139,7 +139,8 @@ module OpenAI
139
139
  end
140
140
  end
141
141
 
142
- type service_tier = :auto | :default | :flex | :priority | :fast
142
+ type service_tier =
143
+ :auto | :default | :flex | :priority | :fast | :ultrafast
143
144
 
144
145
  module ServiceTier
145
146
  extend OpenAI::Internal::Type::Enum
@@ -159,6 +160,9 @@ module OpenAI
159
160
  # Uses the fast service tier.
160
161
  FAST: :fast
161
162
 
163
+ # Uses the ultrafast service tier.
164
+ ULTRAFAST: :ultrafast
165
+
162
166
  def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::SessionUpdateParams::Agent::service_tier]
163
167
  end
164
168
  end
@@ -5,6 +5,9 @@ module OpenAI
5
5
  input: OpenAI::Models::DecisionCreateParams::input,
6
6
  model: String,
7
7
  questions: ::Array[OpenAI::Models::DecisionCreateParams::question],
8
+ ?prompt_cache_key: String?,
9
+ ?prompt_cache_options: (OpenAI::DecisionCreateParams::PromptCacheOptions
10
+ | OpenAI::Models::DecisionCreateParams::prompt_cache_options)?,
8
11
  ?safety_identifier: String?,
9
12
  ?request_options: OpenAI::request_opts
10
13
  }
@@ -26,6 +29,21 @@ module OpenAI
26
29
  # or score. Answers come back in the same order.
27
30
  attr_accessor questions: ::Array[OpenAI::Models::DecisionCreateParams::question]
28
31
 
32
+ # Partition prompt cache reuse by caller-provided key.
33
+ attr_accessor prompt_cache_key: String?
34
+
35
+ # Options for prompt caching. Supported for `gpt-5.6` and later models. By
36
+ # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
37
+ # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
38
+ # request can write up to four breakpoints. For cache matching, OpenAI considers
39
+ # up to the latest 80 breakpoints in the conversation, without a content-block
40
+ # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
41
+ # `ttl` defaults to `30m`, which is currently the only supported value. See the
42
+ # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
43
+ # for current details.
44
+ attr_accessor prompt_cache_options: (OpenAI::DecisionCreateParams::PromptCacheOptions
45
+ | OpenAI::Models::DecisionCreateParams::prompt_cache_options)?
46
+
29
47
  # Opaque caller-provided end-user identifier, scoped by the verified org. Match
30
48
  # Responses' limit; this is never the authenticated user identity.
31
49
  attr_accessor safety_identifier: String?
@@ -40,6 +58,18 @@ module OpenAI
40
58
  # @param questions
41
59
  # Ask 1–200 questions about the input. Each question can be a predicate, choice,
42
60
  # or score. Answers come back in the same order.
61
+ # @param prompt_cache_key
62
+ # Partition prompt cache reuse by caller-provided key.
63
+ # @param prompt_cache_options
64
+ # Options for prompt caching. Supported for `gpt-5.6` and later models. By
65
+ # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
66
+ # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
67
+ # request can write up to four breakpoints. For cache matching, OpenAI considers
68
+ # up to the latest 80 breakpoints in the conversation, without a content-block
69
+ # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
70
+ # `ttl` defaults to `30m`, which is currently the only supported value. See the
71
+ # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
72
+ # for current details.
43
73
  # @param safety_identifier
44
74
  # Opaque caller-provided end-user identifier, scoped by the verified org. Match
45
75
  # Responses' limit; this is never the authenticated user identity.
@@ -47,6 +77,9 @@ module OpenAI
47
77
  input: OpenAI::Models::DecisionCreateParams::input,
48
78
  model: String,
49
79
  questions: ::Array[OpenAI::Models::DecisionCreateParams::question],
80
+ ?prompt_cache_key: String?,
81
+ ?prompt_cache_options: (OpenAI::DecisionCreateParams::PromptCacheOptions
82
+ | OpenAI::Models::DecisionCreateParams::prompt_cache_options)?,
50
83
  ?safety_identifier: String?,
51
84
  ?request_options: OpenAI::request_opts
52
85
  ) -> void
@@ -55,6 +88,9 @@ module OpenAI
55
88
  input: OpenAI::Models::DecisionCreateParams::input,
56
89
  model: String,
57
90
  questions: ::Array[OpenAI::Models::DecisionCreateParams::question],
91
+ ?prompt_cache_key: String?,
92
+ ?prompt_cache_options: (OpenAI::DecisionCreateParams::PromptCacheOptions
93
+ | OpenAI::Models::DecisionCreateParams::prompt_cache_options)?,
58
94
  ?safety_identifier: String?,
59
95
  ?request_options: OpenAI::RequestOptions
60
96
  }
@@ -233,6 +269,76 @@ module OpenAI
233
269
 
234
270
  def self?.variants: -> ::Array[OpenAI::Models::DecisionCreateParams::question]
235
271
  end
272
+
273
+ type prompt_cache_options =
274
+ {
275
+ ?mode: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::mode?,
276
+ ?ttl: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl
277
+ }
278
+
279
+ class PromptCacheOptions < OpenAI::Internal::Type::BaseModel
280
+ # Controls whether OpenAI automatically creates an implicit cache breakpoint.
281
+ # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
282
+ # and writes up to the latest three explicit breakpoints in the request. With
283
+ # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
284
+ # latest four explicit breakpoints. If there are no explicit breakpoints, the
285
+ # request does not use prompt caching.
286
+ attr_accessor mode: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::mode?
287
+
288
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
289
+ # written by the request. Defaults to `30m`, which is currently the only supported
290
+ # value. The backend may retain cache entries for longer.
291
+ attr_reader ttl: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl?
292
+
293
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
294
+ # written by the request. Defaults to `30m`, which is currently the only supported
295
+ # value. The backend may retain cache entries for longer.
296
+ def ttl=: (
297
+ OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl
298
+ ) -> OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl
299
+
300
+ # @param mode
301
+ # Controls whether OpenAI automatically creates an implicit cache breakpoint.
302
+ # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
303
+ # and writes up to the latest three explicit breakpoints in the request. With
304
+ # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
305
+ # latest four explicit breakpoints. If there are no explicit breakpoints, the
306
+ # request does not use prompt caching.
307
+ # @param ttl
308
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
309
+ # written by the request. Defaults to `30m`, which is currently the only supported
310
+ # value. The backend may retain cache entries for longer.
311
+ def initialize: (
312
+ ?mode: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::mode?,
313
+ ?ttl: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl
314
+ ) -> void
315
+
316
+ def to_hash: -> {
317
+ ?mode: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::mode?,
318
+ ?ttl: OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl
319
+ }
320
+
321
+ type mode = :implicit | :explicit
322
+
323
+ module Mode
324
+ extend OpenAI::Internal::Type::Enum
325
+
326
+ IMPLICIT: :implicit
327
+ EXPLICIT: :explicit
328
+
329
+ def self?.values: -> ::Array[OpenAI::Models::DecisionCreateParams::PromptCacheOptions::mode]
330
+ end
331
+
332
+ type ttl = :"30m"
333
+
334
+ module Ttl
335
+ extend OpenAI::Internal::Type::Enum
336
+
337
+ TTL_30M: :"30m"
338
+
339
+ def self?.values: -> ::Array[OpenAI::Models::DecisionCreateParams::PromptCacheOptions::ttl]
340
+ end
341
+ end
236
342
  end
237
343
  end
238
344
  end
@@ -4,7 +4,9 @@ module OpenAI
4
4
  {
5
5
  image_url: String,
6
6
  ?type: :input_image,
7
- ?detail: OpenAI::Models::DecisionInputImage::detail?
7
+ ?detail: OpenAI::Models::DecisionInputImage::detail?,
8
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
9
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
8
10
  }
9
11
 
10
12
  class DecisionInputImage < OpenAI::Internal::Type::BaseModel
@@ -17,21 +19,35 @@ module OpenAI
17
19
  # auto.
18
20
  attr_accessor detail: OpenAI::Models::DecisionInputImage::detail?
19
21
 
22
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
23
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
24
+ # token block.
25
+ attr_accessor prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
26
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
27
+
20
28
  # @param image_url
21
29
  # A base64-encoded image in a data URL or a publicly accessible HTTP(S) image URL.
22
30
  # @param detail
23
31
  # The image detail level, using the selected model's image profile. Defaults to
24
32
  # auto.
33
+ # @param prompt_cache_breakpoint
34
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
35
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
36
+ # token block.
25
37
  def initialize: (
26
38
  image_url: String,
27
39
  ?detail: OpenAI::Models::DecisionInputImage::detail?,
40
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
41
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?,
28
42
  ?type: :input_image
29
43
  ) -> void
30
44
 
31
45
  def to_hash: -> {
32
46
  image_url: String,
33
47
  ?type: :input_image,
34
- ?detail: OpenAI::Models::DecisionInputImage::detail?
48
+ ?detail: OpenAI::Models::DecisionInputImage::detail?,
49
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
50
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
35
51
  }
36
52
 
37
53
  type detail = :low | :high | :auto | :original
@@ -1,15 +1,41 @@
1
1
  module OpenAI
2
2
  module Models
3
- type decision_input_text = { text: String, ?type: :input_text }
3
+ type decision_input_text =
4
+ {
5
+ text: String,
6
+ ?type: :input_text,
7
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
8
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
9
+ }
4
10
 
5
11
  class DecisionInputText < OpenAI::Internal::Type::BaseModel
6
12
  attr_accessor text: String
7
13
 
8
14
  attr_accessor type: :input_text
9
15
 
10
- def initialize: (text: String, ?type: :input_text) -> void
16
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
17
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
18
+ # token block.
19
+ attr_accessor prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
20
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
11
21
 
12
- def to_hash: -> { text: String, ?type: :input_text }
22
+ # @param prompt_cache_breakpoint
23
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
24
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
25
+ # token block.
26
+ def initialize: (
27
+ text: String,
28
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
29
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?,
30
+ ?type: :input_text
31
+ ) -> void
32
+
33
+ def to_hash: -> {
34
+ text: String,
35
+ ?type: :input_text,
36
+ ?prompt_cache_breakpoint: (OpenAI::DecisionPromptCacheBreakpoint
37
+ | OpenAI::Models::decision_prompt_cache_breakpoint)?
38
+ }
13
39
  end
14
40
  end
15
41
  end
@@ -0,0 +1,16 @@
1
+ module OpenAI
2
+ module Models
3
+ type decision_prompt_cache_breakpoint = { ?mode: :explicit }
4
+
5
+ class DecisionPromptCacheBreakpoint < OpenAI::Internal::Type::BaseModel
6
+ # The breakpoint mode. Always `explicit`.
7
+ attr_accessor mode: :explicit
8
+
9
+ # @param mode
10
+ # The breakpoint mode. Always `explicit`.
11
+ def initialize: (?mode: :explicit) -> void
12
+
13
+ def to_hash: -> { ?mode: :explicit }
14
+ end
15
+ end
16
+ end
@@ -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
  }