openai 0.106.0 → 0.107.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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -0
  3. data/README.md +1 -1
  4. data/lib/openai/helpers/live/websocket.rb +12 -141
  5. data/lib/openai/helpers/local_audio/process.rb +13 -3
  6. data/lib/openai/helpers/models/embedding.rb +42 -0
  7. data/lib/openai/helpers/realtime/connection.rb +22 -5
  8. data/lib/openai/helpers/realtime/recovery.rb +11 -5
  9. data/lib/openai/helpers/realtime/translation.rb +37 -169
  10. data/lib/openai/helpers/realtime/unknown_server_event.rb +5 -12
  11. data/lib/openai/helpers/responses_websocket/connection.rb +56 -35
  12. data/lib/openai/helpers/responses_websocket/unknown_server_event.rb +2 -14
  13. data/lib/openai/helpers/websocket/async_websocket_transport.rb +8 -6
  14. data/lib/openai/helpers/websocket/client_request.rb +1 -1
  15. data/lib/openai/helpers/websocket/connection.rb +21 -10
  16. data/lib/openai/helpers/websocket/connection_manager.rb +2 -1
  17. data/lib/openai/helpers/websocket/protocol.rb +160 -0
  18. data/lib/openai/helpers/websocket/typed_connection.rb +22 -16
  19. data/lib/openai/helpers/websocket/typed_resource.rb +15 -0
  20. data/lib/openai/internal/transport/base_client.rb +1 -1
  21. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +12 -1
  22. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +12 -1
  23. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +12 -1
  24. data/lib/openai/models/admin/organization/usage_completions_response.rb +12 -1
  25. data/lib/openai/models/admin/organization/usage_costs_response.rb +12 -1
  26. data/lib/openai/models/admin/organization/usage_decisions_response.rb +12 -1
  27. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +12 -1
  28. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +12 -1
  29. data/lib/openai/models/admin/organization/usage_images_response.rb +12 -1
  30. data/lib/openai/models/admin/organization/usage_moderations_response.rb +12 -1
  31. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +12 -1
  32. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +12 -1
  33. data/lib/openai/models/beta/beta_response_input_item.rb +10 -1
  34. data/lib/openai/models/responses/response_input_item.rb +10 -1
  35. data/lib/openai/version.rb +1 -1
  36. data/lib/openai.rb +1 -0
  37. data/rbi/openai/client.rbi +1 -8
  38. data/rbi/openai/helpers/realtime/translation.rbi +0 -5
  39. data/rbi/openai/helpers/realtime/unknown_server_event.rbi +6 -0
  40. data/rbi/openai/helpers/websocket.rbi +44 -6
  41. data/rbi/openai/internal/transport/base_client.rbi +2 -6
  42. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +12 -0
  43. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +12 -0
  44. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +12 -0
  45. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +12 -0
  46. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +12 -0
  47. data/rbi/openai/models/admin/organization/usage_decisions_response.rbi +12 -0
  48. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +12 -0
  49. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +12 -0
  50. data/rbi/openai/models/admin/organization/usage_images_response.rbi +12 -0
  51. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +12 -0
  52. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +12 -0
  53. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +12 -0
  54. data/rbi/openai/models/beta/beta_response_input_item.rbi +14 -1
  55. data/rbi/openai/models/responses/response_input_item.rbi +10 -1
  56. data/realtime.md +22 -3
  57. data/sig/openai/client.rbs +1 -1
  58. data/sig/openai/helpers/realtime/translation.rbs +0 -2
  59. data/sig/openai/helpers/realtime/unknown_server_event.rbs +2 -0
  60. data/sig/openai/helpers/websocket.rbs +23 -6
  61. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +10 -0
  62. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +10 -0
  63. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +10 -0
  64. data/sig/openai/models/admin/organization/usage_completions_response.rbs +10 -0
  65. data/sig/openai/models/admin/organization/usage_costs_response.rbs +10 -0
  66. data/sig/openai/models/admin/organization/usage_decisions_response.rbs +10 -0
  67. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +10 -0
  68. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +10 -0
  69. data/sig/openai/models/admin/organization/usage_images_response.rbs +10 -0
  70. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +10 -0
  71. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +10 -0
  72. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +10 -0
  73. data/sig/openai/models/beta/beta_response_input_item.rbs +8 -0
  74. data/sig/openai/models/responses/response_input_item.rbs +8 -3
  75. metadata +3 -1
@@ -227,6 +227,11 @@ module OpenAI
227
227
  sig { params(input_cache_write_12h_tokens: Integer).void }
228
228
  attr_writer :input_cache_write_12h_tokens
229
229
 
230
+ # The aggregated number of input tokens written to the cache with a 30-minute
231
+ # retention period. May be absent or null for older responses.
232
+ sig { returns(T.nilable(Integer)) }
233
+ attr_accessor :input_cache_write_30m_tokens
234
+
230
235
  # The aggregated number of input tokens written to the cache with a 30-minute
231
236
  # retention period.
232
237
  sig { returns(T.nilable(Integer)) }
@@ -350,6 +355,8 @@ module OpenAI
350
355
 
351
356
  input_cache_write_12h_tokens: Integer,
352
357
 
358
+ input_cache_write_30m_tokens: T.nilable(Integer),
359
+
353
360
  input_cache_write_tokens: Integer,
354
361
 
355
362
  input_cached_audio_tokens: Integer,
@@ -420,6 +427,10 @@ module OpenAI
420
427
  # retention period.
421
428
  input_cache_write_12h_tokens: nil,
422
429
 
430
+ # The aggregated number of input tokens written to the cache with a 30-minute
431
+ # retention period. May be absent or null for older responses.
432
+ input_cache_write_30m_tokens: nil,
433
+
423
434
  # The aggregated number of input tokens written to the cache with a 30-minute
424
435
  # retention period.
425
436
  input_cache_write_tokens: nil,
@@ -491,6 +502,7 @@ module OpenAI
491
502
  batch: T.nilable(T::Boolean),
492
503
  input_audio_tokens: Integer,
493
504
  input_cache_write_12h_tokens: Integer,
505
+ input_cache_write_30m_tokens: T.nilable(Integer),
494
506
  input_cache_write_tokens: Integer,
495
507
  input_cached_audio_tokens: Integer,
496
508
  input_cached_image_tokens: Integer,
@@ -227,6 +227,11 @@ module OpenAI
227
227
  sig { params(input_cache_write_12h_tokens: Integer).void }
228
228
  attr_writer :input_cache_write_12h_tokens
229
229
 
230
+ # The aggregated number of input tokens written to the cache with a 30-minute
231
+ # retention period. May be absent or null for older responses.
232
+ sig { returns(T.nilable(Integer)) }
233
+ attr_accessor :input_cache_write_30m_tokens
234
+
230
235
  # The aggregated number of input tokens written to the cache with a 30-minute
231
236
  # retention period.
232
237
  sig { returns(T.nilable(Integer)) }
@@ -350,6 +355,8 @@ module OpenAI
350
355
 
351
356
  input_cache_write_12h_tokens: Integer,
352
357
 
358
+ input_cache_write_30m_tokens: T.nilable(Integer),
359
+
353
360
  input_cache_write_tokens: Integer,
354
361
 
355
362
  input_cached_audio_tokens: Integer,
@@ -420,6 +427,10 @@ module OpenAI
420
427
  # retention period.
421
428
  input_cache_write_12h_tokens: nil,
422
429
 
430
+ # The aggregated number of input tokens written to the cache with a 30-minute
431
+ # retention period. May be absent or null for older responses.
432
+ input_cache_write_30m_tokens: nil,
433
+
423
434
  # The aggregated number of input tokens written to the cache with a 30-minute
424
435
  # retention period.
425
436
  input_cache_write_tokens: nil,
@@ -491,6 +502,7 @@ module OpenAI
491
502
  batch: T.nilable(T::Boolean),
492
503
  input_audio_tokens: Integer,
493
504
  input_cache_write_12h_tokens: Integer,
505
+ input_cache_write_30m_tokens: T.nilable(Integer),
494
506
  input_cache_write_tokens: Integer,
495
507
  input_cached_audio_tokens: Integer,
496
508
  input_cached_image_tokens: Integer,
@@ -229,6 +229,11 @@ module OpenAI
229
229
  sig { params(input_cache_write_12h_tokens: Integer).void }
230
230
  attr_writer :input_cache_write_12h_tokens
231
231
 
232
+ # The aggregated number of input tokens written to the cache with a 30-minute
233
+ # retention period. May be absent or null for older responses.
234
+ sig { returns(T.nilable(Integer)) }
235
+ attr_accessor :input_cache_write_30m_tokens
236
+
232
237
  # The aggregated number of input tokens written to the cache with a 30-minute
233
238
  # retention period.
234
239
  sig { returns(T.nilable(Integer)) }
@@ -352,6 +357,8 @@ module OpenAI
352
357
 
353
358
  input_cache_write_12h_tokens: Integer,
354
359
 
360
+ input_cache_write_30m_tokens: T.nilable(Integer),
361
+
355
362
  input_cache_write_tokens: Integer,
356
363
 
357
364
  input_cached_audio_tokens: Integer,
@@ -422,6 +429,10 @@ module OpenAI
422
429
  # retention period.
423
430
  input_cache_write_12h_tokens: nil,
424
431
 
432
+ # The aggregated number of input tokens written to the cache with a 30-minute
433
+ # retention period. May be absent or null for older responses.
434
+ input_cache_write_30m_tokens: nil,
435
+
425
436
  # The aggregated number of input tokens written to the cache with a 30-minute
426
437
  # retention period.
427
438
  input_cache_write_tokens: nil,
@@ -493,6 +504,7 @@ module OpenAI
493
504
  batch: T.nilable(T::Boolean),
494
505
  input_audio_tokens: Integer,
495
506
  input_cache_write_12h_tokens: Integer,
507
+ input_cache_write_30m_tokens: T.nilable(Integer),
496
508
  input_cache_write_tokens: Integer,
497
509
  input_cached_audio_tokens: Integer,
498
510
  input_cached_image_tokens: Integer,
@@ -5130,6 +5130,10 @@ module OpenAI
5130
5130
  sig { returns(Symbol) }
5131
5131
  attr_accessor :type
5132
5132
 
5133
+ # The unique ID of this compaction trigger.
5134
+ sig { returns(T.nilable(String)) }
5135
+ attr_accessor :id
5136
+
5133
5137
  # The agent that produced this item.
5134
5138
  sig { returns(T.nilable(OpenAI::Beta::BetaResponseInputItem::CompactionTrigger::Agent)) }
5135
5139
  attr_reader :agent
@@ -5141,6 +5145,8 @@ module OpenAI
5141
5145
  sig do
5142
5146
  params(
5143
5147
 
5148
+ id: T.nilable(String),
5149
+
5144
5150
  agent: T.nilable(OpenAI::Beta::BetaResponseInputItem::CompactionTrigger::Agent::OrHash),
5145
5151
 
5146
5152
  type: Symbol
@@ -5149,6 +5155,9 @@ module OpenAI
5149
5155
  end
5150
5156
  def self.new(
5151
5157
 
5158
+ # The unique ID of this compaction trigger.
5159
+ id: nil,
5160
+
5152
5161
  # The agent that produced this item.
5153
5162
  agent: nil,
5154
5163
 
@@ -5160,7 +5169,11 @@ module OpenAI
5160
5169
 
5161
5170
  sig do
5162
5171
  override.returns(
5163
- {type: Symbol, agent: T.nilable(OpenAI::Beta::BetaResponseInputItem::CompactionTrigger::Agent)}
5172
+ {
5173
+ type: Symbol,
5174
+ id: T.nilable(String),
5175
+ agent: T.nilable(OpenAI::Beta::BetaResponseInputItem::CompactionTrigger::Agent)
5176
+ }
5164
5177
  )
5165
5178
  end
5166
5179
  def to_hash
@@ -3433,16 +3433,25 @@ module OpenAI
3433
3433
  sig { returns(Symbol) }
3434
3434
  attr_accessor :type
3435
3435
 
3436
+ # The unique ID of this compaction trigger.
3437
+ sig { returns(T.nilable(String)) }
3438
+ attr_accessor :id
3439
+
3436
3440
  # Compacts the current context. Must be the final input item.
3437
3441
  sig do
3438
3442
  params(
3439
3443
 
3444
+ id: T.nilable(String),
3445
+
3440
3446
  type: Symbol
3441
3447
  )
3442
3448
  .returns(T.attached_class)
3443
3449
  end
3444
3450
  def self.new(
3445
3451
 
3452
+ # The unique ID of this compaction trigger.
3453
+ id: nil,
3454
+
3446
3455
  # The type of the item. Always `compaction_trigger`.
3447
3456
 
3448
3457
  type: :compaction_trigger
@@ -3451,7 +3460,7 @@ module OpenAI
3451
3460
 
3452
3461
  sig do
3453
3462
  override.returns(
3454
- {type: Symbol}
3463
+ {type: Symbol, id: T.nilable(String)}
3455
3464
  )
3456
3465
  end
3457
3466
  def to_hash
data/realtime.md CHANGED
@@ -468,6 +468,8 @@ Malformed known events raise `OpenAI::Errors::RealtimeProtocolError`. A valid
468
468
  JSON object with a newer, unknown event discriminator is returned as
469
469
  `OpenAI::Realtime::UnknownServerEvent`, preserving its deeply frozen payload so
470
470
  an additive service event does not terminate an otherwise healthy session.
471
+ Its `inspect` and `to_s` output omits remote values. Access `type`, `data`, or
472
+ `to_h` explicitly when those values are needed.
471
473
 
472
474
  ```ruby
473
475
  connection.each do |event|
@@ -495,6 +497,11 @@ Connection and protocol failures use distinct error classes:
495
497
  - `OpenAI::Errors::RealtimeProtocolError` exposes the invalid raw `data` and
496
498
  original `cause`.
497
499
 
500
+ For these connection and protocol errors, default rendering, including
501
+ `full_message`, suppresses native cause chains, including exceptions active when
502
+ an SDK state check fails. Explicit `data` and `cause` access can expose remote
503
+ payloads or credentials; sanitize these values before logging or sharing them.
504
+
498
505
  The configured request timeout bounds WebSocket negotiation. It does not become
499
506
  an idle-session deadline after the connection is established.
500
507
 
@@ -595,6 +602,18 @@ The examples in this guide cover local function calling, image input, and MCP
595
602
  approval through the generic Realtime connection API, alongside generated
596
603
  WebRTC/SDP call creation and sideband control of existing WebRTC and SIP calls.
597
604
  Continuous microphone capture, concurrent live captioning, full-duplex
598
- conversation, SIP call-ownership orchestration, and translation connections
599
- remain out of scope. Existing generated HTTP resources remain
600
- generated-code-owned.
605
+ conversation, and SIP call-ownership orchestration are outside this guide's
606
+ scope.
607
+
608
+ ## Translation connections
609
+
610
+ The SDK also supports the separate Translation WebSocket protocol through
611
+ `client.realtime.connect_translation(model: ...) { |connection| ... }`.
612
+ It uses Translation event types rather than the Realtime events shown above.
613
+ See the [Translation connection helper](lib/openai/helpers/realtime/translation.rb)
614
+ and [server event types](lib/openai/models/realtime/realtime_translation_server_event.rb).
615
+
616
+ After sending input, call `connection.finish(timeout: ...)` with a block to
617
+ consume the remaining events through `session.closed`. Finish calls must be
618
+ sequential, with no competing reader. Keep the connection inside its opening
619
+ block so the SDK can clean it up when the block exits.
@@ -75,7 +75,7 @@ module OpenAI
75
75
  attr_reader videos: OpenAI::Resources::Videos
76
76
 
77
77
  private def auth_headers: (
78
- security: { :bearer_auth? => bool, :admin_api_key_auth? => bool }
78
+ security: { ?bearer_auth: bool, ?admin_api_key_auth: bool }
79
79
  ) -> ::Hash[String, String]
80
80
 
81
81
  private def bearer_auth: -> ::Hash[String, String]
@@ -31,8 +31,6 @@ module OpenAI
31
31
  | ::Hash[Symbol | String, untyped]
32
32
 
33
33
  class UnknownTranslationServerEvent < OpenAI::Realtime::UnknownServerEvent
34
- def inspect: -> String
35
- alias to_s inspect
36
34
  end
37
35
  class TranslationConnection
38
36
  include Enumerable[OpenAI::Models::Realtime::translation_connection_server_event]
@@ -8,6 +8,8 @@ module OpenAI
8
8
  # @api private
9
9
  def initialize: (data: ::Hash[Symbol, untyped]) -> void
10
10
  def to_h: -> ::Hash[Symbol, untyped]
11
+ def inspect: -> String
12
+ alias to_s inspect
11
13
  end
12
14
  end
13
15
  end
@@ -23,17 +23,34 @@ module OpenAI
23
23
  ?transport: untyped,
24
24
  ?transport_options: Hash[untyped, untyped]
25
25
  ) {
26
- (TypedConnection) -> untyped
26
+ (TypedConnection[untyped, untyped]) -> untyped
27
27
  } -> untyped
28
28
  end
29
29
 
30
- class TypedConnection
31
- include Enumerable[untyped]
30
+ module TypedResource[WebSocketClientEvent, WebSocketServerEvent]
31
+ include Resource
32
+
33
+ def connect: (
34
+ *untyped path_arguments,
35
+ ?query: Hash[untyped, untyped],
36
+ ?websocket_base_url: String?,
37
+ ?request_options: untyped,
38
+ ?transport: untyped,
39
+ ?transport_options: Hash[untyped, untyped]
40
+ ) {
41
+ (TypedConnection[WebSocketClientEvent, WebSocketServerEvent]) -> untyped
42
+ } -> untyped
43
+ end
44
+
45
+ class TypedConnection[in ClientEvent, out Elem]
46
+ include Enumerable[Elem]
32
47
 
33
48
  attr_reader url: URI::Generic
34
- def receive: -> untyped
35
- def send_event: (untyped event) -> void
36
- def each: -> Enumerator[untyped, self] | { (untyped) -> void } -> self
49
+ def receive: -> Elem?
50
+ def send_event: (
51
+ ClientEvent | Hash[String | Symbol, untyped] event
52
+ ) -> void
53
+ def each: -> Enumerator[Elem, self] | { (Elem) -> void } -> self
37
54
  def close: (?code: Integer, ?reason: String) -> void
38
55
  def closed?: -> bool
39
56
  end
@@ -91,6 +91,7 @@ module OpenAI
91
91
  ?batch: bool?,
92
92
  ?input_audio_tokens: Integer,
93
93
  ?:input_cache_write_12h_tokens => Integer,
94
+ ?:input_cache_write_30m_tokens => Integer?,
94
95
  ?input_cache_write_tokens: Integer,
95
96
  ?input_cached_audio_tokens: Integer,
96
97
  ?input_cached_image_tokens: Integer,
@@ -152,6 +153,10 @@ module OpenAI
152
153
  # retention period.
153
154
  def input_cache_write_12h_tokens=: (Integer) -> Integer
154
155
 
156
+ # The aggregated number of input tokens written to the cache with a 30-minute
157
+ # retention period. May be absent or null for older responses.
158
+ attr_accessor input_cache_write_30m_tokens: Integer?
159
+
155
160
  # The aggregated number of input tokens written to the cache with a 30-minute
156
161
  # retention period.
157
162
  attr_reader input_cache_write_tokens: Integer?
@@ -268,6 +273,9 @@ module OpenAI
268
273
  # @param input_cache_write_12h_tokens
269
274
  # The aggregated number of input tokens written to the cache with a 12-hour
270
275
  # retention period.
276
+ # @param input_cache_write_30m_tokens
277
+ # The aggregated number of input tokens written to the cache with a 30-minute
278
+ # retention period. May be absent or null for older responses.
271
279
  # @param input_cache_write_tokens
272
280
  # The aggregated number of input tokens written to the cache with a 30-minute
273
281
  # retention period.
@@ -315,6 +323,7 @@ module OpenAI
315
323
  ?batch: bool?,
316
324
  ?input_audio_tokens: Integer,
317
325
  ?input_cache_write_12h_tokens: Integer,
326
+ ?input_cache_write_30m_tokens: Integer?,
318
327
  ?input_cache_write_tokens: Integer,
319
328
  ?input_cached_audio_tokens: Integer,
320
329
  ?input_cached_image_tokens: Integer,
@@ -343,6 +352,7 @@ module OpenAI
343
352
  ?batch: bool?,
344
353
  ?input_audio_tokens: Integer,
345
354
  ?:input_cache_write_12h_tokens => Integer,
355
+ ?:input_cache_write_30m_tokens => Integer?,
346
356
  ?input_cache_write_tokens: Integer,
347
357
  ?input_cached_audio_tokens: Integer,
348
358
  ?input_cached_image_tokens: Integer,
@@ -91,6 +91,7 @@ module OpenAI
91
91
  ?batch: bool?,
92
92
  ?input_audio_tokens: Integer,
93
93
  ?:input_cache_write_12h_tokens => Integer,
94
+ ?:input_cache_write_30m_tokens => Integer?,
94
95
  ?input_cache_write_tokens: Integer,
95
96
  ?input_cached_audio_tokens: Integer,
96
97
  ?input_cached_image_tokens: Integer,
@@ -152,6 +153,10 @@ module OpenAI
152
153
  # retention period.
153
154
  def input_cache_write_12h_tokens=: (Integer) -> Integer
154
155
 
156
+ # The aggregated number of input tokens written to the cache with a 30-minute
157
+ # retention period. May be absent or null for older responses.
158
+ attr_accessor input_cache_write_30m_tokens: Integer?
159
+
155
160
  # The aggregated number of input tokens written to the cache with a 30-minute
156
161
  # retention period.
157
162
  attr_reader input_cache_write_tokens: Integer?
@@ -268,6 +273,9 @@ module OpenAI
268
273
  # @param input_cache_write_12h_tokens
269
274
  # The aggregated number of input tokens written to the cache with a 12-hour
270
275
  # retention period.
276
+ # @param input_cache_write_30m_tokens
277
+ # The aggregated number of input tokens written to the cache with a 30-minute
278
+ # retention period. May be absent or null for older responses.
271
279
  # @param input_cache_write_tokens
272
280
  # The aggregated number of input tokens written to the cache with a 30-minute
273
281
  # retention period.
@@ -315,6 +323,7 @@ module OpenAI
315
323
  ?batch: bool?,
316
324
  ?input_audio_tokens: Integer,
317
325
  ?input_cache_write_12h_tokens: Integer,
326
+ ?input_cache_write_30m_tokens: Integer?,
318
327
  ?input_cache_write_tokens: Integer,
319
328
  ?input_cached_audio_tokens: Integer,
320
329
  ?input_cached_image_tokens: Integer,
@@ -343,6 +352,7 @@ module OpenAI
343
352
  ?batch: bool?,
344
353
  ?input_audio_tokens: Integer,
345
354
  ?:input_cache_write_12h_tokens => Integer,
355
+ ?:input_cache_write_30m_tokens => Integer?,
346
356
  ?input_cache_write_tokens: Integer,
347
357
  ?input_cached_audio_tokens: Integer,
348
358
  ?input_cached_image_tokens: Integer,
@@ -91,6 +91,7 @@ module OpenAI
91
91
  ?batch: bool?,
92
92
  ?input_audio_tokens: Integer,
93
93
  ?:input_cache_write_12h_tokens => Integer,
94
+ ?:input_cache_write_30m_tokens => Integer?,
94
95
  ?input_cache_write_tokens: Integer,
95
96
  ?input_cached_audio_tokens: Integer,
96
97
  ?input_cached_image_tokens: Integer,
@@ -152,6 +153,10 @@ module OpenAI
152
153
  # retention period.
153
154
  def input_cache_write_12h_tokens=: (Integer) -> Integer
154
155
 
156
+ # The aggregated number of input tokens written to the cache with a 30-minute
157
+ # retention period. May be absent or null for older responses.
158
+ attr_accessor input_cache_write_30m_tokens: Integer?
159
+
155
160
  # The aggregated number of input tokens written to the cache with a 30-minute
156
161
  # retention period.
157
162
  attr_reader input_cache_write_tokens: Integer?
@@ -268,6 +273,9 @@ module OpenAI
268
273
  # @param input_cache_write_12h_tokens
269
274
  # The aggregated number of input tokens written to the cache with a 12-hour
270
275
  # retention period.
276
+ # @param input_cache_write_30m_tokens
277
+ # The aggregated number of input tokens written to the cache with a 30-minute
278
+ # retention period. May be absent or null for older responses.
271
279
  # @param input_cache_write_tokens
272
280
  # The aggregated number of input tokens written to the cache with a 30-minute
273
281
  # retention period.
@@ -315,6 +323,7 @@ module OpenAI
315
323
  ?batch: bool?,
316
324
  ?input_audio_tokens: Integer,
317
325
  ?input_cache_write_12h_tokens: Integer,
326
+ ?input_cache_write_30m_tokens: Integer?,
318
327
  ?input_cache_write_tokens: Integer,
319
328
  ?input_cached_audio_tokens: Integer,
320
329
  ?input_cached_image_tokens: Integer,
@@ -343,6 +352,7 @@ module OpenAI
343
352
  ?batch: bool?,
344
353
  ?input_audio_tokens: Integer,
345
354
  ?:input_cache_write_12h_tokens => Integer,
355
+ ?:input_cache_write_30m_tokens => Integer?,
346
356
  ?input_cache_write_tokens: Integer,
347
357
  ?input_cached_audio_tokens: Integer,
348
358
  ?input_cached_image_tokens: Integer,
@@ -91,6 +91,7 @@ module OpenAI
91
91
  ?batch: bool?,
92
92
  ?input_audio_tokens: Integer,
93
93
  ?:input_cache_write_12h_tokens => Integer,
94
+ ?:input_cache_write_30m_tokens => Integer?,
94
95
  ?input_cache_write_tokens: Integer,
95
96
  ?input_cached_audio_tokens: Integer,
96
97
  ?input_cached_image_tokens: Integer,
@@ -152,6 +153,10 @@ module OpenAI
152
153
  # retention period.
153
154
  def input_cache_write_12h_tokens=: (Integer) -> Integer
154
155
 
156
+ # The aggregated number of input tokens written to the cache with a 30-minute
157
+ # retention period. May be absent or null for older responses.
158
+ attr_accessor input_cache_write_30m_tokens: Integer?
159
+
155
160
  # The aggregated number of input tokens written to the cache with a 30-minute
156
161
  # retention period.
157
162
  attr_reader input_cache_write_tokens: Integer?
@@ -268,6 +273,9 @@ module OpenAI
268
273
  # @param input_cache_write_12h_tokens
269
274
  # The aggregated number of input tokens written to the cache with a 12-hour
270
275
  # retention period.
276
+ # @param input_cache_write_30m_tokens
277
+ # The aggregated number of input tokens written to the cache with a 30-minute
278
+ # retention period. May be absent or null for older responses.
271
279
  # @param input_cache_write_tokens
272
280
  # The aggregated number of input tokens written to the cache with a 30-minute
273
281
  # retention period.
@@ -315,6 +323,7 @@ module OpenAI
315
323
  ?batch: bool?,
316
324
  ?input_audio_tokens: Integer,
317
325
  ?input_cache_write_12h_tokens: Integer,
326
+ ?input_cache_write_30m_tokens: Integer?,
318
327
  ?input_cache_write_tokens: Integer,
319
328
  ?input_cached_audio_tokens: Integer,
320
329
  ?input_cached_image_tokens: Integer,
@@ -343,6 +352,7 @@ module OpenAI
343
352
  ?batch: bool?,
344
353
  ?input_audio_tokens: Integer,
345
354
  ?:input_cache_write_12h_tokens => Integer,
355
+ ?:input_cache_write_30m_tokens => Integer?,
346
356
  ?input_cache_write_tokens: Integer,
347
357
  ?input_cached_audio_tokens: Integer,
348
358
  ?input_cached_image_tokens: Integer,
@@ -91,6 +91,7 @@ module OpenAI
91
91
  ?batch: bool?,
92
92
  ?input_audio_tokens: Integer,
93
93
  ?:input_cache_write_12h_tokens => Integer,
94
+ ?:input_cache_write_30m_tokens => Integer?,
94
95
  ?input_cache_write_tokens: Integer,
95
96
  ?input_cached_audio_tokens: Integer,
96
97
  ?input_cached_image_tokens: Integer,
@@ -152,6 +153,10 @@ module OpenAI
152
153
  # retention period.
153
154
  def input_cache_write_12h_tokens=: (Integer) -> Integer
154
155
 
156
+ # The aggregated number of input tokens written to the cache with a 30-minute
157
+ # retention period. May be absent or null for older responses.
158
+ attr_accessor input_cache_write_30m_tokens: Integer?
159
+
155
160
  # The aggregated number of input tokens written to the cache with a 30-minute
156
161
  # retention period.
157
162
  attr_reader input_cache_write_tokens: Integer?
@@ -268,6 +273,9 @@ module OpenAI
268
273
  # @param input_cache_write_12h_tokens
269
274
  # The aggregated number of input tokens written to the cache with a 12-hour
270
275
  # retention period.
276
+ # @param input_cache_write_30m_tokens
277
+ # The aggregated number of input tokens written to the cache with a 30-minute
278
+ # retention period. May be absent or null for older responses.
271
279
  # @param input_cache_write_tokens
272
280
  # The aggregated number of input tokens written to the cache with a 30-minute
273
281
  # retention period.
@@ -315,6 +323,7 @@ module OpenAI
315
323
  ?batch: bool?,
316
324
  ?input_audio_tokens: Integer,
317
325
  ?input_cache_write_12h_tokens: Integer,
326
+ ?input_cache_write_30m_tokens: Integer?,
318
327
  ?input_cache_write_tokens: Integer,
319
328
  ?input_cached_audio_tokens: Integer,
320
329
  ?input_cached_image_tokens: Integer,
@@ -343,6 +352,7 @@ module OpenAI
343
352
  ?batch: bool?,
344
353
  ?input_audio_tokens: Integer,
345
354
  ?:input_cache_write_12h_tokens => Integer,
355
+ ?:input_cache_write_30m_tokens => Integer?,
346
356
  ?input_cache_write_tokens: Integer,
347
357
  ?input_cached_audio_tokens: Integer,
348
358
  ?input_cached_image_tokens: Integer,
@@ -75,6 +75,7 @@ module OpenAI
75
75
  ?batch: bool?,
76
76
  ?input_audio_tokens: Integer?,
77
77
  ?:input_cache_write_12h_tokens => Integer?,
78
+ ?:input_cache_write_30m_tokens => Integer?,
78
79
  ?input_cache_write_tokens: Integer?,
79
80
  ?input_cached_audio_tokens: Integer?,
80
81
  ?input_cached_image_tokens: Integer?,
@@ -129,6 +130,10 @@ module OpenAI
129
130
  # retention period.
130
131
  attr_accessor input_cache_write_12h_tokens: Integer?
131
132
 
133
+ # The aggregated number of input tokens written to the cache with a 30-minute
134
+ # retention period.
135
+ attr_accessor input_cache_write_30m_tokens: Integer?
136
+
132
137
  # The aggregated number of input tokens written to the cache with a 30-minute
133
138
  # retention period.
134
139
  attr_accessor input_cache_write_tokens: Integer?
@@ -208,6 +213,9 @@ module OpenAI
208
213
  # @param input_cache_write_12h_tokens
209
214
  # The aggregated number of input tokens written to the cache with a 12-hour
210
215
  # retention period.
216
+ # @param input_cache_write_30m_tokens
217
+ # The aggregated number of input tokens written to the cache with a 30-minute
218
+ # retention period.
211
219
  # @param input_cache_write_tokens
212
220
  # The aggregated number of input tokens written to the cache with a 30-minute
213
221
  # retention period.
@@ -255,6 +263,7 @@ module OpenAI
255
263
  ?batch: bool?,
256
264
  ?input_audio_tokens: Integer?,
257
265
  ?input_cache_write_12h_tokens: Integer?,
266
+ ?input_cache_write_30m_tokens: Integer?,
258
267
  ?input_cache_write_tokens: Integer?,
259
268
  ?input_cached_audio_tokens: Integer?,
260
269
  ?input_cached_image_tokens: Integer?,
@@ -283,6 +292,7 @@ module OpenAI
283
292
  ?batch: bool?,
284
293
  ?input_audio_tokens: Integer?,
285
294
  ?:input_cache_write_12h_tokens => Integer?,
295
+ ?:input_cache_write_30m_tokens => Integer?,
286
296
  ?input_cache_write_tokens: Integer?,
287
297
  ?input_cached_audio_tokens: Integer?,
288
298
  ?input_cached_image_tokens: Integer?,
@@ -91,6 +91,7 @@ module OpenAI
91
91
  ?batch: bool?,
92
92
  ?input_audio_tokens: Integer,
93
93
  ?:input_cache_write_12h_tokens => Integer,
94
+ ?:input_cache_write_30m_tokens => Integer?,
94
95
  ?input_cache_write_tokens: Integer,
95
96
  ?input_cached_audio_tokens: Integer,
96
97
  ?input_cached_image_tokens: Integer,
@@ -152,6 +153,10 @@ module OpenAI
152
153
  # retention period.
153
154
  def input_cache_write_12h_tokens=: (Integer) -> Integer
154
155
 
156
+ # The aggregated number of input tokens written to the cache with a 30-minute
157
+ # retention period. May be absent or null for older responses.
158
+ attr_accessor input_cache_write_30m_tokens: Integer?
159
+
155
160
  # The aggregated number of input tokens written to the cache with a 30-minute
156
161
  # retention period.
157
162
  attr_reader input_cache_write_tokens: Integer?
@@ -268,6 +273,9 @@ module OpenAI
268
273
  # @param input_cache_write_12h_tokens
269
274
  # The aggregated number of input tokens written to the cache with a 12-hour
270
275
  # retention period.
276
+ # @param input_cache_write_30m_tokens
277
+ # The aggregated number of input tokens written to the cache with a 30-minute
278
+ # retention period. May be absent or null for older responses.
271
279
  # @param input_cache_write_tokens
272
280
  # The aggregated number of input tokens written to the cache with a 30-minute
273
281
  # retention period.
@@ -315,6 +323,7 @@ module OpenAI
315
323
  ?batch: bool?,
316
324
  ?input_audio_tokens: Integer,
317
325
  ?input_cache_write_12h_tokens: Integer,
326
+ ?input_cache_write_30m_tokens: Integer?,
318
327
  ?input_cache_write_tokens: Integer,
319
328
  ?input_cached_audio_tokens: Integer,
320
329
  ?input_cached_image_tokens: Integer,
@@ -343,6 +352,7 @@ module OpenAI
343
352
  ?batch: bool?,
344
353
  ?input_audio_tokens: Integer,
345
354
  ?:input_cache_write_12h_tokens => Integer,
355
+ ?:input_cache_write_30m_tokens => Integer?,
346
356
  ?input_cache_write_tokens: Integer,
347
357
  ?input_cached_audio_tokens: Integer,
348
358
  ?input_cached_image_tokens: Integer,