You can use the command req Get to https://api.openai.com/v1/dashboard/billing/usage?start_date=2023-05-01&end_date=2023-05-31
https://api.openai.com/v1/dashboard/billing/usage?start_date=2023-05-01&end_date=2023-05-31
The result returned at the variable total_usage/100 is the cost of credit you have used from start_date to end_date
total_usage/100