pub struct NormalizedUsage {
pub tokens: TokenUsage,
pub metrics: BTreeMap<String, Decimal>,
pub dimensions: BTreeMap<String, String>,
pub actual_service_tier: Option<String>,
pub completeness: UsageCompleteness,
pub attempts: Vec<UsageAttempt>,
pub responses: Vec<ResponseUsage>,
}Fields§
§tokens: TokenUsage§metrics: BTreeMap<String, Decimal>Other reported quantities, e.g. audio_seconds, image_outputs, web_searches. Do not duplicate named token fields here; absence is not a measured zero.
dimensions: BTreeMap<String, String>Pricing qualifiers such as resolution, speed or inference_geo.
actual_service_tier: Option<String>Actual upstream serving tier, which may differ from the requested tier.
completeness: UsageCompleteness§attempts: Vec<UsageAttempt>When present, per-attempt usage replaces aggregate usage for billing.
responses: Vec<ResponseUsage>Independently identified upstream responses inside a long-lived call. Their sum is the aggregate above; the settlement layer may deduplicate these across connections before pricing. IDs are upstream identities.
Implementations§
Source§impl NormalizedUsage
impl NormalizedUsage
Sourcepub fn aggregate<'a>(
values: impl IntoIterator<Item = &'a NormalizedUsage>,
) -> Self
pub fn aggregate<'a>( values: impl IntoIterator<Item = &'a NormalizedUsage>, ) -> Self
Sum reported response quantities. Missing values remain unknown rather than becoming invented zeros. Qualifiers survive only when all agree.
Trait Implementations§
Source§impl Clone for NormalizedUsage
impl Clone for NormalizedUsage
Source§impl Debug for NormalizedUsage
impl Debug for NormalizedUsage
Source§impl Default for NormalizedUsage
impl Default for NormalizedUsage
impl Eq for NormalizedUsage
Source§impl PartialEq for NormalizedUsage
impl PartialEq for NormalizedUsage
impl StructuralPartialEq for NormalizedUsage
Auto Trait Implementations§
impl Freeze for NormalizedUsage
impl RefUnwindSafe for NormalizedUsage
impl Send for NormalizedUsage
impl Sync for NormalizedUsage
impl Unpin for NormalizedUsage
impl UnsafeUnpin for NormalizedUsage
impl UnwindSafe for NormalizedUsage
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
Mutably borrows from an owned value. Read more