openai 0.117.0 → 0.119.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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/README.md +1 -1
  4. data/lib/openai/client.rb +1 -1
  5. data/lib/openai/helpers/data_residency.rb +4 -1
  6. data/lib/openai/models/admin/organization/projects/project_optional_service_tier.rb +24 -0
  7. data/lib/openai/models/admin/organization/projects/project_service_tier_settings.rb +88 -0
  8. data/lib/openai/models/admin/organization/projects/service_tier_setting_retrieve_params.rb +29 -0
  9. data/lib/openai/models/admin/organization/projects/service_tier_setting_update_params.rb +92 -0
  10. data/lib/openai/models/all_models.rb +1 -0
  11. data/lib/openai/models/beta/beta_compacted_response.rb +34 -1
  12. data/lib/openai/models/beta/beta_response.rb +35 -1
  13. data/lib/openai/models/beta/beta_response_input_item.rb +45 -1
  14. data/lib/openai/models/beta/beta_response_item.rb +45 -1
  15. data/lib/openai/models/beta/beta_response_output_item.rb +45 -1
  16. data/lib/openai/models/beta/beta_response_tool_search_output_item_param.rb +186 -13
  17. data/lib/openai/models/beta/beta_response_usage.rb +33 -1
  18. data/lib/openai/models/beta/beta_responses_client_event.rb +58 -10
  19. data/lib/openai/models/beta/beta_tool.rb +164 -13
  20. data/lib/openai/models/beta/response_compact_params.rb +47 -4
  21. data/lib/openai/models/beta/response_create_params.rb +54 -10
  22. data/lib/openai/models/beta/session_turn_error.rb +3 -0
  23. data/lib/openai/models/chat/completion_create_params.rb +3 -3
  24. data/lib/openai/models/conversations/conversation_item.rb +45 -1
  25. data/lib/openai/models/image_edit_params.rb +72 -16
  26. data/lib/openai/models/image_generate_params.rb +160 -8
  27. data/lib/openai/models/image_model.rb +2 -0
  28. data/lib/openai/models/images_response.rb +55 -4
  29. data/lib/openai/models/realtime/realtime_audio_config_input.rb +14 -1
  30. data/lib/openai/models/realtime/realtime_session_create_response.rb +14 -1
  31. data/lib/openai/models/realtime/realtime_transcription_session_audio_input.rb +14 -1
  32. data/lib/openai/models/realtime/realtime_transcription_session_create_response.rb +14 -1
  33. data/lib/openai/models/realtime/realtime_translation_session.rb +14 -1
  34. data/lib/openai/models/realtime/realtime_translation_session_create_request.rb +14 -1
  35. data/lib/openai/models/realtime/realtime_translation_session_update_request.rb +14 -1
  36. data/lib/openai/models/responses/compacted_response.rb +37 -1
  37. data/lib/openai/models/responses/response.rb +35 -1
  38. data/lib/openai/models/responses/response_compact_params.rb +53 -4
  39. data/lib/openai/models/responses/response_create_params.rb +57 -10
  40. data/lib/openai/models/responses/response_input_item.rb +45 -1
  41. data/lib/openai/models/responses/response_item.rb +45 -1
  42. data/lib/openai/models/responses/response_output_item.rb +45 -1
  43. data/lib/openai/models/responses/response_tool_search_output_item_param.rb +186 -13
  44. data/lib/openai/models/responses/response_usage.rb +33 -1
  45. data/lib/openai/models/responses/responses_client_event.rb +58 -10
  46. data/lib/openai/models/responses/tool.rb +164 -13
  47. data/lib/openai/models/responses_model.rb +1 -0
  48. data/lib/openai/resources/admin/organization/projects/service_tier_settings.rb +77 -0
  49. data/lib/openai/resources/admin/organization/projects.rb +6 -0
  50. data/lib/openai/resources/admin/organization.rb +6 -6
  51. data/lib/openai/resources/beta/responses.rb +18 -9
  52. data/lib/openai/resources/chat/completions.rb +2 -2
  53. data/lib/openai/resources/images.rb +102 -18
  54. data/lib/openai/resources/responses.rb +15 -6
  55. data/lib/openai/version.rb +1 -1
  56. data/lib/openai.rb +5 -0
  57. data/rbi/openai/models/admin/organization/projects/project_optional_service_tier.rbi +45 -0
  58. data/rbi/openai/models/admin/organization/projects/project_service_tier_settings.rbi +143 -0
  59. data/rbi/openai/models/admin/organization/projects/service_tier_setting_retrieve_params.rbi +63 -0
  60. data/rbi/openai/models/admin/organization/projects/service_tier_setting_update_params.rbi +183 -0
  61. data/rbi/openai/models/all_models.rbi +1 -0
  62. data/rbi/openai/models/beta/beta_compacted_response.rbi +67 -1
  63. data/rbi/openai/models/beta/beta_response.rbi +63 -0
  64. data/rbi/openai/models/beta/beta_response_input_item.rbi +82 -1
  65. data/rbi/openai/models/beta/beta_response_item.rbi +82 -1
  66. data/rbi/openai/models/beta/beta_response_output_item.rbi +82 -1
  67. data/rbi/openai/models/beta/beta_response_tool_search_output_item_param.rbi +338 -13
  68. data/rbi/openai/models/beta/beta_response_usage.rbi +66 -3
  69. data/rbi/openai/models/beta/beta_responses_client_event.rbi +118 -9
  70. data/rbi/openai/models/beta/beta_tool.rbi +245 -13
  71. data/rbi/openai/models/beta/response_compact_params.rbi +84 -3
  72. data/rbi/openai/models/beta/response_create_params.rbi +91 -9
  73. data/rbi/openai/models/beta/session_turn_error.rbi +3 -0
  74. data/rbi/openai/models/chat/completion_create_params.rbi +3 -3
  75. data/rbi/openai/models/conversations/conversation_item.rbi +84 -1
  76. data/rbi/openai/models/image_edit_params.rbi +76 -14
  77. data/rbi/openai/models/image_generate_params.rbi +218 -6
  78. data/rbi/openai/models/image_model.rbi +2 -0
  79. data/rbi/openai/models/images_response.rbi +90 -3
  80. data/rbi/openai/models/realtime/realtime_audio_config_input.rbi +17 -1
  81. data/rbi/openai/models/realtime/realtime_session_create_response.rbi +17 -1
  82. data/rbi/openai/models/realtime/realtime_transcription_session_audio_input.rbi +17 -1
  83. data/rbi/openai/models/realtime/realtime_transcription_session_create_response.rbi +17 -1
  84. data/rbi/openai/models/realtime/realtime_translation_session.rbi +19 -3
  85. data/rbi/openai/models/realtime/realtime_translation_session_create_request.rbi +19 -3
  86. data/rbi/openai/models/realtime/realtime_translation_session_update_request.rbi +19 -3
  87. data/rbi/openai/models/responses/compacted_response.rbi +67 -1
  88. data/rbi/openai/models/responses/response.rbi +63 -0
  89. data/rbi/openai/models/responses/response_compact_params.rbi +91 -3
  90. data/rbi/openai/models/responses/response_create_params.rbi +97 -9
  91. data/rbi/openai/models/responses/response_input_item.rbi +82 -1
  92. data/rbi/openai/models/responses/response_item.rbi +82 -1
  93. data/rbi/openai/models/responses/response_output_item.rbi +82 -1
  94. data/rbi/openai/models/responses/response_tool_search_output_item_param.rbi +340 -13
  95. data/rbi/openai/models/responses/response_usage.rbi +66 -3
  96. data/rbi/openai/models/responses/responses_client_event.rbi +118 -9
  97. data/rbi/openai/models/responses/tool.rbi +248 -13
  98. data/rbi/openai/models/responses_model.rbi +1 -0
  99. data/rbi/openai/resources/admin/organization/projects/service_tier_settings.rbi +67 -0
  100. data/rbi/openai/resources/admin/organization/projects.rbi +3 -0
  101. data/rbi/openai/resources/admin/organization.rbi +3 -3
  102. data/rbi/openai/resources/beta/responses.rbi +15 -6
  103. data/rbi/openai/resources/chat/completions.rbi +2 -2
  104. data/rbi/openai/resources/images.rbi +98 -14
  105. data/rbi/openai/resources/responses.rbi +14 -3
  106. data/sig/openai/models/admin/organization/projects/project_optional_service_tier.rbs +23 -0
  107. data/sig/openai/models/admin/organization/projects/project_service_tier_settings.rbs +72 -0
  108. data/sig/openai/models/admin/organization/projects/service_tier_setting_retrieve_params.rbs +32 -0
  109. data/sig/openai/models/admin/organization/projects/service_tier_setting_update_params.rbs +91 -0
  110. data/sig/openai/models/all_models.rbs +2 -0
  111. data/sig/openai/models/beta/beta_compacted_response.rbs +42 -2
  112. data/sig/openai/models/beta/beta_response.rbs +42 -1
  113. data/sig/openai/models/beta/beta_response_input_item.rbs +51 -3
  114. data/sig/openai/models/beta/beta_response_item.rbs +51 -3
  115. data/sig/openai/models/beta/beta_response_output_item.rbs +51 -3
  116. data/sig/openai/models/beta/beta_response_tool_search_output_item_param.rbs +188 -15
  117. data/sig/openai/models/beta/beta_response_usage.rbs +40 -3
  118. data/sig/openai/models/beta/beta_responses_client_event.rbs +67 -10
  119. data/sig/openai/models/beta/beta_tool.rbs +188 -15
  120. data/sig/openai/models/beta/response_compact_params.rbs +58 -2
  121. data/sig/openai/models/beta/response_create_params.rbs +67 -10
  122. data/sig/openai/models/beta/session_turn_error.rbs +4 -0
  123. data/sig/openai/models/chat/completion_create_params.rbs +3 -3
  124. data/sig/openai/models/conversations/conversation_item.rbs +51 -3
  125. data/sig/openai/models/image_edit_params.rbs +63 -12
  126. data/sig/openai/models/image_generate_params.rbs +150 -5
  127. data/sig/openai/models/image_model.rbs +4 -0
  128. data/sig/openai/models/images_response.rbs +59 -4
  129. data/sig/openai/models/realtime/realtime_audio_config_input.rbs +20 -1
  130. data/sig/openai/models/realtime/realtime_session_create_response.rbs +20 -1
  131. data/sig/openai/models/realtime/realtime_transcription_session_audio_input.rbs +20 -1
  132. data/sig/openai/models/realtime/realtime_transcription_session_create_response.rbs +20 -1
  133. data/sig/openai/models/realtime/realtime_translation_session.rbs +22 -3
  134. data/sig/openai/models/realtime/realtime_translation_session_create_request.rbs +22 -3
  135. data/sig/openai/models/realtime/realtime_translation_session_update_request.rbs +22 -3
  136. data/sig/openai/models/responses/compacted_response.rbs +42 -2
  137. data/sig/openai/models/responses/response.rbs +42 -1
  138. data/sig/openai/models/responses/response_compact_params.rbs +60 -2
  139. data/sig/openai/models/responses/response_create_params.rbs +67 -10
  140. data/sig/openai/models/responses/response_input_item.rbs +51 -3
  141. data/sig/openai/models/responses/response_item.rbs +51 -3
  142. data/sig/openai/models/responses/response_output_item.rbs +51 -3
  143. data/sig/openai/models/responses/response_tool_search_output_item_param.rbs +188 -15
  144. data/sig/openai/models/responses/response_usage.rbs +40 -3
  145. data/sig/openai/models/responses/responses_client_event.rbs +67 -10
  146. data/sig/openai/models/responses/tool.rbs +188 -15
  147. data/sig/openai/models/responses_model.rbs +2 -0
  148. data/sig/openai/resources/admin/organization/projects/service_tier_settings.rbs +25 -0
  149. data/sig/openai/resources/admin/organization/projects.rbs +2 -0
  150. data/sig/openai/resources/admin/organization.rbs +2 -2
  151. data/sig/openai/resources/beta/responses.rbs +3 -0
  152. data/sig/openai/resources/images.rbs +14 -0
  153. data/sig/openai/resources/responses.rbs +4 -0
  154. metadata +16 -1
@@ -25,6 +25,13 @@ module OpenAI
25
25
  sig { returns(T.nilable(T.any(OpenAI::Beta::ResponseCompactParams::Model::OrSymbol, String))) }
26
26
  attr_accessor :model
27
27
 
28
+ # Request level image options.
29
+ sig { returns(T.nilable(OpenAI::Beta::ResponseCompactParams::Image)) }
30
+ attr_reader :image
31
+
32
+ sig { params(image: OpenAI::Beta::ResponseCompactParams::Image::OrHash).void }
33
+ attr_writer :image
34
+
28
35
  # Text, image, or file inputs to the model, used to generate a response
29
36
  sig { returns(T.nilable(OpenAI::Beta::ResponseCompactParams::Input::Variants)) }
30
37
  attr_accessor :input
@@ -53,7 +60,7 @@ module OpenAI
53
60
  # request can write up to four breakpoints. For cache matching, OpenAI considers
54
61
  # up to the latest 80 breakpoints in the conversation, without a content-block
55
62
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
56
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
63
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
57
64
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
58
65
  # for current details.
59
66
  sig { returns(T.nilable(OpenAI::Beta::ResponseCompactParams::PromptCacheOptions)) }
@@ -98,6 +105,8 @@ module OpenAI
98
105
 
99
106
  model: T.nilable(T.any(OpenAI::Beta::ResponseCompactParams::Model::OrSymbol, String)),
100
107
 
108
+ image: OpenAI::Beta::ResponseCompactParams::Image::OrHash,
109
+
101
110
  input: T.nilable(OpenAI::Beta::ResponseCompactParams::Input::Variants),
102
111
 
103
112
  instructions: T.nilable(String),
@@ -127,6 +136,9 @@ module OpenAI
127
136
  # compare available models.
128
137
  model:,
129
138
 
139
+ # Request level image options.
140
+ image: nil,
141
+
130
142
  # Text, image, or file inputs to the model, used to generate a response
131
143
  input: nil,
132
144
 
@@ -151,7 +163,7 @@ module OpenAI
151
163
  # request can write up to four breakpoints. For cache matching, OpenAI considers
152
164
  # up to the latest 80 breakpoints in the conversation, without a content-block
153
165
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
154
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
166
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
155
167
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
156
168
  # for current details.
157
169
  prompt_cache_options: nil,
@@ -187,6 +199,7 @@ module OpenAI
187
199
  override.returns(
188
200
  {
189
201
  model: T.nilable(T.any(OpenAI::Beta::ResponseCompactParams::Model::OrSymbol, String)),
202
+ image: OpenAI::Beta::ResponseCompactParams::Image,
190
203
  input: T.nilable(OpenAI::Beta::ResponseCompactParams::Input::Variants),
191
204
  instructions: T.nilable(String),
192
205
  previous_response_id: T.nilable(String),
@@ -434,6 +447,74 @@ module OpenAI
434
447
 
435
448
  end
436
449
 
450
+ class Image < OpenAI::Internal::Type::BaseModel
451
+ OrHash = T.type_alias do
452
+ T.any(
453
+ OpenAI::Beta::ResponseCompactParams::Image,
454
+ OpenAI::Internal::AnyHash
455
+ )
456
+ end
457
+
458
+ # Controls image context optimization. Defaults to `auto`, which uses the model,
459
+ # transport, and input to select a policy. Use `enabled` to require compression
460
+ # support or `disabled` to turn it off.
461
+ sig { returns(T.nilable(OpenAI::Beta::ResponseCompactParams::Image::ContextCompression::OrSymbol)) }
462
+ attr_reader :context_compression
463
+
464
+ sig {
465
+ params(context_compression: OpenAI::Beta::ResponseCompactParams::Image::ContextCompression::OrSymbol).void
466
+ }
467
+ attr_writer :context_compression
468
+
469
+ # Request level image options.
470
+ sig do
471
+ params(
472
+
473
+ context_compression: OpenAI::Beta::ResponseCompactParams::Image::ContextCompression::OrSymbol
474
+ )
475
+ .returns(T.attached_class)
476
+ end
477
+ def self.new(
478
+
479
+ # Controls image context optimization. Defaults to `auto`, which uses the model,
480
+ # transport, and input to select a policy. Use `enabled` to require compression
481
+ # support or `disabled` to turn it off.
482
+
483
+ context_compression: nil
484
+ )
485
+ end
486
+
487
+ sig do
488
+ override.returns(
489
+ {context_compression: OpenAI::Beta::ResponseCompactParams::Image::ContextCompression::OrSymbol}
490
+ )
491
+ end
492
+ def to_hash
493
+ end
494
+
495
+ # Controls image context optimization. Defaults to `auto`, which uses the model,
496
+ # transport, and input to select a policy. Use `enabled` to require compression
497
+ # support or `disabled` to turn it off.
498
+ module ContextCompression
499
+ extend OpenAI::Internal::Type::Enum
500
+
501
+ TaggedSymbol = T.type_alias {
502
+ T.all(Symbol, OpenAI::Beta::ResponseCompactParams::Image::ContextCompression)
503
+ }
504
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
505
+
506
+ AUTO = T.let(:auto, OpenAI::Beta::ResponseCompactParams::Image::ContextCompression::TaggedSymbol)
507
+ ENABLED = T.let(:enabled, OpenAI::Beta::ResponseCompactParams::Image::ContextCompression::TaggedSymbol)
508
+ DISABLED = T.let(:disabled, OpenAI::Beta::ResponseCompactParams::Image::ContextCompression::TaggedSymbol)
509
+
510
+ sig {
511
+ override.returns(T::Array[OpenAI::Beta::ResponseCompactParams::Image::ContextCompression::TaggedSymbol])
512
+ }
513
+ def self.values
514
+ end
515
+ end
516
+ end
517
+
437
518
  # Text, image, or file inputs to the model, used to generate a response
438
519
  module Input
439
520
  extend OpenAI::Internal::Type::Union
@@ -486,7 +567,7 @@ module OpenAI
486
567
  # request can write up to four breakpoints. For cache matching, OpenAI considers
487
568
  # up to the latest 80 breakpoints in the conversation, without a content-block
488
569
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
489
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
570
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
490
571
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
491
572
  # for current details.
492
573
  sig do
@@ -40,6 +40,13 @@ module OpenAI
40
40
  sig { returns(T.nilable(T.any(String, OpenAI::Beta::BetaResponseConversationParam))) }
41
41
  attr_accessor :conversation
42
42
 
43
+ # Request level image options.
44
+ sig { returns(T.nilable(OpenAI::Beta::ResponseCreateParams::Image)) }
45
+ attr_reader :image
46
+
47
+ sig { params(image: OpenAI::Beta::ResponseCreateParams::Image::OrHash).void }
48
+ attr_writer :image
49
+
43
50
  # Specify additional output data to include in the model response. Currently
44
51
  # supported values are:
45
52
  #
@@ -162,7 +169,7 @@ module OpenAI
162
169
  # request can write up to four breakpoints. For cache matching, OpenAI considers
163
170
  # up to the latest 80 breakpoints in the conversation, without a content-block
164
171
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
165
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
172
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
166
173
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
167
174
  # for current details.
168
175
  sig { returns(T.nilable(OpenAI::Beta::ResponseCreateParams::PromptCacheOptions)) }
@@ -436,6 +443,8 @@ module OpenAI
436
443
 
437
444
  conversation: T.nilable(T.any(String, OpenAI::Beta::BetaResponseConversationParam::OrHash)),
438
445
 
446
+ image: OpenAI::Beta::ResponseCreateParams::Image::OrHash,
447
+
439
448
  include: T.nilable(T::Array[OpenAI::Beta::BetaResponseIncludable::OrSymbol]),
440
449
 
441
450
  input: OpenAI::Beta::ResponseCreateParams::Input::Variants,
@@ -545,6 +554,9 @@ module OpenAI
545
554
  # response completes.
546
555
  conversation: nil,
547
556
 
557
+ # Request level image options.
558
+ image: nil,
559
+
548
560
  # Specify additional output data to include in the model response. Currently
549
561
  # supported values are:
550
562
  #
@@ -639,7 +651,7 @@ module OpenAI
639
651
  # request can write up to four breakpoints. For cache matching, OpenAI considers
640
652
  # up to the latest 80 breakpoints in the conversation, without a content-block
641
653
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
642
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
654
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
643
655
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
644
656
  # for current details.
645
657
  prompt_cache_options: nil,
@@ -793,6 +805,7 @@ module OpenAI
793
805
  background: T.nilable(T::Boolean),
794
806
  context_management: T.nilable(T::Array[OpenAI::Beta::ResponseCreateParams::ContextManagement]),
795
807
  conversation: T.nilable(T.any(String, OpenAI::Beta::BetaResponseConversationParam)),
808
+ image: OpenAI::Beta::ResponseCreateParams::Image,
796
809
  include: T.nilable(T::Array[OpenAI::Beta::BetaResponseIncludable::OrSymbol]),
797
810
  input: OpenAI::Beta::ResponseCreateParams::Input::Variants,
798
811
  instructions: T.nilable(String),
@@ -1005,6 +1018,74 @@ module OpenAI
1005
1018
 
1006
1019
  end
1007
1020
 
1021
+ class Image < OpenAI::Internal::Type::BaseModel
1022
+ OrHash = T.type_alias do
1023
+ T.any(
1024
+ OpenAI::Beta::ResponseCreateParams::Image,
1025
+ OpenAI::Internal::AnyHash
1026
+ )
1027
+ end
1028
+
1029
+ # Controls image context optimization. Defaults to `auto`, which uses the model,
1030
+ # transport, and input to select a policy. Use `enabled` to require compression
1031
+ # support or `disabled` to turn it off.
1032
+ sig { returns(T.nilable(OpenAI::Beta::ResponseCreateParams::Image::ContextCompression::OrSymbol)) }
1033
+ attr_reader :context_compression
1034
+
1035
+ sig {
1036
+ params(context_compression: OpenAI::Beta::ResponseCreateParams::Image::ContextCompression::OrSymbol).void
1037
+ }
1038
+ attr_writer :context_compression
1039
+
1040
+ # Request level image options.
1041
+ sig do
1042
+ params(
1043
+
1044
+ context_compression: OpenAI::Beta::ResponseCreateParams::Image::ContextCompression::OrSymbol
1045
+ )
1046
+ .returns(T.attached_class)
1047
+ end
1048
+ def self.new(
1049
+
1050
+ # Controls image context optimization. Defaults to `auto`, which uses the model,
1051
+ # transport, and input to select a policy. Use `enabled` to require compression
1052
+ # support or `disabled` to turn it off.
1053
+
1054
+ context_compression: nil
1055
+ )
1056
+ end
1057
+
1058
+ sig do
1059
+ override.returns(
1060
+ {context_compression: OpenAI::Beta::ResponseCreateParams::Image::ContextCompression::OrSymbol}
1061
+ )
1062
+ end
1063
+ def to_hash
1064
+ end
1065
+
1066
+ # Controls image context optimization. Defaults to `auto`, which uses the model,
1067
+ # transport, and input to select a policy. Use `enabled` to require compression
1068
+ # support or `disabled` to turn it off.
1069
+ module ContextCompression
1070
+ extend OpenAI::Internal::Type::Enum
1071
+
1072
+ TaggedSymbol = T.type_alias {
1073
+ T.all(Symbol, OpenAI::Beta::ResponseCreateParams::Image::ContextCompression)
1074
+ }
1075
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1076
+
1077
+ AUTO = T.let(:auto, OpenAI::Beta::ResponseCreateParams::Image::ContextCompression::TaggedSymbol)
1078
+ ENABLED = T.let(:enabled, OpenAI::Beta::ResponseCreateParams::Image::ContextCompression::TaggedSymbol)
1079
+ DISABLED = T.let(:disabled, OpenAI::Beta::ResponseCreateParams::Image::ContextCompression::TaggedSymbol)
1080
+
1081
+ sig {
1082
+ override.returns(T::Array[OpenAI::Beta::ResponseCreateParams::Image::ContextCompression::TaggedSymbol])
1083
+ }
1084
+ def self.values
1085
+ end
1086
+ end
1087
+ end
1088
+
1008
1089
  # Text, image, or file inputs to the model, used to generate a response.
1009
1090
  #
1010
1091
  # Learn more:
@@ -1563,8 +1644,8 @@ module OpenAI
1563
1644
  attr_writer :prewarm
1564
1645
 
1565
1646
  # The minimum lifetime applied to every implicit and explicit cache breakpoint
1566
- # written by the request. Defaults to `30m`, which is currently the only supported
1567
- # value. The backend may retain cache entries for longer.
1647
+ # written by the request. Supported values are `30m` (the default) and `12h`. The
1648
+ # backend may retain cache entries for longer.
1568
1649
  sig { returns(T.nilable(OpenAI::Beta::ResponseCreateParams::PromptCacheOptions::Ttl::OrSymbol)) }
1569
1650
  attr_reader :ttl
1570
1651
 
@@ -1577,7 +1658,7 @@ module OpenAI
1577
1658
  # request can write up to four breakpoints. For cache matching, OpenAI considers
1578
1659
  # up to the latest 80 breakpoints in the conversation, without a content-block
1579
1660
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
1580
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
1661
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
1581
1662
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
1582
1663
  # for current details.
1583
1664
  sig do
@@ -1612,8 +1693,8 @@ module OpenAI
1612
1693
  prewarm: nil,
1613
1694
 
1614
1695
  # The minimum lifetime applied to every implicit and explicit cache breakpoint
1615
- # written by the request. Defaults to `30m`, which is currently the only supported
1616
- # value. The backend may retain cache entries for longer.
1696
+ # written by the request. Supported values are `30m` (the default) and `12h`. The
1697
+ # backend may retain cache entries for longer.
1617
1698
 
1618
1699
  ttl: nil
1619
1700
  )
@@ -1655,8 +1736,8 @@ module OpenAI
1655
1736
  end
1656
1737
 
1657
1738
  # The minimum lifetime applied to every implicit and explicit cache breakpoint
1658
- # written by the request. Defaults to `30m`, which is currently the only supported
1659
- # value. The backend may retain cache entries for longer.
1739
+ # written by the request. Supported values are `30m` (the default) and `12h`. The
1740
+ # backend may retain cache entries for longer.
1660
1741
  module Ttl
1661
1742
  extend OpenAI::Internal::Type::Enum
1662
1743
 
@@ -1664,6 +1745,7 @@ module OpenAI
1664
1745
  OrSymbol = T.type_alias { T.any(Symbol, String) }
1665
1746
 
1666
1747
  TTL_30M = T.let(:"30m", OpenAI::Beta::ResponseCreateParams::PromptCacheOptions::Ttl::TaggedSymbol)
1748
+ TTL_12H = T.let(:"12h", OpenAI::Beta::ResponseCreateParams::PromptCacheOptions::Ttl::TaggedSymbol)
1667
1749
 
1668
1750
  sig {
1669
1751
  override.returns(T::Array[OpenAI::Beta::ResponseCreateParams::PromptCacheOptions::Ttl::TaggedSymbol])
@@ -61,6 +61,9 @@ module OpenAI
61
61
  # The request exceeds the model's context window.
62
62
  CONTEXT_LENGTH_EXCEEDED = T.let(:context_length_exceeded, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol)
63
63
 
64
+ # The model reached its output token limit before finishing the response.
65
+ MAX_OUTPUT_TOKENS = T.let(:max_output_tokens, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol)
66
+
64
67
  # The session has reached its usage budget.
65
68
  SESSION_BUDGET_EXCEEDED = T.let(:session_budget_exceeded, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol)
66
69
 
@@ -214,7 +214,7 @@ module OpenAI
214
214
  # request can write up to four breakpoints. For cache matching, OpenAI considers
215
215
  # up to the latest 80 breakpoints in the conversation, without a content-block
216
216
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
217
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
217
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
218
218
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
219
219
  # for current details.
220
220
  sig { returns(T.nilable(OpenAI::Chat::CompletionCreateParams::PromptCacheOptions)) }
@@ -704,7 +704,7 @@ module OpenAI
704
704
  # request can write up to four breakpoints. For cache matching, OpenAI considers
705
705
  # up to the latest 80 breakpoints in the conversation, without a content-block
706
706
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
707
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
707
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
708
708
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
709
709
  # for current details.
710
710
  prompt_cache_options: nil,
@@ -1359,7 +1359,7 @@ module OpenAI
1359
1359
  # request can write up to four breakpoints. For cache matching, OpenAI considers
1360
1360
  # up to the latest 80 breakpoints in the conversation, without a content-block
1361
1361
  # lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The
1362
- # `ttl` defaults to `30m`, which is currently the only supported value. See the
1362
+ # `ttl` defaults to `30m`. Supported lifetimes depend on the API. See the
1363
1363
  # [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching)
1364
1364
  # for current details.
1365
1365
  sig do
@@ -111,6 +111,14 @@ module OpenAI
111
111
  sig { returns(T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Size::Variants)) }
112
112
  attr_accessor :size
113
113
 
114
+ sig { returns(T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::SvgUsage)) }
115
+ attr_reader :svg_usage
116
+
117
+ sig {
118
+ params(svg_usage: OpenAI::Conversations::ConversationItem::ImageGenerationCall::SvgUsage::OrHash).void
119
+ }
120
+ attr_writer :svg_usage
121
+
114
122
  # An image generation request made by the model.
115
123
  sig do
116
124
  params(
@@ -139,6 +147,8 @@ module OpenAI
139
147
  T.any(String, OpenAI::Conversations::ConversationItem::ImageGenerationCall::Size::OrSymbol)
140
148
  ),
141
149
 
150
+ svg_usage: OpenAI::Conversations::ConversationItem::ImageGenerationCall::SvgUsage::OrHash,
151
+
142
152
  type: Symbol
143
153
  )
144
154
  .returns(T.attached_class)
@@ -176,6 +186,8 @@ module OpenAI
176
186
  # The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`.
177
187
  size: nil,
178
188
 
189
+ svg_usage: nil,
190
+
179
191
  # The type of the image generation call. Always `image_generation_call`.
180
192
 
181
193
  type: :image_generation_call
@@ -199,7 +211,8 @@ module OpenAI
199
211
  ),
200
212
  quality: T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Quality::TaggedSymbol),
201
213
  revised_prompt: T.nilable(String),
202
- size: T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Size::Variants)
214
+ size: T.nilable(OpenAI::Conversations::ConversationItem::ImageGenerationCall::Size::Variants),
215
+ svg_usage: OpenAI::Conversations::ConversationItem::ImageGenerationCall::SvgUsage
203
216
  }
204
217
  )
205
218
  end
@@ -487,6 +500,8 @@ module OpenAI
487
500
  :jpeg,
488
501
  OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat::TaggedSymbol
489
502
  )
503
+ GIF = T.let(:gif, OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat::TaggedSymbol)
504
+ SVG = T.let(:svg, OpenAI::Conversations::ConversationItem::ImageGenerationCall::OutputFormat::TaggedSymbol)
490
505
 
491
506
  sig {
492
507
  override.returns(
@@ -557,6 +572,74 @@ module OpenAI
557
572
  )
558
573
 
559
574
  end
575
+
576
+ class SvgUsage < OpenAI::Internal::Type::BaseModel
577
+ OrHash = T.type_alias do
578
+ T.any(
579
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall::SvgUsage,
580
+ OpenAI::Internal::AnyHash
581
+ )
582
+ end
583
+
584
+ sig { returns(Integer) }
585
+ attr_accessor :input_tokens
586
+
587
+ sig { returns(String) }
588
+ attr_accessor :model
589
+
590
+ sig { returns(Integer) }
591
+ attr_accessor :output_tokens
592
+
593
+ sig { returns(Integer) }
594
+ attr_accessor :reasoning_tokens
595
+
596
+ sig { returns(Integer) }
597
+ attr_accessor :total_tokens
598
+
599
+ sig do
600
+ params(
601
+
602
+ input_tokens: Integer,
603
+
604
+ model: String,
605
+
606
+ output_tokens: Integer,
607
+
608
+ reasoning_tokens: Integer,
609
+
610
+ total_tokens: Integer
611
+ )
612
+ .returns(T.attached_class)
613
+ end
614
+ def self.new(
615
+
616
+ input_tokens:,
617
+
618
+ model:,
619
+
620
+ output_tokens:,
621
+
622
+ reasoning_tokens:,
623
+
624
+ total_tokens:
625
+ )
626
+ end
627
+
628
+ sig do
629
+ override.returns(
630
+ {
631
+ input_tokens: Integer,
632
+ model: String,
633
+ output_tokens: Integer,
634
+ reasoning_tokens: Integer,
635
+ total_tokens: Integer
636
+ }
637
+ )
638
+ end
639
+ def to_hash
640
+ end
641
+
642
+ end
560
643
  end
561
644
 
562
645
  class AdditionalTools < OpenAI::Internal::Type::BaseModel
@@ -47,6 +47,26 @@ module OpenAI
47
47
  sig { returns(T.nilable(OpenAI::ImageEditParams::Background::OrSymbol)) }
48
48
  attr_accessor :background
49
49
 
50
+ # Computation spent planning the image, independently of rendering quality. Uses
51
+ # the image model's configured default when omitted. For SVG output, controls the
52
+ # reference image, independently of the SVG author's reasoning.
53
+ sig { returns(T.nilable(OpenAI::ImageEditParams::Complexity::OrSymbol)) }
54
+ attr_accessor :complexity
55
+
56
+ # Number of frames for GIF output. Accepts integers from 2 through 16. Defaults to
57
+ # 9 when omitted. Only supported with output_format=gif. The requested size must
58
+ # satisfy the selected model's GIF size limits. GIF output does not support
59
+ # streaming, partial images, masks, or custom output compression. Requires access
60
+ # to the GIF preview for the selected model.
61
+ sig { returns(T.nilable(Integer)) }
62
+ attr_accessor :frame_count
63
+
64
+ # Requested delay per GIF frame, in milliseconds. Defaults to 200 when omitted.
65
+ # GIF output rounds to the nearest 10 ms and caps the encoded delay at 655,350 ms
66
+ # per frame. Only supported with output_format=gif.
67
+ sig { returns(T.nilable(Integer)) }
68
+ attr_accessor :frame_duration_ms
69
+
50
70
  # Control how much effort the model will exert to match the style and features,
51
71
  # especially facial features, of input images. Supports `high` and `low` on
52
72
  # `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit
@@ -56,7 +76,7 @@ module OpenAI
56
76
 
57
77
  # A transparent PNG overlaid on the first image to guide the edit. Must match that
58
78
  # image's dimensions after orientation and contain transparent pixels. Supports
59
- # GPT Image 2.5 and 2.6. Cannot be combined with mask.
79
+ # GPT Image 2.5. Cannot be combined with mask.
60
80
  #
61
81
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
62
82
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
@@ -84,8 +104,8 @@ module OpenAI
84
104
  # The GPT image model to use for image editing (`gpt-image-1-mini`,
85
105
  # `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
86
106
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
87
- # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
88
- # `chatgpt-image-latest`).
107
+ # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`,
108
+ # `gpt-image-2.6-sunburst`, `gpt-image-2.6-flare`, or `chatgpt-image-latest`).
89
109
  #
90
110
  # `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or
91
111
  # `gpt-image-2.5-flare` instead.
@@ -103,8 +123,7 @@ module OpenAI
103
123
  attr_accessor :output_compression
104
124
 
105
125
  # The format in which the generated images are returned. This parameter is only
106
- # supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. The
107
- # default value is `png`.
126
+ # supported for the GPT image models. The default value is `png`.
108
127
  sig { returns(T.nilable(OpenAI::ImageEditParams::OutputFormat::OrSymbol)) }
109
128
  attr_accessor :output_format
110
129
 
@@ -171,6 +190,12 @@ module OpenAI
171
190
 
172
191
  background: T.nilable(OpenAI::ImageEditParams::Background::OrSymbol),
173
192
 
193
+ complexity: T.nilable(OpenAI::ImageEditParams::Complexity::OrSymbol),
194
+
195
+ frame_count: T.nilable(Integer),
196
+
197
+ frame_duration_ms: T.nilable(Integer),
198
+
174
199
  input_fidelity: T.nilable(OpenAI::ImageEditParams::InputFidelity::OrSymbol),
175
200
 
176
201
  markup: OpenAI::Internal::FileInput,
@@ -232,6 +257,23 @@ module OpenAI
232
257
  # set the output format to `png` or `webp`.
233
258
  background: nil,
234
259
 
260
+ # Computation spent planning the image, independently of rendering quality. Uses
261
+ # the image model's configured default when omitted. For SVG output, controls the
262
+ # reference image, independently of the SVG author's reasoning.
263
+ complexity: nil,
264
+
265
+ # Number of frames for GIF output. Accepts integers from 2 through 16. Defaults to
266
+ # 9 when omitted. Only supported with output_format=gif. The requested size must
267
+ # satisfy the selected model's GIF size limits. GIF output does not support
268
+ # streaming, partial images, masks, or custom output compression. Requires access
269
+ # to the GIF preview for the selected model.
270
+ frame_count: nil,
271
+
272
+ # Requested delay per GIF frame, in milliseconds. Defaults to 200 when omitted.
273
+ # GIF output rounds to the nearest 10 ms and caps the encoded delay at 655,350 ms
274
+ # per frame. Only supported with output_format=gif.
275
+ frame_duration_ms: nil,
276
+
235
277
  # Control how much effort the model will exert to match the style and features,
236
278
  # especially facial features, of input images. Supports `high` and `low` on
237
279
  # `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit
@@ -240,7 +282,7 @@ module OpenAI
240
282
 
241
283
  # A transparent PNG overlaid on the first image to guide the edit. Must match that
242
284
  # image's dimensions after orientation and contain transparent pixels. Supports
243
- # GPT Image 2.5 and 2.6. Cannot be combined with mask.
285
+ # GPT Image 2.5. Cannot be combined with mask.
244
286
  #
245
287
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
246
288
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
@@ -260,8 +302,8 @@ module OpenAI
260
302
  # The GPT image model to use for image editing (`gpt-image-1-mini`,
261
303
  # `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
262
304
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
263
- # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
264
- # `chatgpt-image-latest`).
305
+ # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`,
306
+ # `gpt-image-2.6-sunburst`, `gpt-image-2.6-flare`, or `chatgpt-image-latest`).
265
307
  #
266
308
  # `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or
267
309
  # `gpt-image-2.5-flare` instead.
@@ -276,8 +318,7 @@ module OpenAI
276
318
  output_compression: nil,
277
319
 
278
320
  # The format in which the generated images are returned. This parameter is only
279
- # supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. The
280
- # default value is `png`.
321
+ # supported for the GPT image models. The default value is `png`.
281
322
  output_format: nil,
282
323
 
283
324
  # The number of partial images to generate. This parameter is used for streaming
@@ -335,6 +376,9 @@ module OpenAI
335
376
  image: OpenAI::ImageEditParams::Image::Variants,
336
377
  prompt: String,
337
378
  background: T.nilable(OpenAI::ImageEditParams::Background::OrSymbol),
379
+ complexity: T.nilable(OpenAI::ImageEditParams::Complexity::OrSymbol),
380
+ frame_count: T.nilable(Integer),
381
+ frame_duration_ms: T.nilable(Integer),
338
382
  input_fidelity: T.nilable(OpenAI::ImageEditParams::InputFidelity::OrSymbol),
339
383
  markup: OpenAI::Internal::FileInput,
340
384
  mask: OpenAI::Internal::FileInput,
@@ -403,6 +447,24 @@ module OpenAI
403
447
  end
404
448
  end
405
449
 
450
+ # Computation spent planning the image, independently of rendering quality. Uses
451
+ # the image model's configured default when omitted. For SVG output, controls the
452
+ # reference image, independently of the SVG author's reasoning.
453
+ module Complexity
454
+ extend OpenAI::Internal::Type::Enum
455
+
456
+ TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::ImageEditParams::Complexity) }
457
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
458
+
459
+ LOW = T.let(:low, OpenAI::ImageEditParams::Complexity::TaggedSymbol)
460
+ MEDIUM = T.let(:medium, OpenAI::ImageEditParams::Complexity::TaggedSymbol)
461
+ HIGH = T.let(:high, OpenAI::ImageEditParams::Complexity::TaggedSymbol)
462
+
463
+ sig { override.returns(T::Array[OpenAI::ImageEditParams::Complexity::TaggedSymbol]) }
464
+ def self.values
465
+ end
466
+ end
467
+
406
468
  # Control how much effort the model will exert to match the style and features,
407
469
  # especially facial features, of input images. Supports `high` and `low` on
408
470
  # `gpt-image-1.5`; `gpt-image-1-mini` supports only `low`. For `gpt-image-2`, omit
@@ -424,8 +486,8 @@ module OpenAI
424
486
  # The GPT image model to use for image editing (`gpt-image-1-mini`,
425
487
  # `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`,
426
488
  # `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`,
427
- # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or
428
- # `chatgpt-image-latest`).
489
+ # `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`,
490
+ # `gpt-image-2.6-sunburst`, `gpt-image-2.6-flare`, or `chatgpt-image-latest`).
429
491
  #
430
492
  # `gpt-image-1` was shut down on October 23, 2026. Use `gpt-image-2.5-sunburst` or
431
493
  # `gpt-image-2.5-flare` instead.
@@ -441,8 +503,7 @@ module OpenAI
441
503
  end
442
504
 
443
505
  # The format in which the generated images are returned. This parameter is only
444
- # supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. The
445
- # default value is `png`.
506
+ # supported for the GPT image models. The default value is `png`.
446
507
  module OutputFormat
447
508
  extend OpenAI::Internal::Type::Enum
448
509
 
@@ -452,6 +513,7 @@ module OpenAI
452
513
  PNG = T.let(:png, OpenAI::ImageEditParams::OutputFormat::TaggedSymbol)
453
514
  JPEG = T.let(:jpeg, OpenAI::ImageEditParams::OutputFormat::TaggedSymbol)
454
515
  WEBP = T.let(:webp, OpenAI::ImageEditParams::OutputFormat::TaggedSymbol)
516
+ GIF = T.let(:gif, OpenAI::ImageEditParams::OutputFormat::TaggedSymbol)
455
517
 
456
518
  sig { override.returns(T::Array[OpenAI::ImageEditParams::OutputFormat::TaggedSymbol]) }
457
519
  def self.values