openai 0.99.0 → 0.100.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 (157) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +1 -1
  4. data/bedrock.md +17 -1
  5. data/lib/openai/client.rb +9 -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_responses_server_event.rb +12 -1
  32. data/lib/openai/models/beta/beta_tool.rb +12 -9
  33. data/lib/openai/models/beta/environment_param.rb +6 -6
  34. data/lib/openai/models/beta/session_turn_error.rb +9 -0
  35. data/lib/openai/models/chat/chat_completion_chunk.rb +85 -18
  36. data/lib/openai/models/error_object.rb +12 -1
  37. data/lib/openai/models/eval_create_params.rb +1 -1
  38. data/lib/openai/models/eval_create_response.rb +1 -1
  39. data/lib/openai/models/eval_list_response.rb +1 -1
  40. data/lib/openai/models/eval_retrieve_response.rb +1 -1
  41. data/lib/openai/models/eval_update_response.rb +1 -1
  42. data/lib/openai/models/fine_tuning/job_list_params.rb +14 -4
  43. data/lib/openai/models/graders/score_model_grader.rb +2 -2
  44. data/lib/openai/models/image_edit_params.rb +12 -9
  45. data/lib/openai/models/realtime/realtime_client_event.rb +9 -0
  46. data/lib/openai/models/realtime/session_update_event.rb +16 -0
  47. data/lib/openai/models/responses/response_computer_tool_call_output_item.rb +2 -2
  48. data/lib/openai/models/responses/response_error.rb +12 -1
  49. data/lib/openai/models/responses/responses_server_event.rb +12 -1
  50. data/lib/openai/models/responses/tool.rb +12 -9
  51. data/lib/openai/models/video_create_error.rb +12 -1
  52. data/lib/openai/providers/bedrock.rb +20 -1
  53. data/lib/openai/resources/admin/organization/usage.rb +15 -6
  54. data/lib/openai/resources/beta/agents/environments/templates.rb +3 -4
  55. data/lib/openai/resources/beta/agents/sessions/turns/items.rb +68 -0
  56. data/lib/openai/resources/beta/agents/sessions/turns.rb +4 -0
  57. data/lib/openai/resources/beta/agents/sessions.rb +22 -2
  58. data/lib/openai/resources/fine_tuning/jobs.rb +7 -2
  59. data/lib/openai/resources/images.rb +8 -6
  60. data/lib/openai/version.rb +1 -1
  61. data/lib/openai.rb +2 -0
  62. data/rbi/openai/helpers/agents.rbi +2 -0
  63. data/rbi/openai/helpers/beta/agents/function_tool.rbi +8 -3
  64. data/rbi/openai/helpers/beta/agents/tool_error.rbi +19 -0
  65. data/rbi/openai/helpers/beta/agents.rbi +12 -0
  66. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +194 -1
  67. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +194 -1
  68. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +194 -1
  69. data/rbi/openai/models/admin/organization/usage_completions_params.rbi +9 -4
  70. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +194 -1
  71. data/rbi/openai/models/admin/organization/usage_costs_params.rbi +16 -4
  72. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +194 -1
  73. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +194 -1
  74. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +194 -1
  75. data/rbi/openai/models/admin/organization/usage_images_response.rbi +194 -1
  76. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +194 -1
  77. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +194 -1
  78. data/rbi/openai/models/admin/organization/usage_web_search_calls_params.rbi +12 -4
  79. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +194 -1
  80. data/rbi/openai/models/beta/agents/environments/template_create_params.rbi +6 -6
  81. data/rbi/openai/models/beta/agents/environments/template_update_params.rbi +3 -6
  82. data/rbi/openai/models/beta/agents/sessions/turns/item_list_params.rbi +139 -0
  83. data/rbi/openai/models/beta/beta_response_computer_tool_call_output_item.rbi +2 -2
  84. data/rbi/openai/models/beta/beta_response_error.rbi +12 -0
  85. data/rbi/openai/models/beta/beta_responses_server_event.rbi +12 -0
  86. data/rbi/openai/models/beta/beta_tool.rbi +12 -9
  87. data/rbi/openai/models/beta/environment_param.rbi +6 -6
  88. data/rbi/openai/models/beta/session_turn_error.rbi +18 -0
  89. data/rbi/openai/models/chat/chat_completion_chunk.rbi +123 -17
  90. data/rbi/openai/models/error_object.rbi +12 -0
  91. data/rbi/openai/models/eval_create_params.rbi +1 -1
  92. data/rbi/openai/models/eval_create_response.rbi +1 -1
  93. data/rbi/openai/models/eval_list_response.rbi +1 -1
  94. data/rbi/openai/models/eval_retrieve_response.rbi +1 -1
  95. data/rbi/openai/models/eval_update_response.rbi +1 -1
  96. data/rbi/openai/models/fine_tuning/job_list_params.rbi +14 -4
  97. data/rbi/openai/models/graders/score_model_grader.rbi +2 -2
  98. data/rbi/openai/models/image_edit_params.rbi +12 -9
  99. data/rbi/openai/models/realtime/session_update_event.rbi +16 -0
  100. data/rbi/openai/models/responses/response_computer_tool_call_output_item.rbi +2 -2
  101. data/rbi/openai/models/responses/response_error.rbi +12 -0
  102. data/rbi/openai/models/responses/responses_server_event.rbi +12 -0
  103. data/rbi/openai/models/responses/tool.rbi +12 -9
  104. data/rbi/openai/models/video_create_error.rbi +12 -0
  105. data/rbi/openai/resources/admin/organization/usage.rbi +15 -6
  106. data/rbi/openai/resources/beta/agents/environments/templates.rbi +3 -4
  107. data/rbi/openai/resources/beta/agents/sessions/turns/items.rbi +62 -0
  108. data/rbi/openai/resources/beta/agents/sessions/turns.rbi +3 -0
  109. data/rbi/openai/resources/beta/agents/sessions.rbi +2 -0
  110. data/rbi/openai/resources/fine_tuning/jobs.rbi +7 -2
  111. data/rbi/openai/resources/images.rbi +8 -6
  112. data/sig/openai/helpers/agents.rbs +3 -0
  113. data/sig/openai/helpers/beta/agents/function_tool.rbs +5 -2
  114. data/sig/openai/helpers/beta/agents/tool_error.rbs +17 -0
  115. data/sig/openai/helpers/beta/agents.rbs +5 -0
  116. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +87 -2
  117. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +87 -2
  118. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +87 -2
  119. data/sig/openai/models/admin/organization/usage_completions_params.rbs +14 -6
  120. data/sig/openai/models/admin/organization/usage_completions_response.rbs +87 -2
  121. data/sig/openai/models/admin/organization/usage_costs_params.rbs +25 -7
  122. data/sig/openai/models/admin/organization/usage_costs_response.rbs +87 -2
  123. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +87 -2
  124. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +87 -2
  125. data/sig/openai/models/admin/organization/usage_images_response.rbs +87 -2
  126. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +87 -2
  127. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +87 -2
  128. data/sig/openai/models/admin/organization/usage_web_search_calls_params.rbs +19 -7
  129. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +87 -2
  130. data/sig/openai/models/beta/agents/environments/template_create_params.rbs +4 -4
  131. data/sig/openai/models/beta/agents/environments/template_update_params.rbs +2 -4
  132. data/sig/openai/models/beta/agents/sessions/turns/item_list_params.rbs +91 -0
  133. data/sig/openai/models/beta/beta_response_computer_tool_call_output_item.rbs +2 -2
  134. data/sig/openai/models/beta/beta_response_error.rbs +10 -0
  135. data/sig/openai/models/beta/beta_responses_server_event.rbs +10 -0
  136. data/sig/openai/models/beta/beta_tool.rbs +8 -6
  137. data/sig/openai/models/beta/environment_param.rbs +4 -4
  138. data/sig/openai/models/beta/session_turn_error.rbs +12 -0
  139. data/sig/openai/models/chat/chat_completion_chunk.rbs +96 -12
  140. data/sig/openai/models/error_object.rbs +10 -0
  141. data/sig/openai/models/eval_create_params.rbs +1 -1
  142. data/sig/openai/models/eval_create_response.rbs +1 -1
  143. data/sig/openai/models/eval_list_response.rbs +1 -1
  144. data/sig/openai/models/eval_retrieve_response.rbs +1 -1
  145. data/sig/openai/models/eval_update_response.rbs +1 -1
  146. data/sig/openai/models/fine_tuning/job_list_params.rbs +14 -4
  147. data/sig/openai/models/graders/score_model_grader.rbs +3 -3
  148. data/sig/openai/models/image_edit_params.rbs +8 -6
  149. data/sig/openai/models/responses/response_computer_tool_call_output_item.rbs +2 -2
  150. data/sig/openai/models/responses/response_error.rbs +10 -0
  151. data/sig/openai/models/responses/responses_server_event.rbs +10 -0
  152. data/sig/openai/models/responses/tool.rbs +8 -6
  153. data/sig/openai/models/video_create_error.rbs +10 -0
  154. data/sig/openai/resources/beta/agents/sessions/turns/items.rbs +24 -0
  155. data/sig/openai/resources/beta/agents/sessions/turns.rbs +2 -0
  156. data/sig/openai/resources/beta/agents/sessions.rbs +1 -0
  157. metadata +11 -1
@@ -202,6 +202,21 @@ module OpenAI
202
202
  # @return [String, nil]
203
203
  optional :api_key_id, String, nil?: true
204
204
 
205
+ # @!attribute api_source
206
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
207
+ # activity and `unlabeled` includes all records without published source
208
+ # attribution, including historical and unknown origins. Unlabeled does not imply
209
+ # direct API usage. Without source grouping, this field is null.
210
+ #
211
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource, nil]
212
+ optional(
213
+ :api_source,
214
+ enum: -> {
215
+ OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource
216
+ },
217
+ nil?: true
218
+ )
219
+
205
220
  # @!attribute batch
206
221
  # When `group_by=batch`, this field tells whether the grouped usage result is
207
222
  # batch or not.
@@ -320,7 +335,7 @@ module OpenAI
320
335
  # @return [String, nil]
321
336
  optional :user_id, String, nil?: true
322
337
 
323
- # @!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")
338
+ # @!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")
324
339
  # The aggregated completions usage details of the specific time bucket.
325
340
  #
326
341
  # @param input_tokens [Integer]
@@ -340,6 +355,12 @@ module OpenAI
340
355
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
341
356
  # usage result.
342
357
  #
358
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource, nil]
359
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
360
+ # activity and `unlabeled` includes all records without published source
361
+ # attribution, including historical and unknown origins. Unlabeled does not imply
362
+ # direct API usage. Without source grouping, this field is null.
363
+ #
343
364
  # @param batch [Boolean, nil]
344
365
  # When `group_by=batch`, this field tells whether the grouped usage result is
345
366
  # batch or not.
@@ -405,6 +426,22 @@ module OpenAI
405
426
  # result.
406
427
  #
407
428
  # @param object [Symbol, :"organization.usage.completions.result"]
429
+
430
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
431
+ # activity and `unlabeled` includes all records without published source
432
+ # attribution, including historical and unknown origins. Unlabeled does not imply
433
+ # direct API usage. Without source grouping, this field is null.
434
+ #
435
+ # @see OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationUsageCompletionsResult#api_source
436
+ module APISource
437
+ extend OpenAI::Internal::Type::Enum
438
+
439
+ AGENTS_API = :agents_api
440
+ UNLABELED = :unlabeled
441
+
442
+ # @!method self.values
443
+ # @return [Array<Symbol>]
444
+ end
408
445
  end
409
446
 
410
447
  class OrganizationUsageEmbeddingsResult < OpenAI::Internal::Type::BaseModel
@@ -954,6 +991,21 @@ module OpenAI
954
991
  # @return [String, nil]
955
992
  optional :api_key_id, String, nil?: true
956
993
 
994
+ # @!attribute api_source
995
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
996
+ # activity and `unlabeled` includes all records without published source
997
+ # attribution, including historical and unknown origins. Unlabeled does not imply
998
+ # direct API usage. Without source grouping, this field is null.
999
+ #
1000
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource, nil]
1001
+ optional(
1002
+ :api_source,
1003
+ enum: -> {
1004
+ OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource
1005
+ },
1006
+ nil?: true
1007
+ )
1008
+
957
1009
  # @!attribute context_level
958
1010
  # When `group_by=context_level`, this field provides the search context size of
959
1011
  # the grouped usage result.
@@ -982,7 +1034,7 @@ module OpenAI
982
1034
  # @return [String, nil]
983
1035
  optional :user_id, String, nil?: true
984
1036
 
985
- # @!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")
1037
+ # @!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")
986
1038
  # The aggregated web search calls usage details of the specific time bucket.
987
1039
  #
988
1040
  # @param num_model_requests [Integer]
@@ -995,6 +1047,12 @@ module OpenAI
995
1047
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
996
1048
  # usage result.
997
1049
  #
1050
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource, nil]
1051
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1052
+ # activity and `unlabeled` includes all records without published source
1053
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1054
+ # direct API usage. Without source grouping, this field is null.
1055
+ #
998
1056
  # @param context_level [String, nil]
999
1057
  # When `group_by=context_level`, this field provides the search context size of
1000
1058
  # the grouped usage result.
@@ -1012,6 +1070,22 @@ module OpenAI
1012
1070
  # result.
1013
1071
  #
1014
1072
  # @param object [Symbol, :"organization.usage.web_searches.result"]
1073
+
1074
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1075
+ # activity and `unlabeled` includes all records without published source
1076
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1077
+ # direct API usage. Without source grouping, this field is null.
1078
+ #
1079
+ # @see OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationUsageWebSearchesResult#api_source
1080
+ module APISource
1081
+ extend OpenAI::Internal::Type::Enum
1082
+
1083
+ AGENTS_API = :agents_api
1084
+ UNLABELED = :unlabeled
1085
+
1086
+ # @!method self.values
1087
+ # @return [Array<Symbol>]
1088
+ end
1015
1089
  end
1016
1090
 
1017
1091
  class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel
@@ -1038,6 +1112,21 @@ module OpenAI
1038
1112
  # @return [String, nil]
1039
1113
  optional :api_key_id, String, nil?: true
1040
1114
 
1115
+ # @!attribute api_source
1116
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1117
+ # activity and `unlabeled` includes all records without published source
1118
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1119
+ # direct API usage. Without source grouping, this field is null.
1120
+ #
1121
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult::APISource, nil]
1122
+ optional(
1123
+ :api_source,
1124
+ enum: -> {
1125
+ OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult::APISource
1126
+ },
1127
+ nil?: true
1128
+ )
1129
+
1041
1130
  # @!attribute line_item
1042
1131
  # When `group_by=line_item`, this field provides the line item of the grouped
1043
1132
  # costs result.
@@ -1072,7 +1161,14 @@ module OpenAI
1072
1161
  nil?: true
1073
1162
  )
1074
1163
 
1075
- # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, quantity_unit: nil, object: :"organization.costs.result")
1164
+ # @!attribute user_id
1165
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1166
+ # result.
1167
+ #
1168
+ # @return [String, nil]
1169
+ optional :user_id, String, nil?: true
1170
+
1171
+ # @!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")
1076
1172
  # The aggregated costs details of the specific time bucket.
1077
1173
  #
1078
1174
  # @param amount [OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult::Amount]
@@ -1082,6 +1178,12 @@ module OpenAI
1082
1178
  # When `group_by=api_key_id`, this field provides the API Key ID of the grouped
1083
1179
  # costs result.
1084
1180
  #
1181
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult::APISource, nil]
1182
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1183
+ # activity and `unlabeled` includes all records without published source
1184
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1185
+ # direct API usage. Without source grouping, this field is null.
1186
+ #
1085
1187
  # @param line_item [String, nil]
1086
1188
  # When `group_by=line_item`, this field provides the line item of the grouped
1087
1189
  # costs result.
@@ -1098,6 +1200,10 @@ module OpenAI
1098
1200
  # The unit of the `quantity` value. If no single supported unit applies to the
1099
1201
  # result, this field is `null`.
1100
1202
  #
1203
+ # @param user_id [String, nil]
1204
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1205
+ # result.
1206
+ #
1101
1207
  # @param object [Symbol, :"organization.costs.result"]
1102
1208
 
1103
1209
  # @see OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult#amount
@@ -1123,6 +1229,22 @@ module OpenAI
1123
1229
  # @param value [Float]
1124
1230
  # The numeric value of the cost.
1125
1231
  end
1232
+
1233
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1234
+ # activity and `unlabeled` includes all records without published source
1235
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1236
+ # direct API usage. Without source grouping, this field is null.
1237
+ #
1238
+ # @see OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationCostsResult#api_source
1239
+ module APISource
1240
+ extend OpenAI::Internal::Type::Enum
1241
+
1242
+ AGENTS_API = :agents_api
1243
+ UNLABELED = :unlabeled
1244
+
1245
+ # @!method self.values
1246
+ # @return [Array<Symbol>]
1247
+ end
1126
1248
  end
1127
1249
 
1128
1250
  # @!method self.variants
@@ -202,6 +202,21 @@ module OpenAI
202
202
  # @return [String, nil]
203
203
  optional :api_key_id, String, nil?: true
204
204
 
205
+ # @!attribute api_source
206
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
207
+ # activity and `unlabeled` includes all records without published source
208
+ # attribution, including historical and unknown origins. Unlabeled does not imply
209
+ # direct API usage. Without source grouping, this field is null.
210
+ #
211
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource, nil]
212
+ optional(
213
+ :api_source,
214
+ enum: -> {
215
+ OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource
216
+ },
217
+ nil?: true
218
+ )
219
+
205
220
  # @!attribute batch
206
221
  # When `group_by=batch`, this field tells whether the grouped usage result is
207
222
  # batch or not.
@@ -320,7 +335,7 @@ module OpenAI
320
335
  # @return [String, nil]
321
336
  optional :user_id, String, nil?: true
322
337
 
323
- # @!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")
338
+ # @!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")
324
339
  # The aggregated completions usage details of the specific time bucket.
325
340
  #
326
341
  # @param input_tokens [Integer]
@@ -340,6 +355,12 @@ module OpenAI
340
355
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
341
356
  # usage result.
342
357
  #
358
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource, nil]
359
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
360
+ # activity and `unlabeled` includes all records without published source
361
+ # attribution, including historical and unknown origins. Unlabeled does not imply
362
+ # direct API usage. Without source grouping, this field is null.
363
+ #
343
364
  # @param batch [Boolean, nil]
344
365
  # When `group_by=batch`, this field tells whether the grouped usage result is
345
366
  # batch or not.
@@ -405,6 +426,22 @@ module OpenAI
405
426
  # result.
406
427
  #
407
428
  # @param object [Symbol, :"organization.usage.completions.result"]
429
+
430
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
431
+ # activity and `unlabeled` includes all records without published source
432
+ # attribution, including historical and unknown origins. Unlabeled does not imply
433
+ # direct API usage. Without source grouping, this field is null.
434
+ #
435
+ # @see OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult#api_source
436
+ module APISource
437
+ extend OpenAI::Internal::Type::Enum
438
+
439
+ AGENTS_API = :agents_api
440
+ UNLABELED = :unlabeled
441
+
442
+ # @!method self.values
443
+ # @return [Array<Symbol>]
444
+ end
408
445
  end
409
446
 
410
447
  class OrganizationUsageEmbeddingsResult < OpenAI::Internal::Type::BaseModel
@@ -954,6 +991,21 @@ module OpenAI
954
991
  # @return [String, nil]
955
992
  optional :api_key_id, String, nil?: true
956
993
 
994
+ # @!attribute api_source
995
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
996
+ # activity and `unlabeled` includes all records without published source
997
+ # attribution, including historical and unknown origins. Unlabeled does not imply
998
+ # direct API usage. Without source grouping, this field is null.
999
+ #
1000
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource, nil]
1001
+ optional(
1002
+ :api_source,
1003
+ enum: -> {
1004
+ OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource
1005
+ },
1006
+ nil?: true
1007
+ )
1008
+
957
1009
  # @!attribute context_level
958
1010
  # When `group_by=context_level`, this field provides the search context size of
959
1011
  # the grouped usage result.
@@ -982,7 +1034,7 @@ module OpenAI
982
1034
  # @return [String, nil]
983
1035
  optional :user_id, String, nil?: true
984
1036
 
985
- # @!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")
1037
+ # @!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")
986
1038
  # The aggregated web search calls usage details of the specific time bucket.
987
1039
  #
988
1040
  # @param num_model_requests [Integer]
@@ -995,6 +1047,12 @@ module OpenAI
995
1047
  # When `group_by=api_key_id`, this field provides the API key ID of the grouped
996
1048
  # usage result.
997
1049
  #
1050
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageWebSearchesResult::APISource, nil]
1051
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1052
+ # activity and `unlabeled` includes all records without published source
1053
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1054
+ # direct API usage. Without source grouping, this field is null.
1055
+ #
998
1056
  # @param context_level [String, nil]
999
1057
  # When `group_by=context_level`, this field provides the search context size of
1000
1058
  # the grouped usage result.
@@ -1012,6 +1070,22 @@ module OpenAI
1012
1070
  # result.
1013
1071
  #
1014
1072
  # @param object [Symbol, :"organization.usage.web_searches.result"]
1073
+
1074
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1075
+ # activity and `unlabeled` includes all records without published source
1076
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1077
+ # direct API usage. Without source grouping, this field is null.
1078
+ #
1079
+ # @see OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageWebSearchesResult#api_source
1080
+ module APISource
1081
+ extend OpenAI::Internal::Type::Enum
1082
+
1083
+ AGENTS_API = :agents_api
1084
+ UNLABELED = :unlabeled
1085
+
1086
+ # @!method self.values
1087
+ # @return [Array<Symbol>]
1088
+ end
1015
1089
  end
1016
1090
 
1017
1091
  class OrganizationCostsResult < OpenAI::Internal::Type::BaseModel
@@ -1038,6 +1112,21 @@ module OpenAI
1038
1112
  # @return [String, nil]
1039
1113
  optional :api_key_id, String, nil?: true
1040
1114
 
1115
+ # @!attribute api_source
1116
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1117
+ # activity and `unlabeled` includes all records without published source
1118
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1119
+ # direct API usage. Without source grouping, this field is null.
1120
+ #
1121
+ # @return [Symbol, OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::APISource, nil]
1122
+ optional(
1123
+ :api_source,
1124
+ enum: -> {
1125
+ OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::APISource
1126
+ },
1127
+ nil?: true
1128
+ )
1129
+
1041
1130
  # @!attribute line_item
1042
1131
  # When `group_by=line_item`, this field provides the line item of the grouped
1043
1132
  # costs result.
@@ -1072,7 +1161,14 @@ module OpenAI
1072
1161
  nil?: true
1073
1162
  )
1074
1163
 
1075
- # @!method initialize(amount: nil, api_key_id: nil, line_item: nil, project_id: nil, quantity: nil, quantity_unit: nil, object: :"organization.costs.result")
1164
+ # @!attribute user_id
1165
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1166
+ # result.
1167
+ #
1168
+ # @return [String, nil]
1169
+ optional :user_id, String, nil?: true
1170
+
1171
+ # @!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")
1076
1172
  # The aggregated costs details of the specific time bucket.
1077
1173
  #
1078
1174
  # @param amount [OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::Amount]
@@ -1082,6 +1178,12 @@ module OpenAI
1082
1178
  # When `group_by=api_key_id`, this field provides the API Key ID of the grouped
1083
1179
  # costs result.
1084
1180
  #
1181
+ # @param api_source [Symbol, OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult::APISource, nil]
1182
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1183
+ # activity and `unlabeled` includes all records without published source
1184
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1185
+ # direct API usage. Without source grouping, this field is null.
1186
+ #
1085
1187
  # @param line_item [String, nil]
1086
1188
  # When `group_by=line_item`, this field provides the line item of the grouped
1087
1189
  # costs result.
@@ -1098,6 +1200,10 @@ module OpenAI
1098
1200
  # The unit of the `quantity` value. If no single supported unit applies to the
1099
1201
  # result, this field is `null`.
1100
1202
  #
1203
+ # @param user_id [String, nil]
1204
+ # When `group_by=user_id`, this field provides the user ID of the grouped costs
1205
+ # result.
1206
+ #
1101
1207
  # @param object [Symbol, :"organization.costs.result"]
1102
1208
 
1103
1209
  # @see OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult#amount
@@ -1123,6 +1229,22 @@ module OpenAI
1123
1229
  # @param value [Float]
1124
1230
  # The numeric value of the cost.
1125
1231
  end
1232
+
1233
+ # When grouped by `api_source`, `agents_api` identifies attributed Agents API
1234
+ # activity and `unlabeled` includes all records without published source
1235
+ # attribution, including historical and unknown origins. Unlabeled does not imply
1236
+ # direct API usage. Without source grouping, this field is null.
1237
+ #
1238
+ # @see OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationCostsResult#api_source
1239
+ module APISource
1240
+ extend OpenAI::Internal::Type::Enum
1241
+
1242
+ AGENTS_API = :agents_api
1243
+ UNLABELED = :unlabeled
1244
+
1245
+ # @!method self.values
1246
+ # @return [Array<Symbol>]
1247
+ end
1126
1248
  end
1127
1249
 
1128
1250
  # @!method self.variants
@@ -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>]