OpenAI API

Get costs details for the organization.

get
https://api.openai.com/v1/organization/costs

Query Parameters

start_timeintegerrequired

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

end_timeinteger

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

bucket_widthstring

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

Allowed values:1d

Default:1d

project_idsarray[string]

Return only costs for these projects.

group_byarray[string]

Group the costs by the specified fields. Support fields include project_id, line_item and any combination of them.

Allowed values:project_idline_item

limitinteger

A limit on the number of buckets to be returned. Limit can range between 1 and 180, and the default is 7.

Default:7

pagestring

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

Response

200 application/json

Costs data retrieved successfully.

UsageResponse

objectstringrequired

Allowed values:page

dataarray[object]required
Show Child Parameters
has_morebooleanrequired
next_pagestringrequired
get/organization/costs
 
200 application/json

Get audio speeches usage details for the organization.

get
https://api.openai.com/v1/organization/usage/audio_speeches

Query Parameters

start_timeintegerrequired

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

end_timeinteger

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

bucket_widthstring

Width of each time bucket in response. Currently 1m, 1h and 1d are supported, default to 1d.

Allowed values:1m1h1d

Default:1d

project_idsarray[string]

Return only usage for these projects.

user_idsarray[string]

Return only usage for these users.

api_key_idsarray[string]

Return only usage for these API keys.

modelsarray[string]

Return only usage for these models.

group_byarray[string]

Group the usage data by the specified fields. Support fields include project_id, user_id, api_key_id, model or any combination of them.

Allowed values:project_iduser_idapi_key_idmodel

limitinteger

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: 1440
pagestring

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

Response

200 application/json

Usage data retrieved successfully.

UsageResponse

objectstringrequired

Allowed values:page

dataarray[object]required
Show Child Parameters
has_morebooleanrequired
next_pagestringrequired
get/organization/usage/audio_speeches
 
200 application/json

Get audio transcriptions usage details for the organization.

get
https://api.openai.com/v1/organization/usage/audio_transcriptions

Query Parameters

start_timeintegerrequired

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

end_timeinteger

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

bucket_widthstring

Width of each time bucket in response. Currently 1m, 1h and 1d are supported, default to 1d.

Allowed values:1m1h1d

Default:1d

project_idsarray[string]

Return only usage for these projects.

user_idsarray[string]

Return only usage for these users.

api_key_idsarray[string]

Return only usage for these API keys.

modelsarray[string]

Return only usage for these models.

group_byarray[string]

Group the usage data by the specified fields. Support fields include project_id, user_id, api_key_id, model or any combination of them.

Allowed values:project_iduser_idapi_key_idmodel

limitinteger

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: 1440
pagestring

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

Response

200 application/json

Usage data retrieved successfully.

UsageResponse

objectstringrequired

Allowed values:page

dataarray[object]required
Show Child Parameters
has_morebooleanrequired
next_pagestringrequired
get/organization/usage/audio_transcriptions
 
200 application/json

Get code interpreter sessions usage details for the organization.

get
https://api.openai.com/v1/organization/usage/code_interpreter_sessions

Query Parameters

start_timeintegerrequired

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

end_timeinteger

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

bucket_widthstring

Width of each time bucket in response. Currently 1m, 1h and 1d are supported, default to 1d.

Allowed values:1m1h1d

Default:1d

project_idsarray[string]

Return only usage for these projects.

group_byarray[string]

Group the usage data by the specified fields. Support fields include project_id.

Allowed values:project_id

limitinteger

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: 1440
pagestring

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

Response

200 application/json

Usage data retrieved successfully.

UsageResponse

objectstringrequired

Allowed values:page

dataarray[object]required
Show Child Parameters
has_morebooleanrequired
next_pagestringrequired
get/organization/usage/code_interpreter_sessions
 
200 application/json

Get completions usage details for the organization.

get
https://api.openai.com/v1/organization/usage/completions

Query Parameters

start_timeintegerrequired

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

end_timeinteger

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

bucket_widthstring

Width of each time bucket in response. Currently 1m, 1h and 1d are supported, default to 1d.

Allowed values:1m1h1d

Default:1d

project_idsarray[string]

Return only usage for these projects.

user_idsarray[string]

Return only usage for these users.

api_key_idsarray[string]

Return only usage for these API keys.

modelsarray[string]

Return only usage for these models.

batchboolean

If true, return batch jobs only. If false, return non-batch jobs only. By default, return both.

group_byarray[string]

Group the usage data by the specified fields. Support fields include project_id, user_id, api_key_id, model, batch or any combination of them.

Allowed values:project_iduser_idapi_key_idmodelbatch

limitinteger

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: 1440
pagestring

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

Response

200 application/json

Usage data retrieved successfully.

UsageResponse

objectstringrequired

Allowed values:page

dataarray[object]required
Show Child Parameters
has_morebooleanrequired
next_pagestringrequired
get/organization/usage/completions
 
200 application/json