Costs
admin.organization.usage.costs(**kwargs) -> UsageCostsResponse { data, has_more, next_page, object }
GET/organization/costs
Get costs details for the organization.
Parameters
bucket_width: :"1d"
Width of each time bucket in response. Currently only 1d is supported, default to 1d.
limit: Integer
A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7.
Costs
require "openai"
openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
response = openai.admin.organization.usage.costs(start_time: 0)
puts(response){
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.costs.result",
"amount": {
"value": 0.06,
"currency": "usd"
},
"line_item": null,
"project_id": null,
"api_key_id": null,
"quantity": null
}
]
}
],
"has_more": false,
"next_page": null
}
Returns Examples
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.costs.result",
"amount": {
"value": 0.06,
"currency": "usd"
},
"line_item": null,
"project_id": null,
"api_key_id": null,
"quantity": null
}
]
}
],
"has_more": false,
"next_page": null
}