use std::collections::HashMap;
#[derive(Debug, Clone, Default)]
pub struct Config {
pub default_provider: Option<String>,
pub providers: HashMap<String, ProviderConfig>,
}
#[derive(Debug, Clone, Default)]
pub struct ProviderConfig {
pub base_url: Option<String>,
pub api_key_env: Option<String>,
pub api_key: Option<String>,
pub kind: ProviderKind,
pub no_auth: bool,
pub extra_headers: HashMap<String, String>,
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub enum ProviderKind {
#[default]
OpenAICompatible,
Anthropic,
Gemini,
}
impl ProviderConfig {
pub fn with_base_url(mut self, base: impl Into<String>) -> Self {
self.base_url = Some(base.into());
self
}
pub fn with_api_key_env(mut self, env: impl Into<String>) -> Self {
self.api_key_env = Some(env.into());
self
}
pub fn with_api_key(mut self, key: impl Into<String>) -> Self {
self.api_key = Some(key.into());
self
}
pub fn with_kind(mut self, kind: ProviderKind) -> Self {
self.kind = kind;
self
}
pub fn with_no_auth(mut self, no_auth: bool) -> Self {
self.no_auth = no_auth;
self
}
pub fn with_header(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
self.extra_headers.insert(key.into(), value.into());
self
}
}