Costs
get https://api.openai.com/v1/organization/costs
Get costs details for the organization.
Query parameters
Width of each time bucket in response. Currently only 1d
is supported, default to 1d
.
Group the costs by the specified fields. Support fields include project_id
, line_item
and any combination of them.
A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7.
Returns
A list of paginated, time bucketed Costs objects.
Example request
1
2
3
curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
"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
}
]
}
],
"has_more": false,
"next_page": null
}