pub struct GainSummary {Show 25 fields
pub model: ModelQuote,
pub total_commands: u64,
pub input_tokens: u64,
pub output_tokens: u64,
pub tokens_saved: u64,
pub effective_input_tokens: u64,
pub effective_output_tokens: u64,
pub effective_tokens_saved: u64,
pub effective_compression_pct: f64,
pub total_reduction_pct: f64,
pub gain_rate_pct: f64,
pub injected_overhead_tokens_per_turn: u64,
pub turns: u64,
pub injected_overhead_total_tokens: u64,
pub net_tokens_saved: i64,
pub injected_overhead_budget_tokens: u64,
pub over_budget: bool,
pub avoided_usd: f64,
pub stream_savings: StreamSavings,
pub energy_wh: f64,
pub co2_grams: f64,
pub tool_spend_usd: f64,
pub roi: Option<f64>,
pub score: GainScore,
pub daemon_hint: Option<String>,
}Fields§
§model: ModelQuote§total_commands: u64§input_tokens: u64§output_tokens: u64§tokens_saved: u64§effective_input_tokens: u64Tokens removed from traffic whose output lean-ctx controls.
effective_output_tokens: u64§effective_tokens_saved: u64§effective_compression_pct: f64Compression percentage over compressible traffic only.
total_reduction_pct: f64Reduction percentage over all recorded traffic, including passthrough.
gain_rate_pct: f64§injected_overhead_tokens_per_turn: u64Fixed per-turn context lean-ctx injects (tool schemas + server
instructions + rules block). On a provider WITHOUT prompt caching this
rides — and is re-billed on — every turn, so the net bill impact is
tokens_saved − injected_overhead_tokens_per_turn × turns. Note that
tokens_saved / gain_rate_pct are measured against lean-ctx-touched
traffic (their denominator), not the full provider bill (GitHub #361).
turns: u64Provider turns (requests) the proxy actually saw carry the injected
prefix. 0 when the proxy is not in the request path, in which case the
net figure below collapses to the gross tokens_saved (we cannot count
turns we never observed, and we refuse to guess).
injected_overhead_total_tokens: u64injected_overhead_tokens_per_turn × turns — the total fixed context tax
re-billed across the run on a provider without prompt caching.
net_tokens_saved: i64The honest bill impact: tokens_saved − injected_overhead_total_tokens.
Signed, because on a non-caching rail a short run can legitimately go
net-negative until savings outgrow the per-turn injection.
injected_overhead_budget_tokens: u64Configured fixed-context budget ([context] budget_tokens); 0 disables
the check (#964). Surfaced so gain can flag a bloated injected prefix.
over_budget: boolWhether injected_overhead_tokens_per_turn exceeds a non-zero budget (#964).
avoided_usd: f64§stream_savings: StreamSavingsBill-weighted savings split by provider token stream (#1191).
energy_wh: f64Estimated grid energy avoided (Wh) by keeping tokens_saved out of context.
co2_grams: f64Estimated CO₂-equivalent avoided (grams), derived from energy_wh.
tool_spend_usd: f64§roi: Option<f64>§score: GainScore§daemon_hint: Option<String>Trait Implementations§
Source§impl Clone for GainSummary
impl Clone for GainSummary
Source§fn clone(&self) -> GainSummary
fn clone(&self) -> GainSummary
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GainSummary
impl Debug for GainSummary
Source§impl<'de> Deserialize<'de> for GainSummary
impl<'de> Deserialize<'de> for GainSummary
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for GainSummary
impl RefUnwindSafe for GainSummary
impl Send for GainSummary
impl Sync for GainSummary
impl Unpin for GainSummary
impl UnsafeUnpin for GainSummary
impl UnwindSafe for GainSummary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more