pub struct ProviderEntry {
pub api_key: Option<String>,
pub api_keys: Vec<String>,
pub model: Option<String>,
pub base_url: Option<String>,
pub enabled: bool,
}Expand description
Per-provider configuration stored in ~/.fetchium/config.toml.
Fields§
§api_key: Option<String>API key stored in plain text.
Prefer setting the corresponding environment variable instead
(e.g. OPENAI_API_KEY) to avoid storing secrets in config files.
api_keys: Vec<String>Additional API keys for pool rotation.
All keys in this array plus api_key are combined into a single pool.
Keys are rotated with rate-limit awareness — if one key gets 429’d,
the next key is tried automatically.
model: Option<String>Model name override. Uses the provider default when absent.
base_url: Option<String>Base URL override (useful for proxies or custom deployments).
enabled: boolWhether this entry is active in fallback resolution.
Implementations§
Source§impl ProviderEntry
impl ProviderEntry
Sourcepub fn resolve_api_key(&self, env_var: &str) -> Option<String>
pub fn resolve_api_key(&self, env_var: &str) -> Option<String>
Resolve the API key: config value first, then environment variable.
Returns None if neither source has a non-empty, non-placeholder value.
Sourcepub fn resolve_model(&self, kind: ProviderKind) -> String
pub fn resolve_model(&self, kind: ProviderKind) -> String
Resolve the model, falling back to the provider’s built-in default.
Supports short aliases (e.g. "flash" → "gemini-3-flash-preview" for
gemini_cli, "haiku" → "claude-haiku-4-5-20251001" for anthropic).
Any unrecognized string is treated as a literal model ID and passed through.
Trait Implementations§
Source§impl Clone for ProviderEntry
impl Clone for ProviderEntry
Source§impl Debug for ProviderEntry
impl Debug for ProviderEntry
Source§impl Default for ProviderEntry
impl Default for ProviderEntry
Source§impl<'de> Deserialize<'de> for ProviderEntrywhere
ProviderEntry: Default,
impl<'de> Deserialize<'de> for ProviderEntrywhere
ProviderEntry: 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 ProviderEntry
impl RefUnwindSafe for ProviderEntry
impl Send for ProviderEntry
impl Sync for ProviderEntry
impl Unpin for ProviderEntry
impl UnsafeUnpin for ProviderEntry
impl UnwindSafe for ProviderEntry
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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