Running cost of streamed token usage
Token usage for model requests arrives as a stream of usage records rather than all at once. Compute what the usage costs, keeping the totals correct as each new record arrives, so the current cost can be read at any point without reprocessing the whole stream. Talk through how you would structure the per-record pricing and the running totals, and what the time and memory cost is per record.
No answer yet. Write the first one; the best answer gets endorsed.
