and your headers & payloads can look like headers = {“Authorization”: f"Bearer {api_key}", “Content-Type”: “application/json”} payload = { “start_time”: start_time(epoch),“end_time”: end_time (epoch)} response = requests.get(url, headers=headers, params=payload)
found this with research, the support here is terrible , they treat their own customers with basically zero support , don’t know these forums are for what use , they break stuff internally and replace and never inform (very futuristic ) (very openly)
Thanks a lot for sharing this alternative, @nits101 — really helpful!
I completely agree, it’s been quite confusing lately with the /v1/usage endpoint returning empty data and no clear communication about the change.
Appreciate you taking the time to dig into this and share the workaround!
{
"error": {
"message": "You have insufficient permissions for this operation. Missing scopes: api.usage.read. Check that you have the correct role in your organization, and if you're using a restricted API key, that it has the necessary scopes.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
@nits101
I tried the method you suggested, but I got a permission issue. Do you know how to fix this?
@_22 Can you recheck if the api key you are using is ‘admin api key’ and not user created one, this should be available in your dashboard . this logs can only be fetched through admin api key.
Does this response also include usage data for normal API keys?
Additionally, how can I retrieve complete usage data, similar to what is returned by:
https://api.openai.com/v1/usage
I understand that this is something should provided by OpenAI directly, but unfortunately we haven’t received a response from them yet. If anyone here has experience with this or happens to know the answer, any help would be greatly appreciated.