Blog
Billing1 min read

Reserve, settle, stop: how prepaid billing works

There is no credit line and no invoice. Before a request is forwarded, the most it could cost is held against your balance. Real usage is charged afterwards, and the rest of the hold is released.

Prepaid means you can never spend what you did not load. The way the gateway keeps that promise is a hold on every request, taken before anything is forwarded to the model.

Reserve

The hold covers the prompt at the input rate and the largest possible completion at the output rate. The prompt is measured in bytes rather than through a tokenizer, because a token is always at least one byte, so the byte count is a true upper bound that cannot come in low. If your balance cannot cover the hold, the request is refused with HTTP 402 and the code insufficient_quota. Lower max_tokens or top up.

Settle

When the response finishes, the provider’s usage report sets the real charge: input, cached input and output at the published rates. The charge is taken from the hold and whatever is left of the hold goes straight back to your balance. The receipt in your dashboard shows the counts and the exact charge.

Stop

At zero, requests stop. There is no overdraft, no grace period and no bill arriving later. Top up and the next request goes through.

When things go wrong

  • A stream cut before the provider sends its usage report is billed on the delivered tokens, counted locally, with no cache discount.
  • A client that disconnects before any output arrives is not charged, even though the provider may charge us.
  • A provider failure before any response is not charged and returns HTTP 502.
  • A hold that is still open after fifteen minutes is released by a sweeper, and that request is not billed.

The same checks run on the server whatever the client shows. A hold that fails is refused before the model ever sees the prompt, so a bug in a client cannot overspend the account.