Billing & Credits

Every Quantized license has a credit balance. Successful API calls consume credits based on the model, how much you send and receive (for example token counts), and the rates that apply to your license.

Credit system

Unit Meaning
Micro-credit Smallest unit reported in the API (credits_used, license budget fields).
Credit 1 credit = 1,000,000 micro-credits (useful when reading large balances).

Use the Models endpoint to see each model’s price, what your API key is charged (prompt, completion per million tokens), for planning usage.

Example: usage in a response

After a request completes, the usage object includes how many micro-credits were spent:

{
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 50,
    "total_tokens": 75,
    "credits_used": 3200
  }
}
Field Description
credits_used Micro-credits consumed by this request
Embeddings have no completion tokens

Embedding endpoints (POST /v1/embeddings) return prompt_tokens and total_tokens only — completion_tokens is not present because the response is a vector, not generated text. total_tokens equals prompt_tokens for these calls.

Checking your balance

Use the License endpoint to check your current balance without consuming credits:

curl https://api.quantized.us/v1/license \
  -H "Authorization: Bearer sk-quantized-YOUR-KEY"

Insufficient balance

When your license has no budget left, requests return 402 Payment Required with the
code budget_exhausted:

{
  "error": {
    "message": "Your license is out of budget",
    "type": "insufficient_quota",
    "param": null,
    "code": "budget_exhausted",
    "request_id": "4bf92f3577b34da6a3ce929d0e0e4736",
    "metadata": {
      "unit": "micro_credit",
      "dimension": "day",
      "used": 1000250,
      "limit": 1000000,
      "adjustment": 0,
      "remaining": -250,
      "window_start_at": "2026-11-05T00:00:00+00:00"
    }
  }
}

metadata is the limit that blocked the request, in the same format as budget in
GET /v1/license:

Field Description
unit The budget unit, such as micro_credit
dimension Which limit is used up: lifetime, hour, day, week, or calendar_month
used, limit, adjustment, remaining The limit’s figures, as in GET /v1/license
window_start_at When the current window started; null for lifetime
extra_limit, total_remaining Only when your license allows extra usage

The check runs before the request reaches a provider, so a rejected request is not
charged. GET /v1/models and GET /v1/license are never blocked by it.

How the check works:

  • It only needs one unit left. A request is admitted while any budget remains, and it
    is charged its full cost when it finishes. The request that crosses the limit
    therefore completes, and remaining in GET /v1/license can go below
    zero.
  • Every limit has to have room. A license can have a lifetime limit and limits per
    hour, day, week, or calendar month. A request is rejected if any one of them is used
    up. Period limits reset when their window starts again, so a request rejected today
    can succeed tomorrow.
  • Purchased credit is used first. If the license has purchased credit packs, they
    are drawn down before the license’s default budget. The request is rejected only when
    none of them has room.
  • Extra usage, if enabled. Some licenses allow usage beyond the included limit, up to
    an extra ceiling (extra_limit in GET /v1/license). Requests continue until that
    ceiling is reached too.

Contact your institution administrator to raise the limit or add credit. See the
Error reference for the other errors a request can return.