llm-budget-window 0.1.0

Time-windowed token + USD budget. Define multiple rolling windows (e.g. $5/minute, $100/day) and reject when any window's cap would be breached. Thread-safe, zero deps.
Documentation
//! Error type.

use thiserror::Error;

/// Raised by `BudgetWindows::record` when a record would push any
/// window's running total past its cap.
#[derive(Debug, Error)]
#[error(
    "window {window_name:?} on axis {axis} would breach: attempted {attempted:.6} > cap {cap:.6}"
)]
pub struct WindowBreached {
    /// Name of the window that breached (the first one if multiple).
    pub window_name: String,
    /// "tokens" or "usd".
    pub axis: &'static str,
    /// Running total + record delta.
    pub attempted: f64,
    /// The configured cap on that axis.
    pub cap: f64,
}