pub struct OpenAiCompatibleConfig {
pub base_url: String,
pub api_key: Option<String>,
pub default_model: String,
pub provider_name: String,
pub display_name: String,
pub capabilities: LlmCapabilities,
pub timeout: Duration,
}Expand description
Configuration for the OpenAI-compatible provider
Fields§
§base_url: StringBase URL for the API (e.g., http://localhost:11434/v1)
api_key: Option<String>API key (optional for local servers). Redacted in Debug.
default_model: StringDefault model to use
provider_name: StringProvider name for logging; decides what name() reports
display_name: StringProvider display name
capabilities: LlmCapabilitiesCapabilities of this provider; they decide which optional request fields reach the wire
timeout: DurationHTTP request timeout for a client the provider builds itself
Implementations§
Source§impl OpenAiCompatibleConfig
impl OpenAiCompatibleConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Read the configuration from the environment; the endpoint’s port
decides the provider name (11434 Ollama, 8000 vLLM, 8080
LocalAI, anything else local).
Sourcepub fn openai_api(model: &str) -> Self
pub fn openai_api(model: &str) -> Self
Create configuration for the OpenAI API at
https://api.openai.com/v1, reporting openai_api.
Any endpoint that speaks the same API under its own /v1 works by
replacing base_url.
Sourcepub fn openai_api_from_env() -> Self
pub fn openai_api_from_env() -> Self
Read the OpenAI API configuration from the environment.
OPENAI_API_BASE_URL (default https://api.openai.com) names the
host without the version path: requests go to its /v1. An unset
OPENAI_API_MODEL is gpt-5.4, an unset or unparseable
OPENAI_API_TIMEOUT_SECS is 120, and an unset or empty
OPENAI_API_KEY sends no Authorization header.