Count bytes while your application consumes or produces a stream. When the operation completes, send one event with the total.
Configure a Sum meter whose filter matches stream.transfer and whose aggregation property is metadata.bytes.
Ingest after the stream closes successfully. If partial transfers should be billable, give each accepted chunk its own stable external_id.