Skip to main content

agent_metering/
lib.rs

1//! Provider-independent usage accounting primitives.
2//!
3//! This crate defines normalized, durable-domain representations for resource
4//! consumption at the model-invocation level, including provenance, attribution,
5//! and provider-reported monetary amounts. It deliberately has no dependency on
6//! model providers, storage engines, HTTP APIs, or monitoring backends.
7//!
8//! Pricing data is versioned and cost calculations use integer arithmetic.
9//! Storage and run orchestration are owned by the storage and service crates;
10//! this crate owns the accounting vocabulary and deterministic calculations.
11
12mod pricing;
13mod summary;
14mod usage;
15
16pub use pricing::{
17    CostEstimate, CostOrigin, CostStatus, ModelPricing, PricingError, calculate_cost,
18};
19pub use summary::{CurrencyCostSummary, DimensionUsageSummary, UsageSummary, summarize_usage};
20pub use usage::{
21    InvocationOutcome, MeteredValue, ReportedCost, UsageDimensions, UsageRecord, UsageRecordError,
22};