pub struct ProviderConfig {
pub provider: String,
pub api_key: Option<String>,
pub model: String,
pub base_url: Option<String>,
pub timeout: Option<Duration>,
pub client: Option<Client>,
pub extra: HashMap<String, Value>,
}Expand description
Configuration for building a provider from the registry.
This struct contains common configuration fields that work across
all providers. Provider-specific options go in the extra map.
Fields§
§provider: StringProvider name (e.g., “anthropic”, “openai”, “ollama”).
api_key: Option<String>API key for authenticated providers.
model: StringModel identifier (e.g., “claude-sonnet-4-20250514”, “gpt-4o”).
base_url: Option<String>Custom base URL for the API endpoint.
timeout: Option<Duration>Request timeout.
client: Option<Client>Shared HTTP client for connection pooling.
When set, the provider will use this client instead of creating its own. Useful when multiple providers should share a connection pool (e.g., in multi-agent systems).
extra: HashMap<String, Value>Provider-specific configuration options.
Use this for options that don’t fit the common fields above. Each provider documents which keys it recognizes.
Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub fn new(provider: impl Into<String>, model: impl Into<String>) -> Self
pub fn new(provider: impl Into<String>, model: impl Into<String>) -> Self
Creates a new config with the given provider and model.
Sourcepub fn extra(self, key: impl Into<String>, value: impl Into<Value>) -> Self
pub fn extra(self, key: impl Into<String>, value: impl Into<Value>) -> Self
Adds a provider-specific extra option.
Sourcepub fn get_extra_str(&self, key: &str) -> Option<&str>
pub fn get_extra_str(&self, key: &str) -> Option<&str>
Gets a string value from extra options.
Sourcepub fn get_extra_bool(&self, key: &str) -> Option<bool>
pub fn get_extra_bool(&self, key: &str) -> Option<bool>
Gets a bool value from extra options.
Sourcepub fn get_extra_i64(&self, key: &str) -> Option<i64>
pub fn get_extra_i64(&self, key: &str) -> Option<i64>
Gets an integer value from extra options.
Trait Implementations§
Source§impl Clone for ProviderConfig
impl Clone for ProviderConfig
Source§fn clone(&self) -> ProviderConfig
fn clone(&self) -> ProviderConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more