Skip to main content

Module pricing

Module pricing 

Source
Expand description

Pricing seam for run-level cost budgets.

UsageLimits::max_cost_usd stops a run once its estimated spend crosses a threshold, which requires turning token counts into dollars. Out of the box the SDK prices from the static model_capabilities table compiled into the binary: a model that table has never heard of estimates to None (“cost unknown”), accrues nothing, and can never trip the limit.

A CostEstimator plugs a richer pricing source in front of that table. Wire one in with AgentLoopBuilder::cost_estimator. The loop asks the estimator about every key the call could be filed under before it asks the static table about any of them, so a fresher feed price wins over a compiled-in rate even for a model both sources know.

The model-discovery feature implements the trait for ModelRegistry, the layered catalog, so a run can price — and budget — models whose pricing only ever appeared in a feed.

Traits§

CostEstimator
A source of provider/model pricing for run-level cost budgeting.