pub struct OpenRouterConfig {
pub enabled: bool,
pub accounts: Vec<OpenRouterAccount>,
pub show_default_account: bool,
pub api_key_env: String,
pub api_key: Option<String>,
pub headline: Headline,
}Fields§
§enabled: bool§accounts: Vec<OpenRouterAccount>Extra OpenRouter accounts beyond the default key. Each account gets a separate aggregate-view entry and cache directory.
show_default_account: boolWhether aggregate views include the default (unnamed) key when named
accounts exist. Ignored when accounts is empty so OpenRouter never
loses its only tab.
api_key_env: String§api_key: Option<String>§headline: HeadlineWhich number goes on the bar. OpenRouter states its own denominator —
credits purchased — so it is a quota vendor and defaults to percent.
See DisplayPrefs.
There is deliberately no display_limit here. A setting that is
accepted and then always ignored is a footgun, and the one case where it
would not be ignored — a free-tier account whose total_credits is 0 —
is the case where honouring it would be wrong: the percentage on the bar
comes from OpenRouterSnapshot::consumed_pct, which is 0 without
credits, so a tank would name the headline percent and then show 0%
for an account with money in it.
Implementations§
Source§impl OpenRouterConfig
impl OpenRouterConfig
Sourcepub fn account(&self, label: &str) -> Result<&OpenRouterAccount>
pub fn account(&self, label: &str) -> Result<&OpenRouterAccount>
Find a named account or fail loudly instead of falling back to the default key (which would show the wrong account’s usage).
Trait Implementations§
Source§impl Clone for OpenRouterConfig
impl Clone for OpenRouterConfig
Source§impl Debug for OpenRouterConfig
impl Debug for OpenRouterConfig
Source§impl Default for OpenRouterConfig
impl Default for OpenRouterConfig
Source§impl<'de> Deserialize<'de> for OpenRouterConfigwhere
OpenRouterConfig: Default,
impl<'de> Deserialize<'de> for OpenRouterConfigwhere
OpenRouterConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for OpenRouterConfig
impl RefUnwindSafe for OpenRouterConfig
impl Send for OpenRouterConfig
impl Sync for OpenRouterConfig
impl Unpin for OpenRouterConfig
impl UnsafeUnpin for OpenRouterConfig
impl UnwindSafe for OpenRouterConfig
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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