Usage

Get costs details for the organization.

get/organization/costs

Request

  • Base URL
    https://api.openai.com/v1
  • URL
    https://api.openai.com/v1/organization/costs
  • Auth
    HTTP bearer

Query parameters

start_timeinteger required

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

end_timeinteger

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

bucket_width'1d'

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

project_idsstring[]

Return only costs for these projects.

api_key_idsstring[]

Return only costs for these API keys.

line_itemsstring[]

Return only costs for these exact line item names. Each value must match the complete line_item value, for example gpt-6-astra, input_tokens.

group_bystring[]

Group the costs by the specified fields. Supported fields include project_id, user_id, line_item, api_key_id, and api_source. Support for combining user_id with project_id grouping or the project_ids filter depends on the organization and requested time range. Unsupported combinations return HTTP 400. When grouped by api_source, results use agents_api for attributed Agents API activity and unlabeled for all other activity. Without source grouping, api_source is null.

limitinteger

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

pagestring

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

Response

Costs data retrieved successfully.

object'page' required
has_moreboolean required
next_pagestring nullable required

Changes

    • info

      added the optional property //////// to the response with the status

    • info

      added the optional property ////// to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status