pub struct Attempt {
pub rung: u32,
pub model: String,
pub provider: String,
pub in_tokens: u64,
pub cache_write_tokens: u64,
pub cache_read_tokens: u64,
pub out_tokens: u64,
pub cost_usd: f64,
pub latency_ms: u64,
pub gates: Vec<GateResult>,
pub verdict: Verdict,
}Expand description
One attempt at a rung: the model call plus the gates run against its output.
Fields§
§rung: u32Ladder rung (0 = cheapest).
model: StringModel called, provider/model.
provider: StringProvider segment (denormalized for cheap querying).
in_tokens: u64Input tokens consumed, uncached only.
When the caller uses prompt caching this is the small remainder; the bulk of the prompt is
reported separately below and billed at different rates. Read billable_input() rather
than this field for anything cost-shaped.
cache_write_tokens: u64Prompt tokens written to the provider’s cache on this call, billed at a premium (Anthropic: 1.25× base input).
Defaults to 0, so a receipt written before this field existed still deserializes and still re-derives the same hash — the field is skipped when zero.
cache_read_tokens: u64Prompt tokens served from the provider’s cache, billed at a discount (Anthropic: 0.1×
base input). Same zero-default reasoning as cache_write_tokens.
out_tokens: u64Output tokens produced.
cost_usd: f64USD cost of this model call (excludes gate cost).
latency_ms: u64Wall-clock latency of the model call.
gates: Vec<GateResult>Gate verdicts for this attempt’s output.
verdict: VerdictThe attempt’s overall verdict (the aggregate that drove escalate-or-serve).
Implementations§
Source§impl Attempt
impl Attempt
Sourcepub const fn billable_input(&self) -> u64
pub const fn billable_input(&self) -> u64
Total prompt tokens this call actually consumed, cached or not.
in_tokens alone is not the prompt size when the caller uses prompt caching: providers
report the cached portion in separate fields, and a 190k-token cached prefix shows up as an
in_tokens of about 20. Anything reporting prompt volume wants this, not the raw field.