Hold, then settle
A call reserves its worst case before the model runs and pays what it used when it ends, so the balance can't go below zero and no call costs more than its hold.
Three states
- A call arrivesIts worst case is worked out from the body and max_tokens
- HeldThe worst case is reserved, and balance_usd already leaves it out
- SettledThe call ended, the real charge is taken and the rest comes backorReleasedThe call failed before any output, and the whole hold comes back
How big the hold is
- Input is estimated from the body as Moth rebuilds it, compact and without unknown fields or image data, as its size in bytes divided by three, plus 5,000 tokens for each image, which is more than a real count on purpose.
- Output is your
max_tokens, or 4,096 on/chat/completionswhen you send none. - A web search adds 40,000 input tokens to the hold, since the pages it reads count as input.
- Models that reason before answering,
grok-4.7,deepseek-v4.1-flashandkimi-k3, hold at least 2,048 output tokens however smallmax_tokensis, and their hidden reasoning is charged as output up to that amount, so a smallmax_tokensdoesn't bring their cost below it.
A worked example
A call to gemini-3.8-flash, priced at $0.375 per million input tokens and $1.875 per million output tokens, sends a body that comes to 1,200 bytes, with max_tokens set to 1,000. The model reports 290 input tokens and 180 output tokens.
The reply's moth-charged-micros header reads 447. Prices follow the catalog, so read today's from the models list.
Held $0.002025 for a gemini-3.8-flash call, then settled
- Charged, what the call used
- Released, back to your balance
When a call doesn't finish
- A call refused before it reaches the model, or failed there with no output, releases its whole hold.
- If you disconnect after the prompt was sent but before any output, the input is charged and nothing else, and a stream you leave after output began is also charged for the output it had sent.
- A stream settles once, when it ends, fails or you leave, at the usage seen so far.
- A reply cut at
max_tokensis charged at leastmax_tokensof output. - A hold left open by a restart is released when the server starts, and any hold older than two hours is released within five minutes.
Media jobs
A job holds its unit price times its units, which is n images, the clip's seconds or one song. When it succeeds, images are charged per image delivered and a clip or a song in full. A job that fails, or hasn't finished after an hour, is charged nothing.
Never above the hold. The charge is never more than the hold, whatever the host reports.