Helpers for turning token usage into an estimated cost, used together with
the max_budget_cents field of ExAgent.UsageLimits.
ExAgent does not ship a pricing table (model prices change constantly and
vary by vendor). You bring the prices that matter to you as a map and
CostGuard.estimator/1 builds the (usage -> cents) function you pass to
ExAgent.run/3 via the :estimate_cost option.
Example
pricing = ExAgent.CostGuard.estimator(%{
input_per_1k_cents: 250,
output_per_1k_cents: 1000
})
ExAgent.run(agent, "go", estimate_cost: pricing)
Summary
Functions
Build a cost estimator (Usage.t() -> integer cents) from a pricing map.
Types
Functions
@spec estimator(pricing()) :: (ExAgent.Message.Usage.t() -> non_neg_integer())
Build a cost estimator (Usage.t() -> integer cents) from a pricing map.
Prices are per 1000 tokens, in cents (so 250 = $2.50 / 1M input
tokens, matching how vendors quote).