pub enum ProviderConfig {
OpenAI {
api_key: Option<String>,
api_endpoint: Option<String>,
},
Anthropic {
api_key: Option<String>,
api_endpoint: Option<String>,
access_token: Option<String>,
},
Gemini {
api_key: Option<String>,
api_endpoint: Option<String>,
},
Custom {
api_key: Option<String>,
api_endpoint: String,
},
Stakpak {
api_key: String,
api_endpoint: Option<String>,
},
Bedrock {
region: String,
profile_name: Option<String>,
},
}Expand description
Unified provider configuration enum
All provider configurations are stored in a HashMap<String, ProviderConfig>
where the key is the provider name and becomes the model prefix for routing.
§Provider Key = Model Prefix
The key used in the HashMap becomes the prefix used in model names:
- Config key:
providers.offline - Model usage:
offline/llama3 - Routing: finds
offlineprovider, sendsllama3to API
§Example TOML
[profiles.myprofile.providers.openai]
type = "openai"
api_key = "sk-..."
[profiles.myprofile.providers.anthropic]
type = "anthropic"
api_key = "sk-ant-..."
access_token = "oauth-token"
[profiles.myprofile.providers.offline]
type = "custom"
api_endpoint = "http://localhost:11434/v1"Variants§
OpenAI
OpenAI provider configuration
Anthropic
Anthropic provider configuration
Fields
Gemini
Google Gemini provider configuration
Custom
Custom OpenAI-compatible provider (Ollama, vLLM, etc.)
The provider key in the config becomes the model prefix.
For example, if configured as providers.offline, use models as:
offline/llama3- passesllama3to the APIoffline/anthropic/claude-opus- passesanthropic/claude-opusto the API
§Example TOML
[profiles.myprofile.providers.offline]
type = "custom"
api_endpoint = "http://localhost:11434/v1"
# Then use models as:
smart_model = "offline/llama3"
eco_model = "offline/phi3"Fields
Stakpak
Stakpak provider configuration
Routes inference through Stakpak’s unified API, which provides:
- Access to multiple LLM providers via a single endpoint
- Usage tracking and billing
- Session management and checkpoints
§Example TOML
[profiles.myprofile.providers.stakpak]
type = "stakpak"
api_key = "your-stakpak-api-key"
api_endpoint = "https://apiv2.stakpak.dev" # optional, this is the default
# Then use models as:
smart_model = "stakpak/anthropic/claude-sonnet-4-5-20250929"Fields
Bedrock
AWS Bedrock provider configuration
Uses AWS credential chain for authentication (no API key needed). Supports env vars, shared credentials, SSO, and instance roles.
§Example TOML
[profiles.myprofile.providers.amazon-bedrock]
type = "amazon-bedrock"
region = "us-east-1"
profile_name = "my-aws-profile" # optional
# Then use models as (friendly aliases work):
model = "amazon-bedrock/claude-sonnet-4-5"Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub fn provider_type(&self) -> &'static str
pub fn provider_type(&self) -> &'static str
Get the provider type name
Sourcepub fn api_endpoint(&self) -> Option<&str>
pub fn api_endpoint(&self) -> Option<&str>
Get the API endpoint if set
Sourcepub fn access_token(&self) -> Option<&str>
pub fn access_token(&self) -> Option<&str>
Get the access token (Anthropic only)
Sourcepub fn anthropic(api_key: Option<String>, access_token: Option<String>) -> Self
pub fn anthropic(api_key: Option<String>, access_token: Option<String>) -> Self
Create an Anthropic provider config
Sourcepub fn custom(api_endpoint: String, api_key: Option<String>) -> Self
pub fn custom(api_endpoint: String, api_key: Option<String>) -> Self
Create a custom provider config
Sourcepub fn stakpak(api_key: String, api_endpoint: Option<String>) -> Self
pub fn stakpak(api_key: String, api_endpoint: Option<String>) -> Self
Create a Stakpak provider config
Sourcepub fn bedrock(region: String, profile_name: Option<String>) -> Self
pub fn bedrock(region: String, profile_name: Option<String>) -> Self
Create a Bedrock provider config
Sourcepub fn profile_name(&self) -> Option<&str>
pub fn profile_name(&self) -> Option<&str>
Get the AWS profile name (Bedrock only)
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