ai.stream.TurnMeta

Turn metadata as it arrives on the wire. Providers send stop_reason and token counts on different events; each TurnMeta carries what its event had and TurnStream folds non-null fields together (last write wins). The token counts mean what they mean in `root.events.Usage`.

Reference version

Signature

class ai.stream.TurnMeta

Turn metadata as it arrives on the wire. Providers send stop_reason and token counts on different events; each TurnMeta carries what its event had and TurnStream folds non-null fields together (last write wins). The token counts mean what they mean in root.events.Usage.

Source:<builtin>/ai/ns_stream/stream.bamlbytes 4280–4518

Fields

input_tokens

int | null

output_tokens

int | null

cached_input_tokens

int | null

cache_write_input_tokens

int | null

uncached_input_tokens

int | null

reasoning_tokens

int | null