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
@@ -113,8 +113,9 @@ module OpenAI
113
113
 
114
114
  class OrganizationUsageCompletionsResult < OpenAI::Internal::Type::BaseModel
115
115
  # @!attribute input_tokens
116
- # The aggregated number of text input tokens used, including cached tokens. For
117
- # customers subscribe to scale tier, this includes scale tier tokens.
116
+ # The aggregated number of input tokens used, including cached and cache-write
117
+ # tokens. This includes text, audio, and image tokens. For customers subscribed to
118
+ # Scale Tier, this includes Scale Tier tokens.
118
119
  #
119
120
  # @return [Integer]
120
121
  required :input_tokens, Integer
@@ -131,8 +132,9 @@ module OpenAI
131
132
  required :object, const: :"organization.usage.completions.result"
132
133
 
133
134
  # @!attribute output_tokens
134
- # The aggregated number of text output tokens used. For customers subscribe to
135
- # scale tier, this includes scale tier tokens.
135
+ # The aggregated number of output tokens used across text, audio, and image
136
+ # outputs. For customers subscribed to Scale Tier, this includes Scale Tier
137
+ # tokens.
136
138
  #
137
139
  # @return [Integer]
138
140
  required :output_tokens, Integer
@@ -152,19 +154,62 @@ module OpenAI
152
154
  optional :batch, OpenAI::Internal::Type::Boolean, nil?: true
153
155
 
154
156
  # @!attribute input_audio_tokens
155
- # The aggregated number of audio input tokens used, including cached tokens.
157
+ # The aggregated number of uncached audio input tokens used.
156
158
  #
157
159
  # @return [Integer, nil]
158
160
  optional :input_audio_tokens, Integer
159
161
 
162
+ # @!attribute input_cache_write_tokens
163
+ # The aggregated number of input tokens written to the cache.
164
+ #
165
+ # @return [Integer, nil]
166
+ optional :input_cache_write_tokens, Integer
167
+
168
+ # @!attribute input_cached_audio_tokens
169
+ # The aggregated number of cached audio input tokens used.
170
+ #
171
+ # @return [Integer, nil]
172
+ optional :input_cached_audio_tokens, Integer
173
+
174
+ # @!attribute input_cached_image_tokens
175
+ # The aggregated number of cached image input tokens used.
176
+ #
177
+ # @return [Integer, nil]
178
+ optional :input_cached_image_tokens, Integer
179
+
180
+ # @!attribute input_cached_text_tokens
181
+ # The aggregated number of cached text input tokens used.
182
+ #
183
+ # @return [Integer, nil]
184
+ optional :input_cached_text_tokens, Integer
185
+
160
186
  # @!attribute input_cached_tokens
161
- # The aggregated number of text input tokens that has been cached from previous
162
- # requests. For customers subscribe to scale tier, this includes scale tier
163
- # tokens.
187
+ # The aggregated number of cached input tokens used across text, audio, and image
188
+ # inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens.
164
189
  #
165
190
  # @return [Integer, nil]
166
191
  optional :input_cached_tokens, Integer
167
192
 
193
+ # @!attribute input_image_tokens
194
+ # The aggregated number of uncached image input tokens used.
195
+ #
196
+ # @return [Integer, nil]
197
+ optional :input_image_tokens, Integer
198
+
199
+ # @!attribute input_text_tokens
200
+ # The aggregated number of uncached text input tokens used, excluding cache-write
201
+ # tokens.
202
+ #
203
+ # @return [Integer, nil]
204
+ optional :input_text_tokens, Integer
205
+
206
+ # @!attribute input_uncached_tokens
207
+ # The aggregated number of uncached input tokens used across text, audio, and
208
+ # image inputs, excluding cache-write tokens.
209
+ #
210
+ # @return [Integer, nil]
211
+ optional :input_uncached_tokens, Integer
212
+
168
213
  # @!attribute model
169
214
  # When `group_by=model`, this field provides the model name of the grouped usage
170
215
  # result.
@@ -178,6 +223,18 @@ module OpenAI
178
223
  # @return [Integer, nil]
179
224
  optional :output_audio_tokens, Integer
180
225
 
226
+ # @!attribute output_image_tokens
227
+ # The aggregated number of image output tokens used.
228
+ #
229
+ # @return [Integer, nil]
230
+ optional :output_image_tokens, Integer
231
+
232
+ # @!attribute output_text_tokens
233
+ # The aggregated number of text output tokens used.
234
+ #
235
+ # @return [Integer, nil]
236
+ optional :output_text_tokens, Integer
237
+
181
238
  # @!attribute project_id
182
239
  # When `group_by=project_id`, this field provides the project ID of the grouped
183
240
  # usage result.
@@ -199,31 +256,49 @@ module OpenAI
199
256
  # @return [String, nil]
200
257
  optional :user_id, String, nil?: true
201
258
 
202
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_tokens: nil, input_cached_tokens: nil, model: nil, output_audio_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
259
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
203
260
  # Some parameter documentations has been truncated, see
204
261
  # {OpenAI::Models::Admin::Organization::UsageModerationsResponse::Data::Result::OrganizationUsageCompletionsResult}
205
262
  # for more details.
206
263
  #
207
264
  # The aggregated completions usage details of the specific time bucket.
208
265
  #
209
- # @param input_tokens [Integer] The aggregated number of text input tokens used, including cached tokens. For cu
266
+ # @param input_tokens [Integer] The aggregated number of input tokens used, including cached and cache-write tok
210
267
  #
211
268
  # @param num_model_requests [Integer] The count of requests made to the model.
212
269
  #
213
- # @param output_tokens [Integer] The aggregated number of text output tokens used. For customers subscribe to sca
270
+ # @param output_tokens [Integer] The aggregated number of output tokens used across text, audio, and image output
214
271
  #
215
272
  # @param api_key_id [String, nil] When `group_by=api_key_id`, this field provides the API key ID of the grouped us
216
273
  #
217
274
  # @param batch [Boolean, nil] When `group_by=batch`, this field tells whether the grouped usage result is batc
218
275
  #
219
- # @param input_audio_tokens [Integer] The aggregated number of audio input tokens used, including cached tokens.
276
+ # @param input_audio_tokens [Integer] The aggregated number of uncached audio input tokens used.
220
277
  #
221
- # @param input_cached_tokens [Integer] The aggregated number of text input tokens that has been cached from previous re
278
+ # @param input_cache_write_tokens [Integer] The aggregated number of input tokens written to the cache.
279
+ #
280
+ # @param input_cached_audio_tokens [Integer] The aggregated number of cached audio input tokens used.
281
+ #
282
+ # @param input_cached_image_tokens [Integer] The aggregated number of cached image input tokens used.
283
+ #
284
+ # @param input_cached_text_tokens [Integer] The aggregated number of cached text input tokens used.
285
+ #
286
+ # @param input_cached_tokens [Integer] The aggregated number of cached input tokens used across text, audio, and image
287
+ #
288
+ # @param input_image_tokens [Integer] The aggregated number of uncached image input tokens used.
289
+ #
290
+ # @param input_text_tokens [Integer] The aggregated number of uncached text input tokens used, excluding cache-write
291
+ #
292
+ # @param input_uncached_tokens [Integer] The aggregated number of uncached input tokens used across text, audio, and imag
222
293
  #
223
294
  # @param model [String, nil] When `group_by=model`, this field provides the model name of the grouped usage r
224
295
  #
225
296
  # @param output_audio_tokens [Integer] The aggregated number of audio output tokens used.
226
297
  #
298
+ # @param output_image_tokens [Integer] The aggregated number of image output tokens used.
299
+ #
300
+ # @param output_text_tokens [Integer] The aggregated number of text output tokens used.
301
+ #
227
302
  # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped us
228
303
  #
229
304
  # @param service_tier [String, nil] When `group_by=service_tier`, this field provides the service tier of the groupe
@@ -113,8 +113,9 @@ module OpenAI
113
113
 
114
114
  class OrganizationUsageCompletionsResult < OpenAI::Internal::Type::BaseModel
115
115
  # @!attribute input_tokens
116
- # The aggregated number of text input tokens used, including cached tokens. For
117
- # customers subscribe to scale tier, this includes scale tier tokens.
116
+ # The aggregated number of input tokens used, including cached and cache-write
117
+ # tokens. This includes text, audio, and image tokens. For customers subscribed to
118
+ # Scale Tier, this includes Scale Tier tokens.
118
119
  #
119
120
  # @return [Integer]
120
121
  required :input_tokens, Integer
@@ -131,8 +132,9 @@ module OpenAI
131
132
  required :object, const: :"organization.usage.completions.result"
132
133
 
133
134
  # @!attribute output_tokens
134
- # The aggregated number of text output tokens used. For customers subscribe to
135
- # scale tier, this includes scale tier tokens.
135
+ # The aggregated number of output tokens used across text, audio, and image
136
+ # outputs. For customers subscribed to Scale Tier, this includes Scale Tier
137
+ # tokens.
136
138
  #
137
139
  # @return [Integer]
138
140
  required :output_tokens, Integer
@@ -152,19 +154,62 @@ module OpenAI
152
154
  optional :batch, OpenAI::Internal::Type::Boolean, nil?: true
153
155
 
154
156
  # @!attribute input_audio_tokens
155
- # The aggregated number of audio input tokens used, including cached tokens.
157
+ # The aggregated number of uncached audio input tokens used.
156
158
  #
157
159
  # @return [Integer, nil]
158
160
  optional :input_audio_tokens, Integer
159
161
 
162
+ # @!attribute input_cache_write_tokens
163
+ # The aggregated number of input tokens written to the cache.
164
+ #
165
+ # @return [Integer, nil]
166
+ optional :input_cache_write_tokens, Integer
167
+
168
+ # @!attribute input_cached_audio_tokens
169
+ # The aggregated number of cached audio input tokens used.
170
+ #
171
+ # @return [Integer, nil]
172
+ optional :input_cached_audio_tokens, Integer
173
+
174
+ # @!attribute input_cached_image_tokens
175
+ # The aggregated number of cached image input tokens used.
176
+ #
177
+ # @return [Integer, nil]
178
+ optional :input_cached_image_tokens, Integer
179
+
180
+ # @!attribute input_cached_text_tokens
181
+ # The aggregated number of cached text input tokens used.
182
+ #
183
+ # @return [Integer, nil]
184
+ optional :input_cached_text_tokens, Integer
185
+
160
186
  # @!attribute input_cached_tokens
161
- # The aggregated number of text input tokens that has been cached from previous
162
- # requests. For customers subscribe to scale tier, this includes scale tier
163
- # tokens.
187
+ # The aggregated number of cached input tokens used across text, audio, and image
188
+ # inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens.
164
189
  #
165
190
  # @return [Integer, nil]
166
191
  optional :input_cached_tokens, Integer
167
192
 
193
+ # @!attribute input_image_tokens
194
+ # The aggregated number of uncached image input tokens used.
195
+ #
196
+ # @return [Integer, nil]
197
+ optional :input_image_tokens, Integer
198
+
199
+ # @!attribute input_text_tokens
200
+ # The aggregated number of uncached text input tokens used, excluding cache-write
201
+ # tokens.
202
+ #
203
+ # @return [Integer, nil]
204
+ optional :input_text_tokens, Integer
205
+
206
+ # @!attribute input_uncached_tokens
207
+ # The aggregated number of uncached input tokens used across text, audio, and
208
+ # image inputs, excluding cache-write tokens.
209
+ #
210
+ # @return [Integer, nil]
211
+ optional :input_uncached_tokens, Integer
212
+
168
213
  # @!attribute model
169
214
  # When `group_by=model`, this field provides the model name of the grouped usage
170
215
  # result.
@@ -178,6 +223,18 @@ module OpenAI
178
223
  # @return [Integer, nil]
179
224
  optional :output_audio_tokens, Integer
180
225
 
226
+ # @!attribute output_image_tokens
227
+ # The aggregated number of image output tokens used.
228
+ #
229
+ # @return [Integer, nil]
230
+ optional :output_image_tokens, Integer
231
+
232
+ # @!attribute output_text_tokens
233
+ # The aggregated number of text output tokens used.
234
+ #
235
+ # @return [Integer, nil]
236
+ optional :output_text_tokens, Integer
237
+
181
238
  # @!attribute project_id
182
239
  # When `group_by=project_id`, this field provides the project ID of the grouped
183
240
  # usage result.
@@ -199,31 +256,49 @@ module OpenAI
199
256
  # @return [String, nil]
200
257
  optional :user_id, String, nil?: true
201
258
 
202
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_tokens: nil, input_cached_tokens: nil, model: nil, output_audio_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
259
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
203
260
  # Some parameter documentations has been truncated, see
204
261
  # {OpenAI::Models::Admin::Organization::UsageVectorStoresResponse::Data::Result::OrganizationUsageCompletionsResult}
205
262
  # for more details.
206
263
  #
207
264
  # The aggregated completions usage details of the specific time bucket.
208
265
  #
209
- # @param input_tokens [Integer] The aggregated number of text input tokens used, including cached tokens. For cu
266
+ # @param input_tokens [Integer] The aggregated number of input tokens used, including cached and cache-write tok
210
267
  #
211
268
  # @param num_model_requests [Integer] The count of requests made to the model.
212
269
  #
213
- # @param output_tokens [Integer] The aggregated number of text output tokens used. For customers subscribe to sca
270
+ # @param output_tokens [Integer] The aggregated number of output tokens used across text, audio, and image output
214
271
  #
215
272
  # @param api_key_id [String, nil] When `group_by=api_key_id`, this field provides the API key ID of the grouped us
216
273
  #
217
274
  # @param batch [Boolean, nil] When `group_by=batch`, this field tells whether the grouped usage result is batc
218
275
  #
219
- # @param input_audio_tokens [Integer] The aggregated number of audio input tokens used, including cached tokens.
276
+ # @param input_audio_tokens [Integer] The aggregated number of uncached audio input tokens used.
220
277
  #
221
- # @param input_cached_tokens [Integer] The aggregated number of text input tokens that has been cached from previous re
278
+ # @param input_cache_write_tokens [Integer] The aggregated number of input tokens written to the cache.
279
+ #
280
+ # @param input_cached_audio_tokens [Integer] The aggregated number of cached audio input tokens used.
281
+ #
282
+ # @param input_cached_image_tokens [Integer] The aggregated number of cached image input tokens used.
283
+ #
284
+ # @param input_cached_text_tokens [Integer] The aggregated number of cached text input tokens used.
285
+ #
286
+ # @param input_cached_tokens [Integer] The aggregated number of cached input tokens used across text, audio, and image
287
+ #
288
+ # @param input_image_tokens [Integer] The aggregated number of uncached image input tokens used.
289
+ #
290
+ # @param input_text_tokens [Integer] The aggregated number of uncached text input tokens used, excluding cache-write
291
+ #
292
+ # @param input_uncached_tokens [Integer] The aggregated number of uncached input tokens used across text, audio, and imag
222
293
  #
223
294
  # @param model [String, nil] When `group_by=model`, this field provides the model name of the grouped usage r
224
295
  #
225
296
  # @param output_audio_tokens [Integer] The aggregated number of audio output tokens used.
226
297
  #
298
+ # @param output_image_tokens [Integer] The aggregated number of image output tokens used.
299
+ #
300
+ # @param output_text_tokens [Integer] The aggregated number of text output tokens used.
301
+ #
227
302
  # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped us
228
303
  #
229
304
  # @param service_tier [String, nil] When `group_by=service_tier`, this field provides the service tier of the groupe
@@ -113,8 +113,9 @@ module OpenAI
113
113
 
114
114
  class OrganizationUsageCompletionsResult < OpenAI::Internal::Type::BaseModel
115
115
  # @!attribute input_tokens
116
- # The aggregated number of text input tokens used, including cached tokens. For
117
- # customers subscribe to scale tier, this includes scale tier tokens.
116
+ # The aggregated number of input tokens used, including cached and cache-write
117
+ # tokens. This includes text, audio, and image tokens. For customers subscribed to
118
+ # Scale Tier, this includes Scale Tier tokens.
118
119
  #
119
120
  # @return [Integer]
120
121
  required :input_tokens, Integer
@@ -131,8 +132,9 @@ module OpenAI
131
132
  required :object, const: :"organization.usage.completions.result"
132
133
 
133
134
  # @!attribute output_tokens
134
- # The aggregated number of text output tokens used. For customers subscribe to
135
- # scale tier, this includes scale tier tokens.
135
+ # The aggregated number of output tokens used across text, audio, and image
136
+ # outputs. For customers subscribed to Scale Tier, this includes Scale Tier
137
+ # tokens.
136
138
  #
137
139
  # @return [Integer]
138
140
  required :output_tokens, Integer
@@ -152,19 +154,62 @@ module OpenAI
152
154
  optional :batch, OpenAI::Internal::Type::Boolean, nil?: true
153
155
 
154
156
  # @!attribute input_audio_tokens
155
- # The aggregated number of audio input tokens used, including cached tokens.
157
+ # The aggregated number of uncached audio input tokens used.
156
158
  #
157
159
  # @return [Integer, nil]
158
160
  optional :input_audio_tokens, Integer
159
161
 
162
+ # @!attribute input_cache_write_tokens
163
+ # The aggregated number of input tokens written to the cache.
164
+ #
165
+ # @return [Integer, nil]
166
+ optional :input_cache_write_tokens, Integer
167
+
168
+ # @!attribute input_cached_audio_tokens
169
+ # The aggregated number of cached audio input tokens used.
170
+ #
171
+ # @return [Integer, nil]
172
+ optional :input_cached_audio_tokens, Integer
173
+
174
+ # @!attribute input_cached_image_tokens
175
+ # The aggregated number of cached image input tokens used.
176
+ #
177
+ # @return [Integer, nil]
178
+ optional :input_cached_image_tokens, Integer
179
+
180
+ # @!attribute input_cached_text_tokens
181
+ # The aggregated number of cached text input tokens used.
182
+ #
183
+ # @return [Integer, nil]
184
+ optional :input_cached_text_tokens, Integer
185
+
160
186
  # @!attribute input_cached_tokens
161
- # The aggregated number of text input tokens that has been cached from previous
162
- # requests. For customers subscribe to scale tier, this includes scale tier
163
- # tokens.
187
+ # The aggregated number of cached input tokens used across text, audio, and image
188
+ # inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens.
164
189
  #
165
190
  # @return [Integer, nil]
166
191
  optional :input_cached_tokens, Integer
167
192
 
193
+ # @!attribute input_image_tokens
194
+ # The aggregated number of uncached image input tokens used.
195
+ #
196
+ # @return [Integer, nil]
197
+ optional :input_image_tokens, Integer
198
+
199
+ # @!attribute input_text_tokens
200
+ # The aggregated number of uncached text input tokens used, excluding cache-write
201
+ # tokens.
202
+ #
203
+ # @return [Integer, nil]
204
+ optional :input_text_tokens, Integer
205
+
206
+ # @!attribute input_uncached_tokens
207
+ # The aggregated number of uncached input tokens used across text, audio, and
208
+ # image inputs, excluding cache-write tokens.
209
+ #
210
+ # @return [Integer, nil]
211
+ optional :input_uncached_tokens, Integer
212
+
168
213
  # @!attribute model
169
214
  # When `group_by=model`, this field provides the model name of the grouped usage
170
215
  # result.
@@ -178,6 +223,18 @@ module OpenAI
178
223
  # @return [Integer, nil]
179
224
  optional :output_audio_tokens, Integer
180
225
 
226
+ # @!attribute output_image_tokens
227
+ # The aggregated number of image output tokens used.
228
+ #
229
+ # @return [Integer, nil]
230
+ optional :output_image_tokens, Integer
231
+
232
+ # @!attribute output_text_tokens
233
+ # The aggregated number of text output tokens used.
234
+ #
235
+ # @return [Integer, nil]
236
+ optional :output_text_tokens, Integer
237
+
181
238
  # @!attribute project_id
182
239
  # When `group_by=project_id`, this field provides the project ID of the grouped
183
240
  # usage result.
@@ -199,31 +256,49 @@ module OpenAI
199
256
  # @return [String, nil]
200
257
  optional :user_id, String, nil?: true
201
258
 
202
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_tokens: nil, input_cached_tokens: nil, model: nil, output_audio_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
259
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
203
260
  # Some parameter documentations has been truncated, see
204
261
  # {OpenAI::Models::Admin::Organization::UsageWebSearchCallsResponse::Data::Result::OrganizationUsageCompletionsResult}
205
262
  # for more details.
206
263
  #
207
264
  # The aggregated completions usage details of the specific time bucket.
208
265
  #
209
- # @param input_tokens [Integer] The aggregated number of text input tokens used, including cached tokens. For cu
266
+ # @param input_tokens [Integer] The aggregated number of input tokens used, including cached and cache-write tok
210
267
  #
211
268
  # @param num_model_requests [Integer] The count of requests made to the model.
212
269
  #
213
- # @param output_tokens [Integer] The aggregated number of text output tokens used. For customers subscribe to sca
270
+ # @param output_tokens [Integer] The aggregated number of output tokens used across text, audio, and image output
214
271
  #
215
272
  # @param api_key_id [String, nil] When `group_by=api_key_id`, this field provides the API key ID of the grouped us
216
273
  #
217
274
  # @param batch [Boolean, nil] When `group_by=batch`, this field tells whether the grouped usage result is batc
218
275
  #
219
- # @param input_audio_tokens [Integer] The aggregated number of audio input tokens used, including cached tokens.
276
+ # @param input_audio_tokens [Integer] The aggregated number of uncached audio input tokens used.
220
277
  #
221
- # @param input_cached_tokens [Integer] The aggregated number of text input tokens that has been cached from previous re
278
+ # @param input_cache_write_tokens [Integer] The aggregated number of input tokens written to the cache.
279
+ #
280
+ # @param input_cached_audio_tokens [Integer] The aggregated number of cached audio input tokens used.
281
+ #
282
+ # @param input_cached_image_tokens [Integer] The aggregated number of cached image input tokens used.
283
+ #
284
+ # @param input_cached_text_tokens [Integer] The aggregated number of cached text input tokens used.
285
+ #
286
+ # @param input_cached_tokens [Integer] The aggregated number of cached input tokens used across text, audio, and image
287
+ #
288
+ # @param input_image_tokens [Integer] The aggregated number of uncached image input tokens used.
289
+ #
290
+ # @param input_text_tokens [Integer] The aggregated number of uncached text input tokens used, excluding cache-write
291
+ #
292
+ # @param input_uncached_tokens [Integer] The aggregated number of uncached input tokens used across text, audio, and imag
222
293
  #
223
294
  # @param model [String, nil] When `group_by=model`, this field provides the model name of the grouped usage r
224
295
  #
225
296
  # @param output_audio_tokens [Integer] The aggregated number of audio output tokens used.
226
297
  #
298
+ # @param output_image_tokens [Integer] The aggregated number of image output tokens used.
299
+ #
300
+ # @param output_text_tokens [Integer] The aggregated number of text output tokens used.
301
+ #
227
302
  # @param project_id [String, nil] When `group_by=project_id`, this field provides the project ID of the grouped us
228
303
  #
229
304
  # @param service_tier [String, nil] When `group_by=service_tier`, this field provides the service tier of the groupe
@@ -805,30 +805,32 @@ module OpenAI
805
805
  # @!attribute annotations
806
806
  # Citations associated with the text content.
807
807
  #
808
- # @return [Array<OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember0>, Array<OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember1>, Array<OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember2>, nil]
808
+ # @return [Array<OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::FileCitation, OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::URLCitation, OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::ContainerFileCitation>, nil]
809
809
  optional :annotations,
810
- union: -> { OpenAI::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations }
810
+ -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation] }
811
811
 
812
812
  # @!method initialize(text:, annotations: nil, type: :output_text)
813
813
  # @param text [String] The text content.
814
814
  #
815
- # @param annotations [Array<OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember0>, Array<OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember1>, Array<OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember2>] Citations associated with the text content.
815
+ # @param annotations [Array<OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::FileCitation, OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::URLCitation, OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::ContainerFileCitation>] Citations associated with the text content.
816
816
  #
817
817
  # @param type [Symbol, :output_text] The content type. Always `output_text`.
818
818
 
819
- # Citations associated with the text content.
820
- #
821
- # @see OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output#annotations
822
- module Annotations
819
+ module Annotation
823
820
  extend OpenAI::Internal::Type::Union
824
821
 
825
- variant -> { OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember0Array }
822
+ discriminator :type
823
+
824
+ variant :file_citation,
825
+ -> { OpenAI::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::FileCitation }
826
826
 
827
- variant -> { OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember1Array }
827
+ variant :url_citation,
828
+ -> { OpenAI::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::URLCitation }
828
829
 
829
- variant -> { OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember2Array }
830
+ variant :container_file_citation,
831
+ -> { OpenAI::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::ContainerFileCitation }
830
832
 
831
- class UnionMember0 < OpenAI::Internal::Type::BaseModel
833
+ class FileCitation < OpenAI::Internal::Type::BaseModel
832
834
  # @!attribute file_id
833
835
  # The ID of the file.
834
836
  #
@@ -863,7 +865,7 @@ module OpenAI
863
865
  # @param type [Symbol, :file_citation] The citation type. Always `file_citation`.
864
866
  end
865
867
 
866
- class UnionMember1 < OpenAI::Internal::Type::BaseModel
868
+ class URLCitation < OpenAI::Internal::Type::BaseModel
867
869
  # @!attribute end_index
868
870
  # The index of the last character of the citation in the message.
869
871
  #
@@ -906,7 +908,7 @@ module OpenAI
906
908
  # @param type [Symbol, :url_citation] The citation type. Always `url_citation`.
907
909
  end
908
910
 
909
- class UnionMember2 < OpenAI::Internal::Type::BaseModel
911
+ class ContainerFileCitation < OpenAI::Internal::Type::BaseModel
910
912
  # @!attribute container_id
911
913
  # The ID of the container.
912
914
  #
@@ -958,25 +960,7 @@ module OpenAI
958
960
  end
959
961
 
960
962
  # @!method self.variants
961
- # @return [Array(Array<OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember0>, Array<OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember1>, Array<OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember2>)]
962
-
963
- # @type [OpenAI::Internal::Type::Converter]
964
- UnionMember0Array =
965
- OpenAI::Internal::Type::ArrayOf[-> {
966
- OpenAI::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember0
967
- }]
968
-
969
- # @type [OpenAI::Internal::Type::Converter]
970
- UnionMember1Array =
971
- OpenAI::Internal::Type::ArrayOf[-> {
972
- OpenAI::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember1
973
- }]
974
-
975
- # @type [OpenAI::Internal::Type::Converter]
976
- UnionMember2Array =
977
- OpenAI::Internal::Type::ArrayOf[-> {
978
- OpenAI::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotations::UnionMember2
979
- }]
963
+ # @return [Array(OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::FileCitation, OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::URLCitation, OpenAI::Models::Beta::BetaResponseInputItem::MultiAgentCallOutput::Output::Annotation::ContainerFileCitation)]
980
964
  end
981
965
  end
982
966
 
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ # Opaque configuration for an OpenAI-supported third-party provider.
5
+ #
6
+ # Provider instances are created by factories in OpenAI::Providers.
7
+ class Provider
8
+ # @api private
9
+ def initialize(definition) = @definition = definition
10
+
11
+ def inspect = "#<OpenAI::Provider>"
12
+
13
+ attr_reader(:definition)
14
+ private(:definition)
15
+
16
+ private_class_method :new, :allocate
17
+ end
18
+ end