Skip to main content

Module pricing

Module pricing 

Source
Expand description

BP-7 (catalog §4a “Turn/budget caps” — the spend cap; “Per-turn cost/usage accounting” — the cost half): token→dollars on the request path.

Until BP-7 the only pricing in the workspace was crate::pricing_ref, whose own module doc says it is “not used anywhere on the request path” — which is exactly why the ledger’s turn-budget-caps row read “no spend/budget cap at all — no pricing exists on the request path”. This module is that missing piece, and nothing more: a per-million-token price pair for a model id, resolved from (1) the config’s explicit override (crate::Config::price_input_per_mtok / crate::Config::price_output_per_mtok) or (2) a small built-in table of published list prices for the model families the parity presets pin.

Deliberately fails closed. resolve returns None for a model it cannot price rather than guessing, and crate::Agent::new refuses to build an agent that arms core.max_budget_usd against an unpriceable model. A spend cap that silently never bites is worse than no cap: the caller believes they are protected.

Structs§

ModelPrice
Per-million-token prices for one model, in US dollars.

Functions§

built_in
The built-in list price for model, if this build knows one.
resolve
Resolve the price to bill model at: the explicit config override when BOTH halves are set, else the built-in table, else None.