dalle2-in-python icon indicating copy to clipboard operation
dalle2-in-python copied to clipboard

Add support for user information API calls

Open charlesjlee opened this issue 3 years ago • 4 comments

It would be nice to be able to get some user information -- specifically how many tokens are left in the user's account.

charlesjlee avatar Jul 22 '22 01:07 charlesjlee

Did you find API endpoints for this? (i was looking for the same thing with openais gpt3 api, but found nothing)

ezzcodeezzlife avatar Jul 22 '22 16:07 ezzcodeezzlife

I just created this as a placeholder. I didn't try doing it 😆

charlesjlee avatar Jul 23 '22 02:07 charlesjlee

import requests

auth_header = "Bearer sess-......."


ret = requests.get(
    "https://labs.openai.com/api/labs/billing/credit_summary",
    headers={"Authorization": auth_header},
)
print(ret.json())

returns {'aggregate_credits': 545, 'next_grant_ts': 1661754850, 'breakdown': {'free': 0, 'paid_dalle_15_115': 545}, 'object': 'credit_summary'}

kv-crosstech avatar Aug 11 '22 12:08 kv-crosstech

I will add this asap 🔥

ezzcodeezzlife avatar Aug 11 '22 13:08 ezzcodeezzlife