Skip to main content

Module cost

Module cost 

Structs§

ToolLoopCostTrackingContext
Context for cost tracking within the tool call loop. Scoped via tokio::task_local! at call sites (channels, gateway).
TurnUsage
Per-scope token/cost accumulator derived from the usage events emitted during a single task-local runtime invocation.

Statics§

TOOL_LOOP_COST_TRACKING_CONTEXT
TOOL_LOOP_TURN_USAGE

Functions§

build_model_provider_pricing
build_type_level_model_provider_pricing
check_tool_loop_budget
Check budget before an LLM call. Returns None when 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, None when not scoped or no usage.
tool_loop_cost_tracking_context_for_agent
tool_loop_cost_tracking_context_from_tracker

Type Aliases§

ModelProviderPricing