openai 0.70.0 → 0.72.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 (172) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -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/organization_spend_limit.rb +151 -0
  10. data/lib/openai/models/admin/organization/organization_spend_limit_deleted.rb +33 -0
  11. data/lib/openai/models/admin/organization/projects/project_service_account.rb +4 -3
  12. data/lib/openai/models/admin/organization/projects/project_spend_limit.rb +155 -0
  13. data/lib/openai/models/admin/organization/projects/project_spend_limit_deleted.rb +35 -0
  14. data/lib/openai/models/admin/organization/projects/service_account_create_params.rb +9 -1
  15. data/lib/openai/models/admin/organization/projects/service_account_create_response.rb +26 -6
  16. data/lib/openai/models/admin/organization/projects/service_accounts/api_key_create_params.rb +54 -0
  17. data/lib/openai/models/admin/organization/projects/service_accounts/api_key_create_response.rb +57 -0
  18. data/lib/openai/models/admin/organization/projects/spend_limit_delete_params.rb +26 -0
  19. data/lib/openai/models/admin/organization/projects/spend_limit_retrieve_params.rb +26 -0
  20. data/lib/openai/models/admin/organization/projects/spend_limit_update_params.rb +77 -0
  21. data/lib/openai/models/admin/organization/spend_limit_delete_params.rb +18 -0
  22. data/lib/openai/models/admin/organization/spend_limit_retrieve_params.rb +18 -0
  23. data/lib/openai/models/admin/organization/spend_limit_update_params.rb +67 -0
  24. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +88 -13
  25. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +88 -13
  26. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +88 -13
  27. data/lib/openai/models/admin/organization/usage_completions_response.rb +88 -13
  28. data/lib/openai/models/admin/organization/usage_costs_response.rb +88 -13
  29. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +88 -13
  30. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +88 -13
  31. data/lib/openai/models/admin/organization/usage_images_response.rb +88 -13
  32. data/lib/openai/models/admin/organization/usage_moderations_response.rb +88 -13
  33. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +88 -13
  34. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +88 -13
  35. data/lib/openai/models/beta/beta_response.rb +12 -6
  36. data/lib/openai/models/beta/beta_response_error.rb +1 -0
  37. data/lib/openai/models/beta/beta_response_input_item.rb +16 -32
  38. data/lib/openai/models/beta/beta_response_text_config.rb +4 -2
  39. data/lib/openai/models/beta/beta_responses_client_event.rb +12 -6
  40. data/lib/openai/models/beta/response_create_params.rb +12 -6
  41. data/lib/openai/models/beta/responses/input_token_count_params.rb +12 -4
  42. data/lib/openai/models/chat/completion_create_params.rb +8 -6
  43. data/lib/openai/models/reasoning.rb +8 -2
  44. data/lib/openai/models/responses/input_token_count_params.rb +4 -2
  45. data/lib/openai/models/responses/response.rb +4 -4
  46. data/lib/openai/models/responses/response_create_params.rb +4 -4
  47. data/lib/openai/models/responses/response_error.rb +1 -0
  48. data/lib/openai/models/responses/response_text_config.rb +4 -2
  49. data/lib/openai/models/responses/responses_client_event.rb +4 -4
  50. data/lib/openai/provider.rb +18 -0
  51. data/lib/openai/providers/bedrock.rb +489 -0
  52. data/lib/openai/resources/admin/organization/projects/service_accounts/api_keys.rb +60 -0
  53. data/lib/openai/resources/admin/organization/projects/service_accounts.rb +10 -3
  54. data/lib/openai/resources/admin/organization/projects/spend_limit.rb +95 -0
  55. data/lib/openai/resources/admin/organization/projects.rb +4 -0
  56. data/lib/openai/resources/admin/organization/spend_limit.rb +86 -0
  57. data/lib/openai/resources/admin/organization.rb +4 -0
  58. data/lib/openai/resources/beta/responses.rb +4 -4
  59. data/lib/openai/resources/chat/completions.rb +4 -4
  60. data/lib/openai/resources/responses.rb +4 -4
  61. data/lib/openai/version.rb +1 -1
  62. data/lib/openai.rb +18 -0
  63. data/rbi/openai/client.rbi +17 -0
  64. data/rbi/openai/internal/provider.rbi +51 -0
  65. data/rbi/openai/internal/transport/base_client.rbi +32 -0
  66. data/rbi/openai/models/admin/organization/audit_log_list_params.rbi +420 -0
  67. data/rbi/openai/models/admin/organization/audit_log_list_response.rbi +420 -0
  68. data/rbi/openai/models/admin/organization/organization_spend_limit.rbi +278 -0
  69. data/rbi/openai/models/admin/organization/organization_spend_limit_deleted.rbi +48 -0
  70. data/rbi/openai/models/admin/organization/projects/project_service_account.rbi +8 -3
  71. data/rbi/openai/models/admin/organization/projects/project_spend_limit.rbi +280 -0
  72. data/rbi/openai/models/admin/organization/projects/project_spend_limit_deleted.rbi +49 -0
  73. data/rbi/openai/models/admin/organization/projects/service_account_create_params.rbi +8 -0
  74. data/rbi/openai/models/admin/organization/projects/service_account_create_response.rbi +52 -8
  75. data/rbi/openai/models/admin/organization/projects/service_accounts/api_key_create_params.rbi +84 -0
  76. data/rbi/openai/models/admin/organization/projects/service_accounts/api_key_create_response.rbi +80 -0
  77. data/rbi/openai/models/admin/organization/projects/spend_limit_delete_params.rbi +44 -0
  78. data/rbi/openai/models/admin/organization/projects/spend_limit_retrieve_params.rbi +44 -0
  79. data/rbi/openai/models/admin/organization/projects/spend_limit_update_params.rbi +149 -0
  80. data/rbi/openai/models/admin/organization/spend_limit_delete_params.rbi +34 -0
  81. data/rbi/openai/models/admin/organization/spend_limit_retrieve_params.rbi +34 -0
  82. data/rbi/openai/models/admin/organization/spend_limit_update_params.rbi +141 -0
  83. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +121 -16
  84. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +121 -16
  85. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +121 -16
  86. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +121 -16
  87. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +121 -16
  88. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +121 -16
  89. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +121 -16
  90. data/rbi/openai/models/admin/organization/usage_images_response.rbi +121 -16
  91. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +121 -16
  92. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +121 -16
  93. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +121 -16
  94. data/rbi/openai/models/beta/beta_response.rbi +18 -15
  95. data/rbi/openai/models/beta/beta_response_error.rbi +5 -0
  96. data/rbi/openai/models/beta/beta_response_input_item.rbi +39 -46
  97. data/rbi/openai/models/beta/beta_response_text_config.rbi +6 -3
  98. data/rbi/openai/models/beta/beta_responses_client_event.rbi +18 -15
  99. data/rbi/openai/models/beta/response_create_params.rbi +18 -15
  100. data/rbi/openai/models/beta/responses/input_token_count_params.rbi +18 -6
  101. data/rbi/openai/models/chat/completion_create_params.rbi +12 -15
  102. data/rbi/openai/models/reasoning.rbi +12 -3
  103. data/rbi/openai/models/responses/input_token_count_params.rbi +6 -3
  104. data/rbi/openai/models/responses/response.rbi +6 -12
  105. data/rbi/openai/models/responses/response_create_params.rbi +6 -12
  106. data/rbi/openai/models/responses/response_error.rbi +5 -0
  107. data/rbi/openai/models/responses/response_text_config.rbi +6 -3
  108. data/rbi/openai/models/responses/responses_client_event.rbi +6 -12
  109. data/rbi/openai/provider.rbi +9 -0
  110. data/rbi/openai/providers.rbi +33 -0
  111. data/rbi/openai/resources/admin/organization/projects/service_accounts/api_keys.rbi +45 -0
  112. data/rbi/openai/resources/admin/organization/projects/service_accounts.rbi +12 -2
  113. data/rbi/openai/resources/admin/organization/projects/spend_limit.rbi +78 -0
  114. data/rbi/openai/resources/admin/organization/projects.rbi +7 -0
  115. data/rbi/openai/resources/admin/organization/spend_limit.rbi +57 -0
  116. data/rbi/openai/resources/admin/organization.rbi +3 -0
  117. data/rbi/openai/resources/beta/responses.rbi +4 -4
  118. data/rbi/openai/resources/chat/completions.rbi +8 -6
  119. data/rbi/openai/resources/responses.rbi +4 -4
  120. data/sig/openai/client.rbs +7 -0
  121. data/sig/openai/internal/provider.rbs +29 -0
  122. data/sig/openai/internal/transport/base_client.rbs +17 -1
  123. data/sig/openai/models/admin/organization/audit_log_list_params.rbs +168 -0
  124. data/sig/openai/models/admin/organization/audit_log_list_response.rbs +168 -0
  125. data/sig/openai/models/admin/organization/organization_spend_limit.rbs +94 -0
  126. data/sig/openai/models/admin/organization/organization_spend_limit_deleted.rbs +28 -0
  127. data/sig/openai/models/admin/organization/projects/project_service_account.rbs +2 -1
  128. data/sig/openai/models/admin/organization/projects/project_spend_limit.rbs +96 -0
  129. data/sig/openai/models/admin/organization/projects/project_spend_limit_deleted.rbs +30 -0
  130. data/sig/openai/models/admin/organization/projects/service_account_create_params.rbs +9 -1
  131. data/sig/openai/models/admin/organization/projects/service_account_create_response.rbs +16 -5
  132. data/sig/openai/models/admin/organization/projects/service_accounts/api_key_create_params.rbs +53 -0
  133. data/sig/openai/models/admin/organization/projects/service_accounts/api_key_create_response.rbs +48 -0
  134. data/sig/openai/models/admin/organization/projects/spend_limit_delete_params.rbs +29 -0
  135. data/sig/openai/models/admin/organization/projects/spend_limit_retrieve_params.rbs +29 -0
  136. data/sig/openai/models/admin/organization/projects/spend_limit_update_params.rbs +67 -0
  137. data/sig/openai/models/admin/organization/spend_limit_delete_params.rbs +19 -0
  138. data/sig/openai/models/admin/organization/spend_limit_retrieve_params.rbs +19 -0
  139. data/sig/openai/models/admin/organization/spend_limit_update_params.rbs +60 -0
  140. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +63 -0
  141. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +63 -0
  142. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +63 -0
  143. data/sig/openai/models/admin/organization/usage_completions_response.rbs +63 -0
  144. data/sig/openai/models/admin/organization/usage_costs_response.rbs +63 -0
  145. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +63 -0
  146. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +63 -0
  147. data/sig/openai/models/admin/organization/usage_images_response.rbs +63 -0
  148. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +63 -0
  149. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +63 -0
  150. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +63 -0
  151. data/sig/openai/models/beta/beta_response.rbs +8 -12
  152. data/sig/openai/models/beta/beta_response_error.rbs +2 -0
  153. data/sig/openai/models/beta/beta_response_input_item.rbs +18 -24
  154. data/sig/openai/models/beta/beta_responses_client_event.rbs +8 -12
  155. data/sig/openai/models/beta/response_create_params.rbs +8 -12
  156. data/sig/openai/models/chat/completion_create_params.rbs +8 -12
  157. data/sig/openai/models/responses/response.rbs +8 -12
  158. data/sig/openai/models/responses/response_create_params.rbs +8 -12
  159. data/sig/openai/models/responses/response_error.rbs +2 -0
  160. data/sig/openai/models/responses/responses_client_event.rbs +8 -12
  161. data/sig/openai/provider.rbs +5 -0
  162. data/sig/openai/providers.rbs +15 -0
  163. data/sig/openai/resources/admin/organization/projects/service_accounts/api_keys.rbs +23 -0
  164. data/sig/openai/resources/admin/organization/projects/service_accounts.rbs +3 -0
  165. data/sig/openai/resources/admin/organization/projects/spend_limit.rbs +31 -0
  166. data/sig/openai/resources/admin/organization/projects.rbs +2 -0
  167. data/sig/openai/resources/admin/organization/spend_limit.rbs +26 -0
  168. data/sig/openai/resources/admin/organization.rbs +2 -0
  169. data/sig/openai/resources/beta/responses.rbs +4 -4
  170. data/sig/openai/resources/chat/completions.rbs +4 -4
  171. data/sig/openai/resources/responses.rbs +4 -4
  172. metadata +56 -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
@@ -204,7 +204,7 @@ module OpenAI
204
204
  # [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
205
205
  #
206
206
  # @return [String, nil]
207
- optional :prompt_cache_key, String
207
+ optional :prompt_cache_key, String, nil?: true
208
208
 
209
209
  # @!attribute prompt_cache_options
210
210
  # The prompt-caching options that were applied to the response. Supported for
@@ -257,7 +257,7 @@ module OpenAI
257
257
  # [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
258
258
  #
259
259
  # @return [String, nil]
260
- optional :safety_identifier, String
260
+ optional :safety_identifier, String, nil?: true
261
261
 
262
262
  # @!attribute service_tier
263
263
  # Specifies the processing type used for serving the request.
@@ -382,7 +382,7 @@ module OpenAI
382
382
  #
383
383
  # @param prompt [OpenAI::Models::Beta::BetaResponsePrompt, nil] Reference to a prompt template and its variables.
384
384
  #
385
- # @param prompt_cache_key [String] Used by OpenAI to cache responses for similar requests to optimize your cache hi
385
+ # @param prompt_cache_key [String, nil] Used by OpenAI to cache responses for similar requests to optimize your cache hi
386
386
  #
387
387
  # @param prompt_cache_options [OpenAI::Models::Beta::BetaResponse::PromptCacheOptions] The prompt-caching options that were applied to the response. Supported for `gpt
388
388
  #
@@ -390,7 +390,7 @@ module OpenAI
390
390
  #
391
391
  # @param reasoning [OpenAI::Models::Beta::BetaResponse::Reasoning, nil] **gpt-5 and o-series models only**
392
392
  #
393
- # @param safety_identifier [String] A stable identifier used to help detect users of your application that may be vi
393
+ # @param safety_identifier [String, nil] A stable identifier used to help detect users of your application that may be vi
394
394
  #
395
395
  # @param service_tier [Symbol, OpenAI::Models::Beta::BetaResponse::ServiceTier, nil] Specifies the processing type used for serving the request.
396
396
  #
@@ -1190,7 +1190,10 @@ module OpenAI
1190
1190
  # @see OpenAI::Models::Beta::BetaResponse#reasoning
1191
1191
  class Reasoning < OpenAI::Internal::Type::BaseModel
1192
1192
  # @!attribute context
1193
- # Controls which reasoning items are rendered back to the model on later turns.
1193
+ # Controls which reasoning items are rendered back to the model on later turns. If
1194
+ # omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
1195
+ # model family defaults to `all_turns`; earlier models default to `current_turn`.
1196
+ #
1194
1197
  # When returned on a response, this is the effective reasoning context mode used
1195
1198
  # for the response.
1196
1199
  #
@@ -1260,7 +1263,10 @@ module OpenAI
1260
1263
  #
1261
1264
  # @param summary [Symbol, OpenAI::Models::Beta::BetaResponse::Reasoning::Summary, nil] A summary of the reasoning performed by the model. This can be
1262
1265
 
1263
- # Controls which reasoning items are rendered back to the model on later turns.
1266
+ # Controls which reasoning items are rendered back to the model on later turns. If
1267
+ # omitted or set to `auto`, the model determines the context mode. The `gpt-5.6`
1268
+ # model family defaults to `all_turns`; earlier models default to `current_turn`.
1269
+ #
1264
1270
  # When returned on a response, this is the effective reasoning context mode used
1265
1271
  # for the response.
1266
1272
  #
@@ -35,6 +35,7 @@ module OpenAI
35
35
  SERVER_ERROR = :server_error
36
36
  RATE_LIMIT_EXCEEDED = :rate_limit_exceeded
37
37
  INVALID_PROMPT = :invalid_prompt
38
+ DATA_RESIDENCY_MISMATCH = :data_residency_mismatch
38
39
  BIO_POLICY = :bio_policy
39
40
  VECTOR_STORE_TIMEOUT = :vector_store_timeout
40
41
  INVALID_IMAGE = :invalid_image