Skip to main content

floopy/types/
constraints.rs

1use serde::{Deserialize, Serialize};
2
3/// Org-wide spend and rate constraints. All fields are `Option`: `None`
4/// means "no limit" — and, on
5/// [`put`](crate::resources::Constraints::put), clears any existing limit
6/// server-side (the gateway PUT is full-replace, so every field is always
7/// sent).
8#[derive(Debug, Clone, Default, Serialize, Deserialize)]
9pub struct OrgConstraints {
10    /// Hard cap (USD) on total monthly spend.
11    pub cost_limit_monthly_usd: Option<f64>,
12    /// Sliding window for the token rate limit, in seconds.
13    pub token_window_seconds: Option<i64>,
14    /// Max tokens allowed per `token_window_seconds`.
15    pub max_tokens_per_window: Option<i64>,
16    /// Max requests per minute per API key.
17    pub max_requests_per_minute: Option<i64>,
18}