Different ledger movements have different meanings
The initial reservation protects the approved spending ceiling while the final usage is unknown. A short answer can use much less than max_tokens, and the input bound can exceed the actual metered input. Keep reserved_credits and final credits together so the user can understand both the temporary balance effect and the settled amount.
What to do next
- 01
Read the confirmed receipt
Save measured prompt and completion tokens, final credits, reserved amount and job ID. Distinguish a completed response from an uncertain job that lacks confirmed metering.
- 02
Compare the two amounts
Calculate the unused reservation only from confirmed recorded values. Do not treat a displayed balance change from another concurrent task as this job's settlement.
- 03
Describe the outcome accurately
Show the final charge and returned unused amount in your app's task record. Keep failed-job returns and successful usage settlements as different reasons in reporting.
A concrete example
Illustrative case: a request reserves for a 1,000-token answer but finishes with 100 output tokens. The final measured charge can be below the ceiling, and the unused portion returns while the completed response still has a nonzero cost.
Before you call it ready
- The task is confirmed complete.
- Reservation and final charge are both retained.
- The return reason is identified correctly.
When to stop or choose another method
If usage or settlement is uncertain, do not calculate a fabricated final receipt from message length. Preserve the job and resolve its accounting state first.
