pub struct ProviderConfig {Show 13 fields
pub kind: String,
pub model: Option<String>,
pub api_key_env: Option<String>,
pub api_key: Option<String>,
pub base_url: Option<String>,
pub input_price_per_mtok: Option<f64>,
pub output_price_per_mtok: Option<f64>,
pub temperature: Option<f64>,
pub seed: Option<u64>,
pub context_window: Option<u64>,
pub max_retries: Option<u32>,
pub retry_after_cap_secs: Option<u64>,
pub fallbacks: Vec<String>,
}Fields§
§kind: Stringanthropic | openai | local
model: Option<String>§api_key_env: Option<String>Environment variable holding the key. Preferred over api_key.
api_key: Option<String>Inline key. Convenient, but it lands in a file on disk — prefer the env var.
base_url: Option<String>§input_price_per_mtok: Option<f64>Per-million-token prices, so budgets and reporting can be in dollars. Leave unset for a local model — the marginal cost really is zero.
output_price_per_mtok: Option<f64>§temperature: Option<f64>Sampling temperature, sent verbatim by providers that accept one. Unset
means the server’s default. Do not reach for 0.0 to get repeatability:
measured on qwen3.6, greedy decoding walks into verbatim repetition
loops that sampling noise would have broken. Pin the server’s own
default value and set seed instead — same distribution, repeatable
draws. The Anthropic API rejects the parameter, so setting this on an
anthropic provider is a startup error rather than a silent no-op.
seed: Option<u64>Sampling seed, for repeatable draws at a nonzero temperature. Only as
deterministic as the backend: llama-server repeats exactly when requests
run one at a time, and does not once concurrent requests share a batch.
Rejected on anthropic for the same reason as temperature.
context_window: Option<u64>How many tokens this model’s context holds — for a local server, the
-c it was started with.
Nothing here can discover this: a provider reports how many tokens a
prompt used, never how many are left. Without it the compaction
threshold has to be an absolute number somebody remembers to set, and
when nobody does, a long session dies on a raw
exceed_context_size_error from the server with the whole run lost.
With it, AgentConfig::compact_at derives a threshold and the CLI
can show how much room is left.
max_retries: Option<u32>Retries per request on transient failures — 429, 5xx, transport. 0 disables. Unset means 3. Auth, billing, invalid-request and context-overflow errors are never retried: the same payload fails the same way, and overflow belongs to the compaction path.
retry_after_cap_secs: Option<u64>A Retry-After above this many seconds is surfaced as a failure
instead of slept through (default 60) — a provider can name a wait
long enough that the process is simply asleep, and control never
returns to a layer that could fall back instead.
fallbacks: Vec<String>Provider entries to try, in order, when this one exhausts its retries
on a transient failure. Turn-local: the next turn starts from this
provider again. Each fallback answers with its own model. Empty —
the default — means strict: fail rather than silently answer with a
different model. mecha eval never falls back regardless: a
scorecard grades the model it names.
Implementations§
Trait Implementations§
Source§impl Clone for ProviderConfig
impl Clone for ProviderConfig
Source§fn clone(&self) -> ProviderConfig
fn clone(&self) -> ProviderConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more