Skip to content

Query: Token Usage

Short description: Query total token usage for the current API key.


Overview

  • Method: GET
  • Path: /v1/dashboard/billing/usage
  • Content-Type: application/json

Authentication

  • Header: Authorization: Bearer <token>

Request Example

Query Parameters

ParameterTypeRequiredDescription
start_datestringNoStart timestamp in milliseconds
end_datestringNoEnd timestamp in milliseconds

curl Example

bash
curl -X GET "https://api.gpt.ge/v1/dashboard/billing/usage?start_date=1716149437000&end_date=1746517437000" \
  -H "Authorization: Bearer sk-xxxx"

JavaScript (fetch) Example

javascript
fetch('https://api.gpt.ge/v1/dashboard/billing/usage?start_date=1716149437000&end_date=1746517437000', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer sk-xxxx'
  }
}).then(r => r.json()).then(console.log);

Python (requests) Example

python
import requests

url = 'https://api.gpt.ge/v1/dashboard/billing/usage'
headers = {
    'Authorization': 'Bearer sk-xxxx'
}
params = {
    'start_date': '1716149437000',
    'end_date': '1746517437000'
}

response = requests.get(url, headers=headers, params=params)
print(response.json())

Response Example (200)

json
{
  "object": "list",
  "total_usage": 695.9646
}

Note: The returned total_usage value should be divided by 100 to calculate the actual usage amount.