Hold, clamp, settle
- The prompt's cost is worked out and held against what the key has left.
- The output it can still afford is worked out, and
max_tokensis lowered to fit. - When the answer is done the hold is let go and the real cost is charged.
A request fails only when what is left cannot pay for even a short answer, and then it is a 402.
A key that reaches its cap
It stops, and your other keys carry on.
Hanging up
Output is counted as it streams. If the client disconnects, the charge is for what was generated up to that point.