Module cost
Structs§
- Tool
Loop Cost Tracking Context - Context for cost tracking within the tool call loop.
Scoped via
tokio::task_local!at call sites (channels, gateway). - Turn
Usage - Per-scope token/cost accumulator derived from the usage events emitted during a single task-local runtime invocation.
Statics§
Functions§
- build_
model_ provider_ pricing - build_
type_ level_ model_ provider_ pricing - check_
tool_ loop_ budget - Check budget before an LLM call. Returns
Nonewhen no cost tracking context is scoped (tests, delegate, CLI without cost config). - provider_
pricing - record_
tool_ loop_ cost_ usage - Record token usage from an LLM response via the task-local cost tracker.
Returns
(total_tokens, cost_usd)on success,Nonewhen not scoped or no usage. - tool_
loop_ cost_ tracking_ context_ for_ agent - tool_
loop_ cost_ tracking_ context_ from_ tracker