Skip to content

Usage And Token Counting API

Usage reports consumption for a Key, while token counting estimates input size before a request. They are not interchangeable; final billing comes from completed-request usage records.

Authentication

The /v1 endpoints use the API Key form required by the current protocol. This generic example uses a Bearer token:

bash
curl https://quotarouter.ai/v1/usage \
  -H "Authorization: Bearer YOUR_QUOTAAPI_KEY"

Endpoints

MethodPathPurpose
GET/v1/usageUsage information for the current Key
GET/v1/modelsModels visible to the current Key
POST/v1/messages/count_tokensCount input tokens for a Messages request
POST/messages/count_tokensClient-compatible alias without /v1
POST/v1/liveCreate a supported live call
GET/v1/live/:call_idRead sideband information for a live call

Count tokens

bash
curl https://quotarouter.ai/v1/messages/count_tokens \
  -H "x-api-key: YOUR_QUOTAAPI_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4.5",
    "messages": [{ "role": "user", "content": "Count this request." }]
  }'

Typical response:

json
{
  "input_tokens": 12
}

OpenAI uses a bridge, Grok uses a local estimate, DeepSeek returns unsupported, and other platforms retain their native counting path. The estimate does not include generated output tokens.

List models

bash
curl "https://quotarouter.ai/v1/models?client_version=1.0.0" \
  -H "Authorization: Bearer YOUR_QUOTAAPI_KEY"

Codex clients can include client_version to receive an adapted model manifest. Other clients receive the regular model list. Both remain constrained by the Key group and model mappings.

Live endpoints

Live serves Codex/OpenAI workflows that explicitly support realtime calls. Preserve the returned call_id and query /v1/live/:call_id for sideband data. Ordinary Chat Completions and Messages clients do not need Live.

Relationship to console records

The /usage console page records completed-request model, tokens, charge, latency, and status. A successful estimate does not guarantee generation success or determine the final charge.

QuotaAPI is an AI API relay service for developers and teams.