Today we’re launching a new API that lets you get granular API usage data, and a Costs endpoint that provides you with a breakdown of your daily spend. You can monitor token use by minute/hour/day, filter usage by API key, project ID, user ID, model. https://platform.openai.com/docs/api-reference/usage
Nice! Lots of people have been asking for this for a while now!
@edwinarbus looks like API keys require a new api.usage.read scope in order to use this new Costs API. I can’t seem to enable this scope for any new keys I create.
Is there something that needs to be enabled on an account in order to use this new API?
Example request:
curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit1" -H "Authorization: Bearer [api-key]"
Example response:
{
"error" : {
"message": "You have insufficient permissions for this operation. Missing scopes: api.usage.read. […]",
"type": "servier_error",
"param": null,
"code" : null
}
}
In case anyone else is hitting this, the new /costs API requires an admin key, not an API key. ![]()

