pub struct OrcaRouterSnapshot {
pub spent_cents: i64,
pub limit_cents: Option<i64>,
pub access_until: Option<DateTime<Utc>>,
}Expand description
OrcaRouter — prepaid credit card from the one-api compatible dashboard
billing endpoints (/v1/dashboard/billing/usage + /subscription), over an
API key. Usage arrives in US cents (total_usage: 275 = $2.75); the
subscription’s limit fields are USD and mean the total credit limit
(remaining + used), with 100000000 as the unlimited sentinel.
Fields§
§spent_cents: i64Cumulative spend, exact US cents (total_usage).
limit_cents: Option<i64>Total credit limit in exact US cents. None for unlimited keys (the
100000000 sentinel) or when the subscription response carried no
limit field at all — either way the card is spend-only.
access_until: Option<DateTime<Utc>>Key expiry (access_until, Unix seconds); None = no expiry (a wire
0 means the same thing).
Implementations§
Source§impl OrcaRouterSnapshot
impl OrcaRouterSnapshot
pub fn spent_usd(&self) -> f64
pub fn limit_usd(&self) -> Option<f64>
Sourcepub fn remaining_cents(&self) -> Option<i64>
pub fn remaining_cents(&self) -> Option<i64>
Remaining credit in exact cents. Can be negative (spend past the limit) — the sign belongs outside the symbol, like OpenRouter debt.
pub fn remaining_usd(&self) -> Option<f64>
Sourcepub fn consumed_pct(&self) -> Option<i32>
pub fn consumed_pct(&self) -> Option<i32>
Integer-percentage of the limit consumed, computed in cents so no
float division is involved. None when there is no limit — an
unlimited key has no percentage to be exact about.
Trait Implementations§
Source§impl Clone for OrcaRouterSnapshot
impl Clone for OrcaRouterSnapshot
Source§impl Debug for OrcaRouterSnapshot
impl Debug for OrcaRouterSnapshot
impl Eq for OrcaRouterSnapshot
Source§impl PartialEq for OrcaRouterSnapshot
impl PartialEq for OrcaRouterSnapshot
impl StructuralPartialEq for OrcaRouterSnapshot
Auto Trait Implementations§
impl Freeze for OrcaRouterSnapshot
impl RefUnwindSafe for OrcaRouterSnapshot
impl Send for OrcaRouterSnapshot
impl Sync for OrcaRouterSnapshot
impl Unpin for OrcaRouterSnapshot
impl UnsafeUnpin for OrcaRouterSnapshot
impl UnwindSafe for OrcaRouterSnapshot
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more