Skip to content

API reference

Account and usage

Your credit, your usage added up by client, model, key or day, and your keys, with the same API key: read only, free, as JSON or CSV.

Last updated: 2026-10-26

What the dashboard shows, with your API key. These endpoints only read: a key can see the account it belongs to, but it cannot create keys, change a limit or top up. They cost nothing and count against a limit of 30 requests per minute per key.

Credit and spending

bash
curl https://api.ai-tokens.it/v1/account -H "Authorization: Bearer $API_KEY"
json
{
  "object": "account",
  "currency": "EUR",
  "credit_left": 7583.52,
  "spent_this_month": 412.18,
  "spent_this_month_with_this_key": 96.40,
  "this_key": { "id": "…", "name": "backend", "prefix": "sk-ait-…", "monthly_limit": null, "…": "…" }
}

The month is the calendar month in Swiss time.

Usage, added up

GET /v1/usage sums requests, input and output tokens and cost over a period, one line per group.

Parameter Meaning
period 7d, 30d (default), month (this calendar month) or last-month
from, to days YYYY-MM-DD, Swiss time, both included; at most 366 days apart. They replace period
group_by a comma list of client, model, key, day, hardware. Default client,model
client, model, key only that client, model or key (key by name or id)
format json (default) or csv
bash
curl "https://api.ai-tokens.it/v1/usage?period=last-month&group_by=client,model" \
  -H "Authorization: Bearer $API_KEY"
json
{
  "object": "usage",
  "from": "2026-09-01", "to": "2026-09-30", "timezone": "Europe/Zurich",
  "currency": "EUR",
  "group_by": ["client", "model"],
  "data": [
    { "client": "rossi-srl", "model": "gemma-4-26b", "requests": 1820, "input_tokens": 2410334, "output_tokens": 611208, "cost": 0.426713 }
  ],
  "total": { "requests": 1820, "input_tokens": 2410334, "output_tokens": 611208, "cost": 0.426713 }
}

The client is what your requests send as user, or as safety_identifier, OpenAI's newer name for it: on chat completions, on the Responses API and on embeddings. Requests without it are in the client "". The same file, one line per client and model, is on the Usage page of the dashboard: CSV by client. The other CSV there has one line per request, with a client column.

Keys

bash
curl https://api.ai-tokens.it/v1/keys -H "Authorization: Bearer $API_KEY"

Each key of the account with its id, name, prefix, creation, last use, expiry, whether it is revoked, its country, its monthly limit, its output and requests-per-minute limits, and what it spent this month. Never its secret.

With Claude

The same three are tools of the MCP server, set up from the dashboard: get_account, get_usage and list_keys. Ask Claude «how much did each of my clients use last month?» and it calls get_usage.

Search the docs

Type to search…