Query remaining API usage from Python

I made a module in vs code editor using chatgpt API with python language. I added an error check to find out the remaining usage of the API. For example, if my balance is 15 dollars, when the credit I use is 14 dollars, it will notify me that you have 1 dollar of usage left. But I am getting chatgpt error. What is your solution to my problem?

There is no API for obtaining an account’s credit balance.

If you asked ChatGPT to write you some code for something the AI doesn’t know about, it will just make up a likely way of doing it. Complete nonsense if that’s what you ask for: