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
@@ -87,6 +87,7 @@ module OpenAI
87
87
  ?object: :"organization.usage.completions.result",
88
88
  output_tokens: Integer,
89
89
  ?api_key_id: String?,
90
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
90
91
  ?batch: bool?,
91
92
  ?input_audio_tokens: Integer,
92
93
  ?:input_cache_write_12h_tokens => Integer,
@@ -127,6 +128,12 @@ module OpenAI
127
128
  # usage result.
128
129
  attr_accessor api_key_id: String?
129
130
 
131
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
132
+ # activity and `unlabeled` includes all records without published source
133
+ # attribution, including historical and unknown origins. Unlabeled does not imply
134
+ # direct API usage. Without source grouping, this field is null.
135
+ attr_accessor api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?
136
+
130
137
  # When `group_by=batch`, this field tells whether the grouped usage result is
131
138
  # batch or not.
132
139
  attr_accessor batch: bool?
@@ -248,6 +255,11 @@ module OpenAI
248
255
  # @param api_key_id
249
256
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
250
257
  # usage result.
258
+ # @param api_source
259
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
260
+ # activity and `unlabeled` includes all records without published source
261
+ # attribution, including historical and unknown origins. Unlabeled does not imply
262
+ # direct API usage. Without source grouping, this field is null.
251
263
  # @param batch
252
264
  # When `group_by=batch`, this field tells whether the grouped usage result is
253
265
  # batch or not.
@@ -299,6 +311,7 @@ module OpenAI
299
311
  num_model_requests: Integer,
300
312
  output_tokens: Integer,
301
313
  ?api_key_id: String?,
314
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
302
315
  ?batch: bool?,
303
316
  ?input_audio_tokens: Integer,
304
317
  ?input_cache_write_12h_tokens: Integer,
@@ -326,6 +339,7 @@ module OpenAI
326
339
  ?object: :"organization.usage.completions.result",
327
340
  output_tokens: Integer,
328
341
  ?api_key_id: String?,
342
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
329
343
  ?batch: bool?,
330
344
  ?input_audio_tokens: Integer,
331
345
  ?:input_cache_write_12h_tokens => Integer,
@@ -345,6 +359,17 @@ module OpenAI
345
359
  ?service_tier: String?,
346
360
  ?user_id: String?
347
361
  }
362
+
363
+ type api_source = :agents_api | :unlabeled
364
+
365
+ module APISource
366
+ extend OpenAI::Internal::Type::Enum
367
+
368
+ AGENTS_API: :agents_api
369
+ UNLABELED: :unlabeled
370
+
371
+ def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source]
372
+ end
348
373
  end
349
374
 
350
375
  type organization_usage_embeddings_result =
@@ -873,6 +898,7 @@ module OpenAI
873
898
  num_requests: Integer,
874
899
  ?object: :"organization.usage.web_searches.result",
875
900
  ?api_key_id: String?,
901
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageWebSearchesResult::api_source?,
876
902
  ?context_level: String?,
877
903
  ?model: String?,
878
904
  ?project_id: String?,
@@ -892,6 +918,12 @@ module OpenAI
892
918
  # usage result.
893
919
  attr_accessor api_key_id: String?
894
920
 
921
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
922
+ # activity and `unlabeled` includes all records without published source
923
+ # attribution, including historical and unknown origins. Unlabeled does not imply
924
+ # direct API usage. Without source grouping, this field is null.
925
+ attr_accessor api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageWebSearchesResult::api_source?
926
+
895
927
  # When `group_by=context_level`, this field provides the search context size of
896
928
  # the grouped usage result.
897
929
  attr_accessor context_level: String?
@@ -915,6 +947,11 @@ module OpenAI
915
947
  # @param api_key_id
916
948
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
917
949
  # usage result.
950
+ # @param api_source
951
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
952
+ # activity and `unlabeled` includes all records without published source
953
+ # attribution, including historical and unknown origins. Unlabeled does not imply
954
+ # direct API usage. Without source grouping, this field is null.
918
955
  # @param context_level
919
956
  # When `group_by=context_level`, this field provides the search context size of
920
957
  # the grouped usage result.
@@ -931,6 +968,7 @@ module OpenAI
931
968
  num_model_requests: Integer,
932
969
  num_requests: Integer,
933
970
  ?api_key_id: String?,
971
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageWebSearchesResult::api_source?,
934
972
  ?context_level: String?,
935
973
  ?model: String?,
936
974
  ?project_id: String?,
@@ -943,11 +981,23 @@ module OpenAI
943
981
  num_requests: Integer,
944
982
  ?object: :"organization.usage.web_searches.result",
945
983
  ?api_key_id: String?,
984
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageWebSearchesResult::api_source?,
946
985
  ?context_level: String?,
947
986
  ?model: String?,
948
987
  ?project_id: String?,
949
988
  ?user_id: String?
950
989
  }
990
+
991
+ type api_source = :agents_api | :unlabeled
992
+
993
+ module APISource
994
+ extend OpenAI::Internal::Type::Enum
995
+
996
+ AGENTS_API: :agents_api
997
+ UNLABELED: :unlabeled
998
+
999
+ def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageWebSearchesResult::api_source]
1000
+ end
951
1001
  end
952
1002
 
953
1003
  type organization_costs_result =
@@ -955,10 +1005,12 @@ module OpenAI
955
1005
  ?object: :"organization.costs.result",
956
1006
  ?amount: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::Amount,
957
1007
  ?api_key_id: String?,
1008
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::api_source?,
958
1009
  ?line_item: String?,
959
1010
  ?project_id: String?,
960
1011
  ?quantity: Float?,
961
- ?quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?
1012
+ ?quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?,
1013
+ ?user_id: String?
962
1014
  }
963
1015
 
964
1016
  class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel
@@ -976,6 +1028,12 @@ module OpenAI
976
1028
  # costs result.
977
1029
  attr_accessor api_key_id: String?
978
1030
 
1031
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1032
+ # activity and `unlabeled` includes all records without published source
1033
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1034
+ # direct API usage. Without source grouping, this field is null.
1035
+ attr_accessor api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::api_source?
1036
+
979
1037
  # When `group_by=line_item`, this field provides the line item of the grouped
980
1038
  # costs result.
981
1039
  attr_accessor line_item: String?
@@ -992,11 +1050,20 @@ module OpenAI
992
1050
  # result, this field is `null`.
993
1051
  attr_accessor quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?
994
1052
 
1053
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1054
+ # result.
1055
+ attr_accessor user_id: String?
1056
+
995
1057
  # @param amount
996
1058
  # The monetary value in its associated currency.
997
1059
  # @param api_key_id
998
1060
  # When `group_by=api_key_id`, this field provides the API Key ID of the grouped
999
1061
  # costs result.
1062
+ # @param api_source
1063
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1064
+ # activity and `unlabeled` includes all records without published source
1065
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1066
+ # direct API usage. Without source grouping, this field is null.
1000
1067
  # @param line_item
1001
1068
  # When `group_by=line_item`, this field provides the line item of the grouped
1002
1069
  # costs result.
@@ -1009,13 +1076,18 @@ module OpenAI
1009
1076
  # @param quantity_unit
1010
1077
  # The unit of the `quantity` value. If no single supported unit applies to the
1011
1078
  # result, this field is `null`.
1079
+ # @param user_id
1080
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1081
+ # result.
1012
1082
  def initialize: (
1013
1083
  ?amount: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::Amount,
1014
1084
  ?api_key_id: String?,
1085
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::api_source?,
1015
1086
  ?line_item: String?,
1016
1087
  ?project_id: String?,
1017
1088
  ?quantity: Float?,
1018
1089
  ?quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?,
1090
+ ?user_id: String?,
1019
1091
  ?object: :"organization.costs.result"
1020
1092
  ) -> void
1021
1093
 
@@ -1023,10 +1095,12 @@ module OpenAI
1023
1095
  ?object: :"organization.costs.result",
1024
1096
  ?amount: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::Amount,
1025
1097
  ?api_key_id: String?,
1098
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::api_source?,
1026
1099
  ?line_item: String?,
1027
1100
  ?project_id: String?,
1028
1101
  ?quantity: Float?,
1029
- ?quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?
1102
+ ?quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?,
1103
+ ?user_id: String?
1030
1104
  }
1031
1105
 
1032
1106
  type amount = { ?currency: String, ?value: Float }
@@ -1052,6 +1126,17 @@ module OpenAI
1052
1126
 
1053
1127
  def to_hash: -> { ?currency: String, ?value: Float }
1054
1128
  end
1129
+
1130
+ type api_source = :agents_api | :unlabeled
1131
+
1132
+ module APISource
1133
+ extend OpenAI::Internal::Type::Enum
1134
+
1135
+ AGENTS_API: :agents_api
1136
+ UNLABELED: :unlabeled
1137
+
1138
+ def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::api_source]
1139
+ end
1055
1140
  end
1056
1141
 
1057
1142
  def self?.variants: -> ::Array[OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::result]
@@ -56,13 +56,17 @@ module OpenAI
56
56
  def end_time=: (Integer) -> Integer
57
57
 
58
58
  # Group the usage data by the specified fields. Support fields include
59
- # `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier` or any
60
- # combination of them.
59
+ # `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`,
60
+ # `api_source` or any combination of them. When grouped by `api_source`, results
61
+ # use `agents_api` for attributed Agents API activity and `unlabeled` for all
62
+ # other activity. Without source grouping, `api_source` is null.
61
63
  attr_reader group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsParams::group_by]?
62
64
 
63
65
  # Group the usage data by the specified fields. Support fields include
64
- # `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier` or any
65
- # combination of them.
66
+ # `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`,
67
+ # `api_source` or any combination of them. When grouped by `api_source`, results
68
+ # use `agents_api` for attributed Agents API activity and `unlabeled` for all
69
+ # other activity. Without source grouping, `api_source` is null.
66
70
  def group_by=: (
67
71
  ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsParams::group_by]
68
72
  ) -> ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsParams::group_by]
@@ -121,8 +125,10 @@ module OpenAI
121
125
  # End time (Unix seconds) of the query time range, exclusive.
122
126
  # @param group_by
123
127
  # Group the usage data by the specified fields. Support fields include
124
- # `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier` or any
125
- # combination of them.
128
+ # `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`,
129
+ # `api_source` or any combination of them. When grouped by `api_source`, results
130
+ # use `agents_api` for attributed Agents API activity and `unlabeled` for all
131
+ # other activity. Without source grouping, `api_source` is null.
126
132
  # @param limit
127
133
  # Specifies the number of buckets to return.
128
134
  #
@@ -187,6 +193,7 @@ module OpenAI
187
193
  | :model
188
194
  | :batch
189
195
  | :service_tier
196
+ | :api_source
190
197
 
191
198
  module GroupBy
192
199
  extend OpenAI::Internal::Type::Enum
@@ -197,6 +204,7 @@ module OpenAI
197
204
  MODEL: :model
198
205
  BATCH: :batch
199
206
  SERVICE_TIER: :service_tier
207
+ API_SOURCE: :api_source
200
208
 
201
209
  def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsParams::group_by]
202
210
  end
@@ -87,6 +87,7 @@ module OpenAI
87
87
  ?object: :"organization.usage.completions.result",
88
88
  output_tokens: Integer,
89
89
  ?api_key_id: String?,
90
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
90
91
  ?batch: bool?,
91
92
  ?input_audio_tokens: Integer,
92
93
  ?:input_cache_write_12h_tokens => Integer,
@@ -127,6 +128,12 @@ module OpenAI
127
128
  # usage result.
128
129
  attr_accessor api_key_id: String?
129
130
 
131
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
132
+ # activity and `unlabeled` includes all records without published source
133
+ # attribution, including historical and unknown origins. Unlabeled does not imply
134
+ # direct API usage. Without source grouping, this field is null.
135
+ attr_accessor api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?
136
+
130
137
  # When `group_by=batch`, this field tells whether the grouped usage result is
131
138
  # batch or not.
132
139
  attr_accessor batch: bool?
@@ -248,6 +255,11 @@ module OpenAI
248
255
  # @param api_key_id
249
256
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
250
257
  # usage result.
258
+ # @param api_source
259
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
260
+ # activity and `unlabeled` includes all records without published source
261
+ # attribution, including historical and unknown origins. Unlabeled does not imply
262
+ # direct API usage. Without source grouping, this field is null.
251
263
  # @param batch
252
264
  # When `group_by=batch`, this field tells whether the grouped usage result is
253
265
  # batch or not.
@@ -299,6 +311,7 @@ module OpenAI
299
311
  num_model_requests: Integer,
300
312
  output_tokens: Integer,
301
313
  ?api_key_id: String?,
314
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
302
315
  ?batch: bool?,
303
316
  ?input_audio_tokens: Integer,
304
317
  ?input_cache_write_12h_tokens: Integer,
@@ -326,6 +339,7 @@ module OpenAI
326
339
  ?object: :"organization.usage.completions.result",
327
340
  output_tokens: Integer,
328
341
  ?api_key_id: String?,
342
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
329
343
  ?batch: bool?,
330
344
  ?input_audio_tokens: Integer,
331
345
  ?:input_cache_write_12h_tokens => Integer,
@@ -345,6 +359,17 @@ module OpenAI
345
359
  ?service_tier: String?,
346
360
  ?user_id: String?
347
361
  }
362
+
363
+ type api_source = :agents_api | :unlabeled
364
+
365
+ module APISource
366
+ extend OpenAI::Internal::Type::Enum
367
+
368
+ AGENTS_API: :agents_api
369
+ UNLABELED: :unlabeled
370
+
371
+ def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source]
372
+ end
348
373
  end
349
374
 
350
375
  type organization_usage_embeddings_result =
@@ -873,6 +898,7 @@ module OpenAI
873
898
  num_requests: Integer,
874
899
  ?object: :"organization.usage.web_searches.result",
875
900
  ?api_key_id: String?,
901
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageWebSearchesResult::api_source?,
876
902
  ?context_level: String?,
877
903
  ?model: String?,
878
904
  ?project_id: String?,
@@ -892,6 +918,12 @@ module OpenAI
892
918
  # usage result.
893
919
  attr_accessor api_key_id: String?
894
920
 
921
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
922
+ # activity and `unlabeled` includes all records without published source
923
+ # attribution, including historical and unknown origins. Unlabeled does not imply
924
+ # direct API usage. Without source grouping, this field is null.
925
+ attr_accessor api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageWebSearchesResult::api_source?
926
+
895
927
  # When `group_by=context_level`, this field provides the search context size of
896
928
  # the grouped usage result.
897
929
  attr_accessor context_level: String?
@@ -915,6 +947,11 @@ module OpenAI
915
947
  # @param api_key_id
916
948
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
917
949
  # usage result.
950
+ # @param api_source
951
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
952
+ # activity and `unlabeled` includes all records without published source
953
+ # attribution, including historical and unknown origins. Unlabeled does not imply
954
+ # direct API usage. Without source grouping, this field is null.
918
955
  # @param context_level
919
956
  # When `group_by=context_level`, this field provides the search context size of
920
957
  # the grouped usage result.
@@ -931,6 +968,7 @@ module OpenAI
931
968
  num_model_requests: Integer,
932
969
  num_requests: Integer,
933
970
  ?api_key_id: String?,
971
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageWebSearchesResult::api_source?,
934
972
  ?context_level: String?,
935
973
  ?model: String?,
936
974
  ?project_id: String?,
@@ -943,11 +981,23 @@ module OpenAI
943
981
  num_requests: Integer,
944
982
  ?object: :"organization.usage.web_searches.result",
945
983
  ?api_key_id: String?,
984
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageWebSearchesResult::api_source?,
946
985
  ?context_level: String?,
947
986
  ?model: String?,
948
987
  ?project_id: String?,
949
988
  ?user_id: String?
950
989
  }
990
+
991
+ type api_source = :agents_api | :unlabeled
992
+
993
+ module APISource
994
+ extend OpenAI::Internal::Type::Enum
995
+
996
+ AGENTS_API: :agents_api
997
+ UNLABELED: :unlabeled
998
+
999
+ def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageWebSearchesResult::api_source]
1000
+ end
951
1001
  end
952
1002
 
953
1003
  type organization_costs_result =
@@ -955,10 +1005,12 @@ module OpenAI
955
1005
  ?object: :"organization.costs.result",
956
1006
  ?amount: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::Amount,
957
1007
  ?api_key_id: String?,
1008
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::api_source?,
958
1009
  ?line_item: String?,
959
1010
  ?project_id: String?,
960
1011
  ?quantity: Float?,
961
- ?quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?
1012
+ ?quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?,
1013
+ ?user_id: String?
962
1014
  }
963
1015
 
964
1016
  class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel
@@ -976,6 +1028,12 @@ module OpenAI
976
1028
  # costs result.
977
1029
  attr_accessor api_key_id: String?
978
1030
 
1031
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1032
+ # activity and `unlabeled` includes all records without published source
1033
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1034
+ # direct API usage. Without source grouping, this field is null.
1035
+ attr_accessor api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::api_source?
1036
+
979
1037
  # When `group_by=line_item`, this field provides the line item of the grouped
980
1038
  # costs result.
981
1039
  attr_accessor line_item: String?
@@ -992,11 +1050,20 @@ module OpenAI
992
1050
  # result, this field is `null`.
993
1051
  attr_accessor quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?
994
1052
 
1053
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1054
+ # result.
1055
+ attr_accessor user_id: String?
1056
+
995
1057
  # @param amount
996
1058
  # The monetary value in its associated currency.
997
1059
  # @param api_key_id
998
1060
  # When `group_by=api_key_id`, this field provides the API Key ID of the grouped
999
1061
  # costs result.
1062
+ # @param api_source
1063
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1064
+ # activity and `unlabeled` includes all records without published source
1065
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1066
+ # direct API usage. Without source grouping, this field is null.
1000
1067
  # @param line_item
1001
1068
  # When `group_by=line_item`, this field provides the line item of the grouped
1002
1069
  # costs result.
@@ -1009,13 +1076,18 @@ module OpenAI
1009
1076
  # @param quantity_unit
1010
1077
  # The unit of the `quantity` value. If no single supported unit applies to the
1011
1078
  # result, this field is `null`.
1079
+ # @param user_id
1080
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1081
+ # result.
1012
1082
  def initialize: (
1013
1083
  ?amount: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::Amount,
1014
1084
  ?api_key_id: String?,
1085
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::api_source?,
1015
1086
  ?line_item: String?,
1016
1087
  ?project_id: String?,
1017
1088
  ?quantity: Float?,
1018
1089
  ?quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?,
1090
+ ?user_id: String?,
1019
1091
  ?object: :"organization.costs.result"
1020
1092
  ) -> void
1021
1093
 
@@ -1023,10 +1095,12 @@ module OpenAI
1023
1095
  ?object: :"organization.costs.result",
1024
1096
  ?amount: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::Amount,
1025
1097
  ?api_key_id: String?,
1098
+ ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::api_source?,
1026
1099
  ?line_item: String?,
1027
1100
  ?project_id: String?,
1028
1101
  ?quantity: Float?,
1029
- ?quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?
1102
+ ?quantity_unit: OpenAI::Models::Admin::Organization::cost_quantity_unit?,
1103
+ ?user_id: String?
1030
1104
  }
1031
1105
 
1032
1106
  type amount = { ?currency: String, ?value: Float }
@@ -1052,6 +1126,17 @@ module OpenAI
1052
1126
 
1053
1127
  def to_hash: -> { ?currency: String, ?value: Float }
1054
1128
  end
1129
+
1130
+ type api_source = :agents_api | :unlabeled
1131
+
1132
+ module APISource
1133
+ extend OpenAI::Internal::Type::Enum
1134
+
1135
+ AGENTS_API: :agents_api
1136
+ UNLABELED: :unlabeled
1137
+
1138
+ def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationCostsResult::api_source]
1139
+ end
1055
1140
  end
1056
1141
 
1057
1142
  def self?.variants: -> ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::result]
@@ -45,12 +45,22 @@ module OpenAI
45
45
  # End time (Unix seconds) of the query time range, exclusive.
46
46
  def end_time=: (Integer) -> Integer
47
47
 
48
- # Group the costs by the specified fields. Support fields include `project_id`,
49
- # `line_item`, `api_key_id` and any combination of them.
48
+ # Group the costs by the specified fields. Supported fields include `project_id`,
49
+ # `user_id`, `line_item`, `api_key_id`, and `api_source`. Support for combining
50
+ # `user_id` with `project_id` grouping or the `project_ids` filter depends on the
51
+ # organization and requested time range. Unsupported combinations return HTTP 400.
52
+ # When grouped by `api_source`, results use `agents_api` for attributed Agents API
53
+ # activity and `unlabeled` for all other activity. Without source grouping,
54
+ # `api_source` is null.
50
55
  attr_reader group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by]?
51
56
 
52
- # Group the costs by the specified fields. Support fields include `project_id`,
53
- # `line_item`, `api_key_id` and any combination of them.
57
+ # Group the costs by the specified fields. Supported fields include `project_id`,
58
+ # `user_id`, `line_item`, `api_key_id`, and `api_source`. Support for combining
59
+ # `user_id` with `project_id` grouping or the `project_ids` filter depends on the
60
+ # organization and requested time range. Unsupported combinations return HTTP 400.
61
+ # When grouped by `api_source`, results use `agents_api` for attributed Agents API
62
+ # activity and `unlabeled` for all other activity. Without source grouping,
63
+ # `api_source` is null.
54
64
  def group_by=: (
55
65
  ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by]
56
66
  ) -> ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by]
@@ -95,8 +105,13 @@ module OpenAI
95
105
  # @param end_time
96
106
  # End time (Unix seconds) of the query time range, exclusive.
97
107
  # @param group_by
98
- # Group the costs by the specified fields. Support fields include `project_id`,
99
- # `line_item`, `api_key_id` and any combination of them.
108
+ # Group the costs by the specified fields. Supported fields include `project_id`,
109
+ # `user_id`, `line_item`, `api_key_id`, and `api_source`. Support for combining
110
+ # `user_id` with `project_id` grouping or the `project_ids` filter depends on the
111
+ # organization and requested time range. Unsupported combinations return HTTP 400.
112
+ # When grouped by `api_source`, results use `agents_api` for attributed Agents API
113
+ # activity and `unlabeled` for all other activity. Without source grouping,
114
+ # `api_source` is null.
100
115
  # @param limit
101
116
  # A limit on the number of buckets to be returned. Limit can range between 1 and
102
117
  # 180, and the default is 7.
@@ -144,14 +159,17 @@ module OpenAI
144
159
  def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::bucket_width]
145
160
  end
146
161
 
147
- type group_by = :project_id | :line_item | :api_key_id
162
+ type group_by =
163
+ :project_id | :user_id | :line_item | :api_key_id | :api_source
148
164
 
149
165
  module GroupBy
150
166
  extend OpenAI::Internal::Type::Enum
151
167
 
152
168
  PROJECT_ID: :project_id
169
+ USER_ID: :user_id
153
170
  LINE_ITEM: :line_item
154
171
  API_KEY_ID: :api_key_id
172
+ API_SOURCE: :api_source
155
173
 
156
174
  def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by]
157
175
  end