Created
March 22, 2023 21:13
-
-
Save itrewm/a4b248e442780fd5849c6cab646d896c to your computer and use it in GitHub Desktop.
Get Free trial usage amount in ChatGPT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python code | |
# api endpoint -> https://api.openai.com/dashboard/billing/credit_grants | |
import requests | |
api_key = 'Your-Token' | |
response = requests.get( | |
'https://api.openai.com/dashboard/billing/credit_grants' | |
,headers={ | |
"Authorization": f"Bearer {api_key}" | |
}).json() | |
print("Total used :" , response['total_used']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment