NAME
OpenAPI::Client::OpenAI::Path::organization-usage-completions - Documentation for the /organization/usage/completions path.
OPERATIONS
GET /organization/usage/completions
usage-completions
$client->usage_completions({
body => { ... },
});
Get completions usage details for the organization.
Path/query parameters
start_time(in query, required, integer) - Start time (Unix seconds) of the query time range, inclusive.end_time(in query, optional, integer) - End time (Unix seconds) of the query time range, exclusive.bucket_width(in query, optional, string) - Width of each time bucket in response. Currently1m,1hand1dare supported, default to1d.Allowed values: 1m, 1h, 1d
Default: 1d
project_ids(in query, optional, array) - Return only usage for these projects.user_ids(in query, optional, array) - Return only usage for these users.api_key_ids(in query, optional, array) - Return only usage for these API keys.models(in query, optional, array) - Return only usage for these models.batch(in query, optional, boolean) - Iftrue, return batch jobs only. Iffalse, return non-batch jobs only. By default, return both.group_by(in query, optional, array) - Group the usage data by the specified fields. Support fields includeproject_id,user_id,api_key_id,model,batch,service_tieror any combination of them.limit(in query, optional, integer) - Specifies the number of buckets to return. -bucket_width=1d: default: 7, max: 31 -bucket_width=1h: default: 24, max: 168 -bucket_width=1m: default: 60, max: 1440page(in query, optional, string) - A cursor for use in pagination. Corresponding to thenext_pagefield from the previous response.
Responses
200 - Usage data retrieved successfully.
Content-Type: application/json
Example:
{
"data" : [
{
"end_time" : 0,
"object" : "bucket",
"results" : [
"{\n \"object\": \"organization.usage.completions.result\",\n \"input_tokens\": 5000,\n \"output_tokens\": 1000,\n \"input_cached_tokens\": 4000,\n \"input_audio_tokens\": 300,\n \"output_audio_tokens\": 200,\n \"num_model_requests\": 5,\n \"project_id\": \"proj_abc\",\n \"user_id\": \"user-abc\",\n \"api_key_id\": \"key_abc\",\n \"model\": \"gpt-4o-mini-2024-07-18\",\n \"batch\": false,\n \"service_tier\": \"default\"\n}\n"
],
"start_time" : 0
}
],
"has_more" : false,
"next_page" : "string",
"object" : "page"
}
SCHEMAS
UsageResponse
Properties:
data(array of UsageTimeBucket, required)has_more(boolean, required)next_page(anyOf, required)object(string, required)Allowed values: page
UsageTimeBucket
Properties:
end_time(integer, required)object(string, required)Allowed values: bucket
results(array of object, required)start_time(integer, required)
SEE ALSO
COPYRIGHT AND LICENSE
Copyright (C) 2023-2026 by Nelson Ferraz
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.