How prepaid LLM billing works: hold then settle

Prepaid billing holds an estimate while a request runs, then settles to the exact token cost, so a mid-request balance is a hold, not the final charge.

Checked 2026-11-22

·All posts·Models

Prepaid billing on this API runs in two steps: when a request starts the gateway holds an estimate against your balance, and when it finishes it settles to the exact cost and releases the rest, so a mid-request drop in the available balance is the hold, not the charge. Everything below describes that flow at https://api.uplinkswitch.com/v1, why a streamed call ties up more than it ends up costing, and where the settled figure lands once the work is done.

The two numbers: hold and charge

A prepaid account spends from one balance, per token, with no subscription behind it. Two quantities move that balance:

  • The hold is a reservation placed the instant a request is admitted. It is the worst case the call could run to, priced at the model's current rate: the input it carries plus the output ceiling it is allowed.
  • The charge is what you actually pay, computed from the tokens the model really produced, and applied when the request settles.

The available balance you read at any moment is the money that is neither spent nor reserved. GET /v1/credits states it plainly as the balance minus what requests in flight are holding, which is why it can dip while a call is open and recover a little when that call ends.

Why the hold is larger than the bill

The output ceiling drives the gap. On the OpenAI-style routes, max_tokens (or max_completion_tokens) both caps the answer and sizes the reservation; when a request sets neither, the hold assumes a default output length that the OpenAPI document fixes at well over ten thousand tokens, which on a dear model reserves money you will almost never spend. On the Anthropic-style route max_tokens is required, so the ceiling is always explicit there.

Set the ceiling to what your product can actually show. A chat reply that renders two sentences does not need a four-figure output budget held against it, and trimming the ceiling frees that balance for your other traffic right away.

ModelHeld at this output ceilingSettled on a short answer
claude-sonnet-5-5$0.0052$0.0027

The left column is roughly what a 2,000-token prompt with a 1,000-token ceiling reserves; the right is what a 120-token reply settles to. The difference returns to your balance the moment the request closes.

Streaming holds for longer

A streamed request reserves the same worst-case hold, but keeps it open for the whole generation, because the final figure does not exist until the last event arrives. The cost headers that a normal response carries cannot ride a stream, since those headers leave before any tokens are produced. Instead, each usage event in the stream reports usage.cost, the charge so far in USD, and the final usage-bearing event (the OpenAI usage chunk sent just before [DONE] when the request sets stream_options.include_usage, or the Anthropic message_delta before message_stop) carries the whole charge. Until that event, the hold stands at full size.

Settlement, and the generation variant

For ordinary chat models, settlement happens when the request finishes: the exact token cost is debited and the unused part of the hold is released in one step. Some generation models settle differently: the charge is taken when the model accepts the task, sized for its longest possible output, and then trued up on completion, with the difference returned to the balance once it succeeds. Either way the end state is the same, the reservation becomes a real charge and whatever was over-reserved comes back.

A request that fails never reaches settlement as a charge. An upstream error, a refusal the model raises on its own, or an answer that misses a JSON schema the request demanded, all release the hold and bill nothing; the record marks a refund reason rather than a silent zero. You pay for delivered answers, not for attempts.

Where the real cost lands

Three places carry the settled figure, in rising order of formality:

  1. The response body. A non-streamed answer reports usage.cost beside its token counts, and the body's model field reports which model produced the reply once any alias or fallback is resolved.
  2. The request record. About a minute after a call finishes it appears at GET /v1/requests/{request_id}, readable with any key on the same organization, with the input, cached and output tokens, the charge, the same tokens at the developer's list price, and the saving. This is where a stream's final numbers live.
  3. The signed receipt at GET /v1/requests/{request_id}/receipt, a document stating the model, the billed tokens, the charge and hashes of the request and response, signed so a third party can check it without touching your account.

For reconciling a whole month against these figures, the request-by-request method is on how to audit an LLM API bill; the routes themselves are listed under endpoints and in the docs.

Reading the balance correctly

Because holds and charges share one balance, a quick way to misread it is to watch the number during a burst of parallel calls and assume the drop is spend. It is mostly reservation. Let the calls settle, then read GET /v1/credits or the console: the drop that remains after settlement, less any credit added meanwhile, is the true spend. Admission checks the balance against the full hold, so a burst cannot overshoot what you loaded, and a request the balance cannot cover is refused before it runs with nothing charged.

Questions and answers

Because admission reserves a hold sized to the request's worst case, the input plus the output ceiling at the model's rate, before any tokens are produced. That reservation is subtracted from available balance while the call is open. When the request settles, the exact charge replaces the hold and the unused remainder returns.

It is released in full and nothing is charged. An upstream error, a self-raised refusal, or an answer that misses a required JSON schema all free the reservation; the request record carries a refund reason so the non-charge is visible rather than a silent zero.

The settled charge is usage.cost in a non-streamed response body, and the body's model field names the answering model. Within about a minute the full record is at GET /v1/requests/{request_id} with tokens, charge and saving, and the signed receipt at GET /v1/requests/{request_id}/receipt states the same figures for a dispute.
Join on Telegram
Help