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
data/lib/openai.rb CHANGED
@@ -973,6 +973,7 @@ require_relative "openai/models/decision_input_image"
973
973
  require_relative "openai/models/decision_input_message"
974
974
  require_relative "openai/models/decision_input_part"
975
975
  require_relative "openai/models/decision_input_text"
976
+ require_relative "openai/models/decision_prompt_cache_breakpoint"
976
977
  require_relative "openai/models/deleted_skill"
977
978
  require_relative "openai/models/embedding"
978
979
  require_relative "openai/models/embedding_create_params"
@@ -128,6 +128,7 @@ module OpenAI
128
128
  :validated,
129
129
  OpenAI::Admin::Organization::ExternalStorageConfiguration::Status::TaggedSymbol
130
130
  )
131
+ DEGRADED = T.let(:degraded, OpenAI::Admin::Organization::ExternalStorageConfiguration::Status::TaggedSymbol)
131
132
  UNHEALTHY = T.let(
132
133
  :unhealthy,
133
134
  OpenAI::Admin::Organization::ExternalStorageConfiguration::Status::TaggedSymbol
@@ -208,6 +208,9 @@ module OpenAI
208
208
  # Uses the fast service tier.
209
209
  FAST = T.let(:fast, OpenAI::Beta::AgentCreateParams::ServiceTier::TaggedSymbol)
210
210
 
211
+ # Uses the ultrafast service tier.
212
+ ULTRAFAST = T.let(:ultrafast, OpenAI::Beta::AgentCreateParams::ServiceTier::TaggedSymbol)
213
+
211
214
  sig { override.returns(T::Array[OpenAI::Beta::AgentCreateParams::ServiceTier::TaggedSymbol]) }
212
215
  def self.values
213
216
  end
@@ -219,6 +219,9 @@ module OpenAI
219
219
  # Uses the fast service tier.
220
220
  FAST = T.let(:fast, OpenAI::Beta::AgentUpdateParams::ServiceTier::TaggedSymbol)
221
221
 
222
+ # Uses the ultrafast service tier.
223
+ ULTRAFAST = T.let(:ultrafast, OpenAI::Beta::AgentUpdateParams::ServiceTier::TaggedSymbol)
224
+
222
225
  sig { override.returns(T::Array[OpenAI::Beta::AgentUpdateParams::ServiceTier::TaggedSymbol]) }
223
226
  def self.values
224
227
  end
@@ -333,6 +333,9 @@ module OpenAI
333
333
  # Uses the fast service tier.
334
334
  FAST = T.let(:fast, OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::TaggedSymbol)
335
335
 
336
+ # Uses the ultrafast service tier.
337
+ ULTRAFAST = T.let(:ultrafast, OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::TaggedSymbol)
338
+
336
339
  sig {
337
340
  override.returns(T::Array[OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::TaggedSymbol])
338
341
  }
@@ -251,6 +251,9 @@ module OpenAI
251
251
  # Uses the fast service tier.
252
252
  FAST = T.let(:fast, OpenAI::Beta::Agents::SessionUpdateParams::Agent::ServiceTier::TaggedSymbol)
253
253
 
254
+ # Uses the ultrafast service tier.
255
+ ULTRAFAST = T.let(:ultrafast, OpenAI::Beta::Agents::SessionUpdateParams::Agent::ServiceTier::TaggedSymbol)
256
+
254
257
  sig {
255
258
  override.returns(T::Array[OpenAI::Beta::Agents::SessionUpdateParams::Agent::ServiceTier::TaggedSymbol])
256
259
  }
@@ -41,6 +41,22 @@ module OpenAI
41
41
  }
42
42
  attr_accessor :questions
43
43
 
44
+ # Partition prompt cache reuse by caller-provided key.
45
+ sig { returns(T.nilable(String)) }
46
+ attr_accessor :prompt_cache_key
47
+
48
+ # Options for prompt caching. Supported for `gpt-5.6` and later models. By
49
+ # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
50
+ # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
51
+ # request can write up to four breakpoints. For cache matching, OpenAI considers
52
+ # up to the latest 80 breakpoints in the conversation, without a content-block
53
+ # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
54
+ # `ttl` defaults to `30m`, which is currently the only supported value. See the
55
+ # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
56
+ # for current details.
57
+ sig { returns(T.nilable(OpenAI::DecisionCreateParams::PromptCacheOptions::OrHash)) }
58
+ attr_accessor :prompt_cache_options
59
+
44
60
  # Opaque caller-provided end-user identifier, scoped by the verified org. Match
45
61
  # Responses' limit; this is never the authenticated user identity.
46
62
  sig { returns(T.nilable(String)) }
@@ -61,6 +77,10 @@ module OpenAI
61
77
  )
62
78
  ],
63
79
 
80
+ prompt_cache_key: T.nilable(String),
81
+
82
+ prompt_cache_options: T.nilable(OpenAI::DecisionCreateParams::PromptCacheOptions::OrHash),
83
+
64
84
  safety_identifier: T.nilable(String),
65
85
 
66
86
  request_options: OpenAI::RequestOptions::OrHash
@@ -82,6 +102,20 @@ module OpenAI
82
102
  # or score. Answers come back in the same order.
83
103
  questions:,
84
104
 
105
+ # Partition prompt cache reuse by caller-provided key.
106
+ prompt_cache_key: nil,
107
+
108
+ # Options for prompt caching. Supported for `gpt-5.6` and later models. By
109
+ # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
110
+ # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
111
+ # request can write up to four breakpoints. For cache matching, OpenAI considers
112
+ # up to the latest 80 breakpoints in the conversation, without a content-block
113
+ # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
114
+ # `ttl` defaults to `30m`, which is currently the only supported value. See the
115
+ # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
116
+ # for current details.
117
+ prompt_cache_options: nil,
118
+
85
119
  # Opaque caller-provided end-user identifier, scoped by the verified org. Match
86
120
  # Responses' limit; this is never the authenticated user identity.
87
121
  safety_identifier: nil,
@@ -102,6 +136,8 @@ module OpenAI
102
136
  OpenAI::DecisionCreateParams::Question::Score
103
137
  )
104
138
  ],
139
+ prompt_cache_key: T.nilable(String),
140
+ prompt_cache_options: T.nilable(OpenAI::DecisionCreateParams::PromptCacheOptions::OrHash),
105
141
  safety_identifier: T.nilable(String),
106
142
  request_options: OpenAI::RequestOptions
107
143
  }
@@ -440,6 +476,116 @@ module OpenAI
440
476
 
441
477
  end
442
478
 
479
+ class PromptCacheOptions < OpenAI::Internal::Type::BaseModel
480
+ OrHash = T.type_alias do
481
+ T.any(
482
+ OpenAI::DecisionCreateParams::PromptCacheOptions,
483
+ OpenAI::Internal::AnyHash
484
+ )
485
+ end
486
+
487
+ # Controls whether OpenAI automatically creates an implicit cache breakpoint.
488
+ # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
489
+ # and writes up to the latest three explicit breakpoints in the request. With
490
+ # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
491
+ # latest four explicit breakpoints. If there are no explicit breakpoints, the
492
+ # request does not use prompt caching.
493
+ sig { returns(T.nilable(OpenAI::DecisionCreateParams::PromptCacheOptions::Mode::OrSymbol)) }
494
+ attr_accessor :mode
495
+
496
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
497
+ # written by the request. Defaults to `30m`, which is currently the only supported
498
+ # value. The backend may retain cache entries for longer.
499
+ sig { returns(T.nilable(OpenAI::DecisionCreateParams::PromptCacheOptions::Ttl::OrSymbol)) }
500
+ attr_reader :ttl
501
+
502
+ sig { params(ttl: OpenAI::DecisionCreateParams::PromptCacheOptions::Ttl::OrSymbol).void }
503
+ attr_writer :ttl
504
+
505
+ # Options for prompt caching. Supported for `gpt-5.6` and later models. By
506
+ # default, OpenAI automatically chooses one implicit cache breakpoint. You can add
507
+ # explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each
508
+ # request can write up to four breakpoints. For cache matching, OpenAI considers
509
+ # up to the latest 80 breakpoints in the conversation, without a content-block
510
+ # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
511
+ # `ttl` defaults to `30m`, which is currently the only supported value. See the
512
+ # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
513
+ # for current details.
514
+ sig do
515
+ params(
516
+
517
+ mode: T.nilable(OpenAI::DecisionCreateParams::PromptCacheOptions::Mode::OrSymbol),
518
+
519
+ ttl: OpenAI::DecisionCreateParams::PromptCacheOptions::Ttl::OrSymbol
520
+ )
521
+ .returns(T.attached_class)
522
+ end
523
+ def self.new(
524
+
525
+ # Controls whether OpenAI automatically creates an implicit cache breakpoint.
526
+ # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
527
+ # and writes up to the latest three explicit breakpoints in the request. With
528
+ # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
529
+ # latest four explicit breakpoints. If there are no explicit breakpoints, the
530
+ # request does not use prompt caching.
531
+ mode: nil,
532
+
533
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
534
+ # written by the request. Defaults to `30m`, which is currently the only supported
535
+ # value. The backend may retain cache entries for longer.
536
+
537
+ ttl: nil
538
+ )
539
+ end
540
+
541
+ sig do
542
+ override.returns(
543
+ {
544
+ mode: T.nilable(OpenAI::DecisionCreateParams::PromptCacheOptions::Mode::OrSymbol),
545
+ ttl: OpenAI::DecisionCreateParams::PromptCacheOptions::Ttl::OrSymbol
546
+ }
547
+ )
548
+ end
549
+ def to_hash
550
+ end
551
+
552
+ # Controls whether OpenAI automatically creates an implicit cache breakpoint.
553
+ # Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint
554
+ # and writes up to the latest three explicit breakpoints in the request. With
555
+ # `explicit`, OpenAI does not create an implicit breakpoint and writes up to the
556
+ # latest four explicit breakpoints. If there are no explicit breakpoints, the
557
+ # request does not use prompt caching.
558
+ module Mode
559
+ extend OpenAI::Internal::Type::Enum
560
+
561
+ TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::DecisionCreateParams::PromptCacheOptions::Mode) }
562
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
563
+
564
+ IMPLICIT = T.let(:implicit, OpenAI::DecisionCreateParams::PromptCacheOptions::Mode::TaggedSymbol)
565
+ EXPLICIT = T.let(:explicit, OpenAI::DecisionCreateParams::PromptCacheOptions::Mode::TaggedSymbol)
566
+
567
+ sig { override.returns(T::Array[OpenAI::DecisionCreateParams::PromptCacheOptions::Mode::TaggedSymbol]) }
568
+ def self.values
569
+ end
570
+ end
571
+
572
+ # The minimum lifetime applied to every implicit and explicit cache breakpoint
573
+ # written by the request. Defaults to `30m`, which is currently the only supported
574
+ # value. The backend may retain cache entries for longer.
575
+ module Ttl
576
+ extend OpenAI::Internal::Type::Enum
577
+
578
+ TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::DecisionCreateParams::PromptCacheOptions::Ttl) }
579
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
580
+
581
+ TTL_30M = T.let(:"30m", OpenAI::DecisionCreateParams::PromptCacheOptions::Ttl::TaggedSymbol)
582
+
583
+ sig { override.returns(T::Array[OpenAI::DecisionCreateParams::PromptCacheOptions::Ttl::TaggedSymbol]) }
584
+ def self.values
585
+ end
586
+ end
587
+ end
588
+
443
589
  end
444
590
 
445
591
  end
@@ -24,6 +24,15 @@ module OpenAI
24
24
  sig { returns(T.nilable(OpenAI::DecisionInputImage::Detail::OrSymbol)) }
25
25
  attr_accessor :detail
26
26
 
27
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
28
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
29
+ # token block.
30
+ sig { returns(T.nilable(OpenAI::DecisionPromptCacheBreakpoint::OrHash)) }
31
+ attr_reader :prompt_cache_breakpoint
32
+
33
+ sig { params(prompt_cache_breakpoint: T.nilable(OpenAI::DecisionPromptCacheBreakpoint::OrHash)).void }
34
+ attr_writer :prompt_cache_breakpoint
35
+
27
36
  # An image provided as a base64 data URL or a publicly accessible HTTP(S) URL.
28
37
  # File IDs are not supported.
29
38
  sig do
@@ -33,6 +42,8 @@ module OpenAI
33
42
 
34
43
  detail: T.nilable(OpenAI::DecisionInputImage::Detail::OrSymbol),
35
44
 
45
+ prompt_cache_breakpoint: T.nilable(OpenAI::DecisionPromptCacheBreakpoint::OrHash),
46
+
36
47
  type: Symbol
37
48
  )
38
49
  .returns(T.attached_class)
@@ -46,13 +57,23 @@ module OpenAI
46
57
  # auto.
47
58
  detail: nil,
48
59
 
60
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
61
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
62
+ # token block.
63
+ prompt_cache_breakpoint: nil,
64
+
49
65
  type: :input_image
50
66
  )
51
67
  end
52
68
 
53
69
  sig do
54
70
  override.returns(
55
- {image_url: String, type: Symbol, detail: T.nilable(OpenAI::DecisionInputImage::Detail::OrSymbol)}
71
+ {
72
+ image_url: String,
73
+ type: Symbol,
74
+ detail: T.nilable(OpenAI::DecisionInputImage::Detail::OrSymbol),
75
+ prompt_cache_breakpoint: T.nilable(OpenAI::DecisionPromptCacheBreakpoint::OrHash)
76
+ }
56
77
  )
57
78
  end
58
79
  def to_hash
@@ -18,11 +18,22 @@ module OpenAI
18
18
  sig { returns(Symbol) }
19
19
  attr_accessor :type
20
20
 
21
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
22
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
23
+ # token block.
24
+ sig { returns(T.nilable(OpenAI::DecisionPromptCacheBreakpoint::OrHash)) }
25
+ attr_reader :prompt_cache_breakpoint
26
+
27
+ sig { params(prompt_cache_breakpoint: T.nilable(OpenAI::DecisionPromptCacheBreakpoint::OrHash)).void }
28
+ attr_writer :prompt_cache_breakpoint
29
+
21
30
  sig do
22
31
  params(
23
32
 
24
33
  text: String,
25
34
 
35
+ prompt_cache_breakpoint: T.nilable(OpenAI::DecisionPromptCacheBreakpoint::OrHash),
36
+
26
37
  type: Symbol
27
38
  )
28
39
  .returns(T.attached_class)
@@ -31,13 +42,22 @@ module OpenAI
31
42
 
32
43
  text:,
33
44
 
45
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
46
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
47
+ # token block.
48
+ prompt_cache_breakpoint: nil,
49
+
34
50
  type: :input_text
35
51
  )
36
52
  end
37
53
 
38
54
  sig do
39
55
  override.returns(
40
- {text: String, type: Symbol}
56
+ {
57
+ text: String,
58
+ type: Symbol,
59
+ prompt_cache_breakpoint: T.nilable(OpenAI::DecisionPromptCacheBreakpoint::OrHash)
60
+ }
41
61
  )
42
62
  end
43
63
  def to_hash
@@ -0,0 +1,48 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+
6
+ class DecisionPromptCacheBreakpoint < OpenAI::Internal::Type::BaseModel
7
+
8
+ OrHash = T.type_alias do
9
+ T.any(
10
+ OpenAI::DecisionPromptCacheBreakpoint,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # The breakpoint mode. Always `explicit`.
16
+ sig { returns(Symbol) }
17
+ attr_accessor :mode
18
+
19
+ # Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL
20
+ # from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a
21
+ # token block.
22
+ sig do
23
+ params(
24
+
25
+ mode: Symbol
26
+ )
27
+ .returns(T.attached_class)
28
+ end
29
+ def self.new(
30
+
31
+ # The breakpoint mode. Always `explicit`.
32
+
33
+ mode: :explicit
34
+ )
35
+ end
36
+
37
+ sig do
38
+ override.returns(
39
+ {mode: Symbol}
40
+ )
41
+ end
42
+ def to_hash
43
+ end
44
+
45
+ end
46
+
47
+ end
48
+ 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
  }
@@ -79,7 +79,7 @@ module OpenAI
79
79
 
80
80
  sig do
81
81
  override.returns(
82
- {delta: String, type: Symbol, end_ms: Integer, start_ms: Integer}
82
+ {delta: String, type: Symbol, end_ms: T.nilable(Integer), start_ms: T.nilable(Integer)}
83
83
  )
84
84
  end
85
85
  def to_hash