pub struct GainSummary {Show 29 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 economic_evidence: EconomicEvidence,
pub provider_path_observed: bool,
pub net_bill_impact_tokens: Option<i64>,
pub net_bill_impact_usd: Option<f64>,
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; the provider bill
impact is then unknown (net_bill_impact_* = None).
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: i64tokens_saved − injected_overhead_total_tokens. Legacy DTO field: with no
observed provider turn it equals the gross savings and says nothing about
the bill — read net_bill_impact_tokens and economic_evidence instead.
economic_evidence: EconomicEvidenceWhat the economic figures rest on (local estimate … paired control).
provider_path_observed: boolWhether the proxy carried provider requests, i.e. the bill side is visible.
net_bill_impact_tokens: Option<i64>Net provider-bill impact in tokens — None when the provider path was not
observed. Never the gross number in disguise.
net_bill_impact_usd: Option<f64>Net provider-bill impact in USD — None when not observable.
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§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 Forget for GainSummary
impl Freeze for GainSummary
impl Move for GainSummary
impl RefUnwindSafe for GainSummary
impl Send for GainSummarywhere
RawVecInner: Send,
impl Sync for GainSummarywhere
RawVecInner: Sync,
impl Unpin for GainSummary
impl UnsafeUnpin for GainSummary
impl UnwindSafe for GainSummarywhere
RawVecInner: UnwindSafe,
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