Can you view usage statistics with the API Client

It would be much easier if I could view my usage statistics from the API client itself rather than having to log in through the internet site. That way I could program that client to stop when my limits are approaching. Is it possible to do that with the python version of the API? Something like:
projid = ‘secret’
orgid = ‘secret’
client = OpenAI(
organization=orgid,
api_key=projid,
)
print (client.requests)
print (client.tokens_used)

Something like that.

Hello,

As of my last update, the OpenAI API itself doesn’t provide direct usage statistics through its endpoints. However, you can manage and view usage statistics via the OpenAI platform’s web interface.

@kylefoley202 - if you would like to check the token usage in cost per request. You may pull the values for usage in completions or run object and it looks something like shown below and use these values to compute costs for each request.

"usage": {
    "prompt_tokens": 9,
    "completion_tokens": 12,
    "total_tokens": 21
  }