Class: OpenAI::Resources::Admin::Organization::Usage

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/admin/organization/usage.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Usage

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Usage.

Parameters:



409
410
411
# File 'lib/openai/resources/admin/organization/usage.rb', line 409

def initialize(client:)
  @client = client
end

Instance Method Details

#audio_speeches(start_time:, api_key_ids: nil, bucket_width: nil, end_time: nil, group_by: nil, limit: nil, models: nil, page: nil, project_ids: nil, user_ids: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse

Some parameter documentations has been truncated, see Models::Admin::Organization::UsageAudioSpeechesParams for more details.

Get audio speeches usage details for the organization.

Parameters:

  • start_time (Integer)

    Start time (Unix seconds) of the query time range, inclusive.

  • api_key_ids (Array<String>)

    Return only usage for these API keys.

  • bucket_width (Symbol, OpenAI::Models::Admin::Organization::UsageAudioSpeechesParams::BucketWidth)

    Width of each time bucket in response. Currently ‘1m`, `1h` and `1d` are support

  • end_time (Integer)

    End time (Unix seconds) of the query time range, exclusive.

  • group_by (Array<Symbol, OpenAI::Models::Admin::Organization::UsageAudioSpeechesParams::GroupBy>)

    Group the usage data by the specified fields. Support fields include ‘project_id

  • limit (Integer)

    Specifies the number of buckets to return.

  • models (Array<String>)

    Return only usage for these models.

  • page (String)

    A cursor for use in pagination. Corresponding to the ‘next_page` field from the

  • project_ids (Array<String>)

    Return only usage for these projects.

  • user_ids (Array<String>)

    Return only usage for these users.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/openai/resources/admin/organization/usage.rb', line 41

def audio_speeches(params)
  parsed, options = OpenAI::Admin::Organization::UsageAudioSpeechesParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "organization/usage/audio_speeches",
    query: query,
    model: OpenAI::Models::Admin::Organization::UsageAudioSpeechesResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#audio_transcriptions(start_time:, api_key_ids: nil, bucket_width: nil, end_time: nil, group_by: nil, limit: nil, models: nil, page: nil, project_ids: nil, user_ids: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse

Some parameter documentations has been truncated, see Models::Admin::Organization::UsageAudioTranscriptionsParams for more details.

Get audio transcriptions usage details for the organization.

Parameters:

  • start_time (Integer)

    Start time (Unix seconds) of the query time range, inclusive.

  • api_key_ids (Array<String>)

    Return only usage for these API keys.

  • bucket_width (Symbol, OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsParams::BucketWidth)

    Width of each time bucket in response. Currently ‘1m`, `1h` and `1d` are support

  • end_time (Integer)

    End time (Unix seconds) of the query time range, exclusive.

  • group_by (Array<Symbol, OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsParams::GroupBy>)

    Group the usage data by the specified fields. Support fields include ‘project_id

  • limit (Integer)

    Specifies the number of buckets to return.

  • models (Array<String>)

    Return only usage for these models.

  • page (String)

    A cursor for use in pagination. Corresponding to the ‘next_page` field from the

  • project_ids (Array<String>)

    Return only usage for these projects.

  • user_ids (Array<String>)

    Return only usage for these users.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/openai/resources/admin/organization/usage.rb', line 87

def audio_transcriptions(params)
  parsed, options = OpenAI::Admin::Organization::UsageAudioTranscriptionsParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "organization/usage/audio_transcriptions",
    query: query,
    model: OpenAI::Models::Admin::Organization::UsageAudioTranscriptionsResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#code_interpreter_sessions(start_time:, bucket_width: nil, end_time: nil, group_by: nil, limit: nil, page: nil, project_ids: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse

Some parameter documentations has been truncated, see Models::Admin::Organization::UsageCodeInterpreterSessionsParams for more details.

Get code interpreter sessions usage details for the organization.

Parameters:

Returns:

See Also:



127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/openai/resources/admin/organization/usage.rb', line 127

def code_interpreter_sessions(params)
  parsed, options = OpenAI::Admin::Organization::UsageCodeInterpreterSessionsParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "organization/usage/code_interpreter_sessions",
    query: query,
    model: OpenAI::Models::Admin::Organization::UsageCodeInterpreterSessionsResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#completions(start_time:, api_key_ids: nil, batch: nil, bucket_width: nil, end_time: nil, group_by: nil, limit: nil, models: nil, page: nil, project_ids: nil, user_ids: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::UsageCompletionsResponse

Some parameter documentations has been truncated, see Models::Admin::Organization::UsageCompletionsParams for more details.

Get completions usage details for the organization.

Parameters:

  • start_time (Integer)

    Start time (Unix seconds) of the query time range, inclusive.

  • api_key_ids (Array<String>)

    Return only usage for these API keys.

  • batch (Boolean)

    If ‘true`, return batch jobs only. If `false`, return non-batch jobs only. By de

  • bucket_width (Symbol, OpenAI::Models::Admin::Organization::UsageCompletionsParams::BucketWidth)

    Width of each time bucket in response. Currently ‘1m`, `1h` and `1d` are support

  • end_time (Integer)

    End time (Unix seconds) of the query time range, exclusive.

  • group_by (Array<Symbol, OpenAI::Models::Admin::Organization::UsageCompletionsParams::GroupBy>)

    Group the usage data by the specified fields. Support fields include ‘project_id

  • limit (Integer)

    Specifies the number of buckets to return.

  • models (Array<String>)

    Return only usage for these models.

  • page (String)

    A cursor for use in pagination. Corresponding to the ‘next_page` field from the

  • project_ids (Array<String>)

    Return only usage for these projects.

  • user_ids (Array<String>)

    Return only usage for these users.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/openai/resources/admin/organization/usage.rb', line 174

def completions(params)
  parsed, options = OpenAI::Admin::Organization::UsageCompletionsParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "organization/usage/completions",
    query: query,
    model: OpenAI::Models::Admin::Organization::UsageCompletionsResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#costs(start_time:, api_key_ids: nil, bucket_width: nil, end_time: nil, group_by: nil, limit: nil, page: nil, project_ids: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::UsageCostsResponse

Some parameter documentations has been truncated, see Models::Admin::Organization::UsageCostsParams for more details.

Get costs details for the organization.

Parameters:

  • start_time (Integer)

    Start time (Unix seconds) of the query time range, inclusive.

  • api_key_ids (Array<String>)

    Return only costs for these API keys.

  • bucket_width (Symbol, OpenAI::Models::Admin::Organization::UsageCostsParams::BucketWidth)

    Width of each time bucket in response. Currently only ‘1d` is supported, default

  • end_time (Integer)

    End time (Unix seconds) of the query time range, exclusive.

  • group_by (Array<Symbol, OpenAI::Models::Admin::Organization::UsageCostsParams::GroupBy>)

    Group the costs by the specified fields. Support fields include ‘project_id`, `l

  • limit (Integer)

    A limit on the number of buckets to be returned. Limit can range between 1 and 1

  • page (String)

    A cursor for use in pagination. Corresponding to the ‘next_page` field from the

  • project_ids (Array<String>)

    Return only costs for these projects.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/openai/resources/admin/organization/usage.rb', line 215

def costs(params)
  parsed, options = OpenAI::Admin::Organization::UsageCostsParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "organization/costs",
    query: query,
    model: OpenAI::Models::Admin::Organization::UsageCostsResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#embeddings(start_time:, api_key_ids: nil, bucket_width: nil, end_time: nil, group_by: nil, limit: nil, models: nil, page: nil, project_ids: nil, user_ids: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse

Some parameter documentations has been truncated, see Models::Admin::Organization::UsageEmbeddingsParams for more details.

Get embeddings usage details for the organization.

Parameters:

  • start_time (Integer)

    Start time (Unix seconds) of the query time range, inclusive.

  • api_key_ids (Array<String>)

    Return only usage for these API keys.

  • bucket_width (Symbol, OpenAI::Models::Admin::Organization::UsageEmbeddingsParams::BucketWidth)

    Width of each time bucket in response. Currently ‘1m`, `1h` and `1d` are support

  • end_time (Integer)

    End time (Unix seconds) of the query time range, exclusive.

  • group_by (Array<Symbol, OpenAI::Models::Admin::Organization::UsageEmbeddingsParams::GroupBy>)

    Group the usage data by the specified fields. Support fields include ‘project_id

  • limit (Integer)

    Specifies the number of buckets to return.

  • models (Array<String>)

    Return only usage for these models.

  • page (String)

    A cursor for use in pagination. Corresponding to the ‘next_page` field from the

  • project_ids (Array<String>)

    Return only usage for these projects.

  • user_ids (Array<String>)

    Return only usage for these users.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/openai/resources/admin/organization/usage.rb', line 260

def embeddings(params)
  parsed, options = OpenAI::Admin::Organization::UsageEmbeddingsParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "organization/usage/embeddings",
    query: query,
    model: OpenAI::Models::Admin::Organization::UsageEmbeddingsResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#images(start_time:, api_key_ids: nil, bucket_width: nil, end_time: nil, group_by: nil, limit: nil, models: nil, page: nil, project_ids: nil, sizes: nil, sources: nil, user_ids: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::UsageImagesResponse

Some parameter documentations has been truncated, see Models::Admin::Organization::UsageImagesParams for more details.

Get images usage details for the organization.

Parameters:

  • start_time (Integer)

    Start time (Unix seconds) of the query time range, inclusive.

  • api_key_ids (Array<String>)

    Return only usage for these API keys.

  • bucket_width (Symbol, OpenAI::Models::Admin::Organization::UsageImagesParams::BucketWidth)

    Width of each time bucket in response. Currently ‘1m`, `1h` and `1d` are support

  • end_time (Integer)

    End time (Unix seconds) of the query time range, exclusive.

  • group_by (Array<Symbol, OpenAI::Models::Admin::Organization::UsageImagesParams::GroupBy>)

    Group the usage data by the specified fields. Support fields include ‘project_id

  • limit (Integer)

    Specifies the number of buckets to return.

  • models (Array<String>)

    Return only usage for these models.

  • page (String)

    A cursor for use in pagination. Corresponding to the ‘next_page` field from the

  • project_ids (Array<String>)

    Return only usage for these projects.

  • sizes (Array<Symbol, OpenAI::Models::Admin::Organization::UsageImagesParams::Size>)

    Return only usages for these image sizes. Possible values are ‘256x256`, `512x51

  • sources (Array<Symbol, OpenAI::Models::Admin::Organization::UsageImagesParams::Source>)

    Return only usages for these sources. Possible values are ‘image.generation`, `i

  • user_ids (Array<String>)

    Return only usage for these users.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/openai/resources/admin/organization/usage.rb', line 309

def images(params)
  parsed, options = OpenAI::Admin::Organization::UsageImagesParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "organization/usage/images",
    query: query,
    model: OpenAI::Models::Admin::Organization::UsageImagesResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#moderations(start_time:, api_key_ids: nil, bucket_width: nil, end_time: nil, group_by: nil, limit: nil, models: nil, page: nil, project_ids: nil, user_ids: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::UsageModerationsResponse

Some parameter documentations has been truncated, see Models::Admin::Organization::UsageModerationsParams for more details.

Get moderations usage details for the organization.

Parameters:

  • start_time (Integer)

    Start time (Unix seconds) of the query time range, inclusive.

  • api_key_ids (Array<String>)

    Return only usage for these API keys.

  • bucket_width (Symbol, OpenAI::Models::Admin::Organization::UsageModerationsParams::BucketWidth)

    Width of each time bucket in response. Currently ‘1m`, `1h` and `1d` are support

  • end_time (Integer)

    End time (Unix seconds) of the query time range, exclusive.

  • group_by (Array<Symbol, OpenAI::Models::Admin::Organization::UsageModerationsParams::GroupBy>)

    Group the usage data by the specified fields. Support fields include ‘project_id

  • limit (Integer)

    Specifies the number of buckets to return.

  • models (Array<String>)

    Return only usage for these models.

  • page (String)

    A cursor for use in pagination. Corresponding to the ‘next_page` field from the

  • project_ids (Array<String>)

    Return only usage for these projects.

  • user_ids (Array<String>)

    Return only usage for these users.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/openai/resources/admin/organization/usage.rb', line 354

def moderations(params)
  parsed, options = OpenAI::Admin::Organization::UsageModerationsParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "organization/usage/moderations",
    query: query,
    model: OpenAI::Models::Admin::Organization::UsageModerationsResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#vector_stores(start_time:, bucket_width: nil, end_time: nil, group_by: nil, limit: nil, page: nil, project_ids: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::UsageVectorStoresResponse

Some parameter documentations has been truncated, see Models::Admin::Organization::UsageVectorStoresParams for more details.

Get vector stores usage details for the organization.

Parameters:

  • start_time (Integer)

    Start time (Unix seconds) of the query time range, inclusive.

  • bucket_width (Symbol, OpenAI::Models::Admin::Organization::UsageVectorStoresParams::BucketWidth)

    Width of each time bucket in response. Currently ‘1m`, `1h` and `1d` are support

  • end_time (Integer)

    End time (Unix seconds) of the query time range, exclusive.

  • group_by (Array<Symbol, OpenAI::Models::Admin::Organization::UsageVectorStoresParams::GroupBy>)

    Group the usage data by the specified fields. Support fields include ‘project_id

  • limit (Integer)

    Specifies the number of buckets to return.

  • page (String)

    A cursor for use in pagination. Corresponding to the ‘next_page` field from the

  • project_ids (Array<String>)

    Return only usage for these projects.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/openai/resources/admin/organization/usage.rb', line 393

def vector_stores(params)
  parsed, options = OpenAI::Admin::Organization::UsageVectorStoresParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "organization/usage/vector_stores",
    query: query,
    model: OpenAI::Models::Admin::Organization::UsageVectorStoresResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end