In the past, I’ve been able to get a summary of my total usage cost by using the following curl request
curl https://api.openai.com/dashboard/billing/usage?end_date=2023-08-01&start_date=2023-07-01 \
-H "authorization: Bearer ${OPENAI_API_KEY}"
Up until this morning, this command was working perfectly fine, but now I’m getting the following error:
{
"error": {
"message": "Your request to GET /dashboard/billing/usage must be made with a session key (that is, it can only be made from the browser). You made it with the following key type: secret.",
"type": "server_error",
"param": null,
"code": null
}
}
Was there a change in the headers needed? Is there a way to calculate total usage via the API in another way, so that I could do it from the terminal, or a way to find the session key to use in the curl request?
Thanks for any help!