pub struct ProviderConfig {
pub id: String,
pub vendor: Vendor,
pub api: Option<String>,
pub base_url: Option<String>,
pub api_key_env: Option<String>,
pub models: Vec<ModelEntry>,
pub tiers: Tiers,
pub quota: Quota,
pub builtin: bool,
}Expand description
One entry of providers.
Fields§
§id: StringUnique, of ASCII letters, digits, - and _. When the tiers define
the same id twice, the first in load order (global, scene, project;
each tier’s settings.local.json after its settings.json) is used
and the rest ignored.
vendor: Vendoranthropic, openai, deepseek, qwen, vllm, sglang or
generic (default). Decides how thinking is switched, whether
reasoning is sent back and how effort is spelled.
api: Option<String>anthropic (default), openai_chat or openai_responses, or a
protocol the host registered.
base_url: Option<String>Required for openai_chat; anthropic without one uses Anthropic’s
own API, openai_responses OpenAI’s.
api_key_env: Option<String>The environment variable holding the key. Without one the host’s
credential source is asked. No child process inherits it once a
settings file names it, unless sandbox.env.allow does.
models: Vec<ModelEntry>The models this provider serves, each an id or an object with what
the engine should know about it. Empty accepts any id. Not fetched
from the provider — config.listModels does that, on request.
tiers: TiersWhich model serves strong, balanced and fast. strong is
required; balanced defaults to strong’s, fast to balanced’s.
Each must be in models when models lists any.
quota: QuotaToken limits; past one, the provider is skipped until the period turns over.
builtin: boolThe provider the engine supplies when the settings define none.
Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub const BUILTIN_ID: &'static str = "anthropic"
pub const BUILTIN_ID: &'static str = "anthropic"
The id of the provider the engine supplies when the settings define none.
Sourcepub fn builtin(model: &str) -> Self
pub fn builtin(model: &str) -> Self
The provider used when the settings define none: Anthropic’s API,
keyed and addressed from the environment, every tier model.
Sourcepub fn id_problem(id: &str) -> Option<String>
pub fn id_problem(id: &str) -> Option<String>
Why id cannot name a provider, if it cannot. The id is the name of
the provider’s quota usage file as it stands, so it holds nothing a
file name would have to change — and no capital, since Ab and ab
are one file on a case-insensitive file system.
Sourcepub fn accepts_model(&self, model: &str) -> bool
pub fn accepts_model(&self, model: &str) -> bool
Whether model may be sent to this provider: listed, or nothing is.
Sourcepub fn lists_model(&self, model: &str) -> bool
pub fn lists_model(&self, model: &str) -> bool
Whether models lists model.
pub fn model_ids(&self) -> Vec<&str>
Sourcepub fn model_spec(&self, model: &str) -> Option<&ModelSpec>
pub fn model_spec(&self, model: &str) -> Option<&ModelSpec>
What models says about model beyond its id, if anything.
Sourcepub fn resolved_tiers(&self) -> Result<ResolvedTiers, String>
pub fn resolved_tiers(&self) -> Result<ResolvedTiers, String>
The tiers with the gaps filled, or why this entry is not usable.
Trait Implementations§
Source§impl Clone for ProviderConfig
impl Clone for ProviderConfig
Source§impl Debug for ProviderConfig
impl Debug for ProviderConfig
Source§impl Default for ProviderConfig
impl Default 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>,
Source§impl JsonSchema for ProviderConfig
impl JsonSchema for ProviderConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more