provider Usage GET /organization/costs
@utdk/openai /organization/costs
Get costs details for the organization.
start_time query required
Start time (Unix seconds) of the query time range, inclusive.
integer
end_time query
End time (Unix seconds) of the query time range, exclusive.
integer
bucket_width query
Width of each time bucket in response. Currently only `1d` is supported, default to `1d`.
enum: 1d
project_ids query
Return only costs for these projects.
array
group_by query
Group the costs by the specified fields. Support fields include `project_id`, `line_item` and any combination of them.
array
limit query
A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7.
integer
page query
A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.
string

Try it

Authentication
Configure credentials for OpenAI API
Gateway
The gateway proxies requests and injects credentials server-side. Configure credentials above, then enter your gateway URL.

Saved automatically to browser storage.

usageCosts
GET/organization/costs

required

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

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

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

Return only costs for these projects.

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.

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

Enter a gateway URL above to enable sending.

Code snippet
Updates live as you fill in the form above.

TypeScript

import openai from '@utdk/openai';

await openai.usageCosts({
  "bucket_width": "1d",
  "limit": 7
})