openai 1.6.0 → 1.7.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +1 -1
  4. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +8 -1
  5. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +8 -1
  6. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +8 -1
  7. data/lib/openai/models/admin/organization/usage_completions_params.rb +23 -8
  8. data/lib/openai/models/admin/organization/usage_completions_response.rb +8 -1
  9. data/lib/openai/models/admin/organization/usage_costs_params.rb +25 -12
  10. data/lib/openai/models/admin/organization/usage_costs_response.rb +47 -19
  11. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +8 -1
  12. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +8 -1
  13. data/lib/openai/models/admin/organization/usage_images_response.rb +8 -1
  14. data/lib/openai/models/admin/organization/usage_moderations_response.rb +8 -1
  15. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +8 -1
  16. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +8 -1
  17. data/lib/openai/resources/admin/organization/usage.rb +24 -11
  18. data/lib/openai/version.rb +1 -1
  19. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +8 -0
  20. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +8 -0
  21. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +8 -0
  22. data/rbi/openai/models/admin/organization/usage_completions_params.rbi +26 -8
  23. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +8 -0
  24. data/rbi/openai/models/admin/organization/usage_costs_params.rbi +28 -12
  25. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +91 -67
  26. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +8 -0
  27. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +8 -0
  28. data/rbi/openai/models/admin/organization/usage_images_response.rbi +8 -0
  29. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +8 -0
  30. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +8 -0
  31. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +8 -0
  32. data/rbi/openai/resources/admin/organization/usage.rbi +24 -11
  33. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +5 -0
  34. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +5 -0
  35. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +5 -0
  36. data/sig/openai/models/admin/organization/usage_completions_params.rbs +35 -12
  37. data/sig/openai/models/admin/organization/usage_completions_response.rbs +5 -0
  38. data/sig/openai/models/admin/organization/usage_costs_params.rbs +43 -19
  39. data/sig/openai/models/admin/organization/usage_costs_response.rbs +38 -21
  40. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +5 -0
  41. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +5 -0
  42. data/sig/openai/models/admin/organization/usage_images_response.rbs +5 -0
  43. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +5 -0
  44. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +5 -0
  45. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +5 -0
  46. data/sig/openai/resources/admin/organization/usage.rbs +1 -1
  47. metadata +1 -1
@@ -214,6 +214,9 @@ module OpenAI
214
214
  sig { returns(T.nilable(T::Boolean)) }
215
215
  attr_accessor :batch
216
216
 
217
+ sig { returns(T.nilable(String)) }
218
+ attr_accessor :completion_window
219
+
217
220
  # The aggregated number of uncached audio input tokens used.
218
221
  sig { returns(T.nilable(Integer)) }
219
222
  attr_reader :input_audio_tokens
@@ -353,6 +356,8 @@ module OpenAI
353
356
 
354
357
  batch: T.nilable(T::Boolean),
355
358
 
359
+ completion_window: T.nilable(String),
360
+
356
361
  input_audio_tokens: Integer,
357
362
 
358
363
  input_cache_write_12h_tokens: Integer,
@@ -422,6 +427,8 @@ module OpenAI
422
427
  # batch or not.
423
428
  batch: nil,
424
429
 
430
+ completion_window: nil,
431
+
425
432
  # The aggregated number of uncached audio input tokens used.
426
433
  input_audio_tokens: nil,
427
434
 
@@ -502,6 +509,7 @@ module OpenAI
502
509
  OpenAI::Models::Admin::Organization::UsageWebSearchCallsResponse::Data::Result::OrganizationUsageCompletionsResult::APISource::TaggedSymbol
503
510
  ),
504
511
  batch: T.nilable(T::Boolean),
512
+ completion_window: T.nilable(String),
505
513
  input_audio_tokens: Integer,
506
514
  input_cache_write_12h_tokens: Integer,
507
515
  input_cache_write_30m_tokens: T.nilable(Integer),
@@ -178,11 +178,18 @@ module OpenAI
178
178
  bucket_width: nil,
179
179
  # End time (Unix seconds) of the query time range, exclusive.
180
180
  end_time: nil,
181
- # Group the usage data by the specified fields. Support fields include
181
+ # Group the usage data by the specified fields. Supported fields include
182
182
  # `project_id`, `user_id`, `api_key_id`, `model`, `batch`, `service_tier`,
183
- # `api_source` or any combination of them. When grouped by `api_source`, results
184
- # use `agents_api` for attributed Agents API activity and `unlabeled` for all
185
- # other activity. Without source grouping, `api_source` is null.
183
+ # `api_source`, `completion_window` or any combination of them. When grouped by
184
+ # `api_source`, results use `agents_api` for attributed Agents API activity and
185
+ # `unlabeled` for all other activity. Without source grouping, `api_source` is
186
+ # null. When grouped by `completion_window`, results use `2h`, `8h`, or
187
+ # `unlabeled` when no known or applicable window is available. Without window
188
+ # grouping, `completion_window` is null. Unlabeled does not imply Standard
189
+ # traffic. The field may be omitted when completion-window reporting is
190
+ # unavailable. Completion window is separate from `service_tier`; Batch's 24h
191
+ # window and legacy Flex scheduling are not included. Keep the same grouping and
192
+ # filters when following `next_page`.
186
193
  group_by: nil,
187
194
  # Specifies the number of buckets to return.
188
195
  #
@@ -217,7 +224,7 @@ module OpenAI
217
224
  project_ids: T::Array[String],
218
225
  request_options: OpenAI::RequestOptions::OrHash
219
226
  )
220
- .returns(OpenAI::Admin::Organization::UsageCostsResponse)
227
+ .returns(OpenAI::Models::Admin::Organization::UsageCostsResponse)
221
228
  }
222
229
  def costs(
223
230
  # Start time (Unix seconds) of the query time range, inclusive.
@@ -230,12 +237,18 @@ module OpenAI
230
237
  # End time (Unix seconds) of the query time range, exclusive.
231
238
  end_time: nil,
232
239
  # Group the costs by the specified fields. Supported fields include `project_id`,
233
- # `user_id`, `line_item`, `api_key_id`, and `api_source`. Support for combining
234
- # `user_id` with `project_id` grouping or the `project_ids` filter depends on the
235
- # organization and requested time range. Unsupported combinations return HTTP 400.
236
- # When grouped by `api_source`, results use `agents_api` for attributed Agents API
237
- # activity and `unlabeled` for all other activity. Without source grouping,
238
- # `api_source` is null.
240
+ # `user_id`, `line_item`, `api_key_id`, `api_source`, and `completion_window`.
241
+ # Support for combining `user_id` with `project_id` grouping or the `project_ids`
242
+ # filter depends on the organization and requested time range. Unsupported
243
+ # combinations return HTTP 400. When grouped by `api_source`, results use
244
+ # `agents_api` for attributed Agents API activity and `unlabeled` for all other
245
+ # activity. Without source grouping, `api_source` is null. When grouped by
246
+ # `completion_window`, results use `2h`, `8h`, or `unlabeled` when no known or
247
+ # applicable window is available. Without window grouping, `completion_window` is
248
+ # null. Unlabeled does not imply Standard traffic. The field may be omitted when
249
+ # completion-window reporting is unavailable. Batch's 24h window and legacy Flex
250
+ # scheduling are not included. Existing line item names and exact-name filters are
251
+ # unchanged. Keep the same grouping and filters when following `next_page`.
239
252
  group_by: nil,
240
253
  # A limit on the number of buckets to be returned. Limit can range between 1 and
241
254
  # 180, and the default is 7.
@@ -89,6 +89,7 @@ module OpenAI
89
89
  ?api_key_id: String?,
90
90
  ?api_source: OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
91
91
  ?batch: bool?,
92
+ ?completion_window: String?,
92
93
  ?input_audio_tokens: Integer,
93
94
  ?:input_cache_write_12h_tokens => Integer,
94
95
  ?:input_cache_write_30m_tokens => Integer?,
@@ -139,6 +140,8 @@ module OpenAI
139
140
  # batch or not.
140
141
  attr_accessor batch: bool?
141
142
 
143
+ attr_accessor completion_window: String?
144
+
142
145
  # The aggregated number of uncached audio input tokens used.
143
146
  attr_reader input_audio_tokens: Integer?
144
147
 
@@ -321,6 +324,7 @@ module OpenAI
321
324
  ?api_key_id: String?,
322
325
  ?api_source: OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
323
326
  ?batch: bool?,
327
+ ?completion_window: String?,
324
328
  ?input_audio_tokens: Integer,
325
329
  ?input_cache_write_12h_tokens: Integer,
326
330
  ?input_cache_write_30m_tokens: Integer?,
@@ -350,6 +354,7 @@ module OpenAI
350
354
  ?api_key_id: String?,
351
355
  ?api_source: OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
352
356
  ?batch: bool?,
357
+ ?completion_window: String?,
353
358
  ?input_audio_tokens: Integer,
354
359
  ?:input_cache_write_12h_tokens => Integer,
355
360
  ?:input_cache_write_30m_tokens => Integer?,
@@ -89,6 +89,7 @@ module OpenAI
89
89
  ?api_key_id: String?,
90
90
  ?api_source: OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
91
91
  ?batch: bool?,
92
+ ?completion_window: String?,
92
93
  ?input_audio_tokens: Integer,
93
94
  ?:input_cache_write_12h_tokens => Integer,
94
95
  ?:input_cache_write_30m_tokens => Integer?,
@@ -139,6 +140,8 @@ module OpenAI
139
140
  # batch or not.
140
141
  attr_accessor batch: bool?
141
142
 
143
+ attr_accessor completion_window: String?
144
+
142
145
  # The aggregated number of uncached audio input tokens used.
143
146
  attr_reader input_audio_tokens: Integer?
144
147
 
@@ -321,6 +324,7 @@ module OpenAI
321
324
  ?api_key_id: String?,
322
325
  ?api_source: OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
323
326
  ?batch: bool?,
327
+ ?completion_window: String?,
324
328
  ?input_audio_tokens: Integer,
325
329
  ?input_cache_write_12h_tokens: Integer,
326
330
  ?input_cache_write_30m_tokens: Integer?,
@@ -350,6 +354,7 @@ module OpenAI
350
354
  ?api_key_id: String?,
351
355
  ?api_source: OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
352
356
  ?batch: bool?,
357
+ ?completion_window: String?,
353
358
  ?input_audio_tokens: Integer,
354
359
  ?:input_cache_write_12h_tokens => Integer,
355
360
  ?:input_cache_write_30m_tokens => Integer?,
@@ -89,6 +89,7 @@ module OpenAI
89
89
  ?api_key_id: String?,
90
90
  ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
91
91
  ?batch: bool?,
92
+ ?completion_window: String?,
92
93
  ?input_audio_tokens: Integer,
93
94
  ?:input_cache_write_12h_tokens => Integer,
94
95
  ?:input_cache_write_30m_tokens => Integer?,
@@ -139,6 +140,8 @@ module OpenAI
139
140
  # batch or not.
140
141
  attr_accessor batch: bool?
141
142
 
143
+ attr_accessor completion_window: String?
144
+
142
145
  # The aggregated number of uncached audio input tokens used.
143
146
  attr_reader input_audio_tokens: Integer?
144
147
 
@@ -321,6 +324,7 @@ module OpenAI
321
324
  ?api_key_id: String?,
322
325
  ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
323
326
  ?batch: bool?,
327
+ ?completion_window: String?,
324
328
  ?input_audio_tokens: Integer,
325
329
  ?input_cache_write_12h_tokens: Integer,
326
330
  ?input_cache_write_30m_tokens: Integer?,
@@ -350,6 +354,7 @@ module OpenAI
350
354
  ?api_key_id: String?,
351
355
  ?api_source: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
352
356
  ?batch: bool?,
357
+ ?completion_window: String?,
353
358
  ?input_audio_tokens: Integer,
354
359
  ?:input_cache_write_12h_tokens => Integer,
355
360
  ?:input_cache_write_30m_tokens => Integer?,
@@ -55,18 +55,32 @@ module OpenAI
55
55
  # End time (Unix seconds) of the query time range, exclusive.
56
56
  def end_time=: (Integer) -> Integer
57
57
 
58
- # Group the usage data by the specified fields. Support fields include
58
+ # Group the usage data by the specified fields. Supported fields include
59
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.
60
+ # `api_source`, `completion_window` or any combination of them. When grouped by
61
+ # `api_source`, results use `agents_api` for attributed Agents API activity and
62
+ # `unlabeled` for all other activity. Without source grouping, `api_source` is
63
+ # null. When grouped by `completion_window`, results use `2h`, `8h`, or
64
+ # `unlabeled` when no known or applicable window is available. Without window
65
+ # grouping, `completion_window` is null. Unlabeled does not imply Standard
66
+ # traffic. The field may be omitted when completion-window reporting is
67
+ # unavailable. Completion window is separate from `service_tier`; Batch's 24h
68
+ # window and legacy Flex scheduling are not included. Keep the same grouping and
69
+ # filters when following `next_page`.
63
70
  attr_reader group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsParams::group_by]?
64
71
 
65
- # Group the usage data by the specified fields. Support fields include
72
+ # Group the usage data by the specified fields. Supported fields include
66
73
  # `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.
74
+ # `api_source`, `completion_window` or any combination of them. When grouped by
75
+ # `api_source`, results use `agents_api` for attributed Agents API activity and
76
+ # `unlabeled` for all other activity. Without source grouping, `api_source` is
77
+ # null. When grouped by `completion_window`, results use `2h`, `8h`, or
78
+ # `unlabeled` when no known or applicable window is available. Without window
79
+ # grouping, `completion_window` is null. Unlabeled does not imply Standard
80
+ # traffic. The field may be omitted when completion-window reporting is
81
+ # unavailable. Completion window is separate from `service_tier`; Batch's 24h
82
+ # window and legacy Flex scheduling are not included. Keep the same grouping and
83
+ # filters when following `next_page`.
70
84
  def group_by=: (
71
85
  ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsParams::group_by]
72
86
  ) -> ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsParams::group_by]
@@ -124,11 +138,18 @@ module OpenAI
124
138
  # @param end_time
125
139
  # End time (Unix seconds) of the query time range, exclusive.
126
140
  # @param group_by
127
- # Group the usage data by the specified fields. Support fields include
141
+ # Group the usage data by the specified fields. Supported fields include
128
142
  # `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.
143
+ # `api_source`, `completion_window` or any combination of them. When grouped by
144
+ # `api_source`, results use `agents_api` for attributed Agents API activity and
145
+ # `unlabeled` for all other activity. Without source grouping, `api_source` is
146
+ # null. When grouped by `completion_window`, results use `2h`, `8h`, or
147
+ # `unlabeled` when no known or applicable window is available. Without window
148
+ # grouping, `completion_window` is null. Unlabeled does not imply Standard
149
+ # traffic. The field may be omitted when completion-window reporting is
150
+ # unavailable. Completion window is separate from `service_tier`; Batch's 24h
151
+ # window and legacy Flex scheduling are not included. Keep the same grouping and
152
+ # filters when following `next_page`.
132
153
  # @param limit
133
154
  # Specifies the number of buckets to return.
134
155
  #
@@ -194,6 +215,7 @@ module OpenAI
194
215
  | :batch
195
216
  | :service_tier
196
217
  | :api_source
218
+ | :completion_window
197
219
 
198
220
  module GroupBy
199
221
  extend OpenAI::Internal::Type::Enum
@@ -205,6 +227,7 @@ module OpenAI
205
227
  BATCH: :batch
206
228
  SERVICE_TIER: :service_tier
207
229
  API_SOURCE: :api_source
230
+ COMPLETION_WINDOW: :completion_window
208
231
 
209
232
  def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::UsageCompletionsParams::group_by]
210
233
  end
@@ -89,6 +89,7 @@ module OpenAI
89
89
  ?api_key_id: String?,
90
90
  ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
91
91
  ?batch: bool?,
92
+ ?completion_window: String?,
92
93
  ?input_audio_tokens: Integer,
93
94
  ?:input_cache_write_12h_tokens => Integer,
94
95
  ?:input_cache_write_30m_tokens => Integer?,
@@ -139,6 +140,8 @@ module OpenAI
139
140
  # batch or not.
140
141
  attr_accessor batch: bool?
141
142
 
143
+ attr_accessor completion_window: String?
144
+
142
145
  # The aggregated number of uncached audio input tokens used.
143
146
  attr_reader input_audio_tokens: Integer?
144
147
 
@@ -321,6 +324,7 @@ module OpenAI
321
324
  ?api_key_id: String?,
322
325
  ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
323
326
  ?batch: bool?,
327
+ ?completion_window: String?,
324
328
  ?input_audio_tokens: Integer,
325
329
  ?input_cache_write_12h_tokens: Integer,
326
330
  ?input_cache_write_30m_tokens: Integer?,
@@ -350,6 +354,7 @@ module OpenAI
350
354
  ?api_key_id: String?,
351
355
  ?api_source: OpenAI::Models::Admin::Organization::UsageCompletionsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
352
356
  ?batch: bool?,
357
+ ?completion_window: String?,
353
358
  ?input_audio_tokens: Integer,
354
359
  ?:input_cache_write_12h_tokens => Integer,
355
360
  ?:input_cache_write_30m_tokens => Integer?,
@@ -46,21 +46,33 @@ module OpenAI
46
46
  def end_time=: (Integer) -> Integer
47
47
 
48
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.
49
+ # `user_id`, `line_item`, `api_key_id`, `api_source`, and `completion_window`.
50
+ # Support for combining `user_id` with `project_id` grouping or the `project_ids`
51
+ # filter depends on the organization and requested time range. Unsupported
52
+ # combinations return HTTP 400. When grouped by `api_source`, results use
53
+ # `agents_api` for attributed Agents API activity and `unlabeled` for all other
54
+ # activity. Without source grouping, `api_source` is null. When grouped by
55
+ # `completion_window`, results use `2h`, `8h`, or `unlabeled` when no known or
56
+ # applicable window is available. Without window grouping, `completion_window` is
57
+ # null. Unlabeled does not imply Standard traffic. The field may be omitted when
58
+ # completion-window reporting is unavailable. Batch's 24h window and legacy Flex
59
+ # scheduling are not included. Existing line item names and exact-name filters are
60
+ # unchanged. Keep the same grouping and filters when following `next_page`.
55
61
  attr_reader group_by: ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by]?
56
62
 
57
63
  # 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.
64
+ # `user_id`, `line_item`, `api_key_id`, `api_source`, and `completion_window`.
65
+ # Support for combining `user_id` with `project_id` grouping or the `project_ids`
66
+ # filter depends on the organization and requested time range. Unsupported
67
+ # combinations return HTTP 400. When grouped by `api_source`, results use
68
+ # `agents_api` for attributed Agents API activity and `unlabeled` for all other
69
+ # activity. Without source grouping, `api_source` is null. When grouped by
70
+ # `completion_window`, results use `2h`, `8h`, or `unlabeled` when no known or
71
+ # applicable window is available. Without window grouping, `completion_window` is
72
+ # null. Unlabeled does not imply Standard traffic. The field may be omitted when
73
+ # completion-window reporting is unavailable. Batch's 24h window and legacy Flex
74
+ # scheduling are not included. Existing line item names and exact-name filters are
75
+ # unchanged. Keep the same grouping and filters when following `next_page`.
64
76
  def group_by=: (
65
77
  ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by]
66
78
  ) -> ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by]
@@ -106,12 +118,18 @@ module OpenAI
106
118
  # End time (Unix seconds) of the query time range, exclusive.
107
119
  # @param group_by
108
120
  # 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.
121
+ # `user_id`, `line_item`, `api_key_id`, `api_source`, and `completion_window`.
122
+ # Support for combining `user_id` with `project_id` grouping or the `project_ids`
123
+ # filter depends on the organization and requested time range. Unsupported
124
+ # combinations return HTTP 400. When grouped by `api_source`, results use
125
+ # `agents_api` for attributed Agents API activity and `unlabeled` for all other
126
+ # activity. Without source grouping, `api_source` is null. When grouped by
127
+ # `completion_window`, results use `2h`, `8h`, or `unlabeled` when no known or
128
+ # applicable window is available. Without window grouping, `completion_window` is
129
+ # null. Unlabeled does not imply Standard traffic. The field may be omitted when
130
+ # completion-window reporting is unavailable. Batch's 24h window and legacy Flex
131
+ # scheduling are not included. Existing line item names and exact-name filters are
132
+ # unchanged. Keep the same grouping and filters when following `next_page`.
115
133
  # @param limit
116
134
  # A limit on the number of buckets to be returned. Limit can range between 1 and
117
135
  # 180, and the default is 7.
@@ -160,7 +178,12 @@ module OpenAI
160
178
  end
161
179
 
162
180
  type group_by =
163
- :project_id | :user_id | :line_item | :api_key_id | :api_source
181
+ :project_id
182
+ | :user_id
183
+ | :line_item
184
+ | :api_key_id
185
+ | :api_source
186
+ | :completion_window
164
187
 
165
188
  module GroupBy
166
189
  extend OpenAI::Internal::Type::Enum
@@ -170,6 +193,7 @@ module OpenAI
170
193
  LINE_ITEM: :line_item
171
194
  API_KEY_ID: :api_key_id
172
195
  API_SOURCE: :api_source
196
+ COMPLETION_WINDOW: :completion_window
173
197
 
174
198
  def self?.values: -> ::Array[OpenAI::Models::Admin::Organization::UsageCostsParams::group_by]
175
199
  end
@@ -4,14 +4,14 @@ module OpenAI
4
4
  module Organization
5
5
  type usage_costs_response =
6
6
  {
7
- data: ::Array[OpenAI::Admin::Organization::UsageCostsResponse::Data],
7
+ data: ::Array[OpenAI::Models::Admin::Organization::UsageCostsResponse::Data],
8
8
  has_more: bool,
9
9
  next_page: String?,
10
10
  ?object: :page
11
11
  }
12
12
 
13
13
  class UsageCostsResponse < OpenAI::Internal::Type::BaseModel
14
- attr_accessor data: ::Array[OpenAI::Admin::Organization::UsageCostsResponse::Data]
14
+ attr_accessor data: ::Array[OpenAI::Models::Admin::Organization::UsageCostsResponse::Data]
15
15
 
16
16
  attr_accessor has_more: bool
17
17
 
@@ -20,14 +20,14 @@ module OpenAI
20
20
  attr_accessor object: :page
21
21
 
22
22
  def initialize: (
23
- data: ::Array[OpenAI::Admin::Organization::UsageCostsResponse::Data],
23
+ data: ::Array[OpenAI::Models::Admin::Organization::UsageCostsResponse::Data],
24
24
  has_more: bool,
25
25
  next_page: String?,
26
26
  ?object: :page
27
27
  ) -> void
28
28
 
29
29
  def to_hash: -> {
30
- data: ::Array[OpenAI::Admin::Organization::UsageCostsResponse::Data],
30
+ data: ::Array[OpenAI::Models::Admin::Organization::UsageCostsResponse::Data],
31
31
  has_more: bool,
32
32
  next_page: String?,
33
33
  ?object: :page
@@ -65,17 +65,17 @@ module OpenAI
65
65
  }
66
66
 
67
67
  type result =
68
- OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageCompletionsResult
69
- | OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageEmbeddingsResult
70
- | OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageModerationsResult
71
- | OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageImagesResult
72
- | OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageAudioSpeechesResult
73
- | OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageAudioTranscriptionsResult
74
- | OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageVectorStoresResult
75
- | OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageCodeInterpreterSessionsResult
76
- | OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageFileSearchesResult
77
- | OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageWebSearchesResult
78
- | OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult
68
+ OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageCompletionsResult
69
+ | OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageEmbeddingsResult
70
+ | OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageModerationsResult
71
+ | OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageImagesResult
72
+ | OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageAudioSpeechesResult
73
+ | OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageAudioTranscriptionsResult
74
+ | OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageVectorStoresResult
75
+ | OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageCodeInterpreterSessionsResult
76
+ | OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageFileSearchesResult
77
+ | OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageWebSearchesResult
78
+ | OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult
79
79
 
80
80
  module Result
81
81
  extend OpenAI::Internal::Type::Union
@@ -89,6 +89,7 @@ module OpenAI
89
89
  ?api_key_id: String?,
90
90
  ?api_source: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
91
91
  ?batch: bool?,
92
+ ?completion_window: String?,
92
93
  ?input_audio_tokens: Integer,
93
94
  ?:input_cache_write_12h_tokens => Integer,
94
95
  ?:input_cache_write_30m_tokens => Integer?,
@@ -139,6 +140,8 @@ module OpenAI
139
140
  # batch or not.
140
141
  attr_accessor batch: bool?
141
142
 
143
+ attr_accessor completion_window: String?
144
+
142
145
  # The aggregated number of uncached audio input tokens used.
143
146
  attr_reader input_audio_tokens: Integer?
144
147
 
@@ -321,6 +324,7 @@ module OpenAI
321
324
  ?api_key_id: String?,
322
325
  ?api_source: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
323
326
  ?batch: bool?,
327
+ ?completion_window: String?,
324
328
  ?input_audio_tokens: Integer,
325
329
  ?input_cache_write_12h_tokens: Integer,
326
330
  ?input_cache_write_30m_tokens: Integer?,
@@ -350,6 +354,7 @@ module OpenAI
350
354
  ?api_key_id: String?,
351
355
  ?api_source: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
352
356
  ?batch: bool?,
357
+ ?completion_window: String?,
353
358
  ?input_audio_tokens: Integer,
354
359
  ?:input_cache_write_12h_tokens => Integer,
355
360
  ?:input_cache_write_30m_tokens => Integer?,
@@ -1013,9 +1018,10 @@ module OpenAI
1013
1018
  type organization_costs_result =
1014
1019
  {
1015
1020
  ?object: :"organization.costs.result",
1016
- ?amount: OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount,
1021
+ ?amount: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount,
1017
1022
  ?api_key_id: String?,
1018
1023
  ?api_source: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::api_source?,
1024
+ ?completion_window: String?,
1019
1025
  ?line_item: String?,
1020
1026
  ?model: String?,
1021
1027
  ?project_id: String?,
@@ -1029,12 +1035,12 @@ module OpenAI
1029
1035
  attr_accessor object: :"organization.costs.result"
1030
1036
 
1031
1037
  # The monetary value in its associated currency.
1032
- attr_reader amount: OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount?
1038
+ attr_reader amount: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount?
1033
1039
 
1034
1040
  # The monetary value in its associated currency.
1035
1041
  def amount=: (
1036
- OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount
1037
- ) -> OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount
1042
+ OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount
1043
+ ) -> OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount
1038
1044
 
1039
1045
  # When `group_by=api_key_id`, this field provides the API Key ID of the grouped
1040
1046
  # costs result.
@@ -1046,6 +1052,11 @@ module OpenAI
1046
1052
  # direct API usage. Without source grouping, this field is null.
1047
1053
  attr_accessor api_source: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::api_source?
1048
1054
 
1055
+ # The background completion window for this result. When group_by includes
1056
+ # completion_window, the value is 2h, 8h, or unlabeled if the window is unknown or
1057
+ # does not apply. Otherwise, the value is null.
1058
+ attr_accessor completion_window: String?
1059
+
1049
1060
  # When `group_by=line_item`, this field provides the line item of the grouped
1050
1061
  # costs result.
1051
1062
  attr_accessor line_item: String?
@@ -1090,6 +1101,10 @@ module OpenAI
1090
1101
  # activity and `unlabeled` includes all records without published source
1091
1102
  # attribution, including historical and unknown origins. Unlabeled does not imply
1092
1103
  # direct API usage. Without source grouping, this field is null.
1104
+ # @param completion_window
1105
+ # The background completion window for this result. When group_by includes
1106
+ # completion_window, the value is 2h, 8h, or unlabeled if the window is unknown or
1107
+ # does not apply. Otherwise, the value is null.
1093
1108
  # @param line_item
1094
1109
  # When `group_by=line_item`, this field provides the line item of the grouped
1095
1110
  # costs result.
@@ -1118,9 +1133,10 @@ module OpenAI
1118
1133
  # When `group_by=user_id`, this field provides the user ID of the grouped costs
1119
1134
  # result.
1120
1135
  def initialize: (
1121
- ?amount: OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount,
1136
+ ?amount: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount,
1122
1137
  ?api_key_id: String?,
1123
1138
  ?api_source: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::api_source?,
1139
+ ?completion_window: String?,
1124
1140
  ?line_item: String?,
1125
1141
  ?model: String?,
1126
1142
  ?project_id: String?,
@@ -1133,9 +1149,10 @@ module OpenAI
1133
1149
 
1134
1150
  def to_hash: -> {
1135
1151
  ?object: :"organization.costs.result",
1136
- ?amount: OpenAI::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount,
1152
+ ?amount: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::Amount,
1137
1153
  ?api_key_id: String?,
1138
1154
  ?api_source: OpenAI::Models::Admin::Organization::UsageCostsResponse::Data::Result::OrganizationCostsResult::api_source?,
1155
+ ?completion_window: String?,
1139
1156
  ?line_item: String?,
1140
1157
  ?model: String?,
1141
1158
  ?project_id: String?,
@@ -89,6 +89,7 @@ module OpenAI
89
89
  ?api_key_id: String?,
90
90
  ?api_source: OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
91
91
  ?batch: bool?,
92
+ ?completion_window: String?,
92
93
  ?input_audio_tokens: Integer,
93
94
  ?:input_cache_write_12h_tokens => Integer,
94
95
  ?:input_cache_write_30m_tokens => Integer?,
@@ -139,6 +140,8 @@ module OpenAI
139
140
  # batch or not.
140
141
  attr_accessor batch: bool?
141
142
 
143
+ attr_accessor completion_window: String?
144
+
142
145
  # The aggregated number of uncached audio input tokens used.
143
146
  attr_reader input_audio_tokens: Integer?
144
147
 
@@ -321,6 +324,7 @@ module OpenAI
321
324
  ?api_key_id: String?,
322
325
  ?api_source: OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
323
326
  ?batch: bool?,
327
+ ?completion_window: String?,
324
328
  ?input_audio_tokens: Integer,
325
329
  ?input_cache_write_12h_tokens: Integer,
326
330
  ?input_cache_write_30m_tokens: Integer?,
@@ -350,6 +354,7 @@ module OpenAI
350
354
  ?api_key_id: String?,
351
355
  ?api_source: OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
352
356
  ?batch: bool?,
357
+ ?completion_window: String?,
353
358
  ?input_audio_tokens: Integer,
354
359
  ?:input_cache_write_12h_tokens => Integer,
355
360
  ?:input_cache_write_30m_tokens => Integer?,
@@ -89,6 +89,7 @@ module OpenAI
89
89
  ?api_key_id: String?,
90
90
  ?api_source: OpenAI::Models::Admin::Organization::UsageFileSearchCallsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
91
91
  ?batch: bool?,
92
+ ?completion_window: String?,
92
93
  ?input_audio_tokens: Integer,
93
94
  ?:input_cache_write_12h_tokens => Integer,
94
95
  ?:input_cache_write_30m_tokens => Integer?,
@@ -139,6 +140,8 @@ module OpenAI
139
140
  # batch or not.
140
141
  attr_accessor batch: bool?
141
142
 
143
+ attr_accessor completion_window: String?
144
+
142
145
  # The aggregated number of uncached audio input tokens used.
143
146
  attr_reader input_audio_tokens: Integer?
144
147
 
@@ -321,6 +324,7 @@ module OpenAI
321
324
  ?api_key_id: String?,
322
325
  ?api_source: OpenAI::Models::Admin::Organization::UsageFileSearchCallsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
323
326
  ?batch: bool?,
327
+ ?completion_window: String?,
324
328
  ?input_audio_tokens: Integer,
325
329
  ?input_cache_write_12h_tokens: Integer,
326
330
  ?input_cache_write_30m_tokens: Integer?,
@@ -350,6 +354,7 @@ module OpenAI
350
354
  ?api_key_id: String?,
351
355
  ?api_source: OpenAI::Models::Admin::Organization::UsageFileSearchCallsResponse::Data::Result::OrganizationUsageCompletionsResult::api_source?,
352
356
  ?batch: bool?,
357
+ ?completion_window: String?,
353
358
  ?input_audio_tokens: Integer,
354
359
  ?:input_cache_write_12h_tokens => Integer,
355
360
  ?:input_cache_write_30m_tokens => Integer?,