API reference / Balance and usage

API reference

Balance and usage

Use an API key itself to check that key's total quota, amount used, expiry and request history — handy for scripts and monitoring.

Updated

The four endpoints below authenticate with the API key itself and report on that key. The key must be sent in the Authorization: Bearer header; putting it in a URL parameter returns 401.

Endpoint Returns
GET /v1/dashboard/billing/subscription The key's total quota (US dollars) and expiry
GET /v1/dashboard/billing/usage The amount the key has used (US cents)
GET /api/usage/token The key's name, total, used and remaining quota (in quota units), expiry and model limits
GET /api/log/token The key's recent requests

The full URL is https://api.goodapi.tech followed by the path.

Total quota and expiry

bash
curl https://api.goodapi.tech/v1/dashboard/billing/subscription \
  -H "Authorization: Bearer $GOODAPI_API_KEY"
json
{
  "object": "billing_subscription",
  "has_payment_method": true,
  "soft_limit_usd": 0.2,
  "hard_limit_usd": 0.2,
  "system_hard_limit_usd": 0.2,
  "access_until": 1795235356
}
  • hard_limit_usd: the key's total quota, in US dollars.
  • access_until: the expiry time, as a Unix timestamp (seconds).

Amount used

bash
curl https://api.goodapi.tech/v1/dashboard/billing/usage \
  -H "Authorization: Bearer $GOODAPI_API_KEY"
json
{"object": "list", "total_usage": 0.3}

total_usage is how much this key has spent, in US cents (matching OpenAI's legacy endpoint). The example above is $0.003.

Quota details

bash
curl https://api.goodapi.tech/api/usage/token \
  -H "Authorization: Bearer $GOODAPI_API_KEY"
json
{
  "code": true,
  "message": "ok",
  "data": {
    "object": "token_usage",
    "name": "my-project",
    "total_granted": 100000,
    "total_used": 1500,
    "total_available": 98500,
    "unlimited_quota": false,
    "expires_at": 1795235356,
    "model_limits_enabled": true,
    "model_limits": {"claude-sonnet-5-5": true}
  }
}
  • total_granted, total_used, total_available: total, used and remaining quota, in quota units. 500,000 quota = 1 US dollar.
  • When unlimited_quota is true, the key has no quota of its own and only the account balance applies.
  • expires_at: the expiry time, as a Unix timestamp (seconds).
  • model_limits: the allowed models, when model limits are enabled.

If Allow querying user quota was enabled when the key was created, the response also includes user_quota, which is the account balance:

json
"user_quota": {"total_available": 99976314, "total_used": 23686}

Request history

bash
curl https://api.goodapi.tech/api/log/token \
  -H "Authorization: Bearer $GOODAPI_API_KEY"

Returns this key's recent requests (newest first, up to 1,000):

json
{
  "success": true,
  "message": "",
  "data": [
    {
      "created_at": 1795247120,
      "token_name": "my-project",
      "model_name": "deepseek-v4-flash",
      "quota": 28,
      "prompt_tokens": 87,
      "completion_tokens": 12,
      "use_time": 1,
      "is_stream": false,
      "request_id": "..."
    }
  ]
}
Field Description
created_at Request time, as a Unix timestamp (seconds)
model_name Model
prompt_tokens, completion_tokens Input and output tokens
quota The charge for this request, in quota units (500,000 quota = 1 US dollar)
use_time Duration, in seconds
is_stream Whether the request was streamed
request_id Request ID, the same as the x-oneapi-request-id response header

For fuller records and filtering, use the Usage Logs page in the console.