openai 0.70.0 → 0.71.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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +51 -1
  4. data/lib/openai/client.rb +62 -8
  5. data/lib/openai/internal/provider.rb +31 -0
  6. data/lib/openai/internal/transport/base_client.rb +65 -21
  7. data/lib/openai/models/admin/organization/audit_log_list_params.rb +84 -0
  8. data/lib/openai/models/admin/organization/audit_log_list_response.rb +84 -0
  9. data/lib/openai/models/admin/organization/projects/project_service_account.rb +4 -3
  10. data/lib/openai/models/admin/organization/projects/service_account_create_params.rb +9 -1
  11. data/lib/openai/models/admin/organization/projects/service_account_create_response.rb +26 -6
  12. data/lib/openai/models/admin/organization/projects/service_accounts/api_key_create_params.rb +54 -0
  13. data/lib/openai/models/admin/organization/projects/service_accounts/api_key_create_response.rb +57 -0
  14. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +88 -13
  15. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +88 -13
  16. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +88 -13
  17. data/lib/openai/models/admin/organization/usage_completions_response.rb +88 -13
  18. data/lib/openai/models/admin/organization/usage_costs_response.rb +88 -13
  19. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +88 -13
  20. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +88 -13
  21. data/lib/openai/models/admin/organization/usage_images_response.rb +88 -13
  22. data/lib/openai/models/admin/organization/usage_moderations_response.rb +88 -13
  23. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +88 -13
  24. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +88 -13
  25. data/lib/openai/models/beta/beta_response_input_item.rb +16 -32
  26. data/lib/openai/provider.rb +18 -0
  27. data/lib/openai/providers/bedrock.rb +489 -0
  28. data/lib/openai/resources/admin/organization/projects/service_accounts/api_keys.rb +60 -0
  29. data/lib/openai/resources/admin/organization/projects/service_accounts.rb +10 -3
  30. data/lib/openai/version.rb +1 -1
  31. data/lib/openai.rb +6 -0
  32. data/rbi/openai/client.rbi +17 -0
  33. data/rbi/openai/internal/provider.rbi +51 -0
  34. data/rbi/openai/internal/transport/base_client.rbi +32 -0
  35. data/rbi/openai/models/admin/organization/audit_log_list_params.rbi +420 -0
  36. data/rbi/openai/models/admin/organization/audit_log_list_response.rbi +420 -0
  37. data/rbi/openai/models/admin/organization/projects/project_service_account.rbi +8 -3
  38. data/rbi/openai/models/admin/organization/projects/service_account_create_params.rbi +8 -0
  39. data/rbi/openai/models/admin/organization/projects/service_account_create_response.rbi +52 -8
  40. data/rbi/openai/models/admin/organization/projects/service_accounts/api_key_create_params.rbi +84 -0
  41. data/rbi/openai/models/admin/organization/projects/service_accounts/api_key_create_response.rbi +80 -0
  42. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +121 -16
  43. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +121 -16
  44. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +121 -16
  45. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +121 -16
  46. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +121 -16
  47. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +121 -16
  48. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +121 -16
  49. data/rbi/openai/models/admin/organization/usage_images_response.rbi +121 -16
  50. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +121 -16
  51. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +121 -16
  52. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +121 -16
  53. data/rbi/openai/models/beta/beta_response_input_item.rbi +39 -46
  54. data/rbi/openai/provider.rbi +9 -0
  55. data/rbi/openai/providers.rbi +33 -0
  56. data/rbi/openai/resources/admin/organization/projects/service_accounts/api_keys.rbi +45 -0
  57. data/rbi/openai/resources/admin/organization/projects/service_accounts.rbi +12 -2
  58. data/sig/openai/client.rbs +7 -0
  59. data/sig/openai/internal/provider.rbs +29 -0
  60. data/sig/openai/internal/transport/base_client.rbs +17 -1
  61. data/sig/openai/models/admin/organization/audit_log_list_params.rbs +168 -0
  62. data/sig/openai/models/admin/organization/audit_log_list_response.rbs +168 -0
  63. data/sig/openai/models/admin/organization/projects/project_service_account.rbs +2 -1
  64. data/sig/openai/models/admin/organization/projects/service_account_create_params.rbs +9 -1
  65. data/sig/openai/models/admin/organization/projects/service_account_create_response.rbs +16 -5
  66. data/sig/openai/models/admin/organization/projects/service_accounts/api_key_create_params.rbs +53 -0
  67. data/sig/openai/models/admin/organization/projects/service_accounts/api_key_create_response.rbs +48 -0
  68. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +63 -0
  69. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +63 -0
  70. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +63 -0
  71. data/sig/openai/models/admin/organization/usage_completions_response.rbs +63 -0
  72. data/sig/openai/models/admin/organization/usage_costs_response.rbs +63 -0
  73. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +63 -0
  74. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +63 -0
  75. data/sig/openai/models/admin/organization/usage_images_response.rbs +63 -0
  76. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +63 -0
  77. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +63 -0
  78. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +63 -0
  79. data/sig/openai/models/beta/beta_response_input_item.rbs +18 -24
  80. data/sig/openai/provider.rbs +5 -0
  81. data/sig/openai/providers.rbs +15 -0
  82. data/sig/openai/resources/admin/organization/projects/service_accounts/api_keys.rbs +23 -0
  83. data/sig/openai/resources/admin/organization/projects/service_accounts.rbs +3 -0
  84. metadata +20 -2
@@ -0,0 +1,80 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Admin
6
+ module Organization
7
+ module Projects
8
+ module ServiceAccounts
9
+ class APIKeyCreateResponse < OpenAI::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ OpenAI::Models::Admin::Organization::Projects::ServiceAccounts::APIKeyCreateResponse,
14
+ OpenAI::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ # The identifier of the API key.
19
+ sig { returns(String) }
20
+ attr_accessor :id
21
+
22
+ # The Unix timestamp (in seconds) when the API key was created.
23
+ sig { returns(Integer) }
24
+ attr_accessor :created_at
25
+
26
+ # The name of the API key.
27
+ sig { returns(String) }
28
+ attr_accessor :name
29
+
30
+ # The object type, which is always `organization.project.service_account.api_key`
31
+ sig { returns(Symbol) }
32
+ attr_accessor :object
33
+
34
+ # The unredacted API key value.
35
+ sig { returns(String) }
36
+ attr_accessor :value
37
+
38
+ sig do
39
+ params(
40
+ id: String,
41
+ created_at: Integer,
42
+ name: String,
43
+ value: String,
44
+ object: Symbol
45
+ ).returns(T.attached_class)
46
+ end
47
+ def self.new(
48
+ # The identifier of the API key.
49
+ id:,
50
+ # The Unix timestamp (in seconds) when the API key was created.
51
+ created_at:,
52
+ # The name of the API key.
53
+ name:,
54
+ # The unredacted API key value.
55
+ value:,
56
+ # The object type, which is always `organization.project.service_account.api_key`
57
+ object: :"organization.project.service_account.api_key"
58
+ )
59
+ end
60
+
61
+ sig do
62
+ override.returns(
63
+ {
64
+ id: String,
65
+ created_at: Integer,
66
+ name: String,
67
+ object: Symbol,
68
+ value: String
69
+ }
70
+ )
71
+ end
72
+ def to_hash
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -160,8 +160,9 @@ module OpenAI
160
160
  )
161
161
  end
162
162
 
163
- # The aggregated number of text input tokens used, including cached tokens. For
164
- # customers subscribe to scale tier, this includes scale tier tokens.
163
+ # The aggregated number of input tokens used, including cached and cache-write
164
+ # tokens. This includes text, audio, and image tokens. For customers subscribed to
165
+ # Scale Tier, this includes Scale Tier tokens.
165
166
  sig { returns(Integer) }
166
167
  attr_accessor :input_tokens
167
168
 
@@ -172,8 +173,9 @@ module OpenAI
172
173
  sig { returns(Symbol) }
173
174
  attr_accessor :object
174
175
 
175
- # The aggregated number of text output tokens used. For customers subscribe to
176
- # scale tier, this includes scale tier tokens.
176
+ # The aggregated number of output tokens used across text, audio, and image
177
+ # outputs. For customers subscribed to Scale Tier, this includes Scale Tier
178
+ # tokens.
177
179
  sig { returns(Integer) }
178
180
  attr_accessor :output_tokens
179
181
 
@@ -187,22 +189,72 @@ module OpenAI
187
189
  sig { returns(T.nilable(T::Boolean)) }
188
190
  attr_accessor :batch
189
191
 
190
- # The aggregated number of audio input tokens used, including cached tokens.
192
+ # The aggregated number of uncached audio input tokens used.
191
193
  sig { returns(T.nilable(Integer)) }
192
194
  attr_reader :input_audio_tokens
193
195
 
194
196
  sig { params(input_audio_tokens: Integer).void }
195
197
  attr_writer :input_audio_tokens
196
198
 
197
- # The aggregated number of text input tokens that has been cached from previous
198
- # requests. For customers subscribe to scale tier, this includes scale tier
199
- # tokens.
199
+ # The aggregated number of input tokens written to the cache.
200
+ sig { returns(T.nilable(Integer)) }
201
+ attr_reader :input_cache_write_tokens
202
+
203
+ sig { params(input_cache_write_tokens: Integer).void }
204
+ attr_writer :input_cache_write_tokens
205
+
206
+ # The aggregated number of cached audio input tokens used.
207
+ sig { returns(T.nilable(Integer)) }
208
+ attr_reader :input_cached_audio_tokens
209
+
210
+ sig { params(input_cached_audio_tokens: Integer).void }
211
+ attr_writer :input_cached_audio_tokens
212
+
213
+ # The aggregated number of cached image input tokens used.
214
+ sig { returns(T.nilable(Integer)) }
215
+ attr_reader :input_cached_image_tokens
216
+
217
+ sig { params(input_cached_image_tokens: Integer).void }
218
+ attr_writer :input_cached_image_tokens
219
+
220
+ # The aggregated number of cached text input tokens used.
221
+ sig { returns(T.nilable(Integer)) }
222
+ attr_reader :input_cached_text_tokens
223
+
224
+ sig { params(input_cached_text_tokens: Integer).void }
225
+ attr_writer :input_cached_text_tokens
226
+
227
+ # The aggregated number of cached input tokens used across text, audio, and image
228
+ # inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens.
200
229
  sig { returns(T.nilable(Integer)) }
201
230
  attr_reader :input_cached_tokens
202
231
 
203
232
  sig { params(input_cached_tokens: Integer).void }
204
233
  attr_writer :input_cached_tokens
205
234
 
235
+ # The aggregated number of uncached image input tokens used.
236
+ sig { returns(T.nilable(Integer)) }
237
+ attr_reader :input_image_tokens
238
+
239
+ sig { params(input_image_tokens: Integer).void }
240
+ attr_writer :input_image_tokens
241
+
242
+ # The aggregated number of uncached text input tokens used, excluding cache-write
243
+ # tokens.
244
+ sig { returns(T.nilable(Integer)) }
245
+ attr_reader :input_text_tokens
246
+
247
+ sig { params(input_text_tokens: Integer).void }
248
+ attr_writer :input_text_tokens
249
+
250
+ # The aggregated number of uncached input tokens used across text, audio, and
251
+ # image inputs, excluding cache-write tokens.
252
+ sig { returns(T.nilable(Integer)) }
253
+ attr_reader :input_uncached_tokens
254
+
255
+ sig { params(input_uncached_tokens: Integer).void }
256
+ attr_writer :input_uncached_tokens
257
+
206
258
  # When `group_by=model`, this field provides the model name of the grouped usage
207
259
  # result.
208
260
  sig { returns(T.nilable(String)) }
@@ -215,6 +267,20 @@ module OpenAI
215
267
  sig { params(output_audio_tokens: Integer).void }
216
268
  attr_writer :output_audio_tokens
217
269
 
270
+ # The aggregated number of image output tokens used.
271
+ sig { returns(T.nilable(Integer)) }
272
+ attr_reader :output_image_tokens
273
+
274
+ sig { params(output_image_tokens: Integer).void }
275
+ attr_writer :output_image_tokens
276
+
277
+ # The aggregated number of text output tokens used.
278
+ sig { returns(T.nilable(Integer)) }
279
+ attr_reader :output_text_tokens
280
+
281
+ sig { params(output_text_tokens: Integer).void }
282
+ attr_writer :output_text_tokens
283
+
218
284
  # When `group_by=project_id`, this field provides the project ID of the grouped
219
285
  # usage result.
220
286
  sig { returns(T.nilable(String)) }
@@ -239,9 +305,18 @@ module OpenAI
239
305
  api_key_id: T.nilable(String),
240
306
  batch: T.nilable(T::Boolean),
241
307
  input_audio_tokens: Integer,
308
+ input_cache_write_tokens: Integer,
309
+ input_cached_audio_tokens: Integer,
310
+ input_cached_image_tokens: Integer,
311
+ input_cached_text_tokens: Integer,
242
312
  input_cached_tokens: Integer,
313
+ input_image_tokens: Integer,
314
+ input_text_tokens: Integer,
315
+ input_uncached_tokens: Integer,
243
316
  model: T.nilable(String),
244
317
  output_audio_tokens: Integer,
318
+ output_image_tokens: Integer,
319
+ output_text_tokens: Integer,
245
320
  project_id: T.nilable(String),
246
321
  service_tier: T.nilable(String),
247
322
  user_id: T.nilable(String),
@@ -249,13 +324,15 @@ module OpenAI
249
324
  ).returns(T.attached_class)
250
325
  end
251
326
  def self.new(
252
- # The aggregated number of text input tokens used, including cached tokens. For
253
- # customers subscribe to scale tier, this includes scale tier tokens.
327
+ # The aggregated number of input tokens used, including cached and cache-write
328
+ # tokens. This includes text, audio, and image tokens. For customers subscribed to
329
+ # Scale Tier, this includes Scale Tier tokens.
254
330
  input_tokens:,
255
331
  # The count of requests made to the model.
256
332
  num_model_requests:,
257
- # The aggregated number of text output tokens used. For customers subscribe to
258
- # scale tier, this includes scale tier tokens.
333
+ # The aggregated number of output tokens used across text, audio, and image
334
+ # outputs. For customers subscribed to Scale Tier, this includes Scale Tier
335
+ # tokens.
259
336
  output_tokens:,
260
337
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
261
338
  # usage result.
@@ -263,17 +340,36 @@ module OpenAI
263
340
  # When `group_by=batch`, this field tells whether the grouped usage result is
264
341
  # batch or not.
265
342
  batch: nil,
266
- # The aggregated number of audio input tokens used, including cached tokens.
343
+ # The aggregated number of uncached audio input tokens used.
267
344
  input_audio_tokens: nil,
268
- # The aggregated number of text input tokens that has been cached from previous
269
- # requests. For customers subscribe to scale tier, this includes scale tier
270
- # tokens.
345
+ # The aggregated number of input tokens written to the cache.
346
+ input_cache_write_tokens: nil,
347
+ # The aggregated number of cached audio input tokens used.
348
+ input_cached_audio_tokens: nil,
349
+ # The aggregated number of cached image input tokens used.
350
+ input_cached_image_tokens: nil,
351
+ # The aggregated number of cached text input tokens used.
352
+ input_cached_text_tokens: nil,
353
+ # The aggregated number of cached input tokens used across text, audio, and image
354
+ # inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens.
271
355
  input_cached_tokens: nil,
356
+ # The aggregated number of uncached image input tokens used.
357
+ input_image_tokens: nil,
358
+ # The aggregated number of uncached text input tokens used, excluding cache-write
359
+ # tokens.
360
+ input_text_tokens: nil,
361
+ # The aggregated number of uncached input tokens used across text, audio, and
362
+ # image inputs, excluding cache-write tokens.
363
+ input_uncached_tokens: nil,
272
364
  # When `group_by=model`, this field provides the model name of the grouped usage
273
365
  # result.
274
366
  model: nil,
275
367
  # The aggregated number of audio output tokens used.
276
368
  output_audio_tokens: nil,
369
+ # The aggregated number of image output tokens used.
370
+ output_image_tokens: nil,
371
+ # The aggregated number of text output tokens used.
372
+ output_text_tokens: nil,
277
373
  # When `group_by=project_id`, this field provides the project ID of the grouped
278
374
  # usage result.
279
375
  project_id: nil,
@@ -297,9 +393,18 @@ module OpenAI
297
393
  api_key_id: T.nilable(String),
298
394
  batch: T.nilable(T::Boolean),
299
395
  input_audio_tokens: Integer,
396
+ input_cache_write_tokens: Integer,
397
+ input_cached_audio_tokens: Integer,
398
+ input_cached_image_tokens: Integer,
399
+ input_cached_text_tokens: Integer,
300
400
  input_cached_tokens: Integer,
401
+ input_image_tokens: Integer,
402
+ input_text_tokens: Integer,
403
+ input_uncached_tokens: Integer,
301
404
  model: T.nilable(String),
302
405
  output_audio_tokens: Integer,
406
+ output_image_tokens: Integer,
407
+ output_text_tokens: Integer,
303
408
  project_id: T.nilable(String),
304
409
  service_tier: T.nilable(String),
305
410
  user_id: T.nilable(String)
@@ -160,8 +160,9 @@ module OpenAI
160
160
  )
161
161
  end
162
162
 
163
- # The aggregated number of text input tokens used, including cached tokens. For
164
- # customers subscribe to scale tier, this includes scale tier tokens.
163
+ # The aggregated number of input tokens used, including cached and cache-write
164
+ # tokens. This includes text, audio, and image tokens. For customers subscribed to
165
+ # Scale Tier, this includes Scale Tier tokens.
165
166
  sig { returns(Integer) }
166
167
  attr_accessor :input_tokens
167
168
 
@@ -172,8 +173,9 @@ module OpenAI
172
173
  sig { returns(Symbol) }
173
174
  attr_accessor :object
174
175
 
175
- # The aggregated number of text output tokens used. For customers subscribe to
176
- # scale tier, this includes scale tier tokens.
176
+ # The aggregated number of output tokens used across text, audio, and image
177
+ # outputs. For customers subscribed to Scale Tier, this includes Scale Tier
178
+ # tokens.
177
179
  sig { returns(Integer) }
178
180
  attr_accessor :output_tokens
179
181
 
@@ -187,22 +189,72 @@ module OpenAI
187
189
  sig { returns(T.nilable(T::Boolean)) }
188
190
  attr_accessor :batch
189
191
 
190
- # The aggregated number of audio input tokens used, including cached tokens.
192
+ # The aggregated number of uncached audio input tokens used.
191
193
  sig { returns(T.nilable(Integer)) }
192
194
  attr_reader :input_audio_tokens
193
195
 
194
196
  sig { params(input_audio_tokens: Integer).void }
195
197
  attr_writer :input_audio_tokens
196
198
 
197
- # The aggregated number of text input tokens that has been cached from previous
198
- # requests. For customers subscribe to scale tier, this includes scale tier
199
- # tokens.
199
+ # The aggregated number of input tokens written to the cache.
200
+ sig { returns(T.nilable(Integer)) }
201
+ attr_reader :input_cache_write_tokens
202
+
203
+ sig { params(input_cache_write_tokens: Integer).void }
204
+ attr_writer :input_cache_write_tokens
205
+
206
+ # The aggregated number of cached audio input tokens used.
207
+ sig { returns(T.nilable(Integer)) }
208
+ attr_reader :input_cached_audio_tokens
209
+
210
+ sig { params(input_cached_audio_tokens: Integer).void }
211
+ attr_writer :input_cached_audio_tokens
212
+
213
+ # The aggregated number of cached image input tokens used.
214
+ sig { returns(T.nilable(Integer)) }
215
+ attr_reader :input_cached_image_tokens
216
+
217
+ sig { params(input_cached_image_tokens: Integer).void }
218
+ attr_writer :input_cached_image_tokens
219
+
220
+ # The aggregated number of cached text input tokens used.
221
+ sig { returns(T.nilable(Integer)) }
222
+ attr_reader :input_cached_text_tokens
223
+
224
+ sig { params(input_cached_text_tokens: Integer).void }
225
+ attr_writer :input_cached_text_tokens
226
+
227
+ # The aggregated number of cached input tokens used across text, audio, and image
228
+ # inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens.
200
229
  sig { returns(T.nilable(Integer)) }
201
230
  attr_reader :input_cached_tokens
202
231
 
203
232
  sig { params(input_cached_tokens: Integer).void }
204
233
  attr_writer :input_cached_tokens
205
234
 
235
+ # The aggregated number of uncached image input tokens used.
236
+ sig { returns(T.nilable(Integer)) }
237
+ attr_reader :input_image_tokens
238
+
239
+ sig { params(input_image_tokens: Integer).void }
240
+ attr_writer :input_image_tokens
241
+
242
+ # The aggregated number of uncached text input tokens used, excluding cache-write
243
+ # tokens.
244
+ sig { returns(T.nilable(Integer)) }
245
+ attr_reader :input_text_tokens
246
+
247
+ sig { params(input_text_tokens: Integer).void }
248
+ attr_writer :input_text_tokens
249
+
250
+ # The aggregated number of uncached input tokens used across text, audio, and
251
+ # image inputs, excluding cache-write tokens.
252
+ sig { returns(T.nilable(Integer)) }
253
+ attr_reader :input_uncached_tokens
254
+
255
+ sig { params(input_uncached_tokens: Integer).void }
256
+ attr_writer :input_uncached_tokens
257
+
206
258
  # When `group_by=model`, this field provides the model name of the grouped usage
207
259
  # result.
208
260
  sig { returns(T.nilable(String)) }
@@ -215,6 +267,20 @@ module OpenAI
215
267
  sig { params(output_audio_tokens: Integer).void }
216
268
  attr_writer :output_audio_tokens
217
269
 
270
+ # The aggregated number of image output tokens used.
271
+ sig { returns(T.nilable(Integer)) }
272
+ attr_reader :output_image_tokens
273
+
274
+ sig { params(output_image_tokens: Integer).void }
275
+ attr_writer :output_image_tokens
276
+
277
+ # The aggregated number of text output tokens used.
278
+ sig { returns(T.nilable(Integer)) }
279
+ attr_reader :output_text_tokens
280
+
281
+ sig { params(output_text_tokens: Integer).void }
282
+ attr_writer :output_text_tokens
283
+
218
284
  # When `group_by=project_id`, this field provides the project ID of the grouped
219
285
  # usage result.
220
286
  sig { returns(T.nilable(String)) }
@@ -239,9 +305,18 @@ module OpenAI
239
305
  api_key_id: T.nilable(String),
240
306
  batch: T.nilable(T::Boolean),
241
307
  input_audio_tokens: Integer,
308
+ input_cache_write_tokens: Integer,
309
+ input_cached_audio_tokens: Integer,
310
+ input_cached_image_tokens: Integer,
311
+ input_cached_text_tokens: Integer,
242
312
  input_cached_tokens: Integer,
313
+ input_image_tokens: Integer,
314
+ input_text_tokens: Integer,
315
+ input_uncached_tokens: Integer,
243
316
  model: T.nilable(String),
244
317
  output_audio_tokens: Integer,
318
+ output_image_tokens: Integer,
319
+ output_text_tokens: Integer,
245
320
  project_id: T.nilable(String),
246
321
  service_tier: T.nilable(String),
247
322
  user_id: T.nilable(String),
@@ -249,13 +324,15 @@ module OpenAI
249
324
  ).returns(T.attached_class)
250
325
  end
251
326
  def self.new(
252
- # The aggregated number of text input tokens used, including cached tokens. For
253
- # customers subscribe to scale tier, this includes scale tier tokens.
327
+ # The aggregated number of input tokens used, including cached and cache-write
328
+ # tokens. This includes text, audio, and image tokens. For customers subscribed to
329
+ # Scale Tier, this includes Scale Tier tokens.
254
330
  input_tokens:,
255
331
  # The count of requests made to the model.
256
332
  num_model_requests:,
257
- # The aggregated number of text output tokens used. For customers subscribe to
258
- # scale tier, this includes scale tier tokens.
333
+ # The aggregated number of output tokens used across text, audio, and image
334
+ # outputs. For customers subscribed to Scale Tier, this includes Scale Tier
335
+ # tokens.
259
336
  output_tokens:,
260
337
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
261
338
  # usage result.
@@ -263,17 +340,36 @@ module OpenAI
263
340
  # When `group_by=batch`, this field tells whether the grouped usage result is
264
341
  # batch or not.
265
342
  batch: nil,
266
- # The aggregated number of audio input tokens used, including cached tokens.
343
+ # The aggregated number of uncached audio input tokens used.
267
344
  input_audio_tokens: nil,
268
- # The aggregated number of text input tokens that has been cached from previous
269
- # requests. For customers subscribe to scale tier, this includes scale tier
270
- # tokens.
345
+ # The aggregated number of input tokens written to the cache.
346
+ input_cache_write_tokens: nil,
347
+ # The aggregated number of cached audio input tokens used.
348
+ input_cached_audio_tokens: nil,
349
+ # The aggregated number of cached image input tokens used.
350
+ input_cached_image_tokens: nil,
351
+ # The aggregated number of cached text input tokens used.
352
+ input_cached_text_tokens: nil,
353
+ # The aggregated number of cached input tokens used across text, audio, and image
354
+ # inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens.
271
355
  input_cached_tokens: nil,
356
+ # The aggregated number of uncached image input tokens used.
357
+ input_image_tokens: nil,
358
+ # The aggregated number of uncached text input tokens used, excluding cache-write
359
+ # tokens.
360
+ input_text_tokens: nil,
361
+ # The aggregated number of uncached input tokens used across text, audio, and
362
+ # image inputs, excluding cache-write tokens.
363
+ input_uncached_tokens: nil,
272
364
  # When `group_by=model`, this field provides the model name of the grouped usage
273
365
  # result.
274
366
  model: nil,
275
367
  # The aggregated number of audio output tokens used.
276
368
  output_audio_tokens: nil,
369
+ # The aggregated number of image output tokens used.
370
+ output_image_tokens: nil,
371
+ # The aggregated number of text output tokens used.
372
+ output_text_tokens: nil,
277
373
  # When `group_by=project_id`, this field provides the project ID of the grouped
278
374
  # usage result.
279
375
  project_id: nil,
@@ -297,9 +393,18 @@ module OpenAI
297
393
  api_key_id: T.nilable(String),
298
394
  batch: T.nilable(T::Boolean),
299
395
  input_audio_tokens: Integer,
396
+ input_cache_write_tokens: Integer,
397
+ input_cached_audio_tokens: Integer,
398
+ input_cached_image_tokens: Integer,
399
+ input_cached_text_tokens: Integer,
300
400
  input_cached_tokens: Integer,
401
+ input_image_tokens: Integer,
402
+ input_text_tokens: Integer,
403
+ input_uncached_tokens: Integer,
301
404
  model: T.nilable(String),
302
405
  output_audio_tokens: Integer,
406
+ output_image_tokens: Integer,
407
+ output_text_tokens: Integer,
303
408
  project_id: T.nilable(String),
304
409
  service_tier: T.nilable(String),
305
410
  user_id: T.nilable(String)