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>,
},
}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"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
Trait Implementations§
Source§impl Clone for ProviderConfig
impl Clone for ProviderConfig
Source§fn clone(&self) -> ProviderConfig
fn clone(&self) -> ProviderConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProviderConfig
impl Debug for ProviderConfig
Source§impl<'de> Deserialize<'de> for ProviderConfig
impl<'de> Deserialize<'de> for ProviderConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ProviderConfig
impl PartialEq for ProviderConfig
Source§impl Serialize for ProviderConfig
impl Serialize for ProviderConfig
impl StructuralPartialEq for ProviderConfig
Auto Trait Implementations§
impl Freeze for ProviderConfig
impl RefUnwindSafe for ProviderConfig
impl Send for ProviderConfig
impl Sync for ProviderConfig
impl Unpin for ProviderConfig
impl UnwindSafe for ProviderConfig
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
Mutably borrows from an owned value. Read more