pub struct LlmOpts {
pub model: String,
pub base_url: Option<String>,
pub api_key: Option<String>,
pub temperature: Option<f64>,
pub endpoint: LlmEndpoint,
pub session_id: Option<String>,
pub effort: Option<String>,
pub retry: RetryPolicy,
pub model_profiles: ModelProfiles,
}Fields§
§model: String§base_url: Option<String>§api_key: Option<String>§temperature: Option<f64>Sampling temperature. No CLI flag surfaces it yet; a library embedder
that builds LlmOpts directly can set it.
endpoint: LlmEndpoint§session_id: Option<String>Stable per-conversation id, sent as x-opencode-session for providers
(e.g. OpenCode Go) that route/cache on it. None = header omitted.
effort: Option<String>Free-style reasoning effort. None = send nothing (backends that reject
unknown fields keep working). Some(level) fans out per endpoint in
build_request(): Chat forwards any string verbatim under
reasoning_effort, while the Responses endpoint validates client-side
against none|minimal|low|medium|high|xhigh|max (rig’s typed enum) — a
value outside that set fails with a clear error before the request.
retry: RetryPolicyRetry policy for the connect phase (transient failures). See
RetryPolicy.
model_profiles: ModelProfilesPer-model provider profiles ([models.<id>]) plus the launch provider a
switch falls back to. Agent::set_model (and the CLI) call
settle_provider to re-point endpoint/base_url/api_key for the selected
model; the Default map (no base) never touches the provider.
Implementations§
Source§impl LlmOpts
impl LlmOpts
Sourcepub fn settle_provider(&mut self)
pub fn settle_provider(&mut self)
Re-point endpoint/base_url/api_key for self.model: the launch
provider (model_profiles.base), then this model’s [models.<id>]
overlay. No-op when no profiles are configured. Cloning the map avoids
borrowing self.model_profiles while mutably borrowing self.