openai 0.99.0 → 0.101.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 (195) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +1 -1
  4. data/bedrock.md +17 -1
  5. data/lib/openai/client.rb +13 -0
  6. data/lib/openai/helpers/agents/session_stream.rb +11 -36
  7. data/lib/openai/helpers/agents/tools.rb +34 -4
  8. data/lib/openai/helpers/beta/agents/creation_stream.rb +26 -0
  9. data/lib/openai/helpers/beta/agents/function_tool.rb +11 -4
  10. data/lib/openai/helpers/beta/agents/tool_dispatcher.rb +74 -0
  11. data/lib/openai/helpers/beta/agents/tool_error.rb +28 -0
  12. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +125 -3
  13. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +125 -3
  14. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +125 -3
  15. data/lib/openai/models/admin/organization/usage_completions_params.rb +9 -4
  16. data/lib/openai/models/admin/organization/usage_completions_response.rb +125 -3
  17. data/lib/openai/models/admin/organization/usage_costs_params.rb +16 -4
  18. data/lib/openai/models/admin/organization/usage_costs_response.rb +125 -3
  19. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +125 -3
  20. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +125 -3
  21. data/lib/openai/models/admin/organization/usage_images_response.rb +125 -3
  22. data/lib/openai/models/admin/organization/usage_moderations_response.rb +125 -3
  23. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +125 -3
  24. data/lib/openai/models/admin/organization/usage_web_search_calls_params.rb +9 -4
  25. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +125 -3
  26. data/lib/openai/models/beta/agents/environments/template_create_params.rb +6 -6
  27. data/lib/openai/models/beta/agents/environments/template_update_params.rb +3 -6
  28. data/lib/openai/models/beta/agents/sessions/turns/item_list_params.rb +79 -0
  29. data/lib/openai/models/beta/beta_response_computer_tool_call_output_item.rb +2 -2
  30. data/lib/openai/models/beta/beta_response_error.rb +12 -1
  31. data/lib/openai/models/beta/beta_response_tool_search_output_item_param.rb +1166 -3
  32. data/lib/openai/models/beta/beta_responses_server_event.rb +12 -1
  33. data/lib/openai/models/beta/beta_tool.rb +12 -9
  34. data/lib/openai/models/beta/beta_tool_search_output_namespace_tool.rb +176 -0
  35. data/lib/openai/models/beta/environment_param.rb +6 -6
  36. data/lib/openai/models/beta/session_turn_error.rb +9 -0
  37. data/lib/openai/models/chat/chat_completion_chunk.rb +85 -18
  38. data/lib/openai/models/decision.rb +313 -0
  39. data/lib/openai/models/decision_create_params.rb +233 -0
  40. data/lib/openai/models/decision_input_image.rb +53 -0
  41. data/lib/openai/models/decision_input_message.rb +60 -0
  42. data/lib/openai/models/decision_input_part.rb +20 -0
  43. data/lib/openai/models/decision_input_text.rb +21 -0
  44. data/lib/openai/models/error_object.rb +12 -1
  45. data/lib/openai/models/eval_create_params.rb +1 -1
  46. data/lib/openai/models/eval_create_response.rb +1 -1
  47. data/lib/openai/models/eval_list_response.rb +1 -1
  48. data/lib/openai/models/eval_retrieve_response.rb +1 -1
  49. data/lib/openai/models/eval_update_response.rb +1 -1
  50. data/lib/openai/models/fine_tuning/job_list_params.rb +14 -4
  51. data/lib/openai/models/graders/score_model_grader.rb +2 -2
  52. data/lib/openai/models/image_edit_params.rb +12 -9
  53. data/lib/openai/models/realtime/realtime_client_event.rb +9 -0
  54. data/lib/openai/models/realtime/session_update_event.rb +16 -0
  55. data/lib/openai/models/responses/response_computer_tool_call_output_item.rb +2 -2
  56. data/lib/openai/models/responses/response_error.rb +12 -1
  57. data/lib/openai/models/responses/response_tool_search_output_item_param.rb +1166 -3
  58. data/lib/openai/models/responses/responses_server_event.rb +12 -1
  59. data/lib/openai/models/responses/tool.rb +12 -9
  60. data/lib/openai/models/responses/tool_search_output_namespace_tool.rb +174 -0
  61. data/lib/openai/models/video_create_error.rb +12 -1
  62. data/lib/openai/models.rb +12 -0
  63. data/lib/openai/providers/bedrock.rb +20 -1
  64. data/lib/openai/resources/admin/organization/usage.rb +15 -6
  65. data/lib/openai/resources/beta/agents/environments/templates.rb +3 -4
  66. data/lib/openai/resources/beta/agents/sessions/turns/items.rb +68 -0
  67. data/lib/openai/resources/beta/agents/sessions/turns.rb +4 -0
  68. data/lib/openai/resources/beta/agents/sessions.rb +22 -2
  69. data/lib/openai/resources/decisions.rb +59 -0
  70. data/lib/openai/resources/fine_tuning/jobs.rb +7 -2
  71. data/lib/openai/resources/images.rb +8 -6
  72. data/lib/openai/version.rb +1 -1
  73. data/lib/openai.rb +11 -0
  74. data/rbi/openai/client.rbi +3 -0
  75. data/rbi/openai/helpers/agents.rbi +2 -0
  76. data/rbi/openai/helpers/beta/agents/function_tool.rbi +8 -3
  77. data/rbi/openai/helpers/beta/agents/tool_error.rbi +19 -0
  78. data/rbi/openai/helpers/beta/agents.rbi +12 -0
  79. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +194 -1
  80. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +194 -1
  81. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +194 -1
  82. data/rbi/openai/models/admin/organization/usage_completions_params.rbi +9 -4
  83. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +194 -1
  84. data/rbi/openai/models/admin/organization/usage_costs_params.rbi +16 -4
  85. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +194 -1
  86. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +194 -1
  87. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +194 -1
  88. data/rbi/openai/models/admin/organization/usage_images_response.rbi +194 -1
  89. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +194 -1
  90. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +194 -1
  91. data/rbi/openai/models/admin/organization/usage_web_search_calls_params.rbi +12 -4
  92. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +194 -1
  93. data/rbi/openai/models/beta/agents/environments/template_create_params.rbi +6 -6
  94. data/rbi/openai/models/beta/agents/environments/template_update_params.rbi +3 -6
  95. data/rbi/openai/models/beta/agents/sessions/turns/item_list_params.rbi +139 -0
  96. data/rbi/openai/models/beta/beta_response_computer_tool_call_output_item.rbi +2 -2
  97. data/rbi/openai/models/beta/beta_response_error.rbi +12 -0
  98. data/rbi/openai/models/beta/beta_response_tool_search_output_item_param.rbi +1893 -18
  99. data/rbi/openai/models/beta/beta_responses_server_event.rbi +12 -0
  100. data/rbi/openai/models/beta/beta_tool.rbi +12 -9
  101. data/rbi/openai/models/beta/beta_tool_search_output_namespace_tool.rbi +272 -0
  102. data/rbi/openai/models/beta/environment_param.rbi +6 -6
  103. data/rbi/openai/models/beta/session_turn_error.rbi +18 -0
  104. data/rbi/openai/models/chat/chat_completion_chunk.rbi +123 -17
  105. data/rbi/openai/models/decision.rbi +586 -0
  106. data/rbi/openai/models/decision_create_params.rbi +435 -0
  107. data/rbi/openai/models/decision_input_image.rbi +81 -0
  108. data/rbi/openai/models/decision_input_message.rbi +96 -0
  109. data/rbi/openai/models/decision_input_part.rbi +24 -0
  110. data/rbi/openai/models/decision_input_text.rbi +49 -0
  111. data/rbi/openai/models/error_object.rbi +12 -0
  112. data/rbi/openai/models/eval_create_params.rbi +1 -1
  113. data/rbi/openai/models/eval_create_response.rbi +1 -1
  114. data/rbi/openai/models/eval_list_response.rbi +1 -1
  115. data/rbi/openai/models/eval_retrieve_response.rbi +1 -1
  116. data/rbi/openai/models/eval_update_response.rbi +1 -1
  117. data/rbi/openai/models/fine_tuning/job_list_params.rbi +14 -4
  118. data/rbi/openai/models/graders/score_model_grader.rbi +2 -2
  119. data/rbi/openai/models/image_edit_params.rbi +12 -9
  120. data/rbi/openai/models/realtime/session_update_event.rbi +16 -0
  121. data/rbi/openai/models/responses/response_computer_tool_call_output_item.rbi +2 -2
  122. data/rbi/openai/models/responses/response_error.rbi +12 -0
  123. data/rbi/openai/models/responses/response_tool_search_output_item_param.rbi +1901 -18
  124. data/rbi/openai/models/responses/responses_server_event.rbi +12 -0
  125. data/rbi/openai/models/responses/tool.rbi +12 -9
  126. data/rbi/openai/models/responses/tool_search_output_namespace_tool.rbi +272 -0
  127. data/rbi/openai/models/video_create_error.rbi +12 -0
  128. data/rbi/openai/models.rbi +12 -0
  129. data/rbi/openai/resources/admin/organization/usage.rbi +15 -6
  130. data/rbi/openai/resources/beta/agents/environments/templates.rbi +3 -4
  131. data/rbi/openai/resources/beta/agents/sessions/turns/items.rbi +62 -0
  132. data/rbi/openai/resources/beta/agents/sessions/turns.rbi +3 -0
  133. data/rbi/openai/resources/beta/agents/sessions.rbi +2 -0
  134. data/rbi/openai/resources/decisions.rbi +57 -0
  135. data/rbi/openai/resources/fine_tuning/jobs.rbi +7 -2
  136. data/rbi/openai/resources/images.rbi +8 -6
  137. data/sig/openai/client.rbs +2 -0
  138. data/sig/openai/helpers/agents.rbs +3 -0
  139. data/sig/openai/helpers/beta/agents/function_tool.rbs +5 -2
  140. data/sig/openai/helpers/beta/agents/tool_error.rbs +17 -0
  141. data/sig/openai/helpers/beta/agents.rbs +5 -0
  142. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +87 -2
  143. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +87 -2
  144. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +87 -2
  145. data/sig/openai/models/admin/organization/usage_completions_params.rbs +14 -6
  146. data/sig/openai/models/admin/organization/usage_completions_response.rbs +87 -2
  147. data/sig/openai/models/admin/organization/usage_costs_params.rbs +25 -7
  148. data/sig/openai/models/admin/organization/usage_costs_response.rbs +87 -2
  149. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +87 -2
  150. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +87 -2
  151. data/sig/openai/models/admin/organization/usage_images_response.rbs +87 -2
  152. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +87 -2
  153. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +87 -2
  154. data/sig/openai/models/admin/organization/usage_web_search_calls_params.rbs +19 -7
  155. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +87 -2
  156. data/sig/openai/models/beta/agents/environments/template_create_params.rbs +4 -4
  157. data/sig/openai/models/beta/agents/environments/template_update_params.rbs +2 -4
  158. data/sig/openai/models/beta/agents/sessions/turns/item_list_params.rbs +91 -0
  159. data/sig/openai/models/beta/beta_response_computer_tool_call_output_item.rbs +2 -2
  160. data/sig/openai/models/beta/beta_response_error.rbs +10 -0
  161. data/sig/openai/models/beta/beta_response_tool_search_output_item_param.rbs +993 -4
  162. data/sig/openai/models/beta/beta_responses_server_event.rbs +10 -0
  163. data/sig/openai/models/beta/beta_tool.rbs +8 -6
  164. data/sig/openai/models/beta/beta_tool_search_output_namespace_tool.rbs +162 -0
  165. data/sig/openai/models/beta/environment_param.rbs +4 -4
  166. data/sig/openai/models/beta/session_turn_error.rbs +12 -0
  167. data/sig/openai/models/chat/chat_completion_chunk.rbs +96 -12
  168. data/sig/openai/models/decision.rbs +296 -0
  169. data/sig/openai/models/decision_create_params.rbs +227 -0
  170. data/sig/openai/models/decision_input_image.rbs +51 -0
  171. data/sig/openai/models/decision_input_message.rbs +57 -0
  172. data/sig/openai/models/decision_input_part.rbs +12 -0
  173. data/sig/openai/models/decision_input_text.rbs +15 -0
  174. data/sig/openai/models/error_object.rbs +10 -0
  175. data/sig/openai/models/eval_create_params.rbs +1 -1
  176. data/sig/openai/models/eval_create_response.rbs +1 -1
  177. data/sig/openai/models/eval_list_response.rbs +1 -1
  178. data/sig/openai/models/eval_retrieve_response.rbs +1 -1
  179. data/sig/openai/models/eval_update_response.rbs +1 -1
  180. data/sig/openai/models/fine_tuning/job_list_params.rbs +14 -4
  181. data/sig/openai/models/graders/score_model_grader.rbs +3 -3
  182. data/sig/openai/models/image_edit_params.rbs +8 -6
  183. data/sig/openai/models/responses/response_computer_tool_call_output_item.rbs +2 -2
  184. data/sig/openai/models/responses/response_error.rbs +10 -0
  185. data/sig/openai/models/responses/response_tool_search_output_item_param.rbs +993 -4
  186. data/sig/openai/models/responses/responses_server_event.rbs +10 -0
  187. data/sig/openai/models/responses/tool.rbs +8 -6
  188. data/sig/openai/models/responses/tool_search_output_namespace_tool.rbs +160 -0
  189. data/sig/openai/models/video_create_error.rbs +10 -0
  190. data/sig/openai/models.rbs +12 -0
  191. data/sig/openai/resources/beta/agents/sessions/turns/items.rbs +24 -0
  192. data/sig/openai/resources/beta/agents/sessions/turns.rbs +2 -0
  193. data/sig/openai/resources/beta/agents/sessions.rbs +1 -0
  194. data/sig/openai/resources/decisions.rbs +15 -0
  195. metadata +38 -1
@@ -43,8 +43,10 @@ module OpenAI
43
43
 
44
44
  # @!attribute group_by
45
45
  # Group the usage data by the specified fields. Support fields include
46
- # `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier` or any
47
- # combination of them.
46
+ # `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`,
47
+ # `api_source` or any combination of them. When grouped by `api_source`, results
48
+ # use `agents_api` for attributed Agents API activity and `unlabeled` for all
49
+ # other activity. Without source grouping, `api_source` is null.
48
50
  #
49
51
  # @return [Array<Symbol, OpenAI::Models::Admin::Organization::UsageCompletionsParams::GroupBy>, nil]
50
52
  optional(
@@ -107,8 +109,10 @@ module OpenAI
107
109
  #
108
110
  # @param group_by [Array<Symbol, OpenAI::Models::Admin::Organization::UsageCompletionsParams::GroupBy>]
109
111
  # Group the usage data by the specified fields. Support fields include
110
- # `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier` or any
111
- # combination of them.
112
+ # `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`,
113
+ # `api_source` or any combination of them. When grouped by `api_source`, results
114
+ # use `agents_api` for attributed Agents API activity and `unlabeled` for all
115
+ # other activity. Without source grouping, `api_source` is null.
112
116
  #
113
117
  # @param limit [Integer]
114
118
  # Specifies the number of buckets to return.
@@ -154,6 +158,7 @@ module OpenAI
154
158
  MODEL = :model
155
159
  BATCH = :batch
156
160
  SERVICE_TIER = :service_tier
161
+ API_SOURCE = :api_source
157
162
 
158
163
  # @!method self.values
159
164
  # @return [Array<Symbol>]
@@ -198,6 +198,21 @@ module OpenAI
198
198
  # @return [String, nil]
199
199
  optional :api_key_id, String, nil?: true
200
200
 
201
+ # @!attribute api_source
202
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
203
+ # activity and `unlabeled` includes all records without published source
204
+ # attribution, including historical and unknown origins. Unlabeled does not imply
205
+ # direct API usage. Without source grouping, this field is null.
206
+ #
207
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource, nil]
208
+ optional(
209
+ :api_source,
210
+ enum: -> {
211
+ OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource
212
+ },
213
+ nil?: true
214
+ )
215
+
201
216
  # @!attribute batch
202
217
  # When `group_by=batch`, this field tells whether the grouped usage result is
203
218
  # batch or not.
@@ -316,7 +331,7 @@ module OpenAI
316
331
  # @return [String, nil]
317
332
  optional :user_id, String, nil?: true
318
333
 
319
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_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")
334
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_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")
320
335
  # The aggregated completions usage details of the specific time bucket.
321
336
  #
322
337
  # @param input_tokens [Integer]
@@ -336,6 +351,12 @@ module OpenAI
336
351
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
337
352
  # usage result.
338
353
  #
354
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource, nil]
355
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
356
+ # activity and `unlabeled` includes all records without published source
357
+ # attribution, including historical and unknown origins. Unlabeled does not imply
358
+ # direct API usage. Without source grouping, this field is null.
359
+ #
339
360
  # @param batch [Boolean, nil]
340
361
  # When `group_by=batch`, this field tells whether the grouped usage result is
341
362
  # batch or not.
@@ -401,6 +422,22 @@ module OpenAI
401
422
  # result.
402
423
  #
403
424
  # @param object [Symbol, :"organization.usage.completions.result"]
425
+
426
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
427
+ # activity and `unlabeled` includes all records without published source
428
+ # attribution, including historical and unknown origins. Unlabeled does not imply
429
+ # direct API usage. Without source grouping, this field is null.
430
+ #
431
+ # @see OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult#api_source
432
+ module APISource
433
+ extend OpenAI::Internal::Type::Enum
434
+
435
+ AGENTS_API = :agents_api
436
+ UNLABELED = :unlabeled
437
+
438
+ # @!method self.values
439
+ # @return [Array<Symbol>]
440
+ end
404
441
  end
405
442
 
406
443
  class OrganizationUsageEmbeddingsResult < OpenAI::Internal::Type::BaseModel
@@ -950,6 +987,21 @@ module OpenAI
950
987
  # @return [String, nil]
951
988
  optional :api_key_id, String, nil?: true
952
989
 
990
+ # @!attribute api_source
991
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
992
+ # activity and `unlabeled` includes all records without published source
993
+ # attribution, including historical and unknown origins. Unlabeled does not imply
994
+ # direct API usage. Without source grouping, this field is null.
995
+ #
996
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource, nil]
997
+ optional(
998
+ :api_source,
999
+ enum: -> {
1000
+ OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource
1001
+ },
1002
+ nil?: true
1003
+ )
1004
+
953
1005
  # @!attribute context_level
954
1006
  # When `group_by=context_level`, this field provides the search context size of
955
1007
  # the grouped usage result.
@@ -978,7 +1030,7 @@ module OpenAI
978
1030
  # @return [String, nil]
979
1031
  optional :user_id, String, nil?: true
980
1032
 
981
- # @!method initialize(num_model_requests:, num_requests:, api_key_id: nil, context_level: nil, model: nil, project_id: nil, user_id: nil, object: :"organization.usage.web_searches.result")
1033
+ # @!method initialize(num_model_requests:, num_requests:, api_key_id: nil, api_source: nil, context_level: nil, model: nil, project_id: nil, user_id: nil, object: :"organization.usage.web_searches.result")
982
1034
  # The aggregated web search calls usage details of the specific time bucket.
983
1035
  #
984
1036
  # @param num_model_requests [Integer]
@@ -991,6 +1043,12 @@ module OpenAI
991
1043
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
992
1044
  # usage result.
993
1045
  #
1046
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource, nil]
1047
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1048
+ # activity and `unlabeled` includes all records without published source
1049
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1050
+ # direct API usage. Without source grouping, this field is null.
1051
+ #
994
1052
  # @param context_level [String, nil]
995
1053
  # When `group_by=context_level`, this field provides the search context size of
996
1054
  # the grouped usage result.
@@ -1008,6 +1066,22 @@ module OpenAI
1008
1066
  # result.
1009
1067
  #
1010
1068
  # @param object [Symbol, :"organization.usage.web_searches.result"]
1069
+
1070
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1071
+ # activity and `unlabeled` includes all records without published source
1072
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1073
+ # direct API usage. Without source grouping, this field is null.
1074
+ #
1075
+ # @see OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageWebSearchesResult#api_source
1076
+ module APISource
1077
+ extend OpenAI::Internal::Type::Enum
1078
+
1079
+ AGENTS_API = :agents_api
1080
+ UNLABELED = :unlabeled
1081
+
1082
+ # @!method self.values
1083
+ # @return [Array<Symbol>]
1084
+ end
1011
1085
  end
1012
1086
 
1013
1087
  class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel
@@ -1034,6 +1108,21 @@ module OpenAI
1034
1108
  # @return [String, nil]
1035
1109
  optional :api_key_id, String, nil?: true
1036
1110
 
1111
+ # @!attribute api_source
1112
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1113
+ # activity and `unlabeled` includes all records without published source
1114
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1115
+ # direct API usage. Without source grouping, this field is null.
1116
+ #
1117
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::APISource, nil]
1118
+ optional(
1119
+ :api_source,
1120
+ enum: -> {
1121
+ OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::APISource
1122
+ },
1123
+ nil?: true
1124
+ )
1125
+
1037
1126
  # @!attribute line_item
1038
1127
  # When `group_by=line_item`, this field provides the line item of the grouped
1039
1128
  # costs result.
@@ -1068,7 +1157,14 @@ module OpenAI
1068
1157
  nil?: true
1069
1158
  )
1070
1159
 
1071
- # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, quantity_unit: nil, object: :"organization.costs.result")
1160
+ # @!attribute user_id
1161
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1162
+ # result.
1163
+ #
1164
+ # @return [String, nil]
1165
+ optional :user_id, String, nil?: true
1166
+
1167
+ # @!method initialize(amount: nil, api_key_id: nil, api_source: nil, line_item: nil, project_id: nil, quantity: nil, quantity_unit: nil, user_id: nil, object: :"organization.costs.result")
1072
1168
  # The aggregated costs details of the specific time bucket.
1073
1169
  #
1074
1170
  # @param amount [OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::Amount]
@@ -1078,6 +1174,12 @@ module OpenAI
1078
1174
  # When `group_by=api_key_id`, this field provides the API Key ID of the grouped
1079
1175
  # costs result.
1080
1176
  #
1177
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::APISource, nil]
1178
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1179
+ # activity and `unlabeled` includes all records without published source
1180
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1181
+ # direct API usage. Without source grouping, this field is null.
1182
+ #
1081
1183
  # @param line_item [String, nil]
1082
1184
  # When `group_by=line_item`, this field provides the line item of the grouped
1083
1185
  # costs result.
@@ -1094,6 +1196,10 @@ module OpenAI
1094
1196
  # The unit of the `quantity` value. If no single supported unit applies to the
1095
1197
  # result, this field is `null`.
1096
1198
  #
1199
+ # @param user_id [String, nil]
1200
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1201
+ # result.
1202
+ #
1097
1203
  # @param object [Symbol, :"organization.costs.result"]
1098
1204
 
1099
1205
  # @see OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult#amount
@@ -1119,6 +1225,22 @@ module OpenAI
1119
1225
  # @param value [Float]
1120
1226
  # The numeric value of the cost.
1121
1227
  end
1228
+
1229
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1230
+ # activity and `unlabeled` includes all records without published source
1231
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1232
+ # direct API usage. Without source grouping, this field is null.
1233
+ #
1234
+ # @see OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult#api_source
1235
+ module APISource
1236
+ extend OpenAI::Internal::Type::Enum
1237
+
1238
+ AGENTS_API = :agents_api
1239
+ UNLABELED = :unlabeled
1240
+
1241
+ # @!method self.values
1242
+ # @return [Array<Symbol>]
1243
+ end
1122
1244
  end
1123
1245
 
1124
1246
  # @!method self.variants
@@ -35,8 +35,13 @@ module OpenAI
35
35
  optional :end_time, Integer
36
36
 
37
37
  # @!attribute group_by
38
- # Group the costs by the specified fields. Support fields include `project_id`,
39
- # `line_item`, `api_key_id` and any combination of them.
38
+ # Group the costs by the specified fields. Supported fields include `project_id`,
39
+ # `user_id`, `line_item`, `api_key_id`, and `api_source`. Support for combining
40
+ # `user_id` with `project_id` grouping or the `project_ids` filter depends on the
41
+ # organization and requested time range. Unsupported combinations return HTTP 400.
42
+ # When grouped by `api_source`, results use `agents_api` for attributed Agents API
43
+ # activity and `unlabeled` for all other activity. Without source grouping,
44
+ # `api_source` is null.
40
45
  #
41
46
  # @return [Array<Symbol, OpenAI::Models::Admin::Organization::UsageCostsParams::GroupBy>, nil]
42
47
  optional(
@@ -86,8 +91,13 @@ module OpenAI
86
91
  # End time (Unix seconds) of the query time range, exclusive.
87
92
  #
88
93
  # @param group_by [Array<Symbol, OpenAI::Models::Admin::Organization::UsageCostsParams::GroupBy>]
89
- # Group the costs by the specified fields. Support fields include `project_id`,
90
- # `line_item`, `api_key_id` and any combination of them.
94
+ # Group the costs by the specified fields. Supported fields include `project_id`,
95
+ # `user_id`, `line_item`, `api_key_id`, and `api_source`. Support for combining
96
+ # `user_id` with `project_id` grouping or the `project_ids` filter depends on the
97
+ # organization and requested time range. Unsupported combinations return HTTP 400.
98
+ # When grouped by `api_source`, results use `agents_api` for attributed Agents API
99
+ # activity and `unlabeled` for all other activity. Without source grouping,
100
+ # `api_source` is null.
91
101
  #
92
102
  # @param limit [Integer]
93
103
  # A limit on the number of buckets to be returned. Limit can range between 1 and
@@ -121,8 +131,10 @@ module OpenAI
121
131
  extend OpenAI::Internal::Type::Enum
122
132
 
123
133
  PROJECT_ID = :project_id
134
+ USER_ID = :user_id
124
135
  LINE_ITEM = :line_item
125
136
  API_KEY_ID = :api_key_id
137
+ API_SOURCE = :api_source
126
138
 
127
139
  # @!method self.values
128
140
  # @return [Array<Symbol>]
@@ -196,6 +196,21 @@ module OpenAI
196
196
  # @return [String, nil]
197
197
  optional :api_key_id, String, nil?: true
198
198
 
199
+ # @!attribute api_source
200
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
201
+ # activity and `unlabeled` includes all records without published source
202
+ # attribution, including historical and unknown origins. Unlabeled does not imply
203
+ # direct API usage. Without source grouping, this field is null.
204
+ #
205
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource, nil]
206
+ optional(
207
+ :api_source,
208
+ enum: -> {
209
+ OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource
210
+ },
211
+ nil?: true
212
+ )
213
+
199
214
  # @!attribute batch
200
215
  # When `group_by=batch`, this field tells whether the grouped usage result is
201
216
  # batch or not.
@@ -314,7 +329,7 @@ module OpenAI
314
329
  # @return [String, nil]
315
330
  optional :user_id, String, nil?: true
316
331
 
317
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_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")
332
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_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")
318
333
  # The aggregated completions usage details of the specific time bucket.
319
334
  #
320
335
  # @param input_tokens [Integer]
@@ -334,6 +349,12 @@ module OpenAI
334
349
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
335
350
  # usage result.
336
351
  #
352
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource, nil]
353
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
354
+ # activity and `unlabeled` includes all records without published source
355
+ # attribution, including historical and unknown origins. Unlabeled does not imply
356
+ # direct API usage. Without source grouping, this field is null.
357
+ #
337
358
  # @param batch [Boolean, nil]
338
359
  # When `group_by=batch`, this field tells whether the grouped usage result is
339
360
  # batch or not.
@@ -399,6 +420,22 @@ module OpenAI
399
420
  # result.
400
421
  #
401
422
  # @param object [Symbol, :"organization.usage.completions.result"]
423
+
424
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
425
+ # activity and `unlabeled` includes all records without published source
426
+ # attribution, including historical and unknown origins. Unlabeled does not imply
427
+ # direct API usage. Without source grouping, this field is null.
428
+ #
429
+ # @see OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageCompletionsResult#api_source
430
+ module APISource
431
+ extend OpenAI::Internal::Type::Enum
432
+
433
+ AGENTS_API = :agents_api
434
+ UNLABELED = :unlabeled
435
+
436
+ # @!method self.values
437
+ # @return [Array<Symbol>]
438
+ end
402
439
  end
403
440
 
404
441
  class OrganizationUsageEmbeddingsResult < OpenAI::Internal::Type::BaseModel
@@ -948,6 +985,21 @@ module OpenAI
948
985
  # @return [String, nil]
949
986
  optional :api_key_id, String, nil?: true
950
987
 
988
+ # @!attribute api_source
989
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
990
+ # activity and `unlabeled` includes all records without published source
991
+ # attribution, including historical and unknown origins. Unlabeled does not imply
992
+ # direct API usage. Without source grouping, this field is null.
993
+ #
994
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource, nil]
995
+ optional(
996
+ :api_source,
997
+ enum: -> {
998
+ OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource
999
+ },
1000
+ nil?: true
1001
+ )
1002
+
951
1003
  # @!attribute context_level
952
1004
  # When `group_by=context_level`, this field provides the search context size of
953
1005
  # the grouped usage result.
@@ -976,7 +1028,7 @@ module OpenAI
976
1028
  # @return [String, nil]
977
1029
  optional :user_id, String, nil?: true
978
1030
 
979
- # @!method initialize(num_model_requests:, num_requests:, api_key_id: nil, context_level: nil, model: nil, project_id: nil, user_id: nil, object: :"organization.usage.web_searches.result")
1031
+ # @!method initialize(num_model_requests:, num_requests:, api_key_id: nil, api_source: nil, context_level: nil, model: nil, project_id: nil, user_id: nil, object: :"organization.usage.web_searches.result")
980
1032
  # The aggregated web search calls usage details of the specific time bucket.
981
1033
  #
982
1034
  # @param num_model_requests [Integer]
@@ -989,6 +1041,12 @@ module OpenAI
989
1041
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
990
1042
  # usage result.
991
1043
  #
1044
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource, nil]
1045
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1046
+ # activity and `unlabeled` includes all records without published source
1047
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1048
+ # direct API usage. Without source grouping, this field is null.
1049
+ #
992
1050
  # @param context_level [String, nil]
993
1051
  # When `group_by=context_level`, this field provides the search context size of
994
1052
  # the grouped usage result.
@@ -1006,6 +1064,22 @@ module OpenAI
1006
1064
  # result.
1007
1065
  #
1008
1066
  # @param object [Symbol, :"organization.usage.web_searches.result"]
1067
+
1068
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1069
+ # activity and `unlabeled` includes all records without published source
1070
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1071
+ # direct API usage. Without source grouping, this field is null.
1072
+ #
1073
+ # @see OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageWebSearchesResult#api_source
1074
+ module APISource
1075
+ extend OpenAI::Internal::Type::Enum
1076
+
1077
+ AGENTS_API = :agents_api
1078
+ UNLABELED = :unlabeled
1079
+
1080
+ # @!method self.values
1081
+ # @return [Array<Symbol>]
1082
+ end
1009
1083
  end
1010
1084
 
1011
1085
  class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel
@@ -1032,6 +1106,21 @@ module OpenAI
1032
1106
  # @return [String, nil]
1033
1107
  optional :api_key_id, String, nil?: true
1034
1108
 
1109
+ # @!attribute api_source
1110
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1111
+ # activity and `unlabeled` includes all records without published source
1112
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1113
+ # direct API usage. Without source grouping, this field is null.
1114
+ #
1115
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::APISource, nil]
1116
+ optional(
1117
+ :api_source,
1118
+ enum: -> {
1119
+ OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::APISource
1120
+ },
1121
+ nil?: true
1122
+ )
1123
+
1035
1124
  # @!attribute line_item
1036
1125
  # When `group_by=line_item`, this field provides the line item of the grouped
1037
1126
  # costs result.
@@ -1066,7 +1155,14 @@ module OpenAI
1066
1155
  nil?: true
1067
1156
  )
1068
1157
 
1069
- # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, quantity_unit: nil, object: :"organization.costs.result")
1158
+ # @!attribute user_id
1159
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1160
+ # result.
1161
+ #
1162
+ # @return [String, nil]
1163
+ optional :user_id, String, nil?: true
1164
+
1165
+ # @!method initialize(amount: nil, api_key_id: nil, api_source: nil, line_item: nil, project_id: nil, quantity: nil, quantity_unit: nil, user_id: nil, object: :"organization.costs.result")
1070
1166
  # The aggregated costs details of the specific time bucket.
1071
1167
  #
1072
1168
  # @param amount [OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount]
@@ -1076,6 +1172,12 @@ module OpenAI
1076
1172
  # When `group_by=api_key_id`, this field provides the API Key ID of the grouped
1077
1173
  # costs result.
1078
1174
  #
1175
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::APISource, nil]
1176
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1177
+ # activity and `unlabeled` includes all records without published source
1178
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1179
+ # direct API usage. Without source grouping, this field is null.
1180
+ #
1079
1181
  # @param line_item [String, nil]
1080
1182
  # When `group_by=line_item`, this field provides the line item of the grouped
1081
1183
  # costs result.
@@ -1092,6 +1194,10 @@ module OpenAI
1092
1194
  # The unit of the `quantity` value. If no single supported unit applies to the
1093
1195
  # result, this field is `null`.
1094
1196
  #
1197
+ # @param user_id [String, nil]
1198
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1199
+ # result.
1200
+ #
1095
1201
  # @param object [Symbol, :"organization.costs.result"]
1096
1202
 
1097
1203
  # @see OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult#amount
@@ -1117,6 +1223,22 @@ module OpenAI
1117
1223
  # @param value [Float]
1118
1224
  # The numeric value of the cost.
1119
1225
  end
1226
+
1227
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1228
+ # activity and `unlabeled` includes all records without published source
1229
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1230
+ # direct API usage. Without source grouping, this field is null.
1231
+ #
1232
+ # @see OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult#api_source
1233
+ module APISource
1234
+ extend OpenAI::Internal::Type::Enum
1235
+
1236
+ AGENTS_API = :agents_api
1237
+ UNLABELED = :unlabeled
1238
+
1239
+ # @!method self.values
1240
+ # @return [Array<Symbol>]
1241
+ end
1120
1242
  end
1121
1243
 
1122
1244
  # @!method self.variants