Expand description
Per-provider usage accumulation: merges the token fields of one session record into a running per-model map, normalising provider-specific shapes along the way.
Structs§
- Codex
Token Totals - Snapshot of Codex’s cumulative
total_token_usagecounters.
Constants§
- CODEX_
TOKEN_ FIELDS - The five integer fields of a Codex
total_token_usageobject.
Functions§
- accumulate_
i64_ fields - Adds the named
i64fields fromsourceintotarget, in place. - accumulate_
nested_ object - Adds every
i64field ofsource_nestedinto the nested object stored attarget_obj[field_name]. - claude_
request_ context - The full prompt context of one Claude request: non-cached input plus cache reads plus cache writes — what the provider compares against the “above Nk tokens” threshold.
- process_
claude_ usage - Merges one Claude usage record into
conversation_usage, keyed bymodel. - process_
codex_ usage - Merges one Codex usage delta into
conversation_usage, keyed bymodel. - process_
gemini_ usage - Merges one Gemini usage record into
conversation_usage, keyed bymodel.