Ask a question to get started
Enter to send•Shift+Enter new line
RecordedRequest( self, model_name: str, provider: str, kind: UsageKind, input_tokens:
Model the contribution was recorded under.
Provider the contribution was recorded under.
Type bucket the contribution was recorded under.
Running input tokens recorded so far for the request.
Running output tokens recorded so far for the request.
Estimate for the whole request so far, or None when unpriceable.
None
Merged usage for the request so far.
Kept so the request can be re-priced as a whole once a later chunk reveals the model. Summing per-chunk estimates would freeze the rates that applied when the model was still unknown.
Whether the request's usage is complete and can no longer be added to.
Set either by a completed (non-chunk) message, which carries the request's whole usage, or by finalize_recorded_requests at the end of a stream round. A later chunk for a finalized request is a replay, not a revision.
finalize_recorded_requests
What a stream consumer last recorded for one request.
Held so a later chunk of the same request can retract that exact contribution and re-record the running totals, keeping one API call to one request and one per-model row.