riwigefi / light-gpt

Light-GPT is an interactive website project based on the GPT-3.5-Turbo Model.

Home Page:https://light-gpt.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature query the balance corresponding to api key

yiios opened this issue · comments

commented
$ curl -s  "https://api.openai.com/dashboard/billing/credit_grants" \
--header 'Content-type: application/json' \
--header 'Authorization: Bearer api_key' | jq   
{
  "object": "credit_summary",
  "total_granted": 18,
  "total_used": 0.178104,  # Amount used
  "total_available": 17.821896,  # Remaining Available Balance
  "grants": {
    "object": "list",
    "data": [
      {
        "object": "credit_grant",
        "id": "be32c280-ad4a-4e14-bc1a-077a32275f9e",
        "grant_amount": 18,
        "used_amount": 0.178104,
        "effective_at": 1677628800,
        "expires_at": 1688169600 # expiration time
      }
    ]
  }
}

commented

The feature to display the remaining available balance for the current API key has already been added to the master branch.