trace._record_usage

(internal) Record the tokens one model turn used against a target from `_usage_target`. `input_tokens` excludes cache reads and writes. Returns whether anything was recorded.

Reference version

Signature

function trace._record_usage(
target: int,
model: string | null,
input_tokens: int,
output_tokens: int,
cache_read_tokens: int | null,
cache_write_tokens: int | null,
reasoning_tokens: int | null
) -> bool throws never

(internal) Record the tokens one model turn used against a target from _usage_target. input_tokens excludes cache reads and writes. Returns whether anything was recorded.

Source:<builtin>/trace/trace.bamlbytes 5506–5746