pub struct CodingPlanQuotaLimit {
pub type_: String,
pub unit: Option<String>,
pub number: u64,
pub percentage: f64,
pub usage: Option<u64>,
pub current_value: Option<u64>,
pub remaining: Option<u64>,
pub next_reset_time: Option<String>,
pub usage_details: Vec<CodingPlanUsageDetail>,
}Expand description
One quota window reported by the monitor endpoint.
The Coding Plan applies two kinds of windows, surfaced as TIME_LIMIT
(per-5-hour) and TOKENS_LIMIT (weekly tokens). Depending on the upstream
deployment, each window may include explicit currentValue / remaining /
usage counters, or only a number plus consumed percentage.
Fields§
§type_: StringLimit kind: TIME_LIMIT (5-hour window) or TOKENS_LIMIT (weekly
tokens).
unit: Option<String>Window unit (e.g. "5h", "week").
number: u64Configured cap for this window (tokens or prompt count).
percentage: f64Consumed percentage within the current window (0–100).
usage: Option<u64>Total quota amount reported by the server, when present.
current_value: Option<u64>Amount already consumed in the current window, when present.
remaining: Option<u64>Remaining amount reported by the server, when present.
next_reset_time: Option<String>When this window resets (server timestamp / ISO string).
usage_details: Vec<CodingPlanUsageDetail>Optional per-model breakdown for this quota window.
Implementations§
Source§impl CodingPlanQuotaLimit
impl CodingPlanQuotaLimit
Sourcepub fn kind(&self) -> CodingPlanQuotaKind
pub fn kind(&self) -> CodingPlanQuotaKind
Normalized quota kind.
Sourcepub fn quota(&self) -> u64
pub fn quota(&self) -> u64
Total quota amount when the server reports it, falling back to number.
Sourcepub fn remaining(&self) -> u64
pub fn remaining(&self) -> u64
Remaining amount in this window.
Uses the server-provided remaining field when present. Otherwise it
falls back to number * (1 - percentage/100).
Sourcepub fn remaining_ratio(&self) -> f64
pub fn remaining_ratio(&self) -> f64
Remaining fraction in [0.0, 1.0], derived from the reported percentage.
Sourcepub fn next_reset_at(&self) -> Option<DateTime<Utc>>
pub fn next_reset_at(&self) -> Option<DateTime<Utc>>
Parsed reset time in UTC when next_reset_time is a Unix timestamp or
RFC3339 datetime.
Sourcepub fn usage_for_model(&self, model_code: &str) -> Option<u64>
pub fn usage_for_model(&self, model_code: &str) -> Option<u64>
Return the usage attributed to one model code, if present.
Sourcepub fn next_reset_at_beijing(&self) -> Option<DateTime<FixedOffset>>
pub fn next_reset_at_beijing(&self) -> Option<DateTime<FixedOffset>>
Parsed reset time in UTC+08:00 (Beijing / Shanghai fixed offset).
Sourcepub fn summary(&self) -> CodingPlanQuotaSummary
pub fn summary(&self) -> CodingPlanQuotaSummary
Build an easy-to-use normalized view for this quota window.
Sourcepub fn is_time_limit(&self) -> bool
pub fn is_time_limit(&self) -> bool
True when this is the per-5-hour time window.
Sourcepub fn is_tokens_limit(&self) -> bool
pub fn is_tokens_limit(&self) -> bool
True when this is the weekly tokens window.
Trait Implementations§
Source§impl Clone for CodingPlanQuotaLimit
impl Clone for CodingPlanQuotaLimit
Source§fn clone(&self) -> CodingPlanQuotaLimit
fn clone(&self) -> CodingPlanQuotaLimit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more