Costs
GET/organization/costs
Get costs details for the organization.
Query Parameters
start_time: number
Start time (Unix seconds) of the query time range, inclusive.
bucket_width: optional "1d"
Width of each time bucket in response. Currently only 1d is supported, default to 1d.
end_time: optional number
End time (Unix seconds) of the query time range, exclusive.
limit: optional number
A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7.
page: optional string
A cursor for use in pagination. Corresponding to the next_page field from the previous response.
project_ids: optional array of string
Return only costs for these projects.
Returns
has_more: boolean
next_page: string
object: "page"
Costs
curl https://api.openai.com/v1/organization/costs \
-H "Authorization: Bearer $OPENAI_API_KEY"{
"data": [
{
"end_time": 0,
"object": "bucket",
"result": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}Returns Examples
{
"data": [
{
"end_time": 0,
"object": "bucket",
"result": [
{
"input_tokens": 0,
"num_model_requests": 0,
"object": "organization.usage.completions.result",
"output_tokens": 0,
"api_key_id": "api_key_id",
"batch": true,
"input_audio_tokens": 0,
"input_cached_tokens": 0,
"model": "model",
"output_audio_tokens": 0,
"project_id": "project_id",
"service_tier": "service_tier",
"user_id": "user_id"
}
],
"start_time": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "page"
}