Skip to main content
CometAPI provides two ways to check account balance and usage: the CometAPI CLI and the query service API at query.cometapi.com. If you use a Workspace, see Manage a team with CometAPI Workspace to understand shared Organization Credits and billing roles.

CometAPI CLI

Check your balance from the terminal with one command. See CometAPI CLI overview for installation.
cometapi balance
Add --source token for per-key details:
cometapi balance --source token
See the commands reference for all available options.

Query service API

GET https://query.cometapi.com/user/quota Returns account-level balance, cumulative usage, total request count, and per-key quota details. This endpoint uses a separate query service at query.cometapi.com and authenticates via the key query parameter rather than a Bearer Token.
Use a dedicated API key for balance queries. If you want to limit exposure, disable Unlimited Quota and set the smallest positive credit limit allowed by the dashboard.

Request parameters

ParameterTypeRequiredDescription
keystringYesYour CometAPI API key
start_datestringNoStart date for daily breakdown (YYYY-MM-DD format)
end_datestringNoEnd date for daily breakdown (YYYY-MM-DD format)
When start_date and end_date are provided, the response includes a daily_quota field with per-key usage broken down by day.

Response fields

FieldTypeDescription
usernamestringUsername
total_quotanumberCurrent account balance (USD)
total_used_quotanumberCumulative usage (USD)
request_countintegerTotal request count
keysarrayPer-key quota details
keys[].namestringAPI key name
keys[].remain_quotanumberKey remaining quota; -1 means unlimited
keys[].used_quotanumberKey used quota; -1 means unlimited
daily_quotaobjectDaily usage breakdown (only when start_date and end_date are set)
daily_quota[date]arrayPer-key usage entries for that date
daily_quota[date][].token_namestringAPI key name
daily_quota[date][].quota_usednumberUsage for that key on that date (USD)
daily_quota[date][].request_countintegerRequest count for that key on that date

Code examples

Query account balance:
curl "https://query.cometapi.com/user/quota?key=$COMETAPI_KEY"
import os
import requests

resp = requests.get(
    "https://query.cometapi.com/user/quota",
    params={"key": os.environ["COMETAPI_KEY"]}
)
data = resp.json()
print(f"Balance: ${data['total_quota']:.2f}")
print(f"Used: ${data['total_used_quota']:.2f}")
print(f"Requests: {data['request_count']}")
const resp = await fetch(
  `https://query.cometapi.com/user/quota?key=${process.env.COMETAPI_KEY}`
);
const data = await resp.json();
console.log(`Balance: $${data.total_quota.toFixed(2)}`);
console.log(`Used: $${data.total_used_quota.toFixed(2)}`);
console.log(`Requests: ${data.request_count}`);

Response example

{
  "username": "example_user",
  "total_quota": 2105.23,
  "total_used_quota": 21.07,
  "request_count": 1221,
  "keys": [
    {
      "name": "my-key",
      "remain_quota": 8.94,
      "used_quota": 2.10
    }
  ]
}

Daily breakdown example

Query daily usage for a date range:
curl "https://query.cometapi.com/user/quota?key=$COMETAPI_KEY&start_date=2026-04-13&end_date=2026-04-14"
The response includes the same top-level fields plus daily_quota:
{
  "username": "example_user",
  "total_quota": 2105.23,
  "total_used_quota": 21.07,
  "request_count": 1221,
  "daily_quota": {
    "2026-04-13T00:00:00Z": [
      {
        "token_name": "my-key",
        "quota_used": 4.27,
        "request_count": 59
      }
    ],
    "2026-04-14T00:00:00Z": [
      {
        "token_name": "my-key",
        "quota_used": 0.57,
        "request_count": 36
      }
    ]
  }
}