Query parameters
The page size is fixed;
page_size and size are ignored. The response has no total count, so keep requesting the next page until one returns fewer than 10 records.
Send a request
Store the AccessToken in an environment variable:gpt-5.4-mini usage:
Authorization; a Bearer prefix also works.
Response fields
other holds the multipliers, cache hits, and tool charges. For web search requests, web_search_billing lists the number of searches and their cost. If you only need the total charge, read quota. Responses can contain other fields as well; ignore the ones you don’t use.
Export a day of usage and total it by model
This script walks every page and totals the charge per model. It needs Python 3.9 or later andrequests (python -m pip install requests).
model_name or token_name.
Errors
Related documentation
- Get an AccessToken and check your balance: Balance API
- Create, disable, and delete API keys from code: Token management API
- Read charges on the console Logs page: How to review and use call logs